Files
clang-p2996/clang/test/SemaCXX/Inputs/array-bounds-system-header.h
Matt Beaumont-Gay 9d570c438c 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
2011-12-12 22:35:02 +00:00

12 lines
285 B
C

// "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)