Skip to content

Commit

Permalink
[libc] Disable hidden visibility for LIBC_NAMESPACE with GCC
Browse files Browse the repository at this point in the history
GCC emits a warning when using the visibility attribute which needs
to be diagnosed and addressed, but this change should unbreak the GCC
build as a temporary workaround.
  • Loading branch information
petrhosek committed Jul 11, 2024
1 parent 6f04f46 commit 643fec2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libc/src/__support/macros/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define LIBC_HAS_FEATURE(f) 0
#endif

#ifndef __GNUC__
// Declare a LIBC_NAMESPACE with hidden visibility. `namespace
// LIBC_NAMESPACE_DECL {` should be used around all declarations and definitions
// for libc internals as opposed to just `namespace LIBC_NAMESPACE {`. This
Expand All @@ -37,5 +38,10 @@
// dynamic relocations. This does not affect the public C symbols which are
// controlled independently via `LLVM_LIBC_FUNCTION_ATTR`.
#define LIBC_NAMESPACE_DECL [[gnu::visibility("hidden")]] LIBC_NAMESPACE
#else
// TODO(#98548): GCC emits a warning when using the visibility attribute which
// needs to be diagnosed and addressed.
#define LIBC_NAMESPACE_DECL LIBC_NAMESPACE
#endif

#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_CONFIG_H

0 comments on commit 643fec2

Please sign in to comment.