Skip to content

Commit

Permalink
Proxy detection of glibc feature test convention
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Dec 17, 2024
1 parent e25d5be commit b7f4f26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// gcc 5.1 was released 2015-04-22...
#ifndef __GNUC__
# define _DEFAULT_SOURCE ///< strcasecmp() feature macro starting glibc 2.20 (2014-09-08)
#elif __GNUC__ >= 5 || __clang__
#elif __GNUC__ >= 5
# define _DEFAULT_SOURCE ///< strcasecmp() feature macro starting glibc 2.20 (2014-09-08)
#else
# define _BSD_SOURCE ///< strcasecmp() feature macro for glibc <= 2.19
Expand Down
8 changes: 5 additions & 3 deletions test/src/test-super.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

// We'll use gcc major version as a proxy for the glibc library to decide which feature macro to use.
// gcc 5.1 was released 2015-04-22...
#if __GNUC__ >= 5 || __clang__
# define _DEFAULT_SOURCE ///< strcasdecmp() feature macro starting glibc 2.20 (2014-09-08)
#ifndef __GNUC__
# define _DEFAULT_SOURCE ///< strcasecmp() feature macro starting glibc 2.20 (2014-09-08)
#elif __GNUC__ >= 5
# define _DEFAULT_SOURCE ///< strcasecmp() feature macro starting glibc 2.20 (2014-09-08)
#else
# define _BSD_SOURCE ///< strcasecmp() feature macro for glibc <= 2.19
# define _BSD_SOURCE ///< strcasecmp() feature macro for glibc <= 2.19
#endif

#include <stdio.h>
Expand Down

0 comments on commit b7f4f26

Please sign in to comment.