From 5447fb3bfa923144cf7ebe95c9f5ce4a55d37597 Mon Sep 17 00:00:00 2001 From: "CHIANG, YU-HSUN (Tommy Chiang, oToToT)" Date: Fri, 13 May 2022 13:22:19 +0800 Subject: [PATCH] Avoid potential compilation error with old gcc The optional message for deprecated attribute is introduced in gcc 4.5[1]. To avoid potential compilation error, we should check gcc version before using it. Also, __GNUG__ is for testing GNU C++ compiler. Therefore, we should remove it as we are targeting C here. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43666 --- src/nvidia/inc/libraries/nvoc/prelude.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvidia/inc/libraries/nvoc/prelude.h b/src/nvidia/inc/libraries/nvoc/prelude.h index 1e1b14b4c..221388d5c 100644 --- a/src/nvidia/inc/libraries/nvoc/prelude.h +++ b/src/nvidia/inc/libraries/nvoc/prelude.h @@ -243,7 +243,7 @@ typedef struct NVOC_CLASS_INFO #pragma warning(error: 1786) // treat deprecated as error (globally affected) #define NVOC_PRIVATE_FIELD(x) __attribute__((deprecated(#x " is a private field"))) x #define NVOC_PRIVATE_FUNCTION(x) __attribute__((deprecated(#x " is a private function"))) x -#elif defined(__GNUC__) || defined(__GNUG__) // gcc +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) // gcc #pragma GCC diagnostic error "-Wdeprecated-declarations" // treat deprecated as error (globally affected) #define NVOC_PRIVATE_FIELD(x) __attribute__((deprecated(#x " is a private field"))) x #define NVOC_PRIVATE_FUNCTION(x) __attribute__((error(#x " is a private function"))) x