diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2023-04-02 14:24:23 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-04-07 22:56:27 +0000 |
commit | 561f27fde9dc51f014b672c227dc7c8ca2530fcf (patch) | |
tree | 867a37583adc0d54e342414c7a4b725854b56eae | |
parent | 7e0797d19ac1837e3001df9d45030b5eb97ca36d (diff) | |
download | riscv-openocd-561f27fde9dc51f014b672c227dc7c8ca2530fcf.zip riscv-openocd-561f27fde9dc51f014b672c227dc7c8ca2530fcf.tar.gz riscv-openocd-561f27fde9dc51f014b672c227dc7c8ca2530fcf.tar.bz2 |
helper/compiler fix build with gcc on MacOS
On MacOS libc includes files from MacOSX.sdk that define the macro
#define __nonnull
without arguments, causing compile error.
Extend the existing check for clang on MacOS and undefine the
macro for gcc too.
Change-Id: Ic99de78348c6aa86561212a3aded9342e5d32e02
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7571
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
-rw-r--r-- | src/helper/compiler.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/helper/compiler.h b/src/helper/compiler.h index 33a075d..312d261 100644 --- a/src/helper/compiler.h +++ b/src/helper/compiler.h @@ -36,9 +36,11 @@ * clang for Apple defines * #define __nonnull _Nonnull * that is a per argument attribute, incompatible with the gcc per function attribute __nonnull__. - * Undefine it to keep compatibility among compilers. + * gcc for Apple includes sys/cdefs.h from MacOSX.sdk that defines + * #define __nonnull + * In both cases, undefine __nonnull to keep compatibility among compilers and platforms. */ -#if defined(__clang__) && defined(__APPLE__) +#if defined(__APPLE__) # undef __nonnull #endif #ifndef __nonnull |