Skip to content

Commit b3b83ac

Browse files
authored
[offload][lit] Fix compilation of two offload tests (#169399)
These are C tests, not C++, so no function parameters means unspecified number of parameters, not `void`. These compile fine on the current tested offload targets because an error is only [thrown](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaDecl.cpp#L10695) if the calling convention doesn't support variadic arguments, which they happen to. When compiling this test for other targets that do not support variadic arguments, we get an error, which does not seem intentional. Just add `void` to the parameter list. --------- Signed-off-by: Nick Sarnie <[email protected]>
1 parent 3564870 commit b3b83ac

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

offload/test/offloading/shared_lib_fp_mapping.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <stdio.h>
99

10-
extern int func(); // Provided in liba.so, returns 42
11-
typedef int (*fp_t)();
10+
extern int func(void); // Provided in liba.so, returns 42
11+
typedef int (*fp_t)(void);
1212

1313
int main() {
1414
int x = 0;

offload/test/offloading/static_linking.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int foo() {
1414
}
1515
#else
1616
#include <stdio.h>
17-
int foo();
17+
int foo(void);
1818

1919
int main() {
2020
int x = foo();

0 commit comments

Comments
 (0)