Skip to content

[libc][errno] Remove unnecessary include #92063

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
May 14, 2024

Conversation

robincaloudis
Copy link
Contributor

@robincaloudis robincaloudis commented May 14, 2024

Since #91150, a proxy header for the errno macros is available and gets included in libc_errno.h since then.

As libc_errno.cpp includes libc_errno.h, which already includes the proxy header hdr/errno_macros.h, there's no need to include it in libc_errno.cpp if we are in overlay mode, because the proxy header takes care to either include our header from libc/include/ (fullbuild) or the corresponding underlying system header (overlay).

@robincaloudis robincaloudis marked this pull request as ready for review May 14, 2024 04:34
@llvmbot llvmbot added the libc label May 14, 2024
@llvmbot
Copy link
Member

llvmbot commented May 14, 2024

@llvm/pr-subscribers-libc

Author: Robin Caloudis (robincaloudis)

Changes

Since #91150, a proxy header for the errno macros is available and gets included in libc_errno.h since then.

As libc_errno.cpp includes libc_errno.h, which already includes the proxy header hdr/errno_macros.h, there's no need to include it in libc_errno.cpp if we are in overlay mode, because the proxy header takes care to either include our header from libc/include/ (fullbuild) or the corresponding underlying system header (overlay).


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

1 Files Affected:

  • (modified) libc/src/errno/libc_errno.cpp (-3)
diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp
index a59e6c34029d7..64f9f522ca296 100644
--- a/libc/src/errno/libc_errno.cpp
+++ b/libc/src/errno/libc_errno.cpp
@@ -36,9 +36,6 @@ void LIBC_NAMESPACE::Errno::operator=(int a) { __llvmlibc_errno = a; }
 LIBC_NAMESPACE::Errno::operator int() { return __llvmlibc_errno; }
 
 #else
-// In overlay mode, we simply use the system errno.
-#include "hdr/errno_macros.h"
-
 void LIBC_NAMESPACE::Errno::operator=(int a) { errno = a; }
 LIBC_NAMESPACE::Errno::operator int() { return errno; }
 

@lntue lntue merged commit cd45bb2 into llvm:main May 14, 2024
8 checks passed
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.

3 participants