| // RUN: %clang_cc1 -verify -Wno-unused -I %S/Inputs %s |
| |
| /* WG14 N590: Clang 3.2 |
| * Increase minimum translation limits |
| * |
| * NB: the content of this document is not available, so this is testing |
| * against the implementation limits in C23, which are the most aggressive |
| * translation limits we can test against. |
| */ |
| // expected-no-diagnostics |
| |
| // 15 nesting levels for #included files |
| // NOTE: this relies on the value of __COUNTER__, so be very careful about |
| // adding code above this line of the test. |
| #include "nested-include.h" |
| |
| // Helpers for declaring unique variables. |
| #define CAT_IMPL(x, y) x ## y |
| #define CAT(x, y) CAT_IMPL(x, y) |
| #define ONCE(x) CAT(x, __COUNTER__) SEPARATOR |
| #define REPEAT10(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) |
| #define REPEAT63(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) ONCE(x) ONCE(x) ONCE(x) |
| #define REPEAT100(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) |
| #define REPEAT127(x) REPEAT100(x) REPEAT10(x) REPEAT10(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) |
| #define REPEAT500(x) REPEAT100(x) REPEAT100(x) REPEAT100(x) REPEAT100(x) REPEAT100(x) |
| #define REPEAT1000(x) REPEAT500(x) REPEAT500(x) |
| #define REPEAT1023(x) REPEAT1000(x) REPEAT10(x) REPEAT10(x) ONCE(x) ONCE(x) ONCE(x) |
| #define REPEAT4095(x) REPEAT1000(x) REPEAT1000(x) REPEAT1000(x) REPEAT1000(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) REPEAT10(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) ONCE(x) |
| |
| // Limits taken from C23 5.2.5.2p1. |
| void func(void) { |
| // 127 nesting levels of blocks |
| {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ |
| }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} |
| |
| // 12 pointer, array, and function declarators (in any combination) modifying |
| // an arithmetic, structure, union, or void type in a declaration. |
| void (************fp)(int foo[1][2][3][4][5][6][7][8][9][10][11][12]); |
| |
| // 63 nesting levels of parenthesized declarators within a full declarator. |
| int (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((decl))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); |
| |
| // 63 significant initial characters in an internal identifier or a macro |
| // name. |
| static int aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggg; |
| |
| // 31 significant initial characters in an external identifier. |
| extern int gggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjjkkkkkkkkkkllllllllllmmm; |
| |
| // 511 identifiers with block scope declared in one block. |
| { |
| #define SEPARATOR ; |
| REPEAT500(int a) |
| REPEAT10(int a) |
| ONCE(int a) |
| #undef SEPARATOR |
| } |
| |
| // 4095 characters in a logical source line. |
| (void)0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,\ |
| 5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,\ |
| 3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8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,7,8,9,0,1,2,3,4,5,6,7,8,\ |
| 9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,\ |
| 7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,\ |
| 5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,\ |
| 3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,\ |
| 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4"; |
| |
| // 1023 case labels for a switch statement. |
| switch (aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggg) { |
| #define SEPARATOR : |
| REPEAT1023(case 0x) |
| #undef SEPARATOR |
| break; |
| } |
| } |
| |
| // 32767 bytes in an object. |
| struct S { |
| unsigned char mem[32767]; |
| }; |
| _Static_assert(sizeof(struct S) >= 32767, ""); |
| |
| // 1023 members in a single structure or union |
| struct T { |
| #define SEPARATOR ; |
| REPEAT1023(int mem) |
| #undef SEPARATOR |
| }; |
| |
| // 1023 enumeration constants in a single enumeration |
| enum E { |
| #define SEPARATOR , |
| REPEAT1023(e) |
| #undef SEPARATOR |
| }; |
| |
| // 127 parameters in one function definition. |
| #define SEPARATOR , |
| // Because the parameters are all separated by commas, we have to add a final |
| // parameter (without a preceeding comma) to form a valid declaration. |
| void lots_of_params(REPEAT127(int a) int last) { |
| // 127 arguments in one function call |
| lots_of_params(REPEAT127(0x0) 0); |
| } |
| #undef SEPARATOR |
| |
| // 63 levels of nested structure or union definitions in a single member |
| // declaration list. |
| struct U { |
| #define SEPARATOR ; |
| REPEAT63(struct { int a) |
| REPEAT63(} mem) |
| #undef SEPARATOR |
| }; |
| |
| // 63 nesting levels of conditional inclusion |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| #if 1 |
| |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| #endif |
| |
| // 63 initial characters in a macro name. |
| #define AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDDDDDDDDDDEEEEEEEEEEFFFFFFFFFFGGG |
| |
| // 4095 external identifiers in one translation unit. |
| #define SEPARATOR ; |
| REPEAT4095(extern int val) |
| #undef SEPARATOR |
| |
| // 127 parameters in one macro definition |
| #define BIG_UN(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, \ |
| a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, \ |
| a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, \ |
| a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, \ |
| a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, \ |
| a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, \ |
| a60, a61, a62, a63, a64, a65, a66, a67, a68, a69, \ |
| a70, a71, a72, a73, a74, a75, a76, a77, a78, a79, \ |
| a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, \ |
| a90, a91, a92, a93, a94, a95, a96, a97, a98, a99, \ |
| a100, a101, a102, a103, a104, a105, a106, a107, a108, a109, \ |
| a110, a111, a112, a113, a114, a115, a116, a117, a118, a119, \ |
| a120, a121, a122, a123, a124, a125, a126) 0 |
| |
| // 127 arguments in one macro invocation |
| int val = BIG_UN(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \ |
| 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \ |
| 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \ |
| 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \ |
| 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, \ |
| 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, \ |
| 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, \ |
| 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \ |
| 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, \ |
| 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \ |
| 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \ |
| 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, \ |
| 120, 121, 122, 123, 124, 125, 126); |
| |
| // 4095 macro identifiers simultaneously defined in one preprocessing |
| // translation unit. Rather than write out 4095 macro definitions, we'll use a |
| // cheap python script to generate the contents and test that. |
| // RUN: %python -c "print('\n'.join(['// expected-no-diagnostics'] + [f'#define M{i}\n' for i in range(4096)]))" >%t.inc |
| // RUN: %clang_cc1 -verify %t.inc |