From ea78a58ca4be0b71f7af60acc0d58e13dd38a700 Mon Sep 17 00:00:00 2001 From: Wyatt Hepler Date: Wed, 21 Aug 2024 22:40:14 +0000 Subject: [PATCH] pw_preprocessor: Introduce PW_MODIFY_DIAGNOSTIC_CLANG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complements PW_MODIFY_DIAGNOSTIC_GCC. Fixes: b/356935569 Change-Id: I1c282ecc65c9fd0ecb88c280a31e22ed6519c82b Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/231332 Presubmit-Verified: CQ Bot Account Lint: Lint 🤖 Commit-Queue: Wyatt Hepler Pigweed-Auto-Submit: Wyatt Hepler Reviewed-by: Dave Roth --- pw_preprocessor/public/pw_preprocessor/compiler.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pw_preprocessor/public/pw_preprocessor/compiler.h b/pw_preprocessor/public/pw_preprocessor/compiler.h index 90e0a2f69d..6d2ca881ea 100644 --- a/pw_preprocessor/public/pw_preprocessor/compiler.h +++ b/pw_preprocessor/public/pw_preprocessor/compiler.h @@ -209,6 +209,15 @@ PW_MODIFY_DIAGNOSTIC(kind, option) #endif // __clang__ +/// Applies ``PW_MODIFY_DIAGNOSTIC`` only for Clang. This is useful for warnings +/// that aren't supported by or don't need to be changed in other compilers. +#ifdef __clang__ +#define PW_MODIFY_DIAGNOSTIC_CLANG(kind, option) \ + PW_MODIFY_DIAGNOSTIC(kind, option) +#else +#define PW_MODIFY_DIAGNOSTIC_CLANG(kind, option) _PW_REQUIRE_SEMICOLON +#endif // __clang__ + /// Expands to a `_Pragma` with the contents as a string. `_Pragma` must take a /// single string literal; this can be used to construct a `_Pragma` argument. #define PW_PRAGMA(contents) _Pragma(#contents)