]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Use defined(__GNUC__) before __GNUC__ in preprocessor lines.
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 22 Feb 2020 12:15:07 +0000 (14:15 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 22 Feb 2020 12:15:07 +0000 (14:15 +0200)
This should silence the equivalent of -Wundef in compilers that
don't define __GNUC__.

src/common/sysdefs.h
src/liblzma/api/lzma.h

index b6918179b59fe7c2a84d4e953c37abfccfe630b3..df7ecf400289a7a5fa62b2e6ef89f614dfda1100 100644 (file)
@@ -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)
index aa88e4243a29ada2db41eaeb1c966a5e65b2267c..122dab80d357d7b7fc9e23cf121821533afb04fa 100644 (file)
 #              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
  * 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