util: Add PRAGMA_DIAGNOSTIC_IGNORED_CLANG PRAGMA_DIAGNOSTIC_IGNORED_GCC for latter use

gcc and clang do not have equal set of warnings, so when warning are specific to CLANG or GCC, using PRAGMA_DIAGNOSTIC_IGNORED_CLANG or PRAGMA_DIAGNOSTIC_GCC_IGNORED instead

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38313>
This commit is contained in:
Yonggang Luo 2025-11-13 03:52:37 +08:00 committed by Marge Bot
parent 583b25e806
commit 24a7d53329

View file

@ -509,18 +509,24 @@ typedef int lock_cap_t;
#define PRAGMA_DIAGNOSTIC_ERROR(X) DO_PRAGMA( clang diagnostic error #X )
#define PRAGMA_DIAGNOSTIC_WARNING(X) DO_PRAGMA( clang diagnostic warning #X )
#define PRAGMA_DIAGNOSTIC_IGNORED(X) DO_PRAGMA( clang diagnostic ignored #X )
#define PRAGMA_DIAGNOSTIC_IGNORED_CLANG(X) DO_PRAGMA( clang diagnostic ignored #X )
#define PRAGMA_DIAGNOSTIC_IGNORED_GCC(X)
#elif defined(__GNUC__)
#define PRAGMA_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
#define PRAGMA_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
#define PRAGMA_DIAGNOSTIC_ERROR(X) DO_PRAGMA( GCC diagnostic error #X )
#define PRAGMA_DIAGNOSTIC_WARNING(X) DO_PRAGMA( GCC diagnostic warning #X )
#define PRAGMA_DIAGNOSTIC_IGNORED(X) DO_PRAGMA( GCC diagnostic ignored #X )
#define PRAGMA_DIAGNOSTIC_IGNORED_CLANG(X)
#define PRAGMA_DIAGNOSTIC_IGNORED_GCC(X) DO_PRAGMA( GCC diagnostic ignored #X )
#else
#define PRAGMA_DIAGNOSTIC_PUSH
#define PRAGMA_DIAGNOSTIC_POP
#define PRAGMA_DIAGNOSTIC_ERROR(X)
#define PRAGMA_DIAGNOSTIC_WARNING(X)
#define PRAGMA_DIAGNOSTIC_IGNORED(X)
#define PRAGMA_DIAGNOSTIC_IGNORED_CLANG(X)
#define PRAGMA_DIAGNOSTIC_IGNORED_GCC(X)
#endif
#define PASTE2(a, b) a ## b