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

Avoid "gcc -Wmissing-field-initializers" warnings on the generated code.

* src/options.h (Options::has_initializer_suffix): New declaration.
* src/options.cc (Options::has_initializer_suffix): New function.
* src/output.cc (Output::output_keyword_table): If option -t is
specified and option -F is not specified, emit '#pragma GCC diagnostic'
lines, to silence -Wmissing-field-initializers warnings from gcc or
clang.
* tests/charsets.exp: Update.
* tests/gpc.exp: Likewise.
* tests/incomplete.exp: Likewise.
* tests/languages.exp: Likewise.
* tests/objc.exp: Likewise.
* tests/test-4.exp: Likewise.
This commit is contained in:
Bruno Haible
2023-09-05 21:20:51 +02:00
parent 91ed1621cc
commit 8d68fff1c7
10 changed files with 93 additions and 4 deletions

View File

@@ -83,6 +83,10 @@ hash (register const char *str, register size_t len)
struct month *
in_word_set (register const char *str, register size_t len)
{
#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
static struct month wordlist[] =
{
{""}, {""}, {""},
@@ -101,6 +105,9 @@ in_word_set (register const char *str, register size_t len)
{""}, {""}, {""},
{"february", 2, 28, 29}
};
#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
#pragma GCC diagnostic pop
#endif
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{