<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 --- - -Wshadow not suppressed in Macro defined in system header"
href="http://llvm.org/bugs/show_bug.cgi?id=16093">16093</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wshadow not suppressed in Macro defined in system header
</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 program (which must be saved as clang.cpp for the self-inclusion
to work) results in a warning when compiled with clang r182233 and -Wshadow:
#ifdef IS_INCLUDE_FILE
#pragma clang system_header
#define M(a) \
__extension__({ int v = a; v; })
#else
#define IS_INCLUDE_FILE
#include "clang.cpp"
int main()
{
int i = M(M(1));
}
#endif
This results in:
% % ~/LLVM/build/Release+Asserts/bin/clang++ -Wshadow -v clang.cpp
clang version 3.4 (trunk 182233)
[...]
clang.cpp:13:12: warning: declaration shadows a local variable [-Wshadow]
int i = M(M(1));
^
clang.cpp:5:22: note: expanded from macro 'M'
__extension__({ int v = a; v; })
^
clang.cpp:5:26: note: expanded from macro 'M'
__extension__({ int v = a; v; })
^
clang.cpp:13:10: note: previous declaration is here
int i = M(M(1));
^
clang.cpp:5:22: note: expanded from macro 'M'
__extension__({ int v = a; v; })
^
1 warning generated.
I'm filing this bug mainly because the SSE2 header file emmintrin.h provided
with clang contains (among others) the macro _mm_shufflelo_epi16 which when
nested trips this warning; the original code that caused the warning was:
_mm_shufflelo_epi16(_mm_shufflehi_epi16(v, MASK_HI), MASK_LO)
(I'm actually not sure if the macros in emmintrin.h really need to define a
local variable to store the macro's parameter in, as the parameter is used only
once in the macro.)</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>