1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Avoid "-Wundef" warnings in C++ mode on the generated code.

Reported by Heiko Becker <mail@heiko-becker.de> in
<https://lists.gnu.org/archive/html/bug-gperf/2025-04/msg00001.html>
and by Thomas Klausner <wiz@netbsd.org>.

* src/output.cc (Output::output_hash_function): Emit a
'defined __STDC_VERSION__' before the test of __STDC_VERSION__.
* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
tests/cplusplus.exp, tests/java.exp, tests/languages.exp,
tests/modula2.exp, tests/objc.exp: Update.
This commit is contained in:
Bruno Haible
2025-04-09 12:29:19 +02:00
parent fe7539a0f9
commit 3bab6ab7bf
10 changed files with 69 additions and 57 deletions

View File

@@ -84,7 +84,7 @@ hash (register const char *str, register size_t len)
{
default:
hval += asso_values[(unsigned char)str[2]];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (__STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));