diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2020-02-22 14:15:07 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2020-02-22 14:15:07 +0200 |
commit | 7b8982b29179b3c586e0456dc9ecbd4f58dcea59 (patch) | |
tree | 92ff9c2748578d1f9c6aabc8ea7a9097295ec150 /src | |
parent | liblzma: Add more uses of lzma_memcmplen() to the normal mode of LZMA. (diff) | |
download | xz-7b8982b29179b3c586e0456dc9ecbd4f58dcea59.tar.xz |
Use defined(__GNUC__) before __GNUC__ in preprocessor lines.
This should silence the equivalent of -Wundef in compilers that
don't define __GNUC__.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/sysdefs.h | 3 | ||||
-rw-r--r-- | src/liblzma/api/lzma.h | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/common/sysdefs.h b/src/common/sysdefs.h index b6918179..df7ecf40 100644 --- a/src/common/sysdefs.h +++ b/src/common/sysdefs.h @@ -189,7 +189,8 @@ typedef unsigned char _Bool; # define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #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))) #else # define lzma_attr_alloc_size(x) diff --git a/src/liblzma/api/lzma.h b/src/liblzma/api/lzma.h index aa88e424..122dab80 100644 --- a/src/liblzma/api/lzma.h +++ b/src/liblzma/api/lzma.h @@ -224,7 +224,8 @@ # else # define lzma_nothrow throw() # endif -# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +# elif defined(__GNUC__) && (__GNUC__ > 3 \ + || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) # define lzma_nothrow __attribute__((__nothrow__)) # else # define lzma_nothrow @@ -241,7 +242,7 @@ * break anything if these are sometimes enabled and sometimes not, only * affects warnings and optimizations. */ -#if __GNUC__ >= 3 +#if defined(__GNUC__) && __GNUC__ >= 3 # ifndef lzma_attribute # define lzma_attribute(attr) __attribute__(attr) # endif |