Skip to content

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
Member

@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