Skip to content

Commit

Permalink
src/lib/dns.h: Fix compilation in GCC 9
Browse files Browse the repository at this point in the history
  • Loading branch information
daurnimator committed Jul 14, 2019
1 parent 36b4b8c commit 5626db8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,15 @@ DNS_PUBLIC int *dns_debug_p(void);

#define dns_quietinit(...) \
DNS_PRAGMA_PUSH DNS_PRAGMA_QUIET __VA_ARGS__ DNS_PRAGMA_POP
#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4
#elif (__GNUC__ < 9) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#define DNS_PRAGMA_PUSH _Pragma("GCC diagnostic push")
#define DNS_PRAGMA_QUIET _Pragma("GCC diagnostic ignored \"-Woverride-init\"")
#define DNS_PRAGMA_POP _Pragma("GCC diagnostic pop")

/* GCC parses the _Pragma operator less elegantly than clang. */
/*
* GCC parses the _Pragma operator less elegantly than clang.
* This only works up to GCC 9
*/
#define dns_quietinit(...) \
__extension__ ({ DNS_PRAGMA_PUSH DNS_PRAGMA_QUIET __VA_ARGS__; DNS_PRAGMA_POP })
#else
Expand Down

0 comments on commit 5626db8

Please sign in to comment.