Tests: Fix clang -Wstrict-prototypes warnings

This commit is contained in:
Brad King
2023-10-25 10:39:15 -04:00
parent 35424aab2e
commit 264dcae5e4
271 changed files with 330 additions and 330 deletions

View File

@@ -1,5 +1,5 @@
extern int foo(void);
int main()
int main(void)
{
return foo();
}

View File

@@ -3,7 +3,7 @@
__declspec(dllimport)
#endif
int link_depends_no_shared_lib(void);
int main()
int main(void)
{
return link_depends_no_shared_lib() + link_depends_no_shared_exe_value;
}

View File

@@ -39,6 +39,6 @@
# error Expected LANG_IS_C_OR_CXX
#endif
void consumer_c()
void consumer_c(void)
{
}

View File

@@ -6,7 +6,7 @@ int foo(int* restrict a, int* restrict b)
return 0;
}
int main()
int main(void)
{
return 0;
}

View File

@@ -8,7 +8,7 @@ int bar(int* restrict a, int* restrict b)
return foo(a, b);
}
int main()
int main(void)
{
return 0;
}

View File

@@ -35,6 +35,6 @@
# endif
#endif
void consumer_c()
void consumer_c(void)
{
}

View File

@@ -15,7 +15,7 @@
# endif
#endif
int consumer_c()
int consumer_c(void)
{
return 0;
}

View File

@@ -1,7 +1,7 @@
# A dummy checker implementation that does not write the requested output file
# so it triggers an error for every checker.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(){return 0;}\n")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(void){return 0;}\n")
configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in"

View File

@@ -4,7 +4,7 @@
#include "libc1.h"
#include "libc2.h"
int main()
int main(void)
{
int class = 0;
if (LibC1Func() != 2.0) {

View File

@@ -1,4 +1,4 @@
float LibC1Func()
float LibC1Func(void)
{
return 2.0;
}

View File

@@ -1,6 +1,6 @@
#include "libc2.h"
float LibC2Func()
float LibC2Func(void)
{
return 1.0;
}

View File

@@ -1,6 +1,6 @@
#include <stdio.h>
int main()
int main(void)
{
printf("Hello, World!\n");
return 42;

View File

@@ -1,4 +1,4 @@
int main()
int main(void)
{
return 0;
}

View File

@@ -1,4 +1,4 @@
int main()
int main(void)
{
return 0;
}

View File

@@ -6,7 +6,7 @@
# error "BUILD_CONFIG_NAME not defined!"
#endif
int main()
int main(void)
{
char build_config_name[] = BUILD_CONFIG_NAME;
char* c;

View File

@@ -9,7 +9,7 @@ int someFunc(int i1, char c, int i2)
#define FUNC_WRAPPER(...) someFunc(__VA_ARGS__)
void otherFunc()
void otherFunc(void)
{
FUNC_WRAPPER(42, 'a', 7);
}

View File

@@ -26,7 +26,7 @@
# endif
#endif
int main()
int main(void)
{
return 0;
}

View File

@@ -38,6 +38,6 @@
# endif
#endif
int main()
int main(void)
{
}

View File

@@ -1,4 +1,4 @@
int NameConflictTest1()
int NameConflictTest1(void)
{
return 0;
}

View File

@@ -1,4 +1,4 @@
int NameConflictTest2()
int NameConflictTest2(void)
{
return 0;
}

View File

@@ -1,4 +1,4 @@
int TestLinkGetType()
int TestLinkGetType(void)
{
#ifdef CMakeTestLinkShared_EXPORTS
return 0;

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
int CsharedFunction()
int CsharedFunction(void)
{
#ifndef TEST_C_FLAGS
printf("TEST_C_FLAGS failed\n");

View File

@@ -1,4 +1,4 @@
int NameConflictTest1()
int NameConflictTest1(void)
{
return 0;
}

View File

@@ -1,4 +1,4 @@
int NameConflictTest2()
int NameConflictTest2(void)
{
return 0;
}

View File

@@ -1,4 +1,4 @@
int TestLinkGetType()
int TestLinkGetType(void)
{
#ifdef CMakeTestLinkShared_EXPORTS
return 0;

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
int CsharedFunction()
int CsharedFunction(void)
{
#ifndef TEST_C_FLAGS
printf("TEST_C_FLAGS failed\n");

View File

@@ -4,7 +4,7 @@ extern int use_cuda(void);
# include <windows.h>
#endif
int main()
int main(void)
{
#ifdef _WIN32
/* Use an API that requires CMake's "standard" C libraries. */

View File

@@ -1,6 +1,6 @@
#if 1
int gen_redirect()
int gen_redirect(void)
{
return 3;
}

View File

@@ -1,4 +1,4 @@
int customTarget()
int customTarget(void)
{
return 0;
}

View File

@@ -1,3 +1,3 @@
void OneFunction()
void OneFunction(void)
{
}

View File

@@ -1,4 +1,4 @@
int a()
int a(void)
{
return 5;
}

View File

@@ -1,6 +1,6 @@
extern int a();
extern int a(void);
int b()
int b(void)
{
return a() + 17;
}

View File

@@ -1,4 +1,4 @@
int b2()
int b2(void)
{
return 3;
}

View File

@@ -1,6 +1,6 @@
extern int b();
extern int b(void);
int c()
int c(void)
{
return b() + 42;
}

View File

@@ -1,6 +1,6 @@
extern int b2();
extern int b2(void);
int c2()
int c2(void)
{
return b2() + 1;
}

View File

@@ -1,6 +1,6 @@
extern int c2();
extern int c2(void);
int d()
int d(void)
{
return c2() + 2;
}

View File

@@ -2,7 +2,7 @@ extern int b();
extern int c();
extern int d();
int main()
int main(void)
{
c();
b();

View File

@@ -1,5 +1,5 @@
extern int foo();
int main()
extern int foo(void);
int main(void)
{
return foo();
}

View File

@@ -1,4 +1,4 @@
int foo()
int foo(void)
{
return 0;
}

View File

@@ -1,6 +1,6 @@
void SevenFunction();
void SevenFunction(void);
void EightFunction()
void EightFunction(void)
{
SevenFunction();
}

View File

@@ -5,7 +5,7 @@ void NoDepCFunction();
void SixAFunction();
void SixBFunction();
int main()
int main(void)
{
SixAFunction();
SixBFunction();

View File

@@ -3,7 +3,7 @@
void FiveFunction();
void EightFunction();
int main()
int main(void)
{
FiveFunction();
EightFunction();

View File

@@ -3,7 +3,7 @@
void FiveFunction();
void EightFunction();
int main()
int main(void)
{
FiveFunction();
EightFunction();

View File

@@ -3,7 +3,7 @@
void FiveFunction();
void TwoFunction();
int main()
int main(void)
{
FiveFunction();
TwoFunction();

View File

@@ -1,6 +1,6 @@
void TwoFunction();
void TwoFunction(void);
void FiveFunction()
void FiveFunction(void)
{
TwoFunction();
}

View File

@@ -1,9 +1,9 @@
#include <two-test.h> /* Requires TwoCustom to be built first. */
void NoDepAFunction();
void OneFunction();
void TwoFunction();
void NoDepAFunction(void);
void OneFunction(void);
void TwoFunction(void);
void FourFunction()
void FourFunction(void)
{
static int count = 0;
if (count == 0) {

View File

@@ -1,3 +1,3 @@
void NoDepAFunction()
void NoDepAFunction(void)
{
}

View File

@@ -1,6 +1,6 @@
void NoDepAFunction();
void NoDepAFunction(void);
void NoDepBFunction()
void NoDepBFunction(void)
{
NoDepAFunction();
}

View File

@@ -1,6 +1,6 @@
void NoDepAFunction();
void NoDepAFunction(void);
void NoDepCFunction()
void NoDepCFunction(void)
{
NoDepAFunction();
}

View File

@@ -1,6 +1,6 @@
void TwoFunction();
void TwoFunction(void);
void SevenFunction()
void SevenFunction(void)
{
TwoFunction();
}

View File

@@ -1,7 +1,7 @@
void FiveFunction();
void TwoFunction();
void FiveFunction(void);
void TwoFunction(void);
void SixAFunction()
void SixAFunction(void)
{
FiveFunction();
TwoFunction();

View File

@@ -1,8 +1,8 @@
void TwoFunction();
void FiveFunction();
void FourFunction();
void TwoFunction(void);
void FiveFunction(void);
void FourFunction(void);
void SixBFunction()
void SixBFunction(void)
{
TwoFunction();
FiveFunction();

View File

@@ -1,7 +1,7 @@
void OneFunction();
void FourFunction();
void OneFunction(void);
void FourFunction(void);
void ThreeFunction()
void ThreeFunction(void)
{
static int count = 0;
if (count == 0) {

View File

@@ -1,10 +1,10 @@
extern void NoFunction();
extern void NoFunction(void);
/* Provide a function that is supposed to be found in the Three
library. If Two links to TwoCustom then TwoCustom will come before
Three and this symbol will be used. Since NoFunction is not
defined, that will cause a link failure. */
void ThreeFunction()
void ThreeFunction(void)
{
NoFunction();
}

View File

@@ -1,6 +1,6 @@
#include <two-test.h>
void TwoFunction()
void TwoFunction(void)
{
static int count = 0;
if (count == 0) {

View File

@@ -1,4 +1,4 @@
int main()
int main(void)
{
return 0;
}

View File

@@ -9,7 +9,7 @@ testExe2_EXPORT int testExe2Func(void)
return 123;
}
int main()
int main(void)
{
return 0;
}

View File

@@ -26,7 +26,7 @@
extern int testLibDepends(void);
int main()
int main(void)
{
return testLibDepends();
}

View File

@@ -7,7 +7,7 @@
testExe2_IMPORT int testExe2Func(void);
testExe2_IMPORT int testExe2lib(void);
int imp_mod1()
int imp_mod1(void)
{
return testExe2Func() + testExe2lib();
}

View File

@@ -21,7 +21,7 @@ extern int testStaticLibPlugin(void);
#endif
extern int testLib4libcfg(void);
int main()
int main(void)
{
return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() +
testLib5() + testLib6() + testLib7() + testLibCycleA1() +

View File

@@ -7,7 +7,7 @@
#ifndef testLibAbs1b
# error "testLibAbs1b not defined"
#endif
int main()
int main(void)
{
return 0 + testLibAbs1();
}

View File

@@ -2,7 +2,7 @@
int testLib8A(void);
int testLib8B(void);
int main()
int main(void)
{
return (testLib8A() + testLib8B());
}

View File

@@ -10,7 +10,7 @@
int testLib9(void);
int main()
int main(void)
{
return testLib9();
}

View File

@@ -1,6 +1,6 @@
extern int imp_lib1(void);
int main()
int main(void)
{
return imp_lib1();
}

View File

@@ -1,4 +1,4 @@
int main()
int main(void)
{
return 0;
}

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
int main()
int main(void)
{
printf("Found ALSA version %s, expected version %s\n",
snd_asoundlib_version(), CMAKE_EXPECTED_ALSA_VERSION);

View File

@@ -13,7 +13,7 @@ typedef int64_t blas_int;
// declare what parts of the blas C-API we need
void dswap_(blas_int* N, double* X, blas_int* incX, double* Y, blas_int* incY);
int main()
int main(void)
{
double x[4] = { 1, 2, 3, 4 };
double y[4] = { 8, 7, 7, 6 };

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
int main()
int main(void)
{
int chunksize = 1024;
FILE* file = fopen("test.bzip2", "wb");

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
int main()
int main(void)
{
struct curl_slist* slist;

View File

@@ -1,6 +1,6 @@
#include <cups/cups.h>
int main()
int main(void)
{
int num_options = 0;
cups_option_t* options = NULL;

View File

@@ -1,6 +1,6 @@
#include <IL/il.h>
int main()
int main(void)
{
// Test 1 requires to link to the library.
ilInit();

View File

@@ -1,6 +1,6 @@
#include <IL/ilu.h>
int main()
int main(void)
{
// IL Utilities requires only initialization.
// Unlike main DevIL there are no shutdown function.

View File

@@ -3,7 +3,7 @@
#include <stdlib.h>
#include <string.h>
int main()
int main(void)
{
XML_Expat_Version expat_version;
char expat_version_string[16];

View File

@@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
int main()
int main(void)
{
FcInit();
printf("Found Fontconfig.\n");

View File

@@ -3,7 +3,7 @@
#include FT_FREETYPE_H
#include <string.h>
int main()
int main(void)
{
FT_Library library;
FT_Error error;

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
int main()
int main(void)
{
printf("Found GDAL version %s, expected version %s\n", GDAL_RELEASE_NAME,
CMAKE_EXPECTED_GDAL_VERSION);

View File

@@ -8,7 +8,7 @@
# define GIFLIB_MAJOR 4
#endif
int main()
int main(void)
{
// because of the API changes we have to test different functions depending
// on the version of GIFLIB

View File

@@ -1,7 +1,7 @@
#include <GL/glut.h>
#include <stdio.h>
int main()
int main(void)
{
/* The following should call exit(1) and print
freeglut ERROR: Function <glutCreateWindow> called

View File

@@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
int main()
int main(void)
{
// test the linker
gnutls_session_t session;

View File

@@ -1,6 +1,6 @@
#include <wand/MagickWand.h>
int main()
int main(void)
{
MagickWand* wand = NewMagickWand();
wand = DestroyMagickWand(wand);

View File

@@ -4,7 +4,7 @@
#include <jpeglib.h>
// clang-format on
int main()
int main(void)
{
/* Without any JPEG file to open, test that the call fails as
expected. This tests that linking worked. */

View File

@@ -4,7 +4,7 @@
#include <jasper/jasper.h>
// clang-format on
int main()
int main(void)
{
/* Without any JPEG file to open, test that the call fails as
expected. This tests that linking worked. */

View File

@@ -14,7 +14,7 @@ typedef int64_t blas_int;
void dgesv_(blas_int*, blas_int*, double*, blas_int*, blas_int*, double*,
blas_int*, blas_int*);
int main()
int main(void)
{
double A[8] = {
0, 1, 2, 3, 4, 5, 6, 7,

View File

@@ -4,7 +4,7 @@
static const uint8_t test_string[9] = "123456789";
int main()
int main(void)
{
static const uint32_t test_vector = 0xCBF43926;

View File

@@ -1,6 +1,6 @@
#include <rhash.h>
int main()
int main(void)
{
rhash_library_init();
return 0;

View File

@@ -1,6 +1,6 @@
#include <uv.h>
int main()
int main(void)
{
uv_loop_close(uv_default_loop());
return 0;

View File

@@ -2,7 +2,7 @@
#include <libxml/tree.h>
#include <string.h>
int main()
int main(void)
{
xmlDoc* doc;

View File

@@ -2,7 +2,7 @@
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
int main()
int main(void)
{
xsltInit();

View File

@@ -4,7 +4,7 @@
#include <stdio.h>
#include <string.h>
int main()
int main(void)
{
xsltInit();

View File

@@ -1,7 +1,7 @@
#include <libinput.h>
#include <stdio.h>
int main()
int main(void)
{
struct libinput_interface interface;
interface.open_restricted = 0;

View File

@@ -3,7 +3,7 @@
#endif
#include <sql.h>
int main()
int main(void)
{
SQLHENV env;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);

View File

@@ -8,7 +8,7 @@ void vecaddgpu(float* r, float* a, float* b, int n)
r[i] = a[i] + b[i];
}
int main()
int main(void)
{
int n = 100000; /* vector length */
float* a; /* input vector 1 */

View File

@@ -4,7 +4,7 @@
# include <CL/cl.h>
#endif
int main()
int main(void)
{
cl_uint platformIdCount;

View File

@@ -9,7 +9,7 @@
#include <stdio.h>
int main()
int main(void)
{
/* Reference a GL symbol without requiring a context at runtime. */
printf("&glGetString = %p\n", &glGetString);

View File

@@ -9,7 +9,7 @@
#include <stdio.h>
int main()
int main(void)
{
/* Reference a GL symbol without requiring a context at runtime. */
printf("&glGetString = %p\n", &glGetString);

View File

@@ -9,7 +9,7 @@
#include <stdio.h>
int main()
int main(void)
{
/* Reference a GL symbol without requiring a context at runtime. */
printf("&glGetString = %p\n", &glGetString);

View File

@@ -1,5 +1,5 @@
#include <omp.h>
int main()
int main(void)
{
#ifndef _OPENMP
breaks_on_purpose

View File

@@ -6,7 +6,7 @@ extern "C"
#endif
int scalprod(int n, double* x, double* y, double* res);
int main()
int main(void)
{
double a[5] = { 1., 2., 3., 4., 5. };
double b[5] = { 2., 3., 4., 5., 6. };

View File

@@ -2,7 +2,7 @@
#include <png.h>
#include <string.h>
int main()
int main(void)
{
png_uint_32 png_version;
char png_version_string[16];

View File

@@ -1,4 +1,4 @@
int main()
int main(void)
{
return 0;
}

Some files were not shown because too many files have changed in this diff Show More