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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Reduced:

$ cat x.h
#pragma GCC system_header
enum E { _A, _B, _C };

$ cat x.C
#include "x.h"

void
g ()
{
  E e = _A;
  switch (e)
    {
    case _A:
    case _B:
      break;
    }
}

$ ./cc1plus -quiet x.C -Wswitch
x.C: In function ‘void g()’:
x.C:7:10: warning: enumeration value ‘_C’ not handled in switch [-Wswitch]
    7 |   switch (e)
      |          ^

Suppressing the warning when the enumerator comes from a system header should
be fairly easy using in_system_header_at.  But for the "use reserved names"
requirement -- should we just check whether the name of an enumerator starts
with an '_'?

Reply via email to