<html>
<head>
<base href="http://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 --- - -Wold-style-cast should be suppressed in the expansion of system header macros"
href="http://llvm.org/bugs/show_bug.cgi?id=18147">18147</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wold-style-cast should be suppressed in the expansion of system header macros
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jonathan.sauer@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following code (which includes itself as a system header) produces a
warning when compiled with clang r196506 and -Wold-style-cast:
#ifdef IS_INCLUDE_FILE
#pragma clang system_header
#define FOO(a) ((int*) (a))
#else
#define IS_INCLUDE_FILE
#include __FILE__
int main()
{
int* i = FOO(0);
}
#endif
This results in:
% ~/LLVM/build/Release+Asserts/bin/clang++ -c -Wold-style-cast clang.cpp
clang.cpp:12:14: warning: use of old-style cast [-Wold-style-cast]
int* i = FOO(0);
^~~~~~
clang.cpp:4:24: note: expanded from macro 'FOO'
#define FOO(a) ((int*) (a))
~~~~~~ ^
1 warning generated.
While -Wold-style-cast already is suppressed inside function definitions in
system headers, it should also be suppressed when a macro defined in a system
header is expanded outside of a system header.
(real-life examples are found in the SSE headers shipped with clang such as
emmintrin.h)</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>