summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/Inputs/array-bounds-system-header.h
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2011-12-12 22:35:02 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2011-12-12 22:35:02 +0000
commit9d570c438cd31923b548bbb5d0ca84d68b3f13c7 (patch)
treeee2eeaba41f00aab93e0310db3dab0cffaee04d0 /clang/test/SemaCXX/Inputs/array-bounds-system-header.h
parent055d0c961b7feee0d875cd791afa2451d98980dc (diff)
downloadbcm5719-llvm-9d570c438cd31923b548bbb5d0ca84d68b3f13c7.tar.gz
bcm5719-llvm-9d570c438cd31923b548bbb5d0ca84d68b3f13c7.zip
Suppress -Warray-bounds in certain cases involving macros from system headers.
The motivation here is a "clever" implementation of strncmp(), which peels the first few comparisons via chained conditional expressions which ensure that the input arrays are known at compile time to be sufficiently large. llvm-svn: 146430
Diffstat (limited to 'clang/test/SemaCXX/Inputs/array-bounds-system-header.h')
-rw-r--r--clang/test/SemaCXX/Inputs/array-bounds-system-header.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/Inputs/array-bounds-system-header.h b/clang/test/SemaCXX/Inputs/array-bounds-system-header.h
new file mode 100644
index 00000000000..07cde80e9af
--- /dev/null
+++ b/clang/test/SemaCXX/Inputs/array-bounds-system-header.h
@@ -0,0 +1,11 @@
+// "System header" for testing that -Warray-bounds is properly suppressed in
+// certain cases.
+
+#define BAD_MACRO_1 \
+ int i[3]; \
+ i[3] = 5
+#define BAD_MACRO_2(_b, _i) \
+ (_b)[(_i)] = 5
+#define QUESTIONABLE_MACRO(_a) \
+ sizeof(_a) > 3 ? (_a)[3] = 5 : 5
+#define NOP(x) (x)
OpenPOWER on IntegriCloud