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

            Bug ID: 100125
           Summary: -Wunused-macros generated while should be ignored; if
                    undef is seen?
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at behdad dot org
  Target Milestone: ---

We're facing this in HarfBuzz. I narrowed down the bug to this:

Works:

```c++
#pragma GCC diagnostic ignored "-Wunused-macros"

#define A B
```

$ g++ a.cc -c -Wunused-macros

(fine; no warning)

But if I add an `undef` to that file:

```c++
#pragma GCC diagnostic ignored "-Wunused-macros"

#define A B

#undef A
```

$ g++ a.cc -c -Wunused-macros
a.cc:3: warning: macros "A" is not used [-Wunused-macros]
    3 | #define A B

Am I missing something?

Reply via email to