Skip to content

[lldb][Posix] Remove unused includes in file system #121913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

DavidSpickett
Copy link
Collaborator

@DavidSpickett DavidSpickett commented Jan 7, 2025

You could remove unistd.h and it will still build, but only because something else included it. So I've left it in in the spirit of "include what you use".

Tested on Linux and FreeBSD.

You could remove unistd.h and it builds, but only because
something else included it. So I've left it in in the spirit
of "include what you use".
@llvmbot
Copy link
Member

llvmbot commented Jan 7, 2025

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

Changes

You could remove unistd.h and it builds, but only because something else included it. So I've left it in in the spirit of "include what you use".

Tested on Linux and FreeBSD.


Full diff: https://github.com/llvm/llvm-project/pull/121913.diff

1 Files Affected:

  • (modified) lldb/source/Host/posix/FileSystemPosix.cpp (-5)
diff --git a/lldb/source/Host/posix/FileSystemPosix.cpp b/lldb/source/Host/posix/FileSystemPosix.cpp
index 945e2affc83715..d2e5b52917ac26 100644
--- a/lldb/source/Host/posix/FileSystemPosix.cpp
+++ b/lldb/source/Host/posix/FileSystemPosix.cpp
@@ -9,12 +9,7 @@
 #include "lldb/Host/FileSystem.h"
 
 // C includes
-#include <dirent.h>
 #include <fcntl.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 #if defined(__NetBSD__)
 #include <sys/statvfs.h>

@DavidSpickett DavidSpickett merged commit 4ecd9bd into llvm:main Jan 7, 2025
7 of 8 checks passed
@DavidSpickett DavidSpickett deleted the posix-includes branch January 7, 2025 11:23
Copy link
Contributor

@DhruvSrivastavaX DhruvSrivastavaX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with AIX too. Thanks!

@brad0
Copy link
Contributor

brad0 commented Jan 7, 2025

@DavidSpickett The NetBSD statvfs header can be removed as the relevant code was removed quite some time ago.. bfe8bcb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants