Fix compile error of GCC 4
authorChung-Chiang Cheng <cccheng@synology.com>
Mon, 28 Mar 2022 06:47:25 +0000 (14:47 +0800)
committerChung-Chiang Cheng <cccheng@synology.com>
Mon, 28 Mar 2022 07:16:21 +0000 (15:16 +0800)
gcc-4.9.3 doesn't recognize __has_attribute(__fallthrough__) and reports
the following error.

  CC crc/crc32c-arm64.o
  In file included from crc/../os/../file.h:5:0,
                   from crc/../os/os-linux.h:32,
                   from crc/../os/os.h:39,
                   from crc/crc32c-arm64.c:2:
  crc/../os/../compiler/compiler.h:74:20: error: missing binary operator before token "("
  Makefile:501: recipe for target 'crc/crc32c-arm64.o' failed
  make: *** [crc/crc32c-arm64.o] Error 1

Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
compiler/compiler.h

index 44fa87b90cf8c5959ec76c8544aa90480b89f318..3fd0822f3b77bca92a99472ebbc9fbd1fb241df0 100644 (file)
@@ -67,6 +67,7 @@
 #endif
 
 #ifndef __has_attribute
+#define __has_attribute(x) __GCC4_has_attribute_##x
 #define __GCC4_has_attribute___fallthrough__   0
 #endif