Skip to content

Commit 2a742c1

Browse files
committed
Fixes mpaland#137: Use strict C prototypes
* Now using `func_name(void)` instead of `func_name()` in declarations, wherever relevant * Now checking for strict prototypes when compiling C test programs
1 parent a7f0e1c commit 2a742c1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ foreach(tgt ${test_targets})
7171
-fverbose-asm
7272
-Wunused-parameter
7373
)
74+
target_compile_options(${tgt} PRIVATE
75+
"$<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>"
76+
)
7477
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
7578
target_compile_options(${tgt} PRIVATE -ffat-lto-objects)
7679
endif()

test/aliasing.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ void putchar_(char c)
2525
}
2626
}
2727

28-
void clear_buffer()
28+
void clear_buffer(void)
2929
{
3030
for(int i = 0; i < BufferSize; i++) {
3131
buffer[i] = '\0';
3232
}
3333
}
3434

35-
int main()
35+
int main(void)
3636
{
3737
#if PRINTF_ALIAS_STANDARD_FUNCTION_NAMES
3838
clear_buffer();

0 commit comments

Comments
 (0)