https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67914

            Bug ID: 67914
           Summary: Unrecognized command line argument warning not shown
                    unless there is another warning for -Wno-*
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: e...@coeus-group.com
  Target Milestone: ---

If you pass an unrecognized -Wno-* option to gcc (or g++) with -Wall -Wextra
also set, you should get a warning, but that seems to only be true if something
*else* emits a warning first.  This makes it difficult to check in a build
system whether or not a flag is supported.

nemequ@hoplite:~/t$ cat t.c
int main(void)
{
#if defined(TRIGGER_A_DIFFERENT_WARNING)
  int unused;
#endif
  return 0;
}
nemequ@hoplite:~/t$ gcc -Wall -Wextra -Werror -What-the-fuck -o t -c t.c
gcc: error: unrecognized command line option ‘-What-the-fuck’
nemequ@hoplite:~/t$ gcc -Wall -Wextra -Werror -Wno-hat-the-fuck -o t -c t.c
nemequ@hoplite:~/t$ gcc -DTRIGGER_A_DIFFERENT_WARNING -Wall -Wextra -Werror
-Wno-hat-the-fuck -o t -c t.c
t.c: In function ‘main’:
t.c:4:7: error: unused variable ‘unused’ [-Werror=unused-variable]
   int unused;
       ^
t.c: At top level:
cc1: error: unrecognized command line option ‘-Wno-hat-the-fuck’ [-Werror]
cc1: all warnings being treated as errors
nemequ@hoplite:~/t$ gcc --version
gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to