<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Clang claims it does not understand "pragma GCC push_options""
href="https://llvm.org/bugs/show_bug.cgi?id=24682">24682</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang claims it does not understand "pragma GCC push_options"
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>noloader@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.,
<a href="https://gcc.gnu.org/ml/gcc-help/2015-07/msg00062.html">https://gcc.gnu.org/ml/gcc-help/2015-07/msg00062.html</a>.
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>