[LLVMbugs] [Bug 16093] New: -Wshadow not suppressed in Macro defined in system header
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 21 08:50:06 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16093
Bug ID: 16093
Summary: -Wshadow not suppressed in Macro defined in system
header
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: jonathan.sauer at gmx.de
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
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.)
--
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/20130521/dd1fe5e6/attachment.html>
More information about the llvm-bugs
mailing list