http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57166

             Bug #: 57166
           Summary: Manual no longer documents -Wmissing-noreturn alias
                    for -Wsuggest-attribute=noreturn
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: j...@joshtriplett.org


Older versions of GCC had an option -Wmissing-noreturn, which acts like
-Wsuggest-attribute=noreturn does now.  Current versions of GCC seem to accept
that option as an alias for -Wsuggest-attribute=noreturn, to the point where
the warnings generated by -Wmissing-noreturn get attributed to
-Wsuggest-attribute=noreturn:

error: function might be candidate for attribute 'noreturn'
[-Werror=suggest-attribute=noreturn]

However, if the compiler command line has -Wmissing-noreturn on it,
-Wno-suggest-attribute=noreturn will not turn it back off; only
-Wno-missing-noreturn will do that.  The same applies in reverse.  Test case:

$ cat test.c 
void f(void)
{
    while (1)
        ;
}

int main(void)
{
    f();
    return 0;
}
$ gcc -Wall -Wsuggest-attribute=noreturn -Wno-suggest-attribute=noreturn test.c
-o /dev/null
$ gcc -Wall -Wmissing-noreturn -Wno-suggest-attribute=noreturn test.c -o
/dev/null
test.c: In function ‘f’:
test.c:1:6: warning: function might be candidate for attribute ‘noreturn’
[-Wsuggest-attribute=noreturn]
$ gcc -Wall -Wmissing-noreturn -Wno-missing-noreturn test.c -o /dev/null
$ gcc -Wall -Wsuggest-attribute=noreturn -Wno-missing-noreturn test.c -o
/dev/null
test.c: In function ‘f’:
test.c:1:6: warning: function might be candidate for attribute ‘noreturn’
[-Wsuggest-attribute=noreturn]


The GCC manual should continue to document the alias -Wmissing-noreturn as long
as it continues to work (just as it currently documents
-Wmissing-format-attribute in addition to -Wsuggest-attribute=format).

In addition, I'd suggest that the -Wno-* forms of either option should cancel
out the other, since otherwise looking at the warning attribution supplied by
GCC and adding the corresponding -Wno-* for that option will not turn off the
warning.

Reply via email to