Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/arocc/test
repos/arocc/test/cases/#pragma pack gcc.c
//aro-args --emulate=gcc struct A { char c; int x; }; struct B { #pragma pack(1) char c; int x; }; #pragma pack() struct C { char c; #pragma pack(1) int x; }; #pragma pack() struct D { char c; int x; #pragma pack(1) }; _Static_assert(sizeof(struct A) > sizeof(struct B), ""); _Static_assert(sizeof(struct B) == sizeof(char) + sizeof(int), ""); _Static_assert(sizeof(struct C) == sizeof(char) + sizeof(int), ""); _Static_assert(sizeof(struct D) == sizeof(char) + sizeof(int), "");
0
repos/arocc/test
repos/arocc/test/cases/tentative array.c
int arr[]; _Static_assert(sizeof arr,""); int arr[3]; // TODO should make the warning go away #define SKIPPED_TESTS 1 #define EXPECTED_ERRORS \ "tentative array.c:1:5: warning: tentative array definition assumed to have one element" \ "tentative array.c:3:16: error: invalid application of 'sizeof' to an incomplete type 'int []'" \
0
repos/arocc/test
repos/arocc/test/cases/pragma without terminating newline.c
#pragma GCC poison foo
0
repos/arocc/test
repos/arocc/test/cases/stringify invalid escape.c
//aro-args -E -P #define str(s) # s x[str(\) #define EXPECTED_ERRORS \ "stringify invalid escape.c:4:7: warning: invalid string literal, ignoring final '\\'"
0
repos/arocc/test
repos/arocc/test/cases/unspecified expansion.c
//aro-args -E -P // This can either expand as 2*f(9) or as 2*9*g (see 6.10.3.4 in the standard) // We follow gcc and clang in expanding it to 2*9*g #define f(a) a*g #define g(a) f(a) f(2)(9)
0
repos/arocc/test
repos/arocc/test/cases/member expr.c
struct Foo { int a; } a; void foo(void) { int a; a->a; } void bar(void) { a->a; } void baz(void) { a->b; } void quux(struct Foo *a) { a.b; int b, *c; b.a; c.a; c->a; } char *quuux(char *arg) { return arg + a.a; } struct Bar { struct { union { int x; }; }; } *b; int f1(void) { return b->x; } struct Foo c[1]; int f2(void) { return c->a; } #define EXPECTED_ERRORS "member expr.c:7:8: error: member reference base type 'int' is not a structure or union" \ "member expr.c:10:8: error: member reference type 'struct Foo' is not a pointer; did you mean to use '.'?" \ "member expr.c:13:8: error: member reference type 'struct Foo' is not a pointer; did you mean to use '.'?" \ "member expr.c:13:8: error: no member named 'b' in 'struct Foo'" \ "member expr.c:16:7: error: member reference type 'struct Foo *' is a pointer; did you mean to use '->'?" \ "member expr.c:16:7: error: no member named 'b' in 'struct Foo *'" \ "member expr.c:18:7: error: member reference base type 'int' is not a structure or union" \ "member expr.c:19:7: error: member reference base type 'int *' is not a structure or union" \ "member expr.c:20:8: error: member reference base type 'int *' is not a structure or union" \
0
repos/arocc/test
repos/arocc/test/cases/array subscript with string.c
#define NO_ERROR_VALIDATION int x[2]; x[""[""]
0
repos/arocc/test
repos/arocc/test/cases/char literal sign extension.c
//aro-args -std=c23 -fsigned-char -Wno-multichar _Static_assert('\xFF' == -1, ""); _Static_assert(u8'\xFF' == 0xFF, ""); #if '\xFF' != -1 #error comparison failed #endif #if u8'\xFF' != 0xFF #error comparison failed #endif _Static_assert('\x00\xFF' == 255, ""); _Static_assert('\xFF\xFF' == 65535, "");
0
repos/arocc/test
repos/arocc/test/cases/type_resolution.c
#include "include/test_helpers.h" void test_type_resolution(void) { EXPECT_TYPE(1 - 1, int); EXPECT_TYPE(1L, long); EXPECT_TYPE(1UL, unsigned long); EXPECT_TYPE(1LL, long long); EXPECT_TYPE(1ULL, unsigned long long); int x = 1; // The next 12 examples are from the C17 standard § 6.5.16 (once with each order for branch types) EXPECT_TYPE(x ? (const void *)1 : (const int *)2, const void *); EXPECT_TYPE(x ? (const int *)1 : (const void *)2, const void *); EXPECT_TYPE(x ? (volatile int *)1 : 0, volatile int *); EXPECT_TYPE(x ? 0 : (volatile int *)1, volatile int *); EXPECT_TYPE(x ? (const int *)1 : (volatile int *)2, const volatile int *); EXPECT_TYPE(x ? (volatile int *)1 : (const int *)2, const volatile int *); EXPECT_TYPE(x ? (void *)1 : (const char *)2, const void *); EXPECT_TYPE(x ? (const char *)1 : (void *)2, const void *); EXPECT_TYPE(x ? (int *)1 : (const int *)2, const int *); EXPECT_TYPE(x ? (const int *)1 : (int *)2, const int *); EXPECT_TYPE(x ? (void *)1 : (int *)2, void *); EXPECT_TYPE(x ? (int *)1 : (void *)2, void *); EXPECT_TYPE(x ? (int *)1 : (float *)2, void *); EXPECT_TYPE(x ? (int *)1 : (_Atomic int*)2, void *); } #define EXPECTED_ERRORS "type_resolution.c:23:5: warning: pointer type mismatch ('int *' and 'float *') [-Wpointer-type-mismatch]" \ "test_helpers.h:3:88: note: expanded from here" \ "type_resolution.c:23:30: note: expanded from here" \ "type_resolution.c:24:5: warning: pointer type mismatch ('int *' and '_Atomic(int) *') [-Wpointer-type-mismatch]" \ "test_helpers.h:3:88: note: expanded from here" \ "type_resolution.c:24:30: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/enumerator constants.c
enum E { A, B = 10, C, D = 2, E = -2, F, #pragma GCC diagnostic warning "-Wpedantic" G = -2147483649, H = 2147483648, #pragma GCC diagnostic ignored "-Wpedantic" }; _Static_assert(A == 0, "A is wrong"); _Static_assert(B == 10, "B is wrong"); _Static_assert(C == 11, "C is wrong"); _Static_assert(D == 2, "D is wrong"); _Static_assert(E == -2, "E is wrong"); _Static_assert(F == -1, "F is wrong"); void foo(enum E e) { switch (e) { case A: return; default: return; } } #if __INT_MAX__ <= 2147483647 // 2 or 4 byte ints #define EXPECTED_ERRORS \ "enumerator constants.c:9:5: warning: ISO C restricts enumerator values to range of 'int' (-2147483649 is too small) [-Wpedantic]" \ "enumerator constants.c:10:5: warning: ISO C restricts enumerator values to range of 'int' (2147483648 is too large) [-Wpedantic]" \ #endif
0
repos/arocc/test
repos/arocc/test/cases/macro backtrace.c
#define a 1 ## 2 #define b a #define c b #define d c #define e d #define f e #define g f #define h g #define i h #define j i #define k j a b c d e f g h i j k #define EXPECTED_ERRORS "macro backtrace.c:12:1: error: expected external declaration" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:1:1: note: expanded from here" \ "macro backtrace.c:13:1: error: expected external declaration" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:2:1: note: expanded from here" \ "macro backtrace.c:14:1: error: expected external declaration" \ "macro backtrace.c:3:11: note: expanded from here" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:3:1: note: expanded from here" \ "macro backtrace.c:15:1: error: expected external declaration" \ "macro backtrace.c:4:11: note: expanded from here" \ "macro backtrace.c:3:11: note: expanded from here" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:4:1: note: expanded from here" \ "macro backtrace.c:16:1: error: expected external declaration" \ "macro backtrace.c:5:11: note: expanded from here" \ "macro backtrace.c:4:11: note: expanded from here" \ "macro backtrace.c:3:11: note: expanded from here" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:5:1: note: expanded from here" \ "macro backtrace.c:17:1: error: expected external declaration" \ "macro backtrace.c:6:11: note: expanded from here" \ "macro backtrace.c:5:11: note: expanded from here" \ "macro backtrace.c:4:11: note: expanded from here" \ "note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:6:1: note: expanded from here" \ "macro backtrace.c:18:1: error: expected external declaration" \ "macro backtrace.c:7:11: note: expanded from here" \ "macro backtrace.c:6:11: note: expanded from here" \ "macro backtrace.c:5:11: note: expanded from here" \ "note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:7:1: note: expanded from here" \ "macro backtrace.c:19:1: error: expected external declaration" \ "macro backtrace.c:8:11: note: expanded from here" \ "macro backtrace.c:7:11: note: expanded from here" \ "macro backtrace.c:6:11: note: expanded from here" \ "note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:8:1: note: expanded from here" \ "macro backtrace.c:20:1: error: expected external declaration" \ "macro backtrace.c:9:11: note: expanded from here" \ "macro backtrace.c:8:11: note: expanded from here" \ "macro backtrace.c:7:11: note: expanded from here" \ "note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:9:1: note: expanded from here" \ "macro backtrace.c:21:1: error: expected external declaration" \ "macro backtrace.c:10:11: note: expanded from here" \ "macro backtrace.c:9:11: note: expanded from here" \ "macro backtrace.c:8:11: note: expanded from here" \ "note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:10:1: note: expanded from here" \ "macro backtrace.c:22:1: error: expected external declaration" \ "macro backtrace.c:11:11: note: expanded from here" \ "macro backtrace.c:10:11: note: expanded from here" \ "macro backtrace.c:9:11: note: expanded from here" \ "note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)" \ "macro backtrace.c:2:11: note: expanded from here" \ "macro backtrace.c:1:11: note: expanded from here" \ "<scratch space>:11:1: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/macro whitespace.c
//aro-args -E -P #define FOO 1 /* fjfao */ /* fjfao */ 2 #define BAR + /* fjfao */ /* fjfao */ / #define BAZ 1 /* FJDLKS */ #define QUX /**/2 #define MULTI /* */3 #define XSTR(s) #s #define STR(s) XSTR(s) STR(FOO) STR(BAR) STR(BAZ) STR(1 2) STR(QUX) STR(MULTI) STR(/* */5) STR(/**/6) #define x foo bar x
0
repos/arocc/test
repos/arocc/test/cases/int128.c
//aro-args -std=c23 --target=x86_64-linux -Wno-c23-extensions -ffreestanding #include <stdint.h> _Static_assert(sizeof(int128_t) == __SIZEOF_INT128__); _Static_assert(INT128_WIDTH == 128); _Static_assert(UINT128_MAX == 340282366920938463463374607431768211455WBU); _Static_assert(INT128_MAX == 170141183460469231731687303715884105727WB); _Static_assert(INT128_MIN == -170141183460469231731687303715884105728WB); _Static_assert(INT128_C(-170141183460469231731687303715884105728) == -170141183460469231731687303715884105728wb); _Static_assert(UINT128_C(340282366920938463463374607431768211455) == 340282366920938463463374607431768211455uwb);
0
repos/arocc/test
repos/arocc/test/cases/gnu variadic macros.h
//aro-args -E -Wpedantic -P #define a(foo, args...) #args, foo __VA_ARGS__ args a(1,2,3,4) #define EXPECTED_ERRORS "gnu variadic macros.h:2:20: warning: named variadic macros are a GNU extension [-Wvariadic-macros]"
0
repos/arocc/test
repos/arocc/test/cases/atomic builtins.c
//aro-args -std=c23 #include <stdbool.h> #include <stdatomic.h> _Static_assert(memory_order_relaxed == 0, ""); _Static_assert(memory_order_consume == 1, ""); _Static_assert(memory_order_acquire == 2, ""); _Static_assert(memory_order_release == 3, ""); _Static_assert(memory_order_acq_rel == 4, ""); _Static_assert(memory_order_seq_cst == 5, ""); void foo(void) { int x = 0, y = 1, z = 2; bool res; res = __atomic_compare_exchange_n(&x, &y, z, false, memory_order_relaxed, memory_order_relaxed); __atomic_compare_exchange_n(&x, &y); res = __atomic_compare_exchange(&x, &y, &z, false, memory_order_relaxed, memory_order_relaxed); __atomic_compare_exchange(&x, &y); char a = 0, old; old = __atomic_fetch_add(&a, 1, memory_order_relaxed); _Atomic int i; atomic_init(&i, 42); i = kill_dependency(i); atomic_thread_fence(memory_order_relaxed); atomic_signal_fence(memory_order_seq_cst); res = atomic_is_lock_free(&i); atomic_store(&i, 42); atomic_store_explicit(&i, 42, memory_order_relaxed); x = atomic_load(&i); x = atomic_load_explicit(&i, memory_order_acquire); x = atomic_exchange(&i, 42); x = atomic_exchange_explicit(&i, 42, memory_order_release); x = atomic_compare_exchange_strong(&i, &y, 32); x = atomic_compare_exchange_strong_explicit(&i, &y, 32, memory_order_acq_rel, memory_order_consume); x = atomic_compare_exchange_weak(&i, &y, 32); x = atomic_compare_exchange_weak_explicit(&i, &y, 32, memory_order_acq_rel, memory_order_consume); x = atomic_fetch_add(&i, 42); x = atomic_fetch_add_explicit(&i, 42, memory_order_relaxed); x = atomic_fetch_sub(&i, 42); x = atomic_fetch_sub_explicit(&i, 42, memory_order_relaxed); x = atomic_fetch_or(&i, 42); x = atomic_fetch_or_explicit(&i, 42, memory_order_relaxed); x = atomic_fetch_xor(&i, 42); x = atomic_fetch_xor_explicit(&i, 42, memory_order_relaxed); x = atomic_fetch_and(&i, 42); x = atomic_fetch_and_explicit(&i, 42, memory_order_relaxed); atomic_flag flag = ATOMIC_FLAG_INIT; res = atomic_flag_test_and_set(&flag); res = atomic_flag_test_and_set_explicit(&flag, memory_order_seq_cst); atomic_flag_clear(&flag); atomic_flag_clear_explicit(&flag, memory_order_seq_cst); atomic_flag_clear_explicit(&flag, memory_order_seq_cst); } /* subject to change */ _Static_assert(ATOMIC_CHAR8_T_LOCK_FREE == 1, ""); _Static_assert(ATOMIC_POINTER_LOCK_FREE == 1, ""); #define EXPECTED_ERRORS "atomic builtins.c:17:33: error: expected 6 argument(s) got 2" \ "atomic builtins.c:20:31: error: expected 6 argument(s) got 2" \
0
repos/arocc/test
repos/arocc/test/cases/extern variables.c
extern int foo[]; extern struct Bar bar;
0
repos/arocc/test
repos/arocc/test/cases/arithmetic overflow.c
_Static_assert(0xFFFFFFFF + 1 == 0, ""); _Static_assert(1 + 0xFFFFFFFF == 0, ""); _Static_assert(0 - 0x00000001 == 0xFFFFFFFF, ""); _Static_assert(0x00000000 - 0x00000001 == 0xFFFFFFFF, ""); _Static_assert(0x80000000 * 2 == 0, ""); _Static_assert(2 * 0x80000000 == 0, ""); _Static_assert(sizeof(int) != 4 || ((unsigned)(-1) << 1) == 0xFFFFFFFFU - 1, ""); _Static_assert((-9223372036854775807LL - 1LL) / -1 != 0, "failed"); #define EXPECTED_ERRORS "arithmetic overflow.c:8:47: warning: overflow in expression; result is '9223372036854775808' [-Winteger-overflow]" \
0
repos/arocc/test
repos/arocc/test/cases/c89 standard.c
//aro-args -std=c89 void foo(void) { int inline = 5; int restrict = 10; int typeof = 20; }
0
repos/arocc/test
repos/arocc/test/cases/__VA_OPT__.c
//aro-args -E -P #define foo(...) __VA_OPT__(1, 2, ) __VA_OPT__(3, 4) foo(1) #define bar(...) a ## __VA_OPT__(3, 4) + bar() #define baz() __VA_OPT__(1) baz() #define invalid1(...) __VA_OPT__ 1 #define invalid2(...) __VA_OPT__(1 #define EXPECTED_ERRORS \ "__VA_OPT__.c:11:33: error: missing '(' following __VA_OPT__" \ "__VA_OPT__.c:13:35: error: unterminated __VA_OPT__ argument list" \ "__VA_OPT__.c:12:33: note: to match this '('" \
0
repos/arocc/test
repos/arocc/test/cases/integer literal promotion warning gcc 32.c
//aro-args --emulate=gcc --target=riscv32-linux-gnu _Static_assert(__builtin_types_compatible_p(typeof(18446744073709550592), long long int), ""); #define EXPECTED_ERRORS "integer literal promotion warning gcc 32.c:3:52: warning: integer literal is too large to be represented in a signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]"
0
repos/arocc/test
repos/arocc/test/cases/complex init.c
void foo(void) { _Complex double cd = { 1.0, 2.0 }; _Complex float cf = { 1.0f, 2.0f }; // _Complex int ci = {1, 2}; // TODO: complx integer initializer cd = __builtin_complex(1.0, 2.0); cf = __builtin_complex(1.0f, 2.0f); cd = (_Complex double) { 1.0f, 2.0f}; // convert float literals to double cf = (_Complex float) { 1.0, 2.0 }; // convert double literals to float }
0
repos/arocc/test
repos/arocc/test/cases/macro expansion to defined.c
//aro-args -Wexpansion-to-defined #define FOO_IS_DEFINED defined(FOO) #if FOO_IS_DEFINED #error FOO should not be defined #endif #pragma GCC diagnostic ignored "-Wexpansion-to-defined" #define FOO #if !FOO_IS_DEFINED #error FOO should be defined #endif #define DEFINED defined #if !DEFINED(FOO) #error FOO should be defined #endif #undef FOO #if DEFINED(FOO) #error FOO should not be defined #endif #define PASTED_DEFINED def ## ined #if PASTED_DEFINED BAR #error BAR should not be defined #endif #define BAR #if !PASTED_DEFINED BAR #error BAR should be defined #endif #define DEFINED_MACRO(X) defined(X) #if DEFINED_MACRO(FOO) #error FOO should not be defined #endif #define FOO #if !DEFINED_MACRO(FOO) #error Foo should be defined #endif #if defined(NOT_DEFINED) #error NOT_DEFINED should not be defined #elif !DEFINED ( FOO ) #error FOO should be defined #endif #define EXPECTED_ERRORS \ "macro expansion to defined.c:5:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]" \ "macro expansion to defined.c:3:24: note: expanded from here" \ "macro expansion to defined.c:43:6: error: macro name must be an identifier" \ "macro expansion to defined.c:37:35: note: expanded from here" \ "macro expansion to defined.c:43:6: error: expected expression" \ "macro expansion to defined.c:37:26: note: expanded from here"
0
repos/arocc/test
repos/arocc/test/cases/adjust diagnostic levels.c
#define FOO 1 #define FOO 2 #pragma GCC diagnostic error "-Wmacro-redefined" #define BAR 1 #define BAR 2 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmacro-redefined" #define BAZ 1 #define BAZ 2 #pragma GCC diagnostic pop #pragma GCC diagnostic pop #define QUX 1 #define QUX 2 #pragma GCC diagnostic push #pragma GCC diagnostic error "-Wpedantic" #pragma GCC diagnostic pop struct Foo {}; #define EXPECTED_ERRORS "adjust diagnostic levels.c:2:9: warning: 'FOO' macro redefined [-Wmacro-redefined]" \ "adjust diagnostic levels.c:1:9: note: previous definition is here" \ "adjust diagnostic levels.c:6:9: error: 'BAR' macro redefined [-Werror,-Wmacro-redefined]" \ "adjust diagnostic levels.c:5:9: note: previous definition is here" \ "adjust diagnostic levels.c:18:9: warning: 'QUX' macro redefined [-Wmacro-redefined]" \ "adjust diagnostic levels.c:17:9: note: previous definition is here" \
0
repos/arocc/test
repos/arocc/test/cases/typeof pointer wrong size.c
#define NO_ERROR_VALIDATION void foo(void) { char arr[10]; typeof(const int) *p = arr; }
0
repos/arocc/test
repos/arocc/test/cases/recursive object macro.c
//aro-args -E -P #define y x #define x y x #undef y #undef x #define x x x
0
repos/arocc/test
repos/arocc/test/cases/unavailable results.c
#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-value" void foo(void) { 1.0f == 1.0f; (double)1 + 1U == 2.0; (_Complex float)1 + 2U; 1U + (int *)1; 1U + &2; } #pragma GCC diagnostic pop #define EXPECTED_ERRORS "unavailable results.c:8:10: error: cannot take the address of an rvalue" \
0
repos/arocc/test
repos/arocc/test/cases/paste operator whitespace.c
//aro-args -P -E #define F(X) (X##Y) F(A)
0
repos/arocc/test
repos/arocc/test/cases/signed remainder.c
_Static_assert(5 % -2 == 1, "failed"); _Static_assert(-10 % -4 == -2, "failed"); _Static_assert(10 % -1 == 0, "failed"); _Static_assert(-10 % -1 == 0, "failed"); _Static_assert(10U % -1 == 10, "failed"); _Static_assert(10U % -1 == 10, "failed"); _Static_assert((-9223372036854775807LL - 1LL) % -1 != 0, "failed"); #if (-9223372036854775807LL - 1LL) % -1 != 0 #error Should not get here #endif #define EXPECTED_ERRORS "signed remainder.c:7:16: error: static_assert expression is not an integral constant expression" \
0
repos/arocc/test
repos/arocc/test/cases/casts.c
void foo(void) { struct Foo { int a; }; (struct Foo)1; (float)(int*)1l; (int*)1.f; (const int)1; const int p_i[] = (typeof(p_i))0; int a = (char)"foo"; int b = (float)"foo"; unsigned long long d = (unsigned long long)"foo"; int x = 1; x ? (void)1 : 1; (enum E)1; int *ptr; ptr = (int *)(void)5; (enum DoesNotExist)2.0; } #define EXPECTED_ERRORS "casts.c:5:5: error: cannot cast to non arithmetic or pointer type 'struct Foo'" \ "casts.c:6:5: error: pointer cannot be cast to type 'float'" \ "casts.c:7:5: error: operand of type 'float' cannot be cast to a pointer type" \ "casts.c:8:5: warning: cast to type 'int' will not preserve qualifiers [-Wcast-qualifiers]" \ "casts.c:9:23: error: cannot cast to non arithmetic or pointer type 'const int []'" \ "casts.c:10:13: warning: cast to smaller integer type 'char' from 'char *' [-Wpointer-to-int-cast]" \ "casts.c:11:13: error: pointer cannot be cast to type 'float'" \ "casts.c:16:5: error: cast to incomplete type 'enum E'" \ "casts.c:18:18: error: used type 'void' where arithmetic or pointer type is required" \ "casts.c:19:5: error: cast to incomplete type 'enum DoesNotExist'" \
0
repos/arocc/test
repos/arocc/test/cases/offsetof.c
int a = __builtin_offsetof(int, a); struct A; int b = __builtin_offsetof(struct A, a); struct A{ int *a; }; int b = __builtin_offsetof(struct A, b); int b = __builtin_offsetof(struct A, a[1]); struct Foo { char a; } __attribute__((packed)); _Static_assert(__builtin_offsetof(struct Foo, a) == 0, "field Foo.a wrong bit offset"); _Static_assert(__builtin_bitoffsetof(struct Foo, a) == 0, "field Foo.a wrong bit offset"); #define EXPECTED_ERRORS "offsetof.c:1:28: error: offsetof requires struct or union type, 'int' invalid" \ "offsetof.c:3:28: error: offsetof of incomplete type 'struct A'" \ "offsetof.c:7:38: error: no member named 'b' in 'struct A'" \ "offsetof.c:8:39: error: offsetof requires array type, 'int *' invalid" \
0
repos/arocc/test
repos/arocc/test/cases/empty records.c
#pragma GCC diagnostic warning "-Wgnu-empty-struct" #pragma GCC diagnostic warning "-Wc++-compat" struct {}s; union {}u; #define EXPECTED_ERRORS "empty records.c:4:1: warning: empty struct is a GNU extension [-Wgnu-empty-struct]" \ "empty records.c:4:1: warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat]" \ "empty records.c:5:1: warning: empty union is a GNU extension [-Wgnu-empty-struct]" \ "empty records.c:5:1: warning: empty union has size 0 in C, size 1 in C++ [-Wc++-compat]" \
0
repos/arocc/test
repos/arocc/test/cases/statements.c
void foo(void) { if ((char)1); if ((void)1); switch (1.f); for (foo;(void)2;); int x; switch (x) case x: return; switch (x) { case 1: x = 1; break; default: break; } enum FOO {BAR, BAZ} y = BAR; if (y) return; if (!BAZ) return; int a, b; for (a=1,b=1;;); } void bar(int arg) { if (arg) goto next; if (arg == 2) goto next; if (arg == 3) goto next; next: return; } #pragma GCC diagnostic warning "-Wgnu-case-range" void baz(int arg) { switch (arg) { case 1 ... 3: case 2: break; default: return; } } #define EXPECTED_ERRORS "statements.c:3:9: error: statement requires expression with scalar type ('void' invalid)" \ "statements.c:4:13: error: statement requires expression with integer type ('float' invalid)" \ "statements.c:5:10: warning: expression result unused [-Wunused-value]" \ "statements.c:5:10: error: statement requires expression with scalar type ('void' invalid)" \ "statements.c:7:21: error: case value must be an integer constant expression" \ "statements.c:32:16: warning: use of GNU case range extension [-Wgnu-case-range]" \ "statements.c:33:14: error: duplicate case value '2'" \ "statements.c:32:14: note: previous case defined here" \
0
repos/arocc/test
repos/arocc/test/cases/macro redefinition.c
#define FOO 1 #define FOO 2 #define FOO 3 #define FOO 3 #define BAR 1 /* fjfao */ /* fjfao */ 2 #define BAR 1 2 #define BAZ + /* fjfao */ /* fjfao */ / #define BAZ +/ #define QUX 1 /* FJDLKS */ #define QUX 1 #define EXPECTED_ERRORS "macro redefinition.c:2:9: warning: 'FOO' macro redefined [-Wmacro-redefined]" \ "macro redefinition.c:1:9: note: previous definition is here" \ "macro redefinition.c:3:9: warning: 'FOO' macro redefined [-Wmacro-redefined]" \ "macro redefinition.c:2:9: note: previous definition is here" \ "macro redefinition.c:10:9: warning: 'BAZ' macro redefined [-Wmacro-redefined]" \ "macro redefinition.c:9:9: note: previous definition is here" \
0
repos/arocc/test
repos/arocc/test/cases/__has_warning.c
#if !__has_warning("-Wextern-initializer") #error #endif #if __has_warning("-Wfoo") #error foo should not exist #elif !__has_warning("-Wunrea" "chable-code") #error unreachable-code should exist #endif #if __has_warning("foobar") #error #elif __has_warning(foobar) #error #endif #define X __has_warning("-Wextern-initializer") _Static_assert(X == 1, "Failed to find warning"); #define EXPECTED_ERRORS "__has_warning.c:11:19: warning: __has_warning expected option name (e.g. \"-Wundef\") [-Wmalformed-warning-check]" \ "__has_warning.c:13:21: error: expected string literal in '__has_warning'" \
0
repos/arocc/test
repos/arocc/test/cases/c23 stdarg.c
//aro-args -std=c23 #include <stdarg.h> void foo(...) { va_list va, new; va_start(va); int arg = va_arg(va, int); va_copy(va, new); va_end(va); }
0
repos/arocc/test
repos/arocc/test/cases/incorrect typeof usage.c
void foo(void) { unsigned typeof(int) x; typeof(int) typeof(int) y; typeof() z; typeof(int) unsigned w; } #define EXPECTED_ERRORS "incorrect typeof usage.c:2:5: error: 'unsigned typeof' is invalid" \ "incorrect typeof usage.c:3:5: error: cannot combine with previous 'typeof' specifier" \ "incorrect typeof usage.c:4:12: error: expected expression" \ "incorrect typeof usage.c:5:17: error: 'unsigned typeof' is invalid" \
0
repos/arocc/test
repos/arocc/test/cases/#pragma pack clang.c
//aro-args --emulate=clang struct A { char c; int x; }; struct B { #pragma pack(1) char c; int x; }; #pragma pack() struct C { char c; #pragma pack(1) int x; }; #pragma pack() struct D { char c; int x; #pragma pack(1) }; _Static_assert(sizeof(struct A) == sizeof(struct B), ""); _Static_assert(sizeof(struct A) == sizeof(struct C), ""); _Static_assert(sizeof(struct A) == sizeof(struct D), "");
0
repos/arocc/test
repos/arocc/test/cases/sizeof variably modified types.c
void foo(int x) { int arr[x]; _Static_assert(sizeof(arr) > 0, "sizeof VLA"); int (*pointer)[x] = &arr; _Static_assert(sizeof(pointer) == sizeof(int *), "pointer size"); _Static_assert(sizeof(*pointer) > 0, "sizeof variably-modified type"); } #define EXPECTED_ERRORS \ "sizeof variably modified types.c:3:20: error: static_assert expression is not an integral constant expression" \ "sizeof variably modified types.c:6:20: error: static_assert expression is not an integral constant expression" \
0
repos/arocc/test
repos/arocc/test/cases/subscript.c
int foo(int foo[2]) { int arr[4]; arr[-4] = 4[arr]; 1[1] = 2; arr[arr] = 2; return foo[2]; } #define EXPECTED_ERRORS "subscript.c:3:8: warning: array index -4 is before the beginning of the array [-Warray-bounds]" \ "subscript.c:3:16: warning: array index 4 is past the end of the array [-Warray-bounds]" \ "subscript.c:4:6: error: subscripted value is not an array or pointer" \ "subscript.c:5:8: error: array subscript is not an integer" \ "subscript.c:6:15: warning: array index 2 is past the end of the array [-Warray-bounds]" \
0
repos/arocc/test
repos/arocc/test/cases/ignored attributes.c
__attribute__((malloc)) int foo(void); __attribute__((malloc)) int *bar(void); #define EXPECTED_ERRORS "ignored attributes.c:1:16: warning: attribute 'malloc' ignored on functions that do not return pointers [-Wignored-attributes]" \
0
repos/arocc/test
repos/arocc/test/cases/c23 identifiers.c
//aro-args -std=c2x struct £ { int x; }; void foo(void) { int ™ = 0; int Dž = 0; int ʶ = 0; int Ⅸ = 9; int ڴ = 0; int ‿ = 0; int a‿1 = 0; } int à = 1; //NFC_Quick_Check=Maybe int à = 1; //NFC_Quick_Check=No #define EXPECTED_ERRORS "c23 identifiers.c:3:8: error: unexpected character <U+00A3>" \ "c23 identifiers.c:3:1: warning: declaration does not declare anything [-Wmissing-declaration]" \ "c23 identifiers.c:8:9: error: unexpected character <U+2122>" \ "c23 identifiers.c:8:11: error: expected identifier or '('" \ "c23 identifiers.c:13:9: error: unexpected character <U+203F>" \ "c23 identifiers.c:13:11: error: expected identifier or '('" \ "c23 identifiers.c:17:5: warning: 'a\\u0300' is not in NFC [-Wnormalized]" \ "c23 identifiers.c:18:5: warning: 'a\\u0340' is not in NFC [-Wnormalized]" \
0
repos/arocc/test
repos/arocc/test/cases/macro backtrace limit.c
//aro-args -fmacro-backtrace-limit=1 #define FOO(X) X FOO(2) #define EXPECTED_ERRORS "macro backtrace limit.c:3:1: error: expected external declaration" \ "note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)" \ "macro backtrace limit.c:3:5: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/double long.c
_Complex double long x; double long y;
0
repos/arocc/test
repos/arocc/test/cases/missing type specifier.c
//aro-args #define EXPECTED_ERRORS \ "missing type specifier.c:4:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]" static x = 5;
0
repos/arocc/test
repos/arocc/test/cases/#elifndef error.c
//aro-args -E -std=c23 -P #define EXPECTED_ERRORS \ "#elifndef error.c:8:9: error: macro name missing" \ "#elifndef error.c:17:10: error: macro name missing" #ifdef FOO long long #elifdef long #else int #endif #define BAR #ifdef FOO long long #elifndef long #else int #endif
0
repos/arocc/test
repos/arocc/test/cases/token paste delete comma gnu.c
//aro-args -E -Wgnu-zero-variadic-macro-arguments -P #define eprintf(format, ...) fprintf (stderr, format, ##__VA_ARGS__) eprintf("foo"); eprintf("foo",); eprintf("foo", "bar"); #define ZERO_ARGS(...) foo(a, ##__VA_ARGS__) ZERO_ARGS() ZERO_ARGS(b) #define foo(a,...) a, ## __VA_ARGS__ #define bar foo(1,bar) #define EXPECTED_ERRORS \ "token paste delete comma gnu.c:3:55: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments]" \ "token paste delete comma gnu.c:3:55: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments]" \ "token paste delete comma gnu.c:8:31: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments]" \ "token paste delete comma gnu.c:8:31: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments]" \ "token paste delete comma gnu.c:13:23: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments]" \
0
repos/arocc/test
repos/arocc/test/cases/pragma once.c
#include "include/global_var.h" #include "include/global_var.h" #include "include/global_var_once.h" #include "include/global_var_once.h" #define EXPECTED_ERRORS "global_var.h:1:5: error: redefinition of 'multiple'" \ "global_var.h:1:5: note: previous definition is here"
0
repos/arocc/test
repos/arocc/test/cases/transparent_union.c
struct S1{ int a; double b; } __attribute__((transparent_union)); union U1 { } __attribute__((transparent_union)); union U2 { int a; double b; } __attribute__((transparent_union)); union U3 { int a; float b; } __attribute__((transparent_union)); void f1(union U3); void f2(void) { f1(1); } union U4 { int *a; float *b; } __attribute__((transparent_union)); void f3(union U4); void f4(void) { f3(1); f3(0); } #define EXPECTED_ERRORS "transparent_union.c:4:18: warning: 'transparent_union' attribute only applies to unions [-Wignored-attributes]" \ "transparent_union.c:6:18: warning: transparent union definition must contain at least one field; transparent_union attribute ignored [-Wignored-attributes]" \ "transparent_union.c:9:12: warning: size of field 'b' (64 bits) does not match the size of the first field in transparent union; transparent_union attribute ignored [-Wignored-attributes]" \ "transparent_union.c:8:9: note: size of first field is 32" \ "transparent_union.c:27:8: error: passing 'int' to parameter of incompatible type 'union U4'" \ "transparent_union.c:25:17: note: passing argument to parameter here" \
0
repos/arocc/test
repos/arocc/test/cases/builtin choose expr.c
void foo(void) { int x, y; __builtin_choose_expr(1, x, 0/0) = 10; __builtin_choose_expr(0, x/0, y) = 32; __builtin_choose_expr(x, 1, 2); int z = __builtin_choose_expr(1>0, 1, (char *)5); float f = __builtin_choose_expr(0!=0, (char *)10, 1.0f); } #define EXPECTED_ERRORS "builtin choose expr.c:5:27: error: '__builtin_choose_expr' requires a constant expression"
0
repos/arocc/test
repos/arocc/test/cases/kr_def_deprecated.c
//aro-args -std=c23 int foo(a, int b, char c, d) int a; short d; { return a; } int baz() { return bar(1); // TODO no return-type warning } #define EXPECTED_ERRORS "kr_def_deprecated.c:2:9: error: unknown type name 'a'" \ "kr_def_deprecated.c:2:27: error: unknown type name 'd'" \ "kr_def_deprecated.c:9:12: error: use of undeclared identifier 'bar'" \ "kr_def_deprecated.c:11:1: warning: non-void function 'baz' does not return a value [-Wreturn-type]" \
0
repos/arocc/test
repos/arocc/test/cases/bitfields.c
int b; struct Foo { float a: 1; int c: b, d: -1; int e: 64, f:0; }; #define EXPECTED_ERRORS "bitfields.c:4:10: error: bit-field has non-integer type 'float'" \ "bitfields.c:5:11: error: expression is not an integer constant expression" \ "bitfields.c:5:14: error: bit-field has negative width (-1)" \ "bitfields.c:6:8: error: width of bit-field exceeds width of its type" \ "bitfields.c:6:15: error: named bit-field has zero width" \
0
repos/arocc/test
repos/arocc/test/cases/initializers.c
void foo(void) { int a, b[a] = {}; (int(int)){}; int *c = 1.f; int d = {}; int e = {1, 2}; const char f[] = {"foo", "bar"}; const char g[2] = "foo"; int h[2] = (int []){1,2,3}; int i[] = "foo"; int j = { [0] = 1 }; int k[2] = { [-1] = 1 }; int l[2] = { [2] = 1 }; #define N 1000000000 int m[] = { [N] = 1, [N] = 2 }; int n = { .foo = 1 }; struct Foo { int a, b, c; } o = { .b = 1, 2 }, p = { .d = 0 }; struct Foo q = { .c = 1, .b = 2, 3, 4, 5}, r = { .c = 1, 2}; int s[2] = {1, 2, 3}, t[2] = {[1] = 1, 2, 3}; int arr[2][2] = {1, [1] = 3, 4, 5, 6}; struct { int a, b; union { int a; float b; } c; } arr2[2] = {1, [0].c.b = 2, 3, 4, 5, 6, 7, 8}; struct {} empty[2] = {1}; int j[] = c; struct S s = {}; enum E e1 = 1, e2 = 2 + e1; union U u = {.x = 1}; void v[1] = {1}; (void){}; } void bar(void) { int x = 1; int arr[] = {[x] = 2}; } void baz(void) { char arr1[] = "arr"; signed char arr2[] = ("arr"); unsigned char arr3[] = ((("arr"))); char arr4[] = arr1; signed char h[2] = (char []){1,2}; } void qux(void) { struct S { int a; char b[2]; float c; } s = {1, {'a', 'b'}, 2.5}; union U { int a; char b[2]; float c; } u = {{'a', 'b'}}; int a = {{1}}; int arr[][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}}; } #pragma GCC diagnostic warning "-Wuninitialized" struct S { int val; }; struct node { struct node *prev, *next; int value; }; void self_referential(void) { int x = x; int y = y + 1; // should warn -Wuninitialized struct S s1 = { .val = s1.val }; // should warn -Wuninitialized struct S s2 = (struct S){ s2.val }; // should warn -Wuninitialized struct S s3 = (struct S){ .val = s3.val }; // should warn -Wuninitialized struct node ll[] = {{0, ll + 1, 42}, {ll, ll + 2, 5}, {ll, 0, 99}}; } struct Foo { struct { int z; union { float b; int x; }; double z1; }; float c; } a = { .x = 1 }; static const unsigned char halfrate[2][3][1] = { { { 0, }, { 0 }, { 0, } }, { { 0, }, { 0 }, { 0, } }, }; struct{ int a, b; } b[2][2] = { [1] = {1,2,3,4}, 1}; struct { int :0; struct { int b; }; } c[2] = { [0].b = 1 }; union { } empty = {{'a', 'b'}}; int invalid_init[] = (int){1}; int array_2d[3][2] = { 1, 2, [2] = 3, [1][1] = 1, 4}; // TODO 4 overrides 3 void quux(void) { struct Foo { int a; } a; struct Bar { struct Foo a; } b = {a}; void *vp1 = 1.0; void *vp2 = a; int x; long *y = &x; unsigned int *z = &x; } struct S2 { char bytes[32]; }; union U { char bytes[32]; }; union U2 { int a; char bytes[32]; }; void array_members(void) { struct S2 s = (struct S2){"ABC"}; struct S2 s2 = {.bytes = "abc"}; struct S2 s3 = (struct S){'h',[1]='i'}; union U u = (union U){"ABC"}; union U2 u2 = (union U2){"ABC"}; char b[32] = (char[32]){"ABC"}; } #define TESTS_SKIPPED 3 #define EXPECTED_ERRORS "initializers.c:2:17: error: variable-sized object may not be initialized" \ "initializers.c:3:15: error: illegal initializer type" \ "initializers.c:4:14: error: initializing 'int *' from incompatible type 'float'" \ "initializers.c:5:13: error: scalar initializer cannot be empty" \ "initializers.c:6:17: warning: excess elements in scalar initializer [-Wexcess-initializers]" \ "initializers.c:7:30: warning: excess elements in string initializer [-Wexcess-initializers]" \ "initializers.c:8:23: warning: initializer-string for char array is too long [-Wexcess-initializers]" \ "initializers.c:9:16: error: cannot initialize type ('int [2]' with array of type 'int [3]')" \ "initializers.c:10:15: error: cannot initialize array of type 'int []' with array of type 'char [4]'" \ "initializers.c:11:15: error: array designator used for non-array type 'int'" \ "initializers.c:12:19: error: array designator value -1 is negative" \ "initializers.c:13:19: error: array designator index 2 exceeds array bounds" \ "initializers.c:15:32: warning: initializer overrides previous initialization [-Winitializer-overrides]" \ "initializers.c:15:23: note: previous initialization" \ "initializers.c:16:15: error: field designator used for non-record type 'int'" \ "initializers.c:19:32: error: record type has no field named 'd'" \ "initializers.c:20:38: warning: initializer overrides previous initialization [-Winitializer-overrides]" \ "initializers.c:20:27: note: previous initialization" \ "initializers.c:20:41: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "initializers.c:20:62: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "initializers.c:21:23: warning: excess elements in array initializer [-Wexcess-initializers]" \ "initializers.c:21:44: warning: excess elements in array initializer [-Wexcess-initializers]" \ /* "initializers.c:23:37: warning: excess elements in array initializer [-Wexcess-initializers]" */ \ "initializers.c:23:34: warning: excess elements in array initializer [-Wexcess-initializers]" \ "initializers.c:30:43: warning: excess elements in array initializer [-Wexcess-initializers]" \ "initializers.c:31:27: error: initializer for aggregate with no elements requires explicit braces" \ "initializers.c:32:15: error: array initializer must be an initializer list or wide string literal" \ "initializers.c:34:14: error: variable has incomplete type 'struct S'" \ "initializers.c:35:12: error: variable has incomplete type 'enum E'" \ "initializers.c:36:13: error: variable has incomplete type 'union U'" \ "initializers.c:37:11: error: array has incomplete element type 'void'" \ "initializers.c:38:11: error: variable has incomplete type 'void'" \ "initializers.c:42:19: error: expression is not an integer constant expression" \ "initializers.c:49:19: error: array initializer must be an initializer list or wide string literal" \ "initializers.c:50:24: error: cannot initialize array of type 'signed char [2]' with array of type 'char [2]'"\ "initializers.c:64:18: warning: excess elements in scalar initializer [-Wexcess-initializers]" \ "initializers.c:66:14: warning: too many braces around scalar initializer [-Wmany-braces-around-scalar-init]" \ /* "initializers.c:77:13: warning: variable 'y' is uninitialized when used within its own initialization" */ \ /* "initializers.c:78:28: warning: variable 's1' is uninitialized when used within its own initialization" */ \ /* "initializers.c:79:31: warning: variable 's2' is uninitialized when used within its own initialization" */ \ /* "initializers.c:80:38: warning: variable 's3' is uninitialized when used within its own initialization" */ \ "initializers.c:104:32: warning: excess elements in array initializer [-Wexcess-initializers]" \ "initializers.c:115:18: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "initializers.c:115:12: warning: initializer overrides previous initialization [-Winitializer-overrides]" \ "initializers.c:115:13: note: previous initialization" \ "initializers.c:115:12: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "initializers.c:117:22: error: array initializer must be an initializer list or wide string literal" \ "initializers.c:128:17: error: initializing 'void *' from incompatible type 'double'" \ "initializers.c:129:17: error: initializing 'void *' from incompatible type 'struct Foo'" \ "initializers.c:131:15: warning: incompatible pointer types initializing 'long *' from incompatible type 'int *' [-Wincompatible-pointer-types]" \ "initializers.c:132:23: warning: incompatible pointer types initializing 'unsigned int *' from incompatible type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign]" \ "initializers.c:148:35: error: array designator used for non-array type 'struct S'" \ "initializers.c:150:30: warning: implicit pointer to integer conversion from 'char *' to 'int' [-Wint-conversion]" \
0
repos/arocc/test
repos/arocc/test/cases/unsigned char.c
//aro-args --target=x86_64-linux-gnu -funsigned-char -Wno-integer-overflow _Static_assert(__CHAR_UNSIGNED__ == 1, ""); _Static_assert((char)-1 == 0xFF, "char should be unsigned"); #if '\0' - 1 < 0 #error "preprocessor char literal is signed when it should be unsigned" #endif #if u'\0' - 1 < 0 #error "preprocessor u8 char literal is signed when it should be unsigned" #endif
0
repos/arocc/test
repos/arocc/test/cases/__func__.c
extern int puts(const char*); static const char *f = __func__; static const char *f1 = __FUNCTION__; static const char *f2 = __PRETTY_FUNCTION__; int foo(void) { puts(f); puts(f1); puts(f2); puts(__func__); puts(__FUNCTION__); puts(__PRETTY_FUNCTION__); return 0; } long *bar(int a) { puts(__FUNCTION__); puts(__func__); puts(__PRETTY_FUNCTION__); return 0; } #define EXPECTED_ERRORS "__func__.c:3:24: warning: predefined identifier is only valid inside function [-Wpredefined-identifier-outside-function]" \ "__func__.c:4:25: warning: predefined identifier is only valid inside function [-Wpredefined-identifier-outside-function]" \ "__func__.c:5:25: warning: predefined identifier is only valid inside function [-Wpredefined-identifier-outside-function]" \
0
repos/arocc/test
repos/arocc/test/cases/comma operator.c
//aro-args -Wno-sizeof-array-argument void foo(void) { char a[1]; _Static_assert(sizeof(((void)0, a)) == sizeof(char *), ""); const int x = 0; __typeof__(((void) 0, x)) y = 5; y = 2; }
0
repos/arocc/test
repos/arocc/test/cases/digraph pretty print.c
//aro-args -E -P %:%: %: <%<%> > <::>
0
repos/arocc/test
repos/arocc/test/cases/macro re-expansion.c
//aro-args -E -P #define f(a) a #define z z[0] #define h(x) f(x(1)) #define s(x) z #define K h(s) #define H h #define L H #define SS (s) #define INCOMPLETE f(1 #define g(a, b) a##b #define INCOMPLETE2 g(1 #define Z1 z Z2 #define Z2 z Z1 #define THETA(x) x f #define TAU(x) x TAU #define OMEGA(x) TAU(x)(1) THETA(x) f(f(z)) h(s) K H(s) L(s) H SS INCOMPLETE) INCOMPLETE2,3) Z1 TAU(1)(2) OMEGA(1)(z)
0
repos/arocc/test
repos/arocc/test/cases/enum attributes gcc.c
//aro-args --emulate=gcc enum __attribute__((vector_size(32))) VectorSize2 { A }; #define EXPECTED_ERRORS "enum attributes gcc.c:3:21: error: invalid vector element type 'enum VectorSize2'" \
0
repos/arocc/test
repos/arocc/test/cases/include pragma.c
#include _Pragma("once") #define EXPECTED_ERRORS "include pragma.c:1:10: error: expected \"FILENAME\" or <FILENAME>" \
0
repos/arocc/test
repos/arocc/test/cases/digraphs disabled.c
//aro-args -fno-digraphs void baz(void) { int x<:5:>; } #define EXPECTED_ERRORS "digraphs disabled.c:4:10: error: expected ';', found '<'"
0
repos/arocc/test
repos/arocc/test/cases/zero length multidimensional array.c
int foo[1][0]; int bar[0][0]; int baz[1][0][0]; int qux[1][1][0];
0
repos/arocc/test
repos/arocc/test/cases/no declarations.c
#pragma GCC diagnostic warning "-Wempty-translation-unit" #define EXPECTED_ERRORS "no declarations.c:2:58: warning: ISO C requires a translation unit to contain at least one declaration [-Wempty-translation-unit]"
0
repos/arocc/test
repos/arocc/test/cases/intmax_t.c
//aro-args --target=x86_64-linux-gnu #include "test_helpers.h" _Static_assert(__INTMAX_MAX__ == 9223372036854775807L, ""); _Static_assert(__INTMAX_WIDTH__ == 64, ""); EXPECT_TYPE(__INTMAX_TYPE__, long); EXPECT_TYPE(CAT(0, __INTMAX_C_SUFFIX__), long); _Static_assert(__UINTMAX_MAX__ == 18446744073709551615UL, ""); _Static_assert(__UINTMAX_WIDTH__ == 64, ""); EXPECT_TYPE(__UINTMAX_TYPE__, unsigned long); EXPECT_TYPE(CAT(0, __UINTMAX_C_SUFFIX__), unsigned long);
0
repos/arocc/test
repos/arocc/test/cases/wide character constants.c
//aro-args -Wfour-char-constants -Wno-c23-extensions /* A multiline comment to test that the linenumber is correct. */ #include <stddef.h> _Static_assert(sizeof L' ' == sizeof(wchar_t), "sizes don't match"); unsigned short a = u'￿' + u'𐀁'; _Static_assert(L'ab' == 'b', "expected to match"); _Static_assert(U'ab' == 'b', "should not be evaluated"); _Static_assert('\1' == 0x01, ""); #if __INT_MAX__ >= 0x01020304 _Static_assert('\1\2\3\4' == 0x01020304, ""); #endif _Static_assert(sizeof(u'a') == 2, ""); _Static_assert(sizeof(U'a') == 4, ""); unsigned long A = U'\xFFFFFFFF'; unsigned long B = u'\xFFFFFFFF'; unsigned long C = U'𝒵'; // U+1D4B5 unsigned long D = u'𝒵'; // U+1D4B5 unsigned long E = U'ℤ'; // U+2124 unsigned long F = u'ℤ'; // U+2124 unsigned long G = U'\UFFFFFFFF'; unsigned long H = u'\U0001D4B5'; unsigned long I = U'ab'; unsigned long J = u'ab'; unsigned long K = '\777'; wchar_t L = L'\777'; _Static_assert(sizeof(u8'a') == sizeof(char), ""); int M = u8'ab'; int N = u8'\xFF'; int O = u8'™'; int P = u8'\u0041'; int Q = u8'\x41'; int R = u8'\u0024'; int S = '\x'; int T = '\xg'; int U = '\8'; int V = '\ '; // tab character _Static_assert('\(' == '(', ""); _Static_assert('\[' == '[', ""); _Static_assert('\{' == '{', ""); _Static_assert('\%' == '%', ""); int W = '\u'; int X = '\U'; #pragma GCC diagnostic warning "-Wpedantic" int Y = 'abc\E'; #pragma GCC diagnostic pop int Z = 'ABC\D'; _Static_assert(sizeof(__CHAR16_TYPE__) == sizeof(u'A'), ""); _Static_assert(sizeof(__CHAR32_TYPE__) == sizeof(U'A'), ""); #define EXPECTED_ERRORS "wide character constants.c:9:27: error: character too large for enclosing character literal type" \ "wide character constants.c:9:20: warning: implicit conversion from 'int' to 'unsigned short' changes non-zero value from 131072 to 0 [-Wconstant-conversion]" \ "wide character constants.c:10:16: error: wide character literals may not contain multiple characters" \ "wide character constants.c:11:16: error: Unicode character literals may not contain multiple characters" \ "wide character constants.c:14:16: warning: multi-character character constant [-Wfour-char-constants]" \ "wide character constants.c:20:21: error: escape sequence out of range" \ "wide character constants.c:22:19: error: character too large for enclosing character literal type" \ "wide character constants.c:25:20: error: invalid universal character" \ "wide character constants.c:26:19: error: character too large for enclosing character literal type" \ "wide character constants.c:27:19: error: Unicode character literals may not contain multiple characters" \ "wide character constants.c:28:19: error: Unicode character literals may not contain multiple characters" \ "wide character constants.c:29:20: error: escape sequence out of range" \ "wide character constants.c:33:9: error: Unicode character literals may not contain multiple characters" \ "wide character constants.c:35:9: error: character too large for enclosing character literal type" \ "wide character constants.c:36:9: error: character 'A' cannot be specified by a universal character name" \ "wide character constants.c:39:9: error: \\x used with no following hex digits" \ "wide character constants.c:40:9: error: \\x used with no following hex digits" \ "wide character constants.c:41:10: warning: unknown escape sequence '\\8' [-Wunknown-escape-sequence]" \ "wide character constants.c:42:10: warning: unknown escape sequence '\\x09' [-Wunknown-escape-sequence]" \ "wide character constants.c:47:9: error: \\u used with no following hex digits" \ "wide character constants.c:48:9: error: \\U used with no following hex digits" \ "wide character constants.c:50:13: warning: use of non-standard escape character '\\E' [-Wpedantic]" \ "wide character constants.c:50:9: warning: multi-character character constant [-Wfour-char-constants]" \ "wide character constants.c:52:13: warning: unknown escape sequence '\\D' [-Wunknown-escape-sequence]" \ "wide character constants.c:52:9: warning: multi-character character constant [-Wfour-char-constants]" \
0
repos/arocc/test
repos/arocc/test/cases/include_next.c
//aro-args -Wgnu-include-next -Wno-gnu-alignof-expression #include <my_include.h> // test/cases/include/my_include.h #include_next <stdalign.h> #include_next "global_var.h" #include_next <other.h> _Static_assert(FOO == 1, "Did not include correct file"); _Static_assert(BAR == 2, "Did not include_next correct file"); _Static_assert(alignof(multiple) == _Alignof(int), "#include_next quotes"); _Static_assert(OTHER_INCLUDED == 1, "OTHER_INCLUDED"); _Static_assert(NEXT_OTHER_INCLUDED == 1, "NEXT_OTHER_INCLUDED"); _Static_assert(HAS_INCLUDE_NEXT_WORKED == 1, "HAS_INCLUDE_NEXT_WORKED"); #if __has_include_next("stdalign.h") #define TOP_LEVEL_INCLUDE_NEXT 1 #endif _Static_assert(TOP_LEVEL_INCLUDE_NEXT == 1, "TOP_LEVEL_INCLUDE_NEXT"); #define EXPECTED_ERRORS \ "my_include.h:3:2: warning: #include_next is a language extension [-Wgnu-include-next]" \ "my_include.h:4:2: warning: #include_next is a language extension [-Wgnu-include-next]" \ "include_next.c:3:2: warning: #include_next is a language extension [-Wgnu-include-next]" \ "include_next.c:3:2: warning: #include_next in primary source file; will search from start of include path [-Winclude-next-outside-header]" \ "include_next.c:4:2: warning: #include_next is a language extension [-Wgnu-include-next]" \ "include_next.c:4:2: warning: #include_next in primary source file; will search from start of include path [-Winclude-next-outside-header]" \ "include_next.c:5:2: warning: #include_next is a language extension [-Wgnu-include-next]" \ "include_next.c:5:2: warning: #include_next in primary source file; will search from start of include path [-Winclude-next-outside-header]" \ "include_next.c:13:5: warning: #include_next in primary source file; will search from start of include path [-Winclude-next-outside-header]" \
0
repos/arocc/test
repos/arocc/test/cases/preserve comments.c
//aro-args -E -P -C #define a() 1 /*foo*/ ## /*bar*/ 2 a() #define b 1 /*foo*/ ## /*bar*/ 2 b #define c() 1 /*foo*/ c() #define d 1 /*foo*/ d #define e(p) p ## 1 e(hello/*foo*/)
0
repos/arocc/test
repos/arocc/test/cases/#embed.c
unsigned char hello[] = { #embed "include/embed data" , 0 // #embed does not provide a trailing NULL byte }; _Static_assert(sizeof(hello) == sizeof("Hello, World!"), ""); int empty[] = { #embed "include/empty" }; _Static_assert(sizeof(empty) == 0, ""); const int Foo = 1 + #embed "include/embed byte" ; _Static_assert(Foo == 1 + 'A', ""); unsigned char third[] = { #embed "include/embed data" __limit__(3) prefix(0, 1,) vendor::unsupported(some toks) suffix(,3, 4) limit(4) }; _Static_assert(sizeof(third) == 2 + 3 + 2, ""); const int bar = #embed "include/embed data" limit(a) limit(1) 1 ; _Static_assert(bar == 'H', ""); # if __has_embed("include/embed data" foo(1)) != __STDC_EMBED_NOT_FOUND__ #error unknown param was accepted #endif # if __has_embed("doesn't exist") != __STDC_EMBED_NOT_FOUND__ #error non-existent embed found #endif # if __has_embed("include/embed data" limit(1)) != __STDC_EMBED_FOUND__ #error embed should be found #endif # if __has_embed("include/empty") != __STDC_EMBED_EMPTY__ #error empty wasn't detected #endif #define EXPECTED_ERRORS \ "#embed.c:19:56: warning: unsupported embed parameter 'vendor::unsupported' embed parameter [-Wunsupported-embed-param]" \ "#embed.c:19:101: warning: duplicate embed parameter 'limit' [-Wduplicate-embed-param]" \ "#embed.c:25:29: error: the limit parameter expects one non-negative integer as a parameter" \ "#embed.c:25:47: error: unexpected token in embed parameter" \
0
repos/arocc/test
repos/arocc/test/cases/macro token pasting order.c
//aro-args -E -P #define CAT(a, ...) a ## __VA_ARGS__ #define M(val) val #define TEST(c) CAT(TEST_, c) #define abc 1 TEST(M(0)) CAT(TEST_, M(0)) CAT(ab, c) CAT(a b, c)
0
repos/arocc/test
repos/arocc/test/cases/comment after define.c
#define FOO /* comment */ #if 0 #endif #define BAR // comment #if 0 #endif
0
repos/arocc/test
repos/arocc/test/cases/msvc boolean bitfield.c
//aro-args --target=x86_64-windows-msvc typedef struct { _Bool a: 4; _Bool : 2; _Bool c: 2; } S; _Static_assert(sizeof(S) == 1, ""); _Static_assert(_Alignof(S) == 1, "");
0
repos/arocc/test
repos/arocc/test/cases/invalid types.c
long float a; _Atomic(int) _Atomic(float) b; enum Foo {}; _Atomic(int(void)) c; _Atomic(int [3]) d; _Atomic void e; void f[4]; struct Bar f; int x[2305843009213693951u]; _Complex z; void foo(int arr[]) { typeof(arr) a[2]; struct bar[1] = {1}; struct bar a[] = {1}; struct bar[1][1] = {{1}}; struct bar b[1][] = {{1}}; struct bar b[1][B(1)] = {1}; } int bar["foo"]; int baz[] = 111111E1111111111111; int qux[] = baz; int g[]; extern int h[]; void foo(void) { int i[]; char j[] = "hello"; } #define EXPECTED_ERRORS \ "invalid types.c:1:6: error: cannot combine with previous 'long' specifier" \ "invalid types.c:2:14: warning: duplicate 'atomic' declaration specifier [-Wduplicate-decl-specifier]" \ "invalid types.c:2:14: error: cannot combine with previous 'int' specifier" \ "invalid types.c:3:11: error: empty enum is invalid" \ "invalid types.c:4:1: error: atomic cannot be applied to function type 'int (void)'" \ "invalid types.c:5:1: error: atomic cannot be applied to array type 'int [3]'" \ "invalid types.c:6:1: error: atomic cannot be applied to incomplete type 'void'" \ "invalid types.c:6:14: error: variable has incomplete type 'void'" \ "invalid types.c:7:7: error: array has incomplete element type 'void'" \ "invalid types.c:8:12: error: tentative definition has type 'struct Bar' that is never completed" \ "invalid types.c:8:8: note: forward declaration of 'struct Bar'" \ "invalid types.c:9:6: error: array is too large" \ "invalid types.c:11:1: warning: plain '_Complex' requires a type specifier; assuming '_Complex double'" \ "invalid types.c:14:6: note: previous definition is here" \ "invalid types.c:16:15: error: expected identifier or '('" \ "invalid types.c:17:17: error: array has incomplete element type 'struct bar'" \ "invalid types.c:18:15: error: expected identifier or '('" \ "invalid types.c:19:17: error: array has incomplete element type 'struct bar []'" \ "invalid types.c:20:21: error: call to undeclared function 'B'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]" \ "invalid types.c:20:23: warning: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]" \ "invalid types.c:20:17: error: array has incomplete element type 'struct bar [<expr>]'" \ "invalid types.c:23:9: error: size of array has non-integer type 'char [4]'" \ "invalid types.c:24:13: error: array initializer must be an initializer list or wide string literal" \ "invalid types.c:25:13: error: array initializer must be an initializer list or wide string literal" \ "invalid types.c:27:5: warning: tentative array definition assumed to have one element" \ "invalid types.c:29:6: error: redefinition of 'foo'" \ "invalid types.c:30:9: error: variable has incomplete type 'int []'" \
0
repos/arocc/test
repos/arocc/test/cases/redefine invalid typedef.c
typedef float *invalid1 __attribute__((vector_size(8))); typedef float invalid1; #define EXPECTED_ERRORS "redefine invalid typedef.c:1:40: error: invalid vector element type 'float *'" \
0
repos/arocc/test
repos/arocc/test/cases/__has_attribute.c
#if defined __has_attribute # if __has_attribute(aligned) #error attribute exists # endif # if __has_attribute(does_not_exist) #error attribute exists # endif #endif #define EXPECTED_ERRORS "__has_attribute.c:3:8: error: attribute exists"
0
repos/arocc/test
repos/arocc/test/cases/stdarg.c
#include <stdarg.h> void foo(int a, ...) { va_list va, new; va_start(va, a); int arg = va_arg(va, int); va_copy(va, new); va_end(va); } void bar(int a, int b, ...) { va_list va; va_start(va, a); } void baz(int a) { va_list va; va_start(va, a); } va_list va; int a = va_start(va, 1); int b = __builtin_va_end; int c = __builtin_foo(); #define EXPECTED_ERRORS "stdarg.c:11:5: warning: second argument to 'va_start' is not the last named parameter [-Wvarargs]" \ "stdarg.h:12:52: note: expanded from here" \ "stdarg.c:11:18: note: expanded from here" \ "stdarg.c:15:5: error: 'va_start' used in a function with fixed args" \ "stdarg.h:12:29: note: expanded from here" \ "stdarg.c:18:9: error: 'va_start' cannot be used outside a function" \ "stdarg.h:12:29: note: expanded from here" \ "stdarg.c:18:9: error: initializing 'int' from incompatible type 'void'" \ "stdarg.h:12:29: note: expanded from here" \ "stdarg.c:19:9: error: builtin function must be directly called" \ "stdarg.c:20:9: error: use of unknown builtin '__builtin_foo' [-Wimplicit-function-declaration]" \
0
repos/arocc/test
repos/arocc/test/cases/enum pointer.c
enum E { A, }; void foo(void) { int x; unsigned y; enum E *p1 = &x; enum E *p2 = &y; } #if __WIN32__ #define EXPECTED_ERRORS "enum pointer.c:9:18: warning: incompatible pointer types initializing 'enum E *' from incompatible type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]" \ #else #define EXPECTED_ERRORS "enum pointer.c:8:18: warning: incompatible pointer types initializing 'enum E *' from incompatible type 'int *' [-Wincompatible-pointer-types]" \ #endif
0
repos/arocc/test
repos/arocc/test/cases/generated location.c
__has_attribute(foo) #define EXPECTED_ERRORS "generated location.c:1:1: error: expected external declaration" \ "<scratch space>:1:1: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/implicit main return zero.c
int main(void) { }
0
repos/arocc/test
repos/arocc/test/cases/nameless param.c
int xyz(float); void foo(int) { return; } void bar(float, char) { return; } #define EXPECTED_ERRORS "nameless param.c:3:13: warning: omitting the parameter name in a function definition is a C23 extension [-Wc23-extensions]" \ "nameless param.c:7:15: warning: omitting the parameter name in a function definition is a C23 extension [-Wc23-extensions]" \ "nameless param.c:7:21: warning: omitting the parameter name in a function definition is a C23 extension [-Wc23-extensions]" \
0
repos/arocc/test
repos/arocc/test/cases/negative and too big shift count.c
void foo(void) { int a = 0b11 << -32; int b = 0b11 << 32; } #define EXPECTED_ERRORS "negative and too big shift count.c:2:16: warning: shift count is negative [-Wshift-count-negative]" \ "negative and too big shift count.c:2:16: warning: overflow in expression; result is '2147483647' [-Winteger-overflow]" \ "negative and too big shift count.c:3:16: warning: shift count >= width of type [-Wshift-count-overflow]" \ "negative and too big shift count.c:3:16: warning: overflow in expression; result is '0' [-Winteger-overflow]"
0
repos/arocc/test
repos/arocc/test/cases/alignment.c
_Alignas(2) int foo(void); typedef int F(void); F _Alignas(2) bar; _Alignas(0) int a; _Alignas(1) int b; _Alignas(3) int c; int baz(_Alignas(8) int d) { return _Alignof(_Alignas(8) int); } _Alignas(536870912) int e; _Alignas(-2) int f; _Alignas(c) int x; __attribute__((aligned)) char g; __attribute__((aligned)) int h; _Alignas(1) _Alignas(2) _Alignas(4) char i; __attribute__((aligned(2), aligned(4))) int j; __attribute__((aligned(8))) __attribute__((aligned(4))) int k; __attribute__((aligned(16))) typeof(int[]) l = {1}; typeof(int[]) __attribute__((aligned(16))) m = {1}; typeof(int[]) n __attribute__((aligned(32))) = {1}; #pragma GCC diagnostic ignored "-Wgnu-alignof-expression" _Static_assert(_Alignof(g) == _Alignof(h), "incorrect alignment"); _Static_assert(_Alignof(i) == 4, "incorrect alignment"); _Static_assert(_Alignof(j) == 4, "incorrect alignment"); _Static_assert(_Alignof(k) == 8, "incorrect alignment"); _Static_assert(_Alignof(l) == 16, "incorrect alignment"); _Static_assert(_Alignof(m) == 16, "incorrect alignment"); _Static_assert(_Alignof(n) == 32, "incorrect alignment"); __attribute__((aligned("foo"))) o; _Alignas(1.2) p; _Static_assert(_Alignof(_BitInt(65535)) > 0, ""); #define EXPECTED_ERRORS "alignment.c:1:1: error: '_Alignas' attribute only applies to variables and fields" \ "alignment.c:3:3: error: '_Alignas' attribute only applies to variables and fields" \ "alignment.c:5:1: error: requested alignment is less than minimum alignment of 4" \ "alignment.c:6:10: error: requested alignment is not a power of 2" \ "alignment.c:8:9: error: '_Alignas' attribute cannot be applied to a function parameter" \ "alignment.c:9:21: warning: '_Alignas' attribute is ignored here" \ "alignment.c:12:10: error: requested alignment of 536870912 is too large" \ "alignment.c:13:10: error: requested negative alignment of -2 is invalid" \ "alignment.c:15:10: error: '_Alignas' attribute requires integer constant expression" \ "alignment.c:35:24: error: '_Alignas' attribute requires integer constant expression" \ "alignment.c:35:33: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]" \ "alignment.c:36:10: error: expression is not an integer constant expression" \ "alignment.c:36:15: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]" \
0
repos/arocc/test
repos/arocc/test/cases/ms-extensions.c
//aro-args -fms-extensions -Wno-microsoft-include #include "include\other.h" #ifndef OTHER_INCLUDED #error backslash in include should work #endif #undef OTHER_INCLUDED #include "include/ms-ext/include other.h" #ifndef OTHER_INCLUDED #error Microsoft search rule should work #endif  don't mind me ;)
0
repos/arocc/test
repos/arocc/test/cases/debug dump macros and results.c
//aro-args -E -dD #define CHECK_PARTIAL_MATCH #define FOO 42 #define BAR FOO int x = BAR; #undef FOO #define FOO 43
0
repos/arocc/test
repos/arocc/test/cases/#if expression macro ws.c
#define FOO(X) X #if FOO( X ) #error Should not error #endif #define Y 1 #if FOO ( Y ) #error Should error #endif #define EXPECTED_ERRORS "#if expression macro ws.c:10:2: error: Should error" \
0
repos/arocc/test
repos/arocc/test/cases/standard-redefinition-reexamination-example.c
//aro-args -E -P // example from the C18 standard draft, 6.10.3.5, example 3 #define x 3 #define f(a) f(x * (a)) #undef x #define x 2 #define g f #define z z[0] #define h g(\~{ } #define m(a) a(w) #define w 0,1 #define t(a) a #define p() int #define q(x) x #define r(x,y) x ## y #define str(x) # x f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); g(x+(3,4)-w) | h 5) & m (f)^m(m); p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; char c[2][6] = { str(hello), str() };
0
repos/arocc/test
repos/arocc/test/cases/digraphs enabled.c
//aro-args -std=c89 -fdigraphs #define STRINGIZE(X) %:X #define PASTE(X, Y) (X %:%: Y) void baz(void) <% int int_arr<::> = <%1%>; char char_arr<::> = STRINGIZE(HELLO); char no_digraph[] = "<::>"; _Static_assert(sizeof(int_arr) == sizeof(int), "wrong size"); _Static_assert(PASTE(1,2) == 12, "bad token pasting"); _Static_assert(sizeof(char_arr) == sizeof("HELLO"), "bad stringize"); _Static_assert(sizeof(no_digraph) == 5, "string literals should not produce digraph tokens"); %>
0
repos/arocc/test
repos/arocc/test/cases/unknown pragmas.c
#pragma GCC diagnostic warning "-Wunknown-pragmas" #pragma unknown_option #pragma GCC unknown_option #pragma GCC diagnostic unknown_option_again #define EXPECTED_ERRORS \ "unknown pragmas.c:3:9: warning: unknown pragma ignored [-Wunknown-pragmas]" \ "unknown pragmas.c:5:13: warning: pragma GCC expected 'error', 'warning', 'diagnostic', 'poison' [-Wunknown-pragmas]" \ "unknown pragmas.c:7:24: warning: pragma GCC diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop' [-Wunknown-pragmas]" \
0
repos/arocc/test
repos/arocc/test/cases/anonymous attributed field.c
#define NO_ERROR_VALIDATION struct A { union { char a } __attribute__((packed))} b = __builtin_offsetof(struct A,a
0
repos/arocc/test
repos/arocc/test/cases/statement expressions.c
#pragma GCC diagnostic warning "-Wgnu-statement-expression" int g = ({ int x = 5; x + 10; }); #pragma GCC diagnostic ignored "-Wgnu-statement-expression" void foo(void) { int x = ({}); ({ 1; }); ({ 2; 3; }); int y = ({ int z = 5; z += 10; z; }); z++; ({foo;})(); } void self_referential_initializer(void) { int x = ({ x = 5; }); } #define TESTS_SKIPPED 1 #define EXPECTED_ERRORS "statement expressions.c:3:10: warning: use of GNU statement expression extension [-Wgnu-statement-expression]" \ "statement expressions.c:3:10: error: statement expression not allowed at file scope" \ "statement expressions.c:10:13: error: initializing 'int' from incompatible type 'void'" \ "statement expressions.c:11:5: warning: expression result unused [-Wunused-value]" \ "statement expressions.c:12:8: warning: expression result unused [-Wunused-value]" \ "statement expressions.c:12:5: warning: expression result unused [-Wunused-value]" \ "statement expressions.c:18:5: error: use of undeclared identifier 'z'" \
0
repos/arocc/test
repos/arocc/test/cases/__float80 clang.c
//aro-args --emulate=clang void foo(void) { __float80 x; double y = 1.0w; _Complex double z = 2.0iw; } #define EXPECTED_ERRORS "__float80 clang.c:4:5: error: use of undeclared identifier '__float80'" \ "__float80 clang.c:5:16: error: invalid suffix 'w' on floating constant" \ "__float80 clang.c:6:25: error: invalid suffix 'iw' on floating constant" \
0
repos/arocc/test
repos/arocc/test/cases/pragma operator.c
#include "include/global_var_once_pragma_operator.h" #include "include/global_var_once_pragma_operator.h" #define PRAGMA(X) _Pragma(#X) PRAGMA(GCC warning "This is a warning") void foo(void) { int x = 1; PRAGMA(GCC diagnostic error "-Wpointer-integer-compare") (void)(x == (int *)2); _Pragma("GCC diagnostic warning \"-Wpointer-integer-compare\"" ) (void)(x == (int *)2); } #pragma GCC diagnostic warning "-Wunknown-pragmas" _Pragma(GCC diagnostic error "-Wpointer-integer-compare") PRAGMA(Not a pragma) _Pragma() #define EXPECTED_ERRORS "pragma operator.c:6:1: warning: This is a warning [-W#pragma-messages]" \ "pragma operator.c:4:27: note: expanded from here" \ "pragma operator.c:4:19: note: expanded from here" \ "<scratch space>:4:13: note: expanded from here" \ "pragma operator.c:18:9: error: _Pragma requires exactly one string literal token" \ "pragma operator.c:19:1: warning: unknown pragma ignored [-Wunknown-pragmas]" \ "pragma operator.c:4:27: note: expanded from here" \ "pragma operator.c:4:19: note: expanded from here" \ "<scratch space>:9:9: note: expanded from here" \ "pragma operator.c:20:1: error: _Pragma requires exactly one string literal token" \ "pragma operator.c:11:14: error: comparison between pointer and integer ('int' and 'int *') [-Werror,-Wpointer-integer-compare]" \ "pragma operator.c:13:14: warning: comparison between pointer and integer ('int' and 'int *') [-Wpointer-integer-compare]" \
0
repos/arocc/test
repos/arocc/test/cases/gnu89 standard.c
//aro-args -std=gnu89 void foo() { typeof(int) x = 5; }
0
repos/arocc/test
repos/arocc/test/cases/enum overflow.c
enum E1 { A = 2147483647, B, C = 4294967295UL, D, F = 9223372036854775807, G, H = 18446744073709551615ULL, I }; #if __INT_MAX__ == 2147483647 && __LONG_MAX__ == 9223372036854775807 && __LONG_LONG_MAX__ == 9223372036854775807 // Mac & Linux _Static_assert(A == 2147483647, "A"); _Static_assert(B == 2147483648, "B"); _Static_assert(C == 4294967295UL, "C"); _Static_assert(D == 4294967296UL, "D"); _Static_assert(F == 9223372036854775807LL, "F"); _Static_assert(G == 9223372036854775808ULL, "G"); _Static_assert(H == 18446744073709551615ULL, "H"); _Static_assert(H != C, "enumerator value was not truncated"); #define EXPECTED_ERRORS "enum overflow.c:3:5: warning: overflow in enumeration value" \ "enum overflow.c:7:5: warning: incremented enumerator value 9223372036854775808 is not representable in the largest integer type [-Wenum-too-large]" \ "enum overflow.c:9:5: warning: incremented enumerator value 18446744073709551616 is not representable in the largest integer type [-Wenum-too-large]" \ #elif __INT_MAX__ == 2147483647 && __LONG_MAX__ == 2147483647 && __LONG_LONG_MAX__ == 9223372036854775807 //Windows #define TESTS_SKIPPED 2 _Static_assert(A == 2147483647, "A"); // _Static_assert(B != 2147483648, "B"); _Static_assert(C == -1, "C"); _Static_assert(D != 4294967296UL, "D"); _Static_assert(F != 9223372036854775807LL, "F"); // _Static_assert(G != 9223372036854775808ULL, "G"); _Static_assert(H == -1, "H"); _Static_assert(H == C, "enumerator value was truncated"); #define EXPECTED_ERRORS "enum overflow.c:3:5: warning: overflow in enumeration value" \ "enum overflow.c:5:5: warning: overflow in enumeration value" \ "enum overflow.c:7:5: warning: incremented enumerator value 9223372036854775808 is not representable in the largest integer type [-Wenum-too-large]" \ "enum overflow.c:9:5: warning: incremented enumerator value 18446744073709551616 is not representable in the largest integer type [-Wenum-too-large]" \ #endif
0
repos/arocc/test
repos/arocc/test/cases/array designator too large.c
int arr1[] = { [0x800000000000000 - 1] = 0 }; int arr2[] = { [0x800000000000000 - 2] = 0 }; _Static_assert(sizeof(arr1), ""); _Static_assert(sizeof(arr2), ""); #define EXPECTED_ERRORS "array designator too large.c:1:14: error: array is too large" \
0
repos/arocc/test
repos/arocc/test/cases/unterminated macro function at eof.c
//aro-args -E -P #define EXPECTED_ERRORS "unterminated macro function at eof.c:5:1: error: unterminated function macro argument list" \ #define foo(X) X foo(1,
0
repos/arocc/test
repos/arocc/test/cases/array of invalid.c
_BitInt(0) a[]; _BitInt(0) b[10]; #define EXPECTED_ERRORS "array of invalid.c:1:1: error: signed _BitInt must have a bit size of at least 2" \ "array of invalid.c:2:1: error: signed _BitInt must have a bit size of at least 2" \
0
repos/arocc/test
repos/arocc/test/cases/attributed typeof.c
typedef __attribute__((aligned(16))) int aligned_int; void foo(void) { aligned_int a; __attribute__((aligned(16))) int b; typeof(a) c; typeof(aligned_int) d; typeof(b) e; } #define EXPECTED_TYPES "attributed(int)" "attributed(int)" \ "int" "int" "int"
0
repos/arocc/test
repos/arocc/test/cases/parser using typeof types.c
// Test for situations where the parser behavior depends on the type, to ensure // that typeof() is handled correctly. void typeof_array_initializer_list(void) { typeof(char[3]) arr = {1,2,3}; typeof(arr) arr2 = {1,2,3}; static char static_arr[3] = {1,2,3}; typeof(static_arr) static_arr2 = {1,2,3}; } void typeof_array_string_init(void) { typeof(char[6]) arr = "Hello"; typeof(arr) arr2 = "Hello"; static char static_arr[6] = "Hello"; typeof(static_arr) static_arr2 = "Hello"; } void array_index_warning(void) { typeof(int[5]) arr; typeof(arr) arr2; static int static_arr[5]; typeof(static_arr) static_arr2; (void)arr[5]; (void)arr2[5]; (void)static_arr2[5]; } void extra_record_inits(void) { struct S {int x; }; typeof(struct S) s = { 1, 2 }; typeof(s) s2 = { 1, 2 }; union U { int x; }; typeof(union U) u = { 1, 2 }; typeof(u) u2 = { 1 , 2 }; } void incomplete_array(void) { typeof(int[]) arr = {1, 2, 3}; typeof(arr) arr2 = {1, 2, 3}; } void voidparams(typeof(const void), ...); void string_initializer(void) { typeof(char[2]) arr = "hello"; typeof(arr) arr2 = "hello"; } void old_style(x, y) typeof(void) x; typeof(x) y; { } void do_not_coerce_extra_initializers(void) { typeof(int[2]) arr = {1,2,"hello"}; typeof(arr) arr2 = {1,2,"hello"}; } void bool_init(void) { struct S {int x;}; struct S s = {1}; typeof(_Bool) b = s; typeof(b) b2 = s; } #define EXPECTED_ERRORS "parser using typeof types.c:26:14: warning: array index 5 is past the end of the array [-Warray-bounds]" \ "parser using typeof types.c:27:15: warning: array index 5 is past the end of the array [-Warray-bounds]" \ "parser using typeof types.c:28:22: warning: array index 5 is past the end of the array [-Warray-bounds]" \ "parser using typeof types.c:33:31: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "parser using typeof types.c:34:25: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "parser using typeof types.c:37:30: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "parser using typeof types.c:38:26: warning: excess elements in struct initializer [-Wexcess-initializers]" \ "parser using typeof types.c:46:35: error: 'void' must be the only parameter if specified" \ "parser using typeof types.c:46:35: error: 'void' parameter cannot be qualified" \ "parser using typeof types.c:49:28: warning: initializer-string for char array is too long [-Wexcess-initializers]" \ "parser using typeof types.c:50:25: warning: initializer-string for char array is too long [-Wexcess-initializers]" \ "parser using typeof types.c:54:18: error: parameter cannot have void type" \ "parser using typeof types.c:55:15: error: parameter cannot have void type" \ "parser using typeof types.c:60:31: warning: excess elements in array initializer [-Wexcess-initializers]" \ "parser using typeof types.c:61:29: warning: excess elements in array initializer [-Wexcess-initializers]" \ "parser using typeof types.c:67:23: error: initializing '_Bool' from incompatible type 'struct S'" \ "parser using typeof types.c:68:20: error: initializing '_Bool' from incompatible type 'struct S'" \
0
repos/arocc/test
repos/arocc/test/cases/unexpected pragmas.c
// This tests that pragmas in locations where the parser does not check for them // do not cause undefined behavior. See https://github.com/Vexu/arocc/issues/82 // Parser improvements may reduce or eliminate the errors reported. int foo, #pragma bar bar int baz; #pragma qux #define EXPECTED_ERRORS "unexpected pragmas.c:6:2: error: expected identifier or '('"
0
repos/arocc/test
repos/arocc/test/cases/alternate spellings for signed.c
_Static_assert(__builtin_types_compatible_p(signed, __signed), ""); _Static_assert(__builtin_types_compatible_p(signed, __signed__), ""); _Static_assert(__builtin_types_compatible_p(signed char, __signed char), ""); _Static_assert(__builtin_types_compatible_p(signed short, short __signed__), ""); _Static_assert(!__builtin_types_compatible_p(unsigned, __signed), ""); _Static_assert(!__builtin_types_compatible_p(unsigned, __signed__), ""); _Static_assert(!__builtin_types_compatible_p(unsigned char, char __signed), ""); _Static_assert(!__builtin_types_compatible_p(unsigned char, __signed__ char), "");
0
repos/arocc/test
repos/arocc/test/cases/undefined macro.c
#pragma GCC diagnostic warning "-Wundef" #if FOO #error "Error" #endif #define FOO BAR #if FOO #error "Error" #endif #if undefined(foo) #error bad #endif #define EXPECTED_ERRORS "undefined macro.c:3:5: warning: 'FOO' is not defined, evaluates to 0 [-Wundef]" \ "undefined macro.c:9:5: warning: 'BAR' is not defined, evaluates to 0 [-Wundef]" \ "undefined macro.c:7:13: note: expanded from here" \ "undefined macro.c:13:5: warning: 'undefined' is not defined, evaluates to 0 [-Wundef]" \ "undefined macro.c:13:5: error: function-like macro 'undefined' is not defined" \