Modules: Fix checks under -Werror=strict-prototypes

This fixes configuration checks when using -Werror=strict-prototypes or
-Wstrict-prototypes compiler flag, for example, via the CMAKE_C_FLAGS.
This commit is contained in:
Peter Kokot 2024-03-20 12:42:48 +01:00
parent a17d76f291
commit 1a4610269a
No known key found for this signature in database
GPG Key ID: 56322FE83A7566FC
4 changed files with 6 additions and 6 deletions

View File

@ -66,7 +66,7 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
int main(void)
{
(void)sizeof(((${_STRUCT} *)0)->${_MEMBER});
return 0;

View File

@ -101,7 +101,7 @@ if(NOT DEFINED Iconv_IS_BUILT_IN)
"
#include <stddef.h>
#include <iconv.h>
int main() {
int main(void) {
char *a, *b;
size_t i, j;
iconv_t ic;

View File

@ -72,7 +72,7 @@ be returned with OpenACC_<lang>_FLAGS.
set(OpenACC_C_CXX_TEST_SOURCE
"
int main(){
int main(void){
#ifdef _OPENACC
return 0;
#else
@ -102,7 +102,7 @@ const char accver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'A',
('0' + ((_OPENACC/10)%10)),
('0' + ((_OPENACC/1)%10)),
']', '\\0' };
int main()
int main(void)
{
puts(accver_str);
return 0;

View File

@ -210,8 +210,8 @@ endmacro()
# TODO: Install this macro separately?
macro(_check_c_compiler_attribute _ATTRIBUTE _RESULT)
check_source_compiles(C "${_ATTRIBUTE} int somefunc() { return 0; }
int main() { return somefunc();}" ${_RESULT}
check_source_compiles(C "${_ATTRIBUTE} int somefunc(void) { return 0; }
int main(void) { return somefunc();}" ${_RESULT}
)
endmacro()