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

            Bug ID: 91318
           Summary: warnings about unused internal macros with
                    -Wunused-macros and #pragma GCC optimize
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: phd at phd dot re
  Target Milestone: ---

GCC shows annoying warnings about unused internal macros when using
-Wunused-macros parameter to compile code containing #pragma GCC optimize


-- a.cpp
-----------------------------------------------------------------------
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("finite-math-only")

int main() {}
--------------------------------------------------------------------------------


command:
    gcc -Wunused-macros a.cpp


-- result
----------------------------------------------------------------------
a.cpp:2:41: warning: macro "__FAST_MATH__" is not used [-Wunused-macros]
    2 | #pragma GCC optimize ("finite-math-only")
      |                                         ^
a.cpp:2:41: warning: macro "__NO_MATH_ERRNO__" is not used [-Wunused-macros]
a.cpp:4:13: warning: macro "__FINITE_MATH_ONLY__" is not used [-Wunused-macros]
    4 | int main() {}
      |             ^
--------------------------------------------------------------------------------


live demo:
    https://godbolt.org/z/flbv97

Reply via email to