R: _Pragma diagnostic not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This seems to be an actual issue, I have now opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118838

Best Regards!
Luca

________________________________
Da: Luca Bacci <luca.bacci@xxxxxxxxxxx>
Inviato: lunedì 10 febbraio 2025 11:30
A: gcc-help@xxxxxxxxxxx <gcc-help@xxxxxxxxxxx>
Oggetto: _Pragma diagnostic not working

Consider this file:

test-gcc.c
-------------------------
#if defined(__clang__)
#  if __clang_major__ >= 12
#    define FENV_ACCESS_ON _Pragma ("STDC FENV_ACCESS ON")
#  endif
#elif defined(_MSC_VER)
#  define FENV_ACCESS_ON __pragma (fenv_access (on))
#elif defined(__GNUC__)
   // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678
#  define FENV_ACCESS_ON \
     _Pragma ("GCC diagnostic push") \
     _Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") \
     _Pragma ("STDC FENV_ACCESS ON") \
     _Pragma ("GCC diagnostic pop")
#else
#  define FENV_ACCESS_ON _Pragma ("STDC FENV_ACCESS ON")
#endif

FENV_ACCESS_ON
-------------------------

When compiling with -Wall I get an "unknown pragma" warning:


test-gcc.c:18: warning: ignoring '#pragma STDC FENV_ACCESS' [-Wunknown-pragmas]

Yet, if I preprocess separately and compile, I don't get any warning:


gcc -E -P test-gcc.c | gcc -c -Wall -xc -

Anyobdy knows why?

Kind regards,
Luca




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux