Skip to content

Commit

Permalink
Feature test macros depending on __GNUC__
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Jan 12, 2025
1 parent 4f85172 commit e0dbde4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions src/smax-messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

// 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...
#ifndef __GNUC__
# define _ISOC99_SOURCE ///< vsnprintf() feature macro starting glibc 2.20 (2014-09-08)
#elif __GNUC__ >= 5
# define _ISOC99_SOURCE ///< vsnprintf() feature macro starting glibc 2.20 (2014-09-08)
#else
#if defined (__GNUC__) && (__GNUC__ < 5)
# define _BSD_SOURCE ///< vsnprinf() feature macro for glibc <= 2.19
#else
# define _ISOC99_SOURCE ///< vsnprintf() feature macro starting glibc 2.20 (2014-09-08)
#endif

#include <stdarg.h>
Expand Down
8 changes: 3 additions & 5 deletions src/smax-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@

// 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...
#ifndef __GNUC__
# define _ISOC99_SOURCE ///< strtoll() feature macro starting glibc 2.20 (2014-09-08)
#elif __GNUC__ >= 5
# define _ISOC99_SOURCE ///< strtoll() feature macro starting glibc 2.20 (2014-09-08)
#else
#if __GNUC__ > 0 && __GNUC__ < 5
# define _BSD_SOURCE ///< strtoll() feature macro for glibc <= 2.19
#else
# define _ISOC99_SOURCE ///< strtoll() feature macro starting glibc 2.20 (2014-09-08)
#endif

#include <stdio.h>
Expand Down

0 comments on commit e0dbde4

Please sign in to comment.