1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Use defined(__GNUC__) before __GNUC__ in preprocessor lines.

This should silence the equivalent of -Wundef in compilers that
don't define __GNUC__.
This commit is contained in:
Lasse Collin 2020-02-22 14:15:07 +02:00
parent 43dfe04e62
commit 7b8982b291
2 changed files with 5 additions and 3 deletions

View file

@ -189,7 +189,8 @@ typedef unsigned char _Bool;
# define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) # define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif #endif
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 #if defined(__GNUC__) \
&& ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4)
# define lzma_attr_alloc_size(x) __attribute__((__alloc_size__(x))) # define lzma_attr_alloc_size(x) __attribute__((__alloc_size__(x)))
#else #else
# define lzma_attr_alloc_size(x) # define lzma_attr_alloc_size(x)

View file

@ -224,7 +224,8 @@
# else # else
# define lzma_nothrow throw() # define lzma_nothrow throw()
# endif # endif
# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) # elif defined(__GNUC__) && (__GNUC__ > 3 \
|| (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
# define lzma_nothrow __attribute__((__nothrow__)) # define lzma_nothrow __attribute__((__nothrow__))
# else # else
# define lzma_nothrow # define lzma_nothrow
@ -241,7 +242,7 @@
* break anything if these are sometimes enabled and sometimes not, only * break anything if these are sometimes enabled and sometimes not, only
* affects warnings and optimizations. * affects warnings and optimizations.
*/ */
#if __GNUC__ >= 3 #if defined(__GNUC__) && __GNUC__ >= 3
# ifndef lzma_attribute # ifndef lzma_attribute
# define lzma_attribute(attr) __attribute__(attr) # define lzma_attribute(attr) __attribute__(attr)
# endif # endif