Skip to content

Commit f884364

Browse files
authored
Merge pull request swiftlang#31562 from compnerd/increased-visibility
Runtime: simplify `SWIFT_LIBRARY_VISIBILITY`
2 parents ce5e0e7 + 5408593 commit f884364

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

stdlib/public/SwiftShims/Visibility.h

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,6 @@
116116
#endif
117117

118118

119-
#ifndef SWIFT_GNUC_PREREQ
120-
# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
121-
# define SWIFT_GNUC_PREREQ(maj, min, patch) \
122-
((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \
123-
((maj) << 20) + ((min) << 10) + (patch))
124-
# elif defined(__GNUC__) && defined(__GNUC_MINOR__)
125-
# define SWIFT_GNUC_PREREQ(maj, min, patch) \
126-
((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))
127-
# else
128-
# define SWIFT_GNUC_PREREQ(maj, min, patch) 0
129-
# endif
130-
#endif
131-
132119
/// Attributes for runtime-stdlib interfaces.
133120
/// Use these for C implementations that are imported into Swift via SwiftShims
134121
/// and for C implementations of Swift @_silgen_name declarations
@@ -151,9 +138,8 @@
151138

152139
// Match the definition of LLVM_LIBRARY_VISIBILITY from LLVM's
153140
// Compiler.h. That header requires C++ and this needs to work in C.
154-
#if (__has_attribute(visibility) || SWIFT_GNUC_PREREQ(4, 0, 0)) && \
155-
!defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)
156-
#define SWIFT_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
141+
#if __has_attribute(visibility) && (defined(__ELF__) || defined(__MACH__))
142+
#define SWIFT_LIBRARY_VISIBILITY __attribute__ ((__visibility__("hidden")))
157143
#else
158144
#define SWIFT_LIBRARY_VISIBILITY
159145
#endif

0 commit comments

Comments
 (0)