From d6e123fd056fa87d4b09b775fa8883520664a0aa Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Sat, 23 Nov 2024 11:33:05 +0100 Subject: [PATCH 1/5] check MSVC preprocessor macros --- libheif/bitstream.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libheif/bitstream.cc b/libheif/bitstream.cc index 4e26c39c39..582abb0dba 100644 --- a/libheif/bitstream.cc +++ b/libheif/bitstream.cc @@ -26,8 +26,10 @@ #define GCC_COMPILER (defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__PGI)) #if (defined(GCC_COMPILER) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10) +__GNUC__ aaa bbb ... #include #else +__clang__ ccc ddd ... #include #endif From 0b5d4282c04fabdabcea94472022b0d3c6ce1f44 Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Sat, 23 Nov 2024 11:52:18 +0100 Subject: [PATCH 2/5] define GNUC right at the beginning --- libheif/bitstream.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libheif/bitstream.cc b/libheif/bitstream.cc index 582abb0dba..f988cad3ab 100644 --- a/libheif/bitstream.cc +++ b/libheif/bitstream.cc @@ -18,6 +18,8 @@ * along with libheif. If not, see . */ +__GNUC__ __GNUC__ __GNUC__ test --- + #include "bitstream.h" #include From 2fcf8a29d76af2ed625643ef376879fa510a728e Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Sat, 23 Nov 2024 11:58:02 +0100 Subject: [PATCH 3/5] another test --- libheif/bitstream.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libheif/bitstream.cc b/libheif/bitstream.cc index f988cad3ab..107274196b 100644 --- a/libheif/bitstream.cc +++ b/libheif/bitstream.cc @@ -18,14 +18,35 @@ * along with libheif. If not, see . */ -__GNUC__ __GNUC__ __GNUC__ test --- +#if defined(__GNUC__) +test1 test1 ... +#endif #include "bitstream.h" +#if defined(__GNUC__) +test2 test2 ... +#endif + #include + +#if defined(__GNUC__) +test3 test3 ... +#endif + #include + +#if defined(__GNUC__) +test4 test4 ... +#endif + #include +#if defined(__GNUC__) +test5 test5 ... +#endif + + #define GCC_COMPILER (defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__PGI)) #if (defined(GCC_COMPILER) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10) __GNUC__ aaa bbb ... From 4da41fe5954209451b59d193c62e6b6aa6acc66d Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Sat, 23 Nov 2024 11:59:18 +0100 Subject: [PATCH 4/5] fix compiler check --- libheif/bitstream.cc | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/libheif/bitstream.cc b/libheif/bitstream.cc index 107274196b..cb9929f10b 100644 --- a/libheif/bitstream.cc +++ b/libheif/bitstream.cc @@ -18,41 +18,16 @@ * along with libheif. If not, see . */ -#if defined(__GNUC__) -test1 test1 ... -#endif - #include "bitstream.h" - -#if defined(__GNUC__) -test2 test2 ... -#endif - #include - -#if defined(__GNUC__) -test3 test3 ... -#endif - #include - -#if defined(__GNUC__) -test4 test4 ... -#endif - #include -#if defined(__GNUC__) -test5 test5 ... -#endif - #define GCC_COMPILER (defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__PGI)) -#if (defined(GCC_COMPILER) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10) -__GNUC__ aaa bbb ... +#if ((GCC_COMPILER) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10) #include #else -__clang__ ccc ddd ... #include #endif From 4f5e1297f2bff11a0e65ace6bd22a9f82e11743c Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Sat, 23 Nov 2024 12:14:16 +0100 Subject: [PATCH 5/5] no macro expansion with 'defined' --- libheif/bitstream.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libheif/bitstream.cc b/libheif/bitstream.cc index cb9929f10b..a79a5b7629 100644 --- a/libheif/bitstream.cc +++ b/libheif/bitstream.cc @@ -24,8 +24,7 @@ #include -#define GCC_COMPILER (defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__PGI)) -#if ((GCC_COMPILER) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10) +#if ((defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__PGI)) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10) #include #else #include