diff options
author | Wyatt Hepler <hepler@google.com> | 2024-02-21 06:14:24 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-02-21 06:14:24 +0000 |
commit | ce288f125447b66e14c085f7028082e905988e69 (patch) | |
tree | 0a0b55690b922cda91ab924c60465df0d0984c4b | |
parent | 975a59eafba5f8796453560bac0265bce0c1b78a (diff) | |
download | pigweed-ce288f125447b66e14c085f7028082e905988e69.tar.gz |
pw_preprocessor: Do not check for __VA_OPT__ on older compilers
Do not check for __VA_OPT__ on compilers that are known to have
incomplete support for it.
Bug: b/326135018
Change-Id: Ifb4f9bb31ba601bc1b0b231367847ced0b271885
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/193434
Reviewed-by: Yuval Peress <peress@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r-- | pw_preprocessor/public/pw_preprocessor/compiler.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pw_preprocessor/public/pw_preprocessor/compiler.h b/pw_preprocessor/public/pw_preprocessor/compiler.h index 4a9ca0b7a..8a048b968 100644 --- a/pw_preprocessor/public/pw_preprocessor/compiler.h +++ b/pw_preprocessor/public/pw_preprocessor/compiler.h @@ -262,9 +262,15 @@ /// Evaluates to 1 if `__VA_OPT__` is supported, regardless of the C or C++ /// standard in use. +#if (defined(__clang_major__) && __clang_major__ < 9) || \ + (defined(__GNUC__) && __GNUC__ < 12) +#define PW_VA_OPT_SUPPORTED() 0 // Don't bother checking on old compilers. +#else #define PW_VA_OPT_SUPPORTED() _PW_VA_OPT_SUPPORTED() /// @} #define _PW_VA_OPT_SUPPORTED(...) _PW_VA_OPT_SUPPORTED_##__VA_OPT__() #define _PW_VA_OPT_SUPPORTED_ 1 #define _PW_VA_OPT_SUPPORTED___VA_OPT__() 0 + +#endif // __clang_major__ < 9 || __GNUC__ < 12 |