[llvm-bugs] [Bug 24682] New: Clang claims it does not understand "pragma GCC push_options"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 2 15:13:22 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24682

            Bug ID: 24682
           Summary: Clang claims it does not understand "pragma GCC
                    push_options"
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: noloader at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

We attempt to manage warnings in code so the command line is not polluted with
extraneous options. In addition, its a library, so there's no way for us to
control the user's command line.

According to the GCC folks, GCC's diagnostic facilities made their appearance
sometime between 4.1 and 4.2. Cf.,
https://gcc.gnu.org/ml/gcc-help/2015-07/msg00062.html.

Our code effectively has the following:

  #if (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
  # define GCC_DIAGNOSTIC_AWARE 1
  #endif

Then, in the code:

  #if GCC_DIAGNOSTIC_AVAILABLE
  # pragma GCC push_options
  # pragma GCC diagnostic ignored "-Wunused-value"
  # pragma GCC diagnostic ignored "-Wunused-parameter"
  # pragma GCC diagnostic ignored "-Wunused-function"
  #endif

Clang defines itself to be GCC 4.2.1:

  $ clang -dM -E - </dev/null | sort
  #define __GNUC_MINOR__ 2
  #define __GNUC_PATCHLEVEL__ 1
  #define __GNUC_STDC_INLINE__ 1
  #define __GNUC__ 4

However, Clang complains it does not understand "pragma GCC push_options" and
"pragma GCC pop_options":

$ make
/usr/local/bin/clang++ -DNDEBUG -g2 -O2 -Wall -fPIC -arch i386 -arch x86_64
-pipe -c 3way.cpp
In file included from 3way.cpp:5:
In file included from ./3way.h:7:
In file included from ./seckey.h:9:
./misc.h:46:14: warning: unknown pragma ignored [-Wunknown-pragmas]
# pragma GCC push_options
             ^
./misc.h:335:14: warning: unknown pragma ignored [-Wunknown-pragmas]
# pragma GCC push_options
             ^
./misc.h:352:14: warning: unknown pragma ignored [-Wunknown-pragmas]
# pragma GCC pop_options
             ^
./misc.h:457:14: warning: unknown pragma ignored [-Wunknown-pragmas]
# pragma GCC push_options
             ^
./misc.h:488:14: warning: unknown pragma ignored [-Wunknown-pragmas]
# pragma GCC pop_options

**********

$ echo $CXX
/usr/local/bin/clang++

$ $CXX --version
clang version 3.6.0 (tags/RELEASE_360/final)
Target: x86_64-apple-darwin12.6.0
Thread model: posix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150902/6805c23a/attachment.html>


More information about the llvm-bugs mailing list