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/digraphs not supported.c
//aro-args -std=c89 void baz(void) { int x<:5:>; } #define EXPECTED_ERRORS "digraphs not supported.c:4:10: error: expected ';', found '<'"
0
repos/arocc/test
repos/arocc/test/cases/digraphs.c
//aro-args -DSTRINGIZE(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 stringify"); _Static_assert(sizeof(no_digraph) == 5, "string literals should not produce digraph tokens"); %>
0
repos/arocc/test
repos/arocc/test/cases/attributed record fields.c
struct S1 {}; struct S2 { __attribute__((packed)) int x; }; struct S3 { int __attribute__((packed)) x; }; struct S4 { int x __attribute__((packed)); }; struct S5 { __attribute__((packed)) int x, y; }; struct S6 { int __attribute__((packed)) x, y; }; struct S7 { int x __attribute__((packed)), y; }; struct S8 { int x, y __attribute__((packed)); }; struct S9 { int __attribute__((packed)) x __attribute__((aligned)); float f; __attribute__((packed)) long __attribute__((aligned(16))) l __attribute__((warn_if_not_aligned(16))); }; union U1 { long x; __attribute__((aligned(32))) int y; unsigned __attribute__((packed)) z; }; union U2 { int x __attribute__((packed)), y, __attribute__((packed)) z, w __attribute__((aligned)); };
0
repos/arocc/test
repos/arocc/test/cases/recursive call non-expanded parens.c
//aro-args -E -P #define foo(X) 1 bar #define bar(X) 2 foo foo(X)(Y)(Z)
0
repos/arocc/test
repos/arocc/test/cases/assembly invalid token.c
void foo(void) { __asm__(""
0
repos/arocc/test
repos/arocc/test/cases/builtin functions.c
//aro-args --target=powerpc-freestanding-none int foo(void) { char c[] = "hello"; return strlen(c); } void bar(int x) { __builtin_ppc_trap(x); } void ns_constant_string(void) { const __NSConstantString *ns_str = __builtin___NSStringMakeConstantString("Hello, world!"); (void)ns_str; } #define EXPECTED_ERRORS "builtin functions.c:4:12: error: implicitly declaring library function 'strlen' [-Wimplicit-function-declaration]" \ "builtin functions.c:4:12: note: include the header <string.h> or explicitly provide a declaration for 'strlen'" \
0
repos/arocc/test
repos/arocc/test/cases/whitespace macro arguments.c
//aro-args -E -P #define h() 1 #define g(x) x #define f(x, y) g(y) x #define p(...) h(__VA_ARGS__) #define q(e, ...) f(e, __VA_ARGS__) h() g() f(1,) f(1,q) f(,) p() q(3, 2) q(, 3)
0
repos/arocc/test
repos/arocc/test/cases/types.c
//aro-args --target=x86_64-linux int _Alignas(int) _Alignas(float) _Alignas(16) a; const volatile int b; __const __volatile int c; __const__ __volatile__ int d; int foo(int *restrict a, int *__restrict b, int *__restrict__ c); int bar(int n, int bar[n]); typedef void baz; _Noreturn void abort(void); typedef int A; typedef A B; typedef A C; typedef C B; typedef int I[2]; void qux(I const a, const I b) { b += 1; a += 1; } enum E { D = (char) 2, E = (long) 3, };
0
repos/arocc/test
repos/arocc/test/cases/fp16 parameter aarch64.c
//aro-args --target=aarch64-linux-gnu __fp16 foo(__fp16 x) { return 0; }
0
repos/arocc/test
repos/arocc/test/cases/linux __float128.c
//aro-args --target=x86_64-linux-gnu void foo(void) { __float128 q = 0.0; _Float128 q2 = 0.0; q = 1.0q; q = 1.0f128; _Complex __float128 q3; q3 = 1.0Qi; q3 = 1.0iQ; q3 = 1.0f128i; q3 = 1.0IF128; } _Static_assert(1.F128 + 2.F128 == 3.F128, "");
0
repos/arocc/test
repos/arocc/test/cases/no declspec.c
__declspec(align(4)) int foo; #if __has_declspec_attribute(noreturn) #error "__has_declspec_attribute macro should not work without -fdeclspec" #endif #if __has_declspec_attribute(x) #error "__has_declspec_attribute macro should not work without -fdeclspec" #endif #define EXPECTED_ERRORS \ "no declspec.c:1:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes" \
0
repos/arocc/test
repos/arocc/test/cases/c99 standard.c
//aro-args -std=c99 void foo(void) { int typeof = 5; }
0
repos/arocc/test
repos/arocc/test/cases/__auto_type self init.c
//aro-args -std=c23 void foo(void) { int x; __auto_type x = x; __auto_type y = (int []){1, y}; auto z = z + 1; } #define EXPECTED_ERRORS "__auto_type self init.c:4:21: error: variable 'x' declared with deduced type '__auto_type' cannot appear in its own initializer" \ "__auto_type self init.c:6:33: error: variable 'y' declared with deduced type '__auto_type' cannot appear in its own initializer" \ "__auto_type self init.c:8:14: error: variable 'z' declared with deduced type '__auto_type' cannot appear in its own initializer" \
0
repos/arocc/test
repos/arocc/test/cases/const decl folding.c
#pragma GCC diagnostic warning "-Wgnu-folding-constant" const int x = 1; int y = 2; struct S { int bits: x; int more_bits: y; }; enum E { FOO = x, BAR = y, }; void foo(void) { int array[] = {[x+10] = 1}; int array2[] = {[y] = 1}; _Static_assert(sizeof(array) == sizeof(array[0]) * (1 + 10 + 1), "wrong size"); } _Static_assert(x == 1, "allowed"); int _Alignas(x) not_allowed; void switch_fn(int param) { switch (param) { case x: return; case 1: return; } } void builtin_choose(void) { int var1, var2; __builtin_choose_expr(x, var1, var2) = 10; } void bar(void) { int array[x+1] = {0}; _Static_assert(sizeof(array) == 2*sizeof(int), "wrong size"); } #pragma GCC diagnostic warning "-Wstring-conversion" _Static_assert("", ""); _Static_assert(!"", ""); _Static_assert((void*)0, ""); _Static_assert((void*)1, ""); int arr[5]; _Static_assert(arr, ""); _Static_assert(!arr, ""); _Static_assert(4.2, ""); #define EXPECTED_ERRORS \ "const decl folding.c:7:15: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:8:20: error: expression is not an integer constant expression" \ "const decl folding.c:12:11: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:13:11: error: enum value must be an integer constant expression" \ "const decl folding.c:17:21: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:18:22: error: expression is not an integer constant expression" \ "const decl folding.c:22:16: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:23:14: error: '_Alignas' attribute requires integer constant expression" \ "const decl folding.c:23:17: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]" \ "const decl folding.c:27:14: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:28:14: error: duplicate case value '1'" \ "const decl folding.c:27:14: note: previous case defined here" \ "const decl folding.c:34:27: error: '__builtin_choose_expr' requires a constant expression" \ "const decl folding.c:38:15: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant]" \ "const decl folding.c:43:16: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:43:16: warning: implicit conversion turns string literal into bool: 'char [1]' to '_Bool' [-Wstring-conversion]" \ "const decl folding.c:44:1: error: static assertion failed \"\"" \ "const decl folding.c:46:1: error: static assertion failed \"\"" \ "const decl folding.c:47:16: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:47:16: note: this conversion is not allowed in a constant expression" \ "const decl folding.c:50:16: warning: expression is not an integer constant expression; folding it to a constant is a GNU extension [-Wgnu-folding-constant]" \ "const decl folding.c:50:16: warning: address of array 'arr' will always evaluate to 'true' [-Wpointer-bool-conversion]" \ "const decl folding.c:51:1: error: static assertion failed \"\"" \ "const decl folding.c:53:16: warning: implicit conversion from 'double' to '_Bool' changes value from 4.2 to true [-Wfloat-conversion]" \
0
repos/arocc/test
repos/arocc/test/cases/non string attribute.c
enum E { is_deprecated_with_msg __attribute__((deprecated("I am deprecated" = 5 ))), }; #define EXPECTED_ERRORS "non string attribute.c:2:71: error: expression is not assignable" \ "non string attribute.c:2:53: error: attribute 'deprecated' requires an ordinary string" \
0
repos/arocc/test
repos/arocc/test/cases/nested unterminated macro gcc.c
//aro-args -E -P --emulate=gcc #define str(s) # s #define xstr(s) str(s) #define INCFILE(n) str(strcmp( xstr(INCFILE(2)) INCFILE(2)) #define EXPECTED_ERRORS \ "nested unterminated macro gcc.c:5:6: error: unterminated function macro argument list" \ "nested unterminated macro gcc.c:4:20: note: expanded from here" \ "nested unterminated macro gcc.c:5:18: error: unterminated function macro argument list" \ "nested unterminated macro gcc.c:4:20: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/constexpr.c
//aro-args -std=c23 -Wpedantic constexpr int a = 1; static constexpr int b = 2; thread_local constexpr int c = 3; constexpr int foo(constexpr int param) { auto constexpr a = 1; register constexpr int b = 2; return b; } constexpr _BitInt(b) bit = 4; int non_const = 4; constexpr int invalid = non_const; // TODO constexpr bool const_bool_true = true; static_assert(const_bool_true); constexpr bool const_bool_false = false; static_assert(!const_bool_false); #define TESTS_SKIPPED 1 #define EXPECTED_ERRORS "constexpr.c:5:14: error: cannot combine with previous 'thread_local' specifier" \ "constexpr.c:7:19: error: invalid storage class on function parameter" \ "constexpr.c:7:1: error: illegal storage class on function" \ "constexpr.c:13:28: warning: implicit conversion from 'int' to 'signed _BitInt(2)' changes non-zero value from 4 to 0 [-Wconstant-conversion]" \
0
repos/arocc/test
repos/arocc/test/cases/object macro expansion.c
//aro-args -E -P #define x a x #define a 1 x #define y define y #define __restrict restrict #define empty empty
0
repos/arocc/test
repos/arocc/test/cases/u8 character constant.c
const unsigned char c = u8'A'; _Static_assert(c == 'A', ""); #pragma GCC diagnostic ignored "-Wc23-extensions" _Static_assert(u8'\xff' == 0xFF, ""); const unsigned char c2 = u8'™'; const unsigned char c3 = u8'£'; // Unicode codepoint 0xA3 const unsigned char c4 = u8'AA'; #if u8'A' #else #error Character constant should be true in preprocessor #endif #define EXPECTED_ERRORS \ "u8 character constant.c:1:25: warning: UTF-8 character literal is a C23 extension [-Wc23-extensions]" \ "u8 character constant.c:6:26: error: character too large for enclosing character literal type" \ "u8 character constant.c:7:26: error: character too large for enclosing character literal type" \ "u8 character constant.c:8:26: error: Unicode character literals may not contain multiple characters" \
0
repos/arocc/test
repos/arocc/test/cases/fp16 parameter.c
__fp16 foo(__fp16 param) { return 0; } #define EXPECTED_ERRORS "fp16 parameter.c:1:19: error: parameters cannot have __fp16 type; did you forget * ?" \ "fp16 parameter.c:1:11: error: function return value cannot have __fp16 type; did you forget * ?" \
0
repos/arocc/test
repos/arocc/test/cases/cast to union.c
union U { int x; float y; }; union Forward; void foo(void) { union U u; #pragma GCC diagnostic push #pragma GCC diagnostic warning "-Wpedantic" u = (union U)1; #pragma GCC diagnostic pop u = (union U)1.0f; u = (union U)1.0; (union Forward)1; (union DoesNotExist)1; } #define EXPECTED_ERRORS "cast to union.c:11:9: warning: cast to union type is a GNU extension [-Wgnu-union-cast]" \ "cast to union.c:15:9: error: cast to union type from type 'double' not present in union" \ "cast to union.c:16:5: error: cast to incomplete type 'union Forward'" \ "cast to union.c:17:5: error: cast to incomplete type 'union DoesNotExist'" \
0
repos/arocc/test
repos/arocc/test/cases/least and fast int.c
//aro-args -std=c23 --target=x86_64-macos -ffreestanding #include <stdint.h> _Static_assert(INT_LEAST8_MAX == INT8_MAX); _Static_assert(INT_LEAST8_MIN == INT8_MIN); _Static_assert(UINT_LEAST8_MAX == UINT8_MAX); _Static_assert(INT_FAST8_MAX == INT8_MAX); _Static_assert(INT_FAST8_MIN == INT8_MIN); _Static_assert(UINT_FAST8_MAX == UINT8_MAX); _Static_assert(INT_FAST8_WIDTH == INT8_WIDTH); _Static_assert(INT_LEAST16_MAX == INT16_MAX); _Static_assert(INT_LEAST16_MIN == INT16_MIN); _Static_assert(UINT_LEAST16_MAX == UINT16_MAX); _Static_assert(INT_FAST16_MAX == INT16_MAX); _Static_assert(INT_FAST16_MIN == INT16_MIN); _Static_assert(UINT_FAST16_MAX == UINT16_MAX); _Static_assert(INT_FAST16_WIDTH == INT16_WIDTH); _Static_assert(INT_LEAST32_MAX == INT32_MAX); _Static_assert(INT_LEAST32_MIN == INT32_MIN); _Static_assert(UINT_LEAST32_MAX == UINT32_MAX); _Static_assert(INT_FAST32_MAX == INT32_MAX); _Static_assert(INT_FAST32_MIN == INT32_MIN); _Static_assert(UINT_FAST32_MAX == UINT32_MAX); _Static_assert(INT_FAST32_WIDTH == INT32_WIDTH); _Static_assert(INT_LEAST64_MAX == INT64_MAX); _Static_assert(INT_LEAST64_MIN == INT64_MIN); _Static_assert(UINT_LEAST64_MAX == UINT64_MAX); _Static_assert(INT_FAST64_MAX == INT64_MAX); _Static_assert(INT_FAST64_MIN == INT64_MIN); _Static_assert(UINT_FAST64_MAX == UINT64_MAX); _Static_assert(INT_FAST64_WIDTH == INT64_WIDTH);
0
repos/arocc/test
repos/arocc/test/cases/stringify invalid.c
#define EXPECTED_ERRORS "stringify invalid.c:9:20: warning: missing terminating '\"' character [-Winvalid-pp-token]" \ "stringify invalid.c:13:1: error: expected ';', found '}'" void foo(void) { #define str(s) # s #define xstr(s) str(s) #define INCFILE(n) "ok\ vers ## n xstr(INCFILE(a)) }
0
repos/arocc/test
repos/arocc/test/cases/imaginary constants.c
#pragma GCC diagnostic push #pragma GCC diagnostic warning "-Wgnu-imaginary-constant" void foo(void) { _Complex double cd = 1.0 + 2.0i; #pragma GCC diagnostic pop _Complex float cf = 1.0f + 2.0if; _Complex long double cld; cld = 1.0l + 2.0il; #pragma GCC diagnostic warning "-Wgnu-complex-integer" int _Complex ci = 1i; #pragma GCC diagnostic ignored "-Wgnu-complex-integer" _Complex unsigned long cl = 1uli; } #if 1.0i #endif #define EXPECTED_ERRORS "imaginary constants.c:5:32: warning: imaginary constants are a GNU extension [-Wgnu-imaginary-constant]" \ "imaginary constants.c:18:5: error: floating point literal in preprocessor expression" \ "imaginary constants.c:13:9: warning: complex integer types are a GNU extension [-Wgnu-complex-integer]" \
0
repos/arocc/test
repos/arocc/test/cases/nested invalid struct layout.c
struct Foo { Bar bar; }; struct Baz { struct Foo foo; }; #define EXPECTED_ERRORS "nested invalid struct layout.c:2:5: error: expected '}', found 'an identifier'" \ "nested invalid struct layout.c:1:12: note: to match this '{'" \
0
repos/arocc/test
repos/arocc/test/cases/macro expansion disabled.c
//aro-args -E -P #define EMPTY() #define LOOP_INDIRECTION() LOOP #define LOOP(x) x LOOP_INDIRECTION EMPTY()() (x) LOOP(1) #define DEFER(id) id EMPTY() #define EXPAND(...) __VA_ARGS__ #define A() 123 EXPAND(DEFER(A)())
0
repos/arocc/test
repos/arocc/test/cases/no dollars in identifiers.c
//aro-args -fno-dollars-in-identifiers #define foo$ bar void fib() { int foo$; } #define EXPECTED_ERRORS ":2:12: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions]" \ ":4:7: error: expected identifier or '('" \ ":2:12: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/unaligned u16 string literal.c
struct S { int x; }; void foo(void) { struct S s; s.y; } _Static_assert(u"A"); #define NO_ERROR_VALIDATION
0
repos/arocc/test
repos/arocc/test/cases/__line__.c
//aro-args -E -P #define LINE __LINE__ void foo(void) { \ i\ nt x = __LI\ NE__; \ \ int y = __LINE__; int z = LINE; \ \ }
0
repos/arocc/test
repos/arocc/test/cases/macro self definition.c
//aro-args -E -P #define FOO FOO FOO #define BAR BAZ #define BAZ BAR BAR BAZ
0
repos/arocc/test
repos/arocc/test/cases/lazy macro.c
//aro-args -E -P #define REC_EMPTY #define REC_DEFER(op) op REC_EMPTY #define REC_0_HOOK() REC_0 #define REC_1 REC_DEFER(REC_0_HOOK)() REC_1
0
repos/arocc/test
repos/arocc/test/cases/macro argument evaluation.c
//aro-args -E -P #define FOO(X) X##OK #define BAR FOO #define A 1 #if BAR(A) #error Should not error #endif BAR(A) #define AOK 1 #if BAR(A) #error Should error #endif BAR(A) #define EXPECTED_ERRORS "macro argument evaluation.c:15:2: error: Should error" \
0
repos/arocc/test
repos/arocc/test/cases/attribute errors.c
//aro-args --target=x86_64-linux void cleanup_fn(void) {} void foo(void) { int __attribute__((access)) bar_1; int __attribute__((access(foo, 0))) bar_2; int __attribute__((access(read_only, 1, 2))) bar_3; int __attribute__((alias(bar))) bar_4; int __attribute__((alias("bar"))) bar_5; int __attribute__((aligned)) bar_6; int __attribute__((aligned(2 + 2))) bar_7; int __attribute__((aligned(4, 8))) bar_8; int __attribute__((aligned(10))) bar_9; int __attribute__((assume_aligned(10, 0))) bar_10; int __attribute__((assume_aligned(2))) bar_11; int __attribute__((assume_aligned(2, 0))) bar_12; int __attribute__((hot, pure)) bar_13; int __attribute__((cleanup(cleanup_fn))) bar_14; int __attribute__((cleanup("cleanup_fn"))) bar_15; int __attribute__((simd())) bar_16; int __attribute__((simd("inbranch"))) bar_17; int __attribute__((simd("wrong"))) bar_18; int __attribute__((invalid_attribute)) bar_19; int __attribute__((invalid_attribute(1, (2 + 3)))) bar_20; int __attribute__((deprecated("deprecated", 1))) bar_21; } struct S { int __attribute__((cold)) x; }; int __thiscall bar(int); int big __attribute__((vector_size(4294967296))); typedef float f2v __attribute__((vector_size(8.0i))); #define EXPECTED_ERRORS "attribute errors.c:4:24: error: 'access' attribute takes at least 2 argument(s)" \ "attribute errors.c:5:31: error: Unknown `access` argument. Possible values are: 'read_only', 'read_write', 'write_only', 'none'" \ "attribute errors.c:6:24: warning: attribute 'access' ignored on variables [-Wignored-attributes]" \ "attribute errors.c:7:30: error: use of undeclared identifier 'bar'" \ "attribute errors.c:11:35: error: 'aligned' attribute takes at most 1 argument(s)" \ "attribute errors.c:12:32: error: requested alignment is not a power of 2" \ "attribute errors.c:13:39: error: requested alignment is not a power of 2" \ "attribute errors.c:14:24: warning: attribute 'assume_aligned' ignored on variables [-Wignored-attributes]" \ "attribute errors.c:15:24: warning: attribute 'assume_aligned' ignored on variables [-Wignored-attributes]" \ "attribute errors.c:16:24: warning: attribute 'hot' ignored on variables [-Wignored-attributes]" \ "attribute errors.c:16:29: warning: attribute 'pure' ignored on variables [-Wignored-attributes]" \ "attribute errors.c:18:32: error: Attribute argument is invalid, expected an identifier but got a string" \ "attribute errors.c:19:24: warning: attribute 'simd' ignored on variables [-Wignored-attributes]" \ "attribute errors.c:20:24: warning: attribute 'simd' ignored on variables [-Wignored-attributes]" \ "attribute errors.c:21:29: error: Unknown `simd` argument. Possible values are: \"notinbranch\", \"inbranch\"" \ "attribute errors.c:22:24: warning: unknown attribute 'invalid_attribute' ignored [-Wunknown-attributes]" \ "attribute errors.c:23:24: warning: unknown attribute 'invalid_attribute' ignored [-Wunknown-attributes]" \ "attribute errors.c:24:49: error: 'deprecated' attribute takes at most 1 argument(s)" \ "attribute errors.c:28:24: warning: attribute 'cold' ignored on fields [-Wignored-attributes]" \ "attribute errors.c:31:5: warning: '__thiscall' calling convention is not supported for this target [-Wignored-attributes]" \ "attribute errors.c:32:36: error: attribute value '4294967296' out of range" \ "attribute errors.c:33:46: error: Attribute argument is invalid, expected an integer constant but got a complex floating point number" \
0
repos/arocc/test
repos/arocc/test/cases/divide by zero.c
void foo(void) { int x = 10; (void)(x/0); (void)(x%0); x /= 0; x %= 0; (void)(0/0); (void)(1%0); _Static_assert(1/0, "unavailable"); float f = 0.0f / 0.0f; f /= 0.0f; x = 1 / 2.0f; } #define EXPECTED_ERRORS \ "divide by zero.c:3:13: warning: division by zero is undefined [-Wdivision-by-zero]" \ "divide by zero.c:4:13: warning: remainder by zero is undefined [-Wdivision-by-zero]" \ "divide by zero.c:5:7: warning: division by zero is undefined [-Wdivision-by-zero]" \ "divide by zero.c:6:7: warning: remainder by zero is undefined [-Wdivision-by-zero]" \ "divide by zero.c:7:13: warning: division by zero is undefined [-Wdivision-by-zero]" \ "divide by zero.c:8:13: warning: remainder by zero is undefined [-Wdivision-by-zero]" \ "divide by zero.c:9:21: warning: division by zero is undefined [-Wdivision-by-zero]" \ "divide by zero.c:9:20: error: static_assert expression is not an integral constant expression" \
0
repos/arocc/test
repos/arocc/test/cases/arithmetic conversion floats.c
#include "include/test_helpers.h" void foo(void) { EXPECT_TYPE((long double)1 + 1.fi, _Complex long double); EXPECT_TYPE(1.i + 1.f, _Complex double); EXPECT_TYPE((long double)1 + 1., long double); EXPECT_TYPE(1.fi + 1.f, _Complex float); EXPECT_TYPE(1.f + 1.f, float); EXPECT_TYPE((long double)1.f + 1.f, long double); }
0
repos/arocc/test
repos/arocc/test/cases/c23 missing type specifier.c
//aro-args -std=c23 #define EXPECTED_ERRORS \ "c23 missing type specifier.c:4:8: error: a type specifier is required for all declarations" static x = 5;
0
repos/arocc/test
repos/arocc/test/cases/empty macro block expansion.c
//aro-args -P -E #define CONTINUE(k) DEFER(k##_HOOK)() #define DEFER(op) op EMPTY #define EMPTY #define F_HOOK() F CONTINUE( F) CONTINUE(F)
0
repos/arocc/test
repos/arocc/test/cases/unterminated char literal.c
#define A 'b #define B '' #define C(X) '' #define D(X) 'A #define EXPECTED_ERRORS "unterminated char literal.c:1:11: warning: missing terminating ' character [-Winvalid-pp-token]" \ "unterminated char literal.c:2:11: warning: empty character constant [-Winvalid-pp-token]" \ "unterminated char literal.c:3:14: warning: empty character constant [-Winvalid-pp-token]" \ "unterminated char literal.c:4:14: warning: missing terminating ' character [-Winvalid-pp-token]" \ "unterminated char literal.c:16:10: warning: empty character constant [-Winvalid-pp-token]" \ "unterminated char literal.c:17:10: warning: missing terminating ' character [-Winvalid-pp-token]" \ "unterminated char literal.c:16:10: error: empty character constant" \ "unterminated char literal.c:17:10: error: missing terminating ' character" \ "unterminated char literal.c:17:11: error: expected ';' before end of file" \ char c = u8''; char d = '
0
repos/arocc/test
repos/arocc/test/cases/enum sizes windows.c
//aro-args --target=x86_64-windows-msvc enum Small { A } __attribute__((packed)); _Static_assert(sizeof(enum Small) == sizeof(int), "Small"); enum __attribute__((packed)) StillSmall { B = 255 }; _Static_assert(sizeof(enum StillSmall) == sizeof(int), "StillSmall"); enum Medium { C = 255, D } __attribute__((packed)); _Static_assert(sizeof(enum Medium) == sizeof(int), "Medium"); enum StillMedium { E = -32768, F = 32767 } __attribute__((packed)); _Static_assert(sizeof(enum StillMedium) == sizeof(int), "StillMedium"); enum Normal { G = -2147483648, H = 2147483647 }; _Static_assert(sizeof(enum Normal) == sizeof(int), "Normal"); enum Unsigned { I = 4294967295, }; _Static_assert(sizeof(enum Unsigned) == sizeof(int), "Unsigned"); enum Large { J = -1, K = 4294967295 }; _Static_assert(sizeof(enum Large) == sizeof(int), "Large"); enum Huge { L = 18446744073709551615ULL }; _Static_assert(sizeof(enum Huge) == sizeof(int), "Huge");
0
repos/arocc/test
repos/arocc/test/cases/#if constant expression.c
//aro-args -E -Wno-integer-overflow -P #if defined FOO & !defined(BAZ) void #elif !defined(BAR) long #endif #if 1 - 1 #error "foo" #endif #if defined BAR ? 1 : 0 #error foo #endif #if 0 && 0 # error foo #endif #if 0 || 0 # error foo #endif #if 0U - 1 != 18446744073709551615ULL #error incorrect unsigned subtraction in preprocessor #endif
0
repos/arocc/test
repos/arocc/test/cases/c17 char8_t enabled.c
//aro-args -std=c17 -fchar8_t void foo(void) { char8_t c = 0; } _Static_assert (_Generic (u8"hello", unsigned char*: 1, default: 2) == 1, "Incorrect type for u8 string literal"); _Static_assert (_Generic (u8"A"[0], unsigned char: 1, default: 2) == 1, "Incorrect type for u8 string literal element"); const char cbuf1[] = u8"text"; const char cbuf2[] = { u8"text" }; const signed char scbuf1[] = u8"text"; const signed char scbuf2[] = { u8"text" }; const unsigned char ucbuf1[] = u8"text"; const unsigned char ucbuf2[] = { u8"text" }; const char8_t c8buf1[] = u8"text"; const char8_t c8buf2[] = { u8"text" }; const char8_t c8buf3[] = "text"; const char8_t c8buf4[] = { "text" };
0
repos/arocc/test
repos/arocc/test/cases/asm.c
void foo(void) __asm__("foo"); __asm__ volatile volatile("foo"); __asm__(u8"nop"); __asm__(L"nop"); __asm__(5); #define EXPECTED_ERRORS "asm.c:2:9: error: meaningless 'volatile' on assembly outside function" \ "asm.c:2:18: error: meaningless 'volatile' on assembly outside function" \ "asm.c:2:18: error: duplicate asm qualifier 'volatile'" \ "asm.c:3:9: error: cannot use unicode string literal in assembly" \ "asm.c:4:9: error: cannot use wide string literal in assembly" \ "asm.c:5:9: error: expected string literal in 'asm'" \
0
repos/arocc/test
repos/arocc/test/cases/integer conversions 32bit.c
//aro-args --target=x86-linux-gnu -Wno-c23-extensions #include "include/test_helpers.h" void foo(void) { EXPECT_TYPE(1U + 1L, unsigned long); }
0
repos/arocc/test
repos/arocc/test/cases/invalid attributes.c
#define NO_ERROR_VALIDATION struct S { __attribute__((__aligned__(x(long)))) long a; __attribute__((packed)) b; }; struct S2 { __attribute__((__aligned__(char: 1))) long a; __attribute__((packed)) b; }; void foo(void) { }
0
repos/arocc/test
repos/arocc/test/cases/zero argument macro.c
//aro-args -E -P #define NO_ARGUMENTS() NO_ARGUMENTS() NO_ARGUMENTS( ) NO_ARGUMENTS( ) NO_ARGUMENTS(1) #define EXPECTED_ERRORS "zero argument macro.c:10:1: error: expected 0 argument(s) got 1" \
0
repos/arocc/test
repos/arocc/test/cases/#elifdef.c
//aro-args -E -P #ifdef FOO long long #elifdef FOO long #elifndef FOO int #endif #define BAR #ifdef FOO long long #elifdef BAR long #elifndef FOO int #endif
0
repos/arocc/test
repos/arocc/test/cases/array argument is null.c
//aro-args -std=c23 #include <stddef.h> void foo(int x[static 10]) { } void bar(void) { foo(NULL); foo(nullptr); foo(0); } #define EXPECTED_ERRORS "array argument is null.c:8:9: warning: null passed to a callee that requires a non-null argument [-Wnonnull]"\ "stddef.h:17:14: note: expanded from here"\ "array argument is null.c:3:14: note: callee declares array parameter as static here"\ "array argument is null.c:9:9: warning: null passed to a callee that requires a non-null argument [-Wnonnull]"\ "array argument is null.c:3:14: note: callee declares array parameter as static here"\ "array argument is null.c:10:9: warning: null passed to a callee that requires a non-null argument [-Wnonnull]"\ "array argument is null.c:3:14: note: callee declares array parameter as static here"
0
repos/arocc/test
repos/arocc/test/cases/guard undef.c
#include "correct_guard.h" #undef CORRECT_GUARD_H #include "correct_guard.h" #define EXPECTED_ERRORS \ "correct_guard.h:3:5: error: redefinition of 'x'" \ "correct_guard.h:3:5: note: previous definition is here" \
0
repos/arocc/test
repos/arocc/test/cases/preserve comments in macros.c
//aro-args -E -P -CC #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*/) #define EXPECTED_ERRORS \ "preserve comments in macros.c:2:15: error: pasting formed '/*foo*//*bar*/', an invalid preprocessing token" \ "preserve comments in macros.c:5:13: error: pasting formed '/*foo*//*bar*/', an invalid preprocessing token" \ "preserve comments in macros.c:14:14: error: pasting formed '/*foo*/1', an invalid preprocessing token" \ "preserve comments in macros.c:16:8: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/static assert messages.c
void foo(int x) { _Static_assert(x, "not allowed"); _Static_assert(1); _Static_assert(0); } void bar(void) { _Static_assert(1, "ok", "not ok"); } _Static_assert(1 == 0, "They are not equal!"); #define EXPECTED_ERRORS "static assert messages.c:2:20: error: static_assert expression is not an integral constant expression" \ "static assert messages.c:3:5: warning: static_assert with no message is a C23 extension [-Wc23-extensions]" \ "static assert messages.c:4:5: warning: static_assert with no message is a C23 extension [-Wc23-extensions]" \ "static assert messages.c:4:5: error: static assertion failed" \ "static assert messages.c:8:27: error: expected ')', found ','" \ "static assert messages.c:8:19: note: to match this '('" \ "static assert messages.c:11:1: error: static assertion failed \"They are not equal!\"" \
0
repos/arocc/test
repos/arocc/test/cases/missing newline before eof.c
#pragma GCC diagnostic warning "-Wnewline-eof" #define EXPECTED_ERRORS "missing newline before eof.c:5:8: warning: no newline at end of file [-Wnewline-eof]" \ "missing newline before eof.c:5:8: error: expected ';' before end of file" int foo
0
repos/arocc/test
repos/arocc/test/cases/debug dump macro names.c
//aro-args -E -dN #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/warn unused result.c
typedef int (*fnptr)(int, int); int foo() __attribute__((warn_unused_result)) { return 0; } fnptr make_fn(int a, int b) { return 0; } void bar(fnptr ptr) { foo(); (foo)(); (foo - 16)(); (foo + 16)(); (*****foo)(); make_fn(1, 2)(2, 2); } struct S { int __attribute__((warn_unused_result))(*close)(void); }; void baz(struct S *s){ (bar(0), s->close)(); } #define EXPECTED_ERRORS "warn unused result.c:13:4: warning: ignoring return value of 'foo', declared with 'warn_unused_result' attribute [-Wunused-result]" \ "warn unused result.c:14:4: warning: ignoring return value of 'foo', declared with 'warn_unused_result' attribute [-Wunused-result]" \ "warn unused result.c:17:4: warning: ignoring return value of 'foo', declared with 'warn_unused_result' attribute [-Wunused-result]" \ "warn unused result.c:26:5: warning: ignoring return value of 'close', declared with 'warn_unused_result' attribute [-Wunused-result]" \
0
repos/arocc/test
repos/arocc/test/cases/builtin headers.c
#include <stdalign.h> #include <stdarg.h> #include <stdatomic.h> #include <stdbool.h> /* a */ # /* b */ include /* c */ <stddef.h> #define HEADER <stdarg.h> #include HEADER
0
repos/arocc/test
repos/arocc/test/cases/implicitly unsigned literal.c
_Static_assert(-9223372036854775808LL > 0, "lhs should be unsigned"); long long x = 9223372036854775808LL; #define EXPECTED_ERRORS \ "implicitly unsigned literal.c:1:17: warning: integer literal is too large to be represented in a signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]" \ "implicitly unsigned literal.c:2:15: 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/__auto_type.c
//aro-args -Wno-gnu-alignof-expression #include "test_helpers.h" __auto_type foo(void); __auto_type foo1(void) {} void bar(__auto_type); void bar1(__auto_type x) {} typedef __auto_type my_auto_type; int __auto_type a = 5; struct S { unsigned bitfield: 5; }; struct BadStruct { __auto_type y; }; union BadUnion { __auto_type x; }; int myfunc(int x) { return x; } void baz(void) { # pragma GCC diagnostic push # pragma GCC diagnostic warning "-Wgnu-auto-type" # pragma GCC diagnostic ignored "-Wsizeof-array-argument" __auto_type decayed_arr = (double[]){1.,2.,3.,4.,5.}; _Static_assert(sizeof(decayed_arr) == sizeof(double *), ""); # pragma GCC diagnostic pop __auto_type b = 5U; EXPECT_TYPE(b, unsigned); int c = (__auto_type)5; __auto_type d; __auto_type e = 1, f = 2, j = 3; struct S s = {}; __auto_type g = s.bitfield; const int const_int = 5; __auto_type h = const_int; h = 100; const __auto_type i = 0; i += 1; __auto_type func_ptr = myfunc; EXPECT_TYPE(func_ptr, __typeof__(&myfunc)); EXPECT_TYPE(func_ptr, int (*)(int)); __auto_type my_struct = (struct S){.bitfield = 10 }; EXPECT_TYPE(my_struct, struct S); __auto_type auto_array[2] = {1, 2}; __auto_type init_list = {1,2}; __attribute__((aligned(128))) __auto_type aligned_var = 0ULL; _Static_assert(_Alignof(aligned_var) == 128, ""); } #define EXPECTED_ERRORS "__auto_type.c:3:1: error: '__auto_type' not allowed in function return type" \ "__auto_type.c:4:1: error: '__auto_type' not allowed in function return type" \ "__auto_type.c:6:10: error: '__auto_type' not allowed in function prototype" \ "__auto_type.c:7:11: error: '__auto_type' not allowed in function prototype" \ "__auto_type.c:9:9: error: '__auto_type' not allowed in typedef" \ "__auto_type.c:10:5: error: cannot combine with previous 'int' specifier" \ "__auto_type.c:16:17: error: '__auto_type' not allowed in struct member" \ "__auto_type.c:19:17: error: '__auto_type' not allowed in union member" \ "__auto_type.c:29:5: warning: '__auto_type' is a GNU extension [-Wgnu-auto-type]" \ "__auto_type.c:35:13: error: invalid cast to '__auto_type'" \ "__auto_type.c:37:17: error: declaration of variable 'd' with deduced type requires an initializer" \ "__auto_type.c:39:5: error: '__auto_type' may only be used with a single declarator" \ "__auto_type.c:42:21: error: cannot use bit-field as '__auto_type' initializer" \ "__auto_type.c:49:7: error: expression is not assignable" \ "__auto_type.c:58:17: error: 'auto_array' declared as array of '__auto_type'" \ "__auto_type.c:60:29: error: cannot use '__auto_type' with initializer list" \
0
repos/arocc/test
repos/arocc/test/cases/extended identifiers c99.c
//aro-args -std=c99 #define Ǻ 42 int fǿǿ(void) { int Ǿ = Ǻ; return Ǿ; } int bȁr(void) { int ™ = 0; return 0; } int bȁz(void) { int a١ = 0; int ١a = 0; return 0; } int uǿ = 0; int uǿ1 = 0; int u8ǿ = 0; int u8ǿ1 = 0; int Uǿ = 0; int Uǿ1 = 0; int Lǿ = 0; int Lǿ1 = 0; #define EXPECTED_ERRORS "extended identifiers c99.c:10:9: error: unexpected character <U+2122>" \ "extended identifiers c99.c:10:11: error: expected identifier or '('" \ "extended identifiers c99.c:16:9: error: character <U+0661> not allowed at the start of an identifier" \
0
repos/arocc/test
repos/arocc/test/cases/msvc zero size array.c
//aro-args --target=x86_64-windows-msvc typedef int J[]; #pragma pack(1) struct J_packed { J a; }; _Static_assert(sizeof(J) == 0, "incorrect size"); _Static_assert(_Alignof(J) == 4, "incorrect alignment"); struct J_size { char a[sizeof(J)+1]; char b; }; _Static_assert(sizeof(struct J_size) == 2, "incorrect size"); _Static_assert(_Alignof(struct J_size) == 1, "incorrect alignment"); struct J_extra_alignment { char a; J b; }; struct J_extra_alignment var83; _Static_assert(sizeof(J) == 0, ""); _Static_assert(_Alignof(J) == 4, ""); #define EXPECTED_ERRORS "msvc zero size array.c:10:16: warning: sizeof returns 0" \ "msvc zero size array.c:14:12: warning: sizeof returns 0" \ "msvc zero size array.c:27:16: warning: sizeof returns 0" \
0
repos/arocc/test
repos/arocc/test/cases/var args macro functions.c
//aro-args -E -P #define foo(a,...) #__VA_ARGS__ foo(1,2,3,4,5,6) #define bar(a,...) bar __VA_ARGS__ #define baz(a,...) baz bar(__VA_ARGS__) baz(1,2,3,4)
0
repos/arocc/test
repos/arocc/test/cases/unreachable.c
//aro-args -std=c23 #include <stddef.h> void foo(void) { unreachable(); }
0
repos/arocc/test
repos/arocc/test/cases/guard defined outside header.c
#include "incorrect_guard.h" #define INCORRECT_GUARD_H #include "incorrect_guard.h"
0
repos/arocc/test
repos/arocc/test/cases/_BitInt.c
//aro-args -std=c17 -Wpedantic _BitInt(17) a; #pragma GCC diagnostic ignored "-Wpedantic" unsigned _BitInt(70) b; signed _BitInt(99) c; _Static_assert(sizeof(_BitInt(65)) == sizeof(_BitInt(66)), "failed"); _Static_assert(sizeof(_BitInt(8)) != sizeof(_BitInt(66)), "failed"); _BitInt(65536) f; signed _BitInt(1) e; unsigned _BitInt(0) d; _BitInt(5) g = 2wb; unsigned _BitInt(5) h = 3Uwb; #pragma GCC diagnostic ignored "-Wc23-extensions" int y = 0wb; int z = 0uwb; int x = 1'2; _Static_assert(((int)-18446744073709551616WB) == 0); enum E: _BitInt(512) { A=6703903964971298549787012499102923063739682910296196688861780721860882015036773488400937149083451713845015929093243025426876941405973284973216824503042047WB, B, }; _Static_assert(sizeof(_BitInt(65535)) == 8192, ""); #define EXPECTED_ERRORS "_BitInt.c:3:1: warning: '_BitInt' in C17 and earlier is a Clang extension' [-Wbit-int-extension]" \ "_BitInt.c:13:1: error: signed _BitInt of bit sizes greater than 65535 not supported" \ "_BitInt.c:14:8: error: signed _BitInt must have a bit size of at least 2" \ "_BitInt.c:15:10: error: unsigned _BitInt must have a bit size of at least 1" \ "_BitInt.c:17:16: warning: '_BitInt' suffix for literals is a C23 extension [-Wc23-extensions]" \ "_BitInt.c:18:25: warning: '_BitInt' suffix for literals is a C23 extension [-Wc23-extensions]" \ "_BitInt.c:18:25: warning: '_BitInt' suffix for literals is a C23 extension [-Wc23-extensions]" \ "_BitInt.c:22:10: error: expected ';', found 'a character literal'" \ "_BitInt.c:27:5: error: enumerator value is not representable in the underlying type 'signed _BitInt(512)'" \
0
repos/arocc/test
repos/arocc/test/cases/__has_feature.c
#if defined __has_feature # if __has_feature(enumerator_attributes) #error feature exists # endif # if __has_feature(does_not_exist) #error feature exists # endif #endif #define EXPECTED_ERRORS "__has_feature.c:3:8: error: feature exists"
0
repos/arocc/test
repos/arocc/test/cases/redefine typedef.c
typedef int MyInt; int foo(MyInt MyInt) { return MyInt; } int MyInt; enum E { Foo, }; typedef int Foo; #define EXPECTED_ERRORS "redefine typedef.c:6:5: error: redefinition of 'MyInt' as different kind of symbol" \ "redefine typedef.c:1:13: note: previous definition is here" \ "redefine typedef.c:12:13: error: redefinition of 'Foo' as different kind of symbol" \ "redefine typedef.c:9:2: note: previous definition is here" \
0
repos/arocc/test
repos/arocc/test/cases/#pragma pack.c
#pragma pack() #pragma pack(show) #pragma pack(4u) #pragma pack(show) #pragma pack(push, r1, 16ll) #pragma pack(show) #pragma pack(pop, r1, 2) #pragma pack(show) #pragma pack(push, foo, 16) #pragma pack(show) #pragma pack(push, bar, 4) #pragma pack(push, foo, 4) #pragma pack(show) #pragma pack() #pragma pack(show) #pragma pack(pop, bar) #pragma pack(show) #pragma pack(pop, foo) #pragma pack(show) // TODO clang says 2 #pragma pack(pop, foo) #pragma pack(show) #pragma pack(pop, foo) #pragma pack(show) #pragma pack #pragma pack(foo) #pragma pack(3) #pragma pack(push, +) #pragma pack(push, pop) #define TESTS_SKIPPED 1 #define EXPECTED_ERRORS "pack.c:2:14: warning: value of #pragma pack(show) == 8" \ "pack.c:4:14: warning: value of #pragma pack(show) == 4" \ "pack.c:6:14: warning: value of #pragma pack(show) == 16" \ "pack.c:7:14: warning: specifying both a name and alignment to 'pop' is undefined" \ "pack.c:8:14: warning: value of #pragma pack(show) == 2" \ "pack.c:11:14: warning: value of #pragma pack(show) == 16" \ "pack.c:14:14: warning: value of #pragma pack(show) == 4" \ "pack.c:16:14: warning: value of #pragma pack(show) == 8" \ "pack.c:19:14: warning: value of #pragma pack(show) == 16" \ "pack.c:21:14: warning: value of #pragma pack(show) == 4" \ "pack.c:22:14: warning: #pragma pack(pop, ...) failed: stack empty [-Wignored-pragmas]" \ "pack.c:23:14: warning: value of #pragma pack(show) == 2" \ "pack.c:24:14: warning: #pragma pack(pop, ...) failed: stack empty [-Wignored-pragmas]" \ "pack.c:25:14: warning: value of #pragma pack(show) == 2" \ "pack.c:29:13: warning: missing '(' after '#pragma pack' - ignoring [-Wignored-pragmas]" \ "pack.c:29:14: warning: unknown action for '#pragma pack' - ignoring [-Wignored-pragmas]" \ "pack.c:30:14: warning: expected #pragma pack parameter to be '1', '2', '4', '8', or '16' [-Wignored-pragmas]" \ "pack.c:31:20: warning: expected integer or identifier in '#pragma pack' - ignored [-Wignored-pragmas]" \
0
repos/arocc/test
repos/arocc/test/cases/debug dump macros.c
//aro-args -E -dM #define CHECK_PARTIAL_MATCH #define FOO 42 #define BAR FOO int x = FOO; #undef BAR #define BAR 43
0
repos/arocc/test
repos/arocc/test/cases/stringify backslashes.c
#define NO_ERROR_VALIDATION #define str(s) #s x[str() x[str(\) x[str(\\) x[str(\\\) x[str(\\\\)
0
repos/arocc/test
repos/arocc/test/cases/colon after #embed.c
#define NO_ERROR_VALIDATION #embed "embed byte"n:
0
repos/arocc/test
repos/arocc/test/cases/integer literal promotion warning gcc 64.c
//aro-args --emulate=gcc --target=x86_64-linux-gnu _Static_assert(__builtin_types_compatible_p(typeof(18446744073709550592), __int128), ""); #define EXPECTED_ERRORS "integer literal promotion warning gcc 64.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/c23 stdint.c
//aro-args -std=c23 #include <stdint.h> #include "test_helpers.h" #ifndef INTPTR_WIDTH #error INTPTR_WIDTH #endif #ifndef UINTPTR_WIDTH #error UINTPTR_WIDTH #endif #ifndef INTMAX_WIDTH #error INTMAX_WIDTH #endif #ifndef UINTMAX_WIDTH #error UINTMAX_WIDTH #endif #ifndef PTRDIFF_WIDTH #error PTRDIFF_WIDTH #endif #ifndef SIZE_WIDTH #error SIZE_WIDTH #endif #ifndef WCHAR_WIDTH #error WCHAR_WIDTH #endif intmax_t intmax = SIZE_MAX; uintmax_t uintmax = UINTMAX_MAX; intptr_t intprt = INTPTR_MAX; uintptr_t uintptr = UINTPTR_MAX; void int64(void) { int64_t x = INT64_MAX; uint64_t y = UINT64_MAX; x = INT64_MIN; x = INT64_C(0); y = UINT64_C(0); _Static_assert(INT64_MAX == 9223372036854775807LL); _Static_assert(INT64_MIN == -9223372036854775807LL - 1LL); _Static_assert(UINT64_MAX == 18446744073709551615ULL); _Static_assert(INT64_WIDTH == 64); _Static_assert(UINT64_WIDTH == 64); EXPECT_TYPE(INT64_C(0), __INT64_TYPE__); EXPECT_TYPE(UINT64_C(0), __UINT64_TYPE__); } void int32(void) { int32_t x = INT32_MAX; uint32_t y = UINT32_MAX; x = INT32_MIN; x = INT32_C(0); y = UINT32_C(0); _Static_assert(INT32_MAX == 2147483647); _Static_assert(INT32_MIN == -2147483648); _Static_assert(UINT32_MAX == 4294967295U); _Static_assert(INT32_WIDTH == 32); _Static_assert(UINT32_WIDTH == 32); EXPECT_TYPE(INT32_C(0), __INT32_TYPE__); EXPECT_TYPE(UINT32_C(0), __UINT32_TYPE__); } void int16(void) { int16_t x = INT16_MAX; uint16_t y = UINT16_MAX; x = INT16_MIN; x = INT16_C(0); y = UINT16_C(0); _Static_assert(INT16_MAX == 32767); _Static_assert(INT16_MIN == -32768); _Static_assert(UINT16_MAX == 65535U); _Static_assert(INT16_WIDTH == 16); _Static_assert(UINT16_WIDTH == 16); } void int8(void) { int8_t x = INT8_MAX; uint8_t y = UINT8_MAX; x = INT8_MIN; x = INT8_C(0); y = UINT8_C(0); _Static_assert(INT8_MAX == 127); _Static_assert(INT8_MIN == -128); _Static_assert(UINT8_MAX == 255U); _Static_assert(INT8_WIDTH == 8); _Static_assert(UINT8_WIDTH == 8); }
0
repos/arocc/test
repos/arocc/test/cases/call.c
struct Foo { int a; }; extern void b(_Bool b); extern void i(int); extern void f(float); extern void ip(int *); extern void s(struct Foo); extern void var(int, ...); void foo(void) { b(1); b(1.f); b((int *)1); b((void)1); i(1); i(1.f); i((int *)1); f(1); f(2.); f((int *)1); ip(1); ip((int *)1); ip(2.f); struct Foo a; s(a); s(1); var(1, 1.f, (char)1, a); } enum E; void bar(enum E e) { baz(e); } void void_star_param(void *p) {} void call_void_star(void) { void_star_param(0); void_star_param(4.0); struct S { int x; } s; void_star_param(s); void_star_param(&s); void_star_param((_Complex int)42); long x; ip(&x); } void signed_int(int *p) {} void call_with_unsigned(void) { unsigned int x = 0; signed_int(&x); } void func_no_proto(); void pass_args_to_no_proto(int a) { func_no_proto(a); } #define EXPECTED_ERRORS "call.c:16:7: error: passing 'void' to parameter of incompatible type '_Bool'" \ "call.c:5:21: note: passing argument to parameter here" \ "call.c:19:7: warning: implicit pointer to integer conversion from 'int *' to 'int' [-Wint-conversion]" \ "call.c:6:18: note: passing argument to parameter here" \ "call.c:22:7: error: passing 'int *' to parameter of incompatible type 'float'" \ "call.c:7:20: note: passing argument to parameter here" \ "call.c:23:8: warning: implicit integer to pointer conversion from 'int' to 'int *' [-Wint-conversion]" \ "call.c:8:20: note: passing argument to parameter here" \ "call.c:25:8: error: passing 'float' to parameter of incompatible type 'int *'" \ "call.c:8:20: note: passing argument to parameter here" \ "call.c:28:7: error: passing 'int' to parameter of incompatible type 'struct Foo'" \ "call.c:9:25: note: passing argument to parameter here" \ "call.c:33:17: error: parameter has incomplete type 'enum E'" \ "call.c:34:5: error: call to undeclared function 'baz'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]" \ "call.c:41:21: error: passing 'double' to parameter of incompatible type 'void *'" \ "call.c:37:28: note: passing argument to parameter here" \ "call.c:45:21: error: passing 'struct S' to parameter of incompatible type 'void *'" \ "call.c:37:28: note: passing argument to parameter here" \ "call.c:47:21: error: passing '_Complex int' to parameter of incompatible type 'void *'" \ "call.c:37:28: note: passing argument to parameter here" \ "call.c:49:8: warning: passing 'long *' to parameter of incompatible type 'int *' [-Wincompatible-pointer-types]" \ "call.c:8:20: note: passing argument to parameter here" \ "call.c:56:16: warning: passing 'unsigned int *' to parameter of incompatible type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign]" \ "call.c:52:22: note: passing argument to parameter here" \ "call.c:61:19: 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]" \
0
repos/arocc/test
repos/arocc/test/cases/misplaced attribute.c
__attribute__ ((aligned (8))) struct S { short f[3]; }; __attribute__ ((packed)) union U { int x; }; __attribute__ ((aligned)) enum E { e }; #define EXPECTED_ERRORS \ "misplaced attribute.c:1:18: warning: attribute 'aligned' is ignored, place it after \"struct\" to apply attribute to type declaration [-Wignored-attributes]" \ "misplaced attribute.c:2:18: warning: attribute 'packed' is ignored, place it after \"union\" to apply attribute to type declaration [-Wignored-attributes]" \ "misplaced attribute.c:3:18: warning: attribute 'aligned' is ignored, place it after \"enum\" to apply attribute to type declaration [-Wignored-attributes]" \
0
repos/arocc/test
repos/arocc/test/cases/c23 char8_t disabled.c
//aro-args -std=c23 -fno-char8_t void foo(void) { char8_t c = 0; } _Static_assert(_Generic(u8"hello", char*: 1, default: 2) == 1, "Incorrect type for u8 string literal"); _Static_assert(_Generic(u8"A"[0], char: 1, default: 2) == 1, "Incorrect type for u8 string literal element"); const char cbuf1[] = u8"text"; const char cbuf2[] = { u8"text" }; const signed char scbuf1[] = u8"text"; const signed char scbuf2[] = { u8"text" }; const unsigned char ucbuf1[] = u8"text"; const unsigned char ucbuf2[] = { u8"text" }; #define EXPECTED_ERRORS "c23 char8_t disabled.c:4:5: error: use of undeclared identifier 'char8_t'" \
0
repos/arocc/test
repos/arocc/test/cases/gnu alignof.c
//aro-args -std=gnu17 void foo(void) { (void) _Alignof 2; (void) _Alignof(2); }
0
repos/arocc/test
repos/arocc/test/cases/empty va args comma delete c99.c
//aro-args -E -std=c99 -P #define ZERO_ARGS(...) foo(a, ##__VA_ARGS__) ZERO_ARGS() ZERO_ARGS(b)
0
repos/arocc/test
repos/arocc/test/cases/assignment.c
void foo(void) { 1 = 1; const int a = 2; a = 1; _Bool b; b = 5.5f; b = (int *)5L; b *= 5.5f; int c; c = a; c *= a; c = (int *)6L; c *= (int *)7L; float d; d = b; d ^= 4; int *e; e = (int *)1L; e += 2; e *= 3; struct Foo { int a; } f, g; f = g; f *= g; int arr[4]; arr = 4; int *x; x = 0; x = (0); x = 2; volatile struct Foo h; h = f; char *i; i = x; { char *y = 0; int *z = y; z = y; } { const int *y = 0; int *z = y; z = y; } { char *x = 0; const char *y = x; y = x; } (int){1} = 1; (const int){2} = 1; const struct { int a; } *j; j->a = 1; const int k[3]; k[2] = 1; const int *l; *l = 1; foo = 0; } void bar(void) { int *a; void *b; a = b; b = a; } void baz(void) { enum E e; e = 0; } int qux(void) { typedef const int A; A a; a = 1; return a; } void different_sign(void) { int x = 0; unsigned int *y; y = &x; } void constant_sign_conversion(void) { unsigned char x = 1000; #pragma GCC diagnostic push #pragma GCC diagnostic warning "-Wsign-conversion" unsigned int u = -1; #pragma GCC diagnostic pop } #define EXPECTED_ERRORS "assignment.c:2:7: error: expression is not assignable" \ "assignment.c:4:7: error: expression is not assignable" \ "assignment.c:6:7: warning: implicit conversion from 'float' to '_Bool' changes value from 5.5 to true [-Wfloat-conversion]" \ "assignment.c:12:7: warning: implicit pointer to integer conversion from 'int *' to 'int' [-Wint-conversion]" \ "assignment.c:13:7: error: invalid operands to binary expression ('int' and 'int *')" \ "assignment.c:16:7: error: invalid operands to binary expression ('float' and 'int')" \ "assignment.c:20:7: error: invalid operands to binary expression ('int *' and 'int')" \ "assignment.c:25:7: error: invalid operands to binary expression ('struct Foo' and 'struct Foo')" \ "assignment.c:27:9: error: expression is not assignable" \ "assignment.c:31:7: warning: implicit integer to pointer conversion from 'int' to 'int *' [-Wint-conversion]" \ "assignment.c:35:7: warning: incompatible pointer types assigning to 'char *' from incompatible type 'int *' [-Wincompatible-pointer-types]" \ "assignment.c:38:18: warning: incompatible pointer types initializing 'int *' from incompatible type 'char *' [-Wincompatible-pointer-types]" \ "assignment.c:39:11: warning: incompatible pointer types assigning to 'int *' from incompatible type 'char *' [-Wincompatible-pointer-types]" \ "assignment.c:43:18: warning: initializing 'int *' from incompatible type 'const int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]" \ "assignment.c:44:11: warning: assigning to 'int *' from incompatible type 'const int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]" \ "assignment.c:52:20: error: expression is not assignable" \ "assignment.c:56:10: error: expression is not assignable" \ "assignment.c:58:10: error: expression is not assignable" \ "assignment.c:60:8: error: expression is not assignable" \ "assignment.c:61:9: error: expression is not assignable" \ "assignment.c:72:12: error: variable has incomplete type 'enum E'" \ "assignment.c:79:7: error: expression is not assignable" \ "assignment.c:86:7: warning: incompatible pointer types assigning to 'unsigned int *' from incompatible type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign]" \ "assignment.c:90:23: warning: implicit conversion from 'int' to 'unsigned char' changes value from 1000 to 232 [-Wconstant-conversion]" \ "assignment.c:94:22: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion]" \
0
repos/arocc/test
repos/arocc/test/cases/generic.c
void foo(void) { _Generic(0); _Generic(1,); _Generic(2, const int: 3); _Generic(4, default: 5, default: 6); (void)_Generic(7, double: 8, double: 9); (void)_Generic(7, int: 8, int: 9); _Static_assert(_Generic(7, int[2]: 8, int(int): 9, default: 1) == 1, "test failure"); _Static_assert(_Generic(7, default: 1) == 1, "test failure"); _Static_assert(_Generic("hello", char *: 1, default: 2) == 1, "test failure"); _Generic(0, int: 8, long: bar()); } #define EXPECTED_ERRORS "generic.c:2:15: error: expected ',', found ')'" \ "generic.c:3:16: error: expected a type" \ "generic.c:4:17: warning: generic association with qualifiers cannot be matched with [-Wgeneric-qual-type]" \ "generic.c:5:29: error: duplicate default generic association" \ "generic.c:5:17: note: previous case defined here" \ "generic.c:6:34: error: type 'double' in generic association compatible with previously specified type" \ "generic.c:6:23: note: compatible type 'double' specified here" \ "generic.c:6:20: error: controlling expression type 'int' not compatible with any generic association type" \ "generic.c:7:31: error: type 'int' in generic association compatible with previously specified type" \ "generic.c:7:23: note: compatible type 'int' specified here" \ "generic.c:8:32: warning: generic association array type cannot be matched with [-Wgeneric-qual-type]" \ "generic.c:8:43: warning: generic association function type cannot be matched with [-Wgeneric-qual-type]" \ "generic.c:11:31: error: call to undeclared function 'bar'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]" \
0
repos/arocc/test
repos/arocc/test/cases/basic math.c
_Static_assert(1 + 1u == 2, "unexpected result");
0
repos/arocc/test
repos/arocc/test/cases/gnuc version override.c
//aro-args -fgnuc-version=5.3.42 _Static_assert(__GNUC__ == 5, ""); _Static_assert(__GNUC_MINOR__ == 3, ""); _Static_assert(__GNUC_PATCHLEVEL__ == 42, "");
0
repos/arocc/test
repos/arocc/test/cases/newline splicing.c
#de\ fine st\ r(x) #\ x void foo(void) { const char bar[] = str("\ "); _Static_assert(sizeof(bar) == 3, "wrong size"); const char baz[] = str(a.\ b); _Static_assert(sizeof(baz) == 4, "wrong size"); int ab\ c = 5; abc = 10; a\ bc = 5; char q\ ux[] = "\ ab\ c"; _Stat\ ic_assert(siz\ eof(qu\ x) =\ = 4, "wrong size"); } int trailing\ ws = 1; #define EXPECTED_ERRORS "newline splicing.c:31:14: warning: backslash and newline separated by space [-Wbackslash-newline-escape]" \
0
repos/arocc/test
repos/arocc/test/cases/decayed attributed array.c
__attribute__((aligned)) int arr[1] = {0}; int *ptr = arr; void foo(void) { _Alignas(8) char x[64]; char *y = &(x)[0]; }
0
repos/arocc/test
repos/arocc/test/cases/float builtins.c
_Static_assert(__builtin_isinf_sign(__builtin_inf()) == 1, ""); _Static_assert(__builtin_isinf_sign(2.0) == 0, ""); _Static_assert(__builtin_isinf_sign(-5.0 / 0.0) == -1, ""); double d = 10.0; _Static_assert(__builtin_isinf_sign(d) == 0, ""); _Static_assert(!__builtin_isinf(d), ""); _Static_assert(__builtin_inf() == __builtin_inf(), ""); _Static_assert(100.0 < __builtin_inf(), ""); _Static_assert(__builtin_inf() > 0.0, ""); _Static_assert(__builtin_isinf(__builtin_inff()), ""); _Static_assert(__builtin_isinf(__builtin_inf()), ""); _Static_assert(__builtin_isinf(__builtin_infl()), ""); _Static_assert(__builtin_isinf(1.0 / 0.0), ""); _Static_assert(!__builtin_isinf(2.0 + 3.0), ""); #define EXPECTED_ERRORS "float builtins.c:5:16: error: static_assert expression is not an integral constant expression" \ "float builtins.c:6:16: error: static_assert expression is not an integral constant expression" \
0
repos/arocc/test
repos/arocc/test/cases/generic ast.c
int x = _Generic(5, int: 42, double: 32.5 ); int y = _Generic(5, int: 42, double: 32.5, default: "string" ); double z = _Generic(5, default: 32 );
0
repos/arocc/test
repos/arocc/test/cases/native half type.c
//aro-args -fnative-half-type void foo(void) { __fp16 x = 1.0f; __fp16 y = 2.0f; x = x + y; }
0
repos/arocc/test
repos/arocc/test/cases/invalid _BitInt pointer.c
#define NO_ERROR_VALIDATION _BitInt(1) *e= __real__ e;
0
repos/arocc/test
repos/arocc/test/cases/intptr_t.c
//aro-args --target=x86_64-linux-gnu #include "test_helpers.h" _Static_assert(__INTPTR_MAX__ == 9223372036854775807L, ""); _Static_assert(__INTPTR_WIDTH__ == 64, ""); EXPECT_TYPE(__INTPTR_TYPE__, long); _Static_assert(__UINTPTR_MAX__ == 18446744073709551615UL, ""); _Static_assert(__UINTPTR_WIDTH__ == 64, ""); EXPECT_TYPE(__UINTPTR_TYPE__, unsigned long);
0
repos/arocc/test
repos/arocc/test/cases/incorrect macro arg count.c
//aro-args -E -P #define TWO_ARGS(A, B) A B TWO_ARGS() TWO_ARGS(A) TWO_ARGS(A, B, C) TWO_ARGS(,,,) #define EXPECTED_ERRORS "incorrect macro arg count.c:5:1: error: expected 2 argument(s) got 1" \ "incorrect macro arg count.c:6:1: error: expected 2 argument(s) got 1" \ "incorrect macro arg count.c:7:1: error: expected 2 argument(s) got 3" \ "incorrect macro arg count.c:8:1: error: expected 2 argument(s) got 4" \
0
repos/arocc/test
repos/arocc/test/cases/functions.c
int foo(int bar) { (void)sizeof(struct Foo { int a; }); (void)__alignof(struct Foo); return bar; } int fooo(bar, baz) float bar; int *baz; double quux; { return *baz * bar; } int foooo(n, bar) int n; int bar[n]; {} int bar(int) = foo; int baz(int a[*]) { return a[0]; } static int GLOBAL = 1; int nested_scopes(int a, int b) { if (a == 1) { int target; target = 1; return b == target; } else { int target = 2; if (b == target) { return GLOBAL == 1; } return target == 2; } } struct S; void forward_decl_struct(struct S s) {} void forward_decl_struct_old(s) struct S s; {} typedef union Union U; void forward_decl_union_td(U u) {} void forward_decl_union_td_old(u) U u; {} void inline_decl_enum(enum E e) {} void inline_decl_enum_old(e) enum EE e; {} void unspecified_variable_len(int, int [][*]); typedef void (*func_pointer)(int, int[][*]); void unspecified_variable_len(int n, int x[][n]) { } static func_pointer p = unspecified_variable_len; void static_array_parameter(x) int x[static 5]; {} int(wrapped)(void) { return 0; } int ARRAY[2]; int (*return_array_ptr(void))[2] { return &ARRAY; } void no_params(void); void no_params(int x){} void invalid_func(__auto_type); int invalid_int = invalid_func; #define EXPECTED_ERRORS "functions.c:10:12: error: parameter named 'quux' is missing" \ "functions.c:20:14: error: illegal initializer (only variables can be initialized)" \ "functions.c:18:2: warning: non-void function 'foooo' does not return a value [-Wreturn-type]" \ "functions.c:22:13: error: variable length array must be bound in function definition" \ "functions.c:42:35: error: parameter has incomplete type 'struct S'" \ "functions.c:44:10: error: parameter has incomplete type 'struct S'" \ "functions.c:48:30: error: parameter has incomplete type 'union Union'" \ "functions.c:50:3: error: parameter has incomplete type 'union Union'" \ "functions.c:53:30: error: parameter has incomplete type 'enum E'" \ "functions.c:55:9: error: parameter has incomplete type 'enum EE'" \ "functions.c:79:6: error: redefinition of 'no_params' with a different type" \ "functions.c:78:6: note: previous definition is here" \ "functions.c:81:19: error: '__auto_type' not allowed in function prototype" \
0
repos/arocc/test
repos/arocc/test/cases/standard-concatenation-strings-example.c
//aro-args -E -P #define str(s) # s #define xstr(s) str(s) #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \ x ## s, x ## t) #define INCFILE(n) vers ## n #define glue(a, b) a ## b #define xglue(a, b) glue(a, b) #define HIGHLOW "hello" #define LOW LOW ", world" debug(1, 2); fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away == 0) str(: @\n), s); xstr(INCFILE(2).h) xstr(INCFILE(2) . h) str(INCFILE(2).h) str(INCFILE(2) . h) glue(HIGH, LOW); xglue(HIGH, LOW)
0
repos/arocc/test
repos/arocc/test/cases/enum attributes clang.c
//aro-args --emulate=clang enum E { is_deprecated __attribute__((deprecated)), is_deprecated_with_msg __attribute__((deprecated("I am deprecated"))), is_unavailable __attribute__((unavailable)), is_unavailable_with_msg __attribute__((unavailable("I am not available"))), newval, }; void foo(void) { int a = newval; a = is_deprecated; a = is_deprecated_with_msg; a = is_unavailable; a = is_unavailable_with_msg; } enum __attribute__((aligned(16))) Attributed { Val, }; _Static_assert(_Alignof(enum Attributed) == 16, "enum align"); enum Trailing { Foo } __attribute__((aligned(32))); _Static_assert(_Alignof(enum Trailing) == 32, "enum align"); enum __attribute__((vector_size(32))) VectorSize1; enum __attribute__((vector_size(32))) VectorSize2 { A }; #define EXPECTED_ERRORS "enum attributes clang.c:12:7: warning: 'is_deprecated' is deprecated [-Wdeprecated-declarations]" \ "enum attributes clang.c:3:33: note: 'is_deprecated' has been explicitly marked deprecated here" \ "enum attributes clang.c:13:7: warning: 'is_deprecated_with_msg' is deprecated: I am deprecated [-Wdeprecated-declarations]" \ "enum attributes clang.c:4:42: note: 'is_deprecated_with_msg' has been explicitly marked deprecated here" \ "enum attributes clang.c:14:7: error: 'is_unavailable' is unavailable" \ "enum attributes clang.c:5:34: note: 'is_unavailable' has been explicitly marked unavailable here" \ "enum attributes clang.c:15:7: error: 'is_unavailable_with_msg' is unavailable: I am not available" \ "enum attributes clang.c:6:44: note: 'is_unavailable_with_msg' has been explicitly marked unavailable here" \
0
repos/arocc/test
repos/arocc/test/cases/avr sizeof long.c
//aro-args --target=avr-freestanding-none _Static_assert(sizeof(int) == 2, "wrong sizeof int"); _Static_assert(sizeof(unsigned) == 2, "wrong sizeof unsigned"); _Static_assert(sizeof(short) == 2, "wrong sizeof short"); _Static_assert(sizeof(unsigned short) == 2, "wrong sizeof unsigned short"); _Static_assert(sizeof(long) == 4, "wrong sizeof long"); _Static_assert(sizeof(unsigned long) == 4, "wrong sizeof unsigned long"); _Static_assert(sizeof(long double) == 4, "wrong sizeof long double"); _Static_assert(sizeof(long long) == 8, "wrong sizeof long long"); _Static_assert(sizeof(unsigned long long) == 8, "wrong sizeof unsigned long long");
0
repos/arocc/test
repos/arocc/test/cases/standard attributes.c
//aro-args -std=c23 #pragma GCC diagnostic ignored "-Wgnu-alignof-expression" #if __has_c_attribute(foo) || __has_c_attribute(foo::bar) #error fail #endif #if !__has_c_attribute(deprecated) || !__has_c_attribute(gnu::__aligned__) #error fail #endif void foo(void) { [[deprecated]] int x; x = 5; } [[nodiscard]] int bar(void) { [[__gnu__::__aligned__(16)]] int x; _Static_assert(_Alignof(x) == 16, "incorrect alignment"); return 5; } #define EXPECTED_ERRORS "standard attributes.c:15:5: warning: 'x' is deprecated [-Wdeprecated-declarations]" \ "standard attributes.c:14:7: note: 'x' has been explicitly marked deprecated here" \
0
repos/arocc/test
repos/arocc/test/cases/typeof_unqual.c
//aro-args -std=c23 const int a; typeof(a) b; typeof_unqual(a) c;
0
repos/arocc/test
repos/arocc/test/cases/layout overflow.c
//aro-args -fdeclspec struct S { char x[2305843009213693952ULL -1]; char y[2305843009213693952ULL -1]; }; struct __declspec(align(268435456)) S1 { char one; char two[2]; char eight[8]; char four[4]; }; struct S2 { __attribute__((aligned(268435456))) int x; }; union U { int a; char bytes[3333333333333333333]; }; #define EXPECTED_ERRORS "layout overflow.c:3:8: error: type 'struct S' is too large" \ "layout overflow.c:22:15: error: array is too large" \ "layout overflow.c:20:7: error: type 'union U' is too large" \
0
repos/arocc/test
repos/arocc/test/cases/object macro expands to function macro.c
#define FOO(X) X##OK #define BAR FOO #define BAZ BAR #define A 1 #if BAZ (A) #endif
0
repos/arocc/test
repos/arocc/test/cases/labeled return.c
int foo(int x) { bar: return x; }
0
repos/arocc/test
repos/arocc/test/cases/__has_extension.c
#if defined __has_extension # if __has_extension(c_alignas) #error extension exists # endif # if __has_extension(does_not_exist) #error extension exists # endif #endif #define EXPECTED_ERRORS "__has_extension.c:3:8: error: extension exists"
0
repos/arocc/test
repos/arocc/test/cases/object macro token pasting.c
//aro-args -E -P #define x a##1 x #define a 1 x
0
repos/arocc/test
repos/arocc/test/cases/float header netbsd 6.99.26.c
//aro-args -E --target=x86-netbsd.6.99.26-gnu -std=c11 -P #include <float.h> DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX_10_EXP DBL_MAX_EXP DBL_MAX DBL_MIN_10_EXP DBL_MIN_EXP DBL_MIN DECIMAL_DIG FLT_DIG FLT_EPSILON FLT_MANT_DIG FLT_MAX_10_EXP FLT_MAX_EXP FLT_MAX FLT_MIN_10_EXP FLT_MIN_EXP FLT_MIN FLT_RADIX LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MAX LDBL_MIN_10_EXP LDBL_MIN_EXP LDBL_MIN FLT_EVAL_METHOD
0
repos/arocc/test
repos/arocc/test/cases/complex values.c
//aro-args -std=c23 _Static_assert(1.0 + 2.0i == 2.0i + 1.0, ""); _Static_assert(2.0i * 2.0i == -4.0, ""); _Static_assert((double)2.0i == 0, ""); _Static_assert((double)(_Complex double)42 == 42, ""); _Static_assert(-2.0i - 2.0i == -4.0i, ""); _Static_assert(~(2.0 + 4.0i) == 2.0 - 4.0i, ""); _Static_assert((2.0 + 2.0i) / 2.0 == 1.0 + 1.0i, ""); _Static_assert((2.0 + 4.0i) / 1.0i == 4.0 - 2.0i, ""); void foo(void) { double x = 0.0; _Complex double cd = (_Complex double){x}; cd = (_Complex double){x,}; cd = (_Complex double){x,0.0}; cd = (_Complex double){x,0.0,}; } _Static_assert(__builtin_isnan(__real(0.0/0.0)), ""); _Static_assert(__builtin_isinf(__real((2.0 + 2.0i)/0.0)), ""); _Static_assert(__builtin_isinf(__imag((2.0 + 2.0i)/0.0)), ""); _Static_assert((_Complex double){2.0, __builtin_inf()} == (_Complex double){2.0, 3.0/0.0}, ""); _Static_assert(__builtin_isinf(__imag((_Complex double){2.0, __builtin_inf()})), ""); _Static_assert((_Complex double){2.0} + (_Complex double){2.0, 4.0} == (_Complex double){4.0, 4.0}, ""); _Static_assert(1.0 / (_Complex double){__builtin_inf(), __builtin_nan("")} == 0.0, ""); constexpr _Complex double product = (_Complex double){__builtin_inf(), __builtin_nan("") * 2.0}; _Static_assert(__builtin_isinf(__real__ product), ""); _Static_assert(__builtin_isnan(__imag__ product), ""); _Complex double a = (_Complex double) {1.0, 2.0,}; _Complex double b = (_Complex double) {1.0, 2.0,,,,,,}; _Complex double c = (_Complex double) {1.0, 2.0,3.0}; _Static_assert(3 + 4.0il == 3 + 4.0il, ""); _Static_assert(5ll + 4.0il == 5ll + 4.0il, ""); unsigned long complex_integer = 2.0i; bool b = 3 != 2.0i; #define EXPECTED_ERRORS "complex values.c:31:49: error: expected expression" \ "complex values.c:32:49: warning: excess elements in scalar initializer [-Wexcess-initializers]" \