diff options
33 files changed, 86 insertions, 28 deletions
diff --git a/.github/workflows/unusedargs_missingreturn.yml b/.github/workflows/unusedargs_missingreturn.yml index a75a6d5ec..6c373b982 100644 --- a/.github/workflows/unusedargs_missingreturn.yml +++ b/.github/workflows/unusedargs_missingreturn.yml @@ -12,14 +12,17 @@ on: - "test cases/cmake/**" - "test cases/common/**" - "test cases/fortran/**" - - "test cases/platform-linux/**" + - "test cases/linuxlike/**" + - "test caes/windows/**" + pull_request: paths: - ".github/workflows/unusedargs_missingreturn.yml" - "test cases/cmake/**" - "test cases/common/**" - "test cases/fortran/**" - - "test cases/platform-linux/**" + - "test cases/linuxlike/**" + - "test caes/windows/**" jobs: @@ -39,3 +42,20 @@ jobs: CFLAGS: "-Werror=unused-parameter -Werror=return-type -Werror=strict-prototypes" CPPFLAGS: "-Werror=unused-parameter -Werror=return-type" FFLAGS: "-fimplicit-none" + + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + - run: pip install ninja + - run: python run_project_tests.py --only platform-windows + env: + CFLAGS: "-Werror=unused-parameter -Werror=return-type -Werror=strict-prototypes" + CPPFLAGS: "-Werror=unused-parameter -Werror=return-type" + FFLAGS: "-fimplicit-none" + CC: gcc + CXX: g++ + FC: gfortran diff --git a/test cases/osx/1 basic/main.c b/test cases/osx/1 basic/main.c index 2417ad849..0a072187a 100644 --- a/test cases/osx/1 basic/main.c +++ b/test cases/osx/1 basic/main.c @@ -1,5 +1,5 @@ #include <CoreFoundation/CoreFoundation.h> -int main(int argc, char **argv) { +int main(void) { return 0; } diff --git a/test cases/osx/2 library versions/exe.orig.c b/test cases/osx/2 library versions/exe.orig.c index 86c4adc38..ad38e6dbc 100644 --- a/test cases/osx/2 library versions/exe.orig.c +++ b/test cases/osx/2 library versions/exe.orig.c @@ -1,8 +1,6 @@ int myFunc (void); -int -main (int argc, char *argv[]) -{ +int main (void) { if (myFunc() == 55) return 0; return 1; diff --git a/test cases/osx/2 library versions/lib.c b/test cases/osx/2 library versions/lib.c index 67b6f4d00..bd251d777 100644 --- a/test cases/osx/2 library versions/lib.c +++ b/test cases/osx/2 library versions/lib.c @@ -1,3 +1,3 @@ -int myFunc() { +int myFunc(void) { return 55; } diff --git a/test cases/osx/4 framework/prog.c b/test cases/osx/4 framework/prog.c index 11b7fad8e..9b6bdc2ec 100644 --- a/test cases/osx/4 framework/prog.c +++ b/test cases/osx/4 framework/prog.c @@ -1,3 +1,3 @@ -int main(int argc, char **argv) { +int main(void) { return 0; } diff --git a/test cases/osx/4 framework/stat.c b/test cases/osx/4 framework/stat.c index fa76a658f..4825cefd2 100644 --- a/test cases/osx/4 framework/stat.c +++ b/test cases/osx/4 framework/stat.c @@ -1 +1 @@ -int func() { return 933; } +int func(void) { return 933; } diff --git a/test cases/osx/5 extra frameworks/prog.c b/test cases/osx/5 extra frameworks/prog.c index 11b7fad8e..9b6bdc2ec 100644 --- a/test cases/osx/5 extra frameworks/prog.c +++ b/test cases/osx/5 extra frameworks/prog.c @@ -1,3 +1,3 @@ -int main(int argc, char **argv) { +int main(void) { return 0; } diff --git a/test cases/osx/5 extra frameworks/stat.c b/test cases/osx/5 extra frameworks/stat.c index fa76a658f..4825cefd2 100644 --- a/test cases/osx/5 extra frameworks/stat.c +++ b/test cases/osx/5 extra frameworks/stat.c @@ -1 +1 @@ -int func() { return 933; } +int func(void) { return 933; } diff --git a/test cases/osx/7 bitcode/libbar.mm b/test cases/osx/7 bitcode/libbar.mm index 22c4dd49d..d9201c129 100644 --- a/test cases/osx/7 bitcode/libbar.mm +++ b/test cases/osx/7 bitcode/libbar.mm @@ -1,7 +1,7 @@ #import <stdio.h> #import "vis.h" -int EXPORT_PUBLIC libbar(int arg) { +int EXPORT_PUBLIC libbar(void) { return 0; } diff --git a/test cases/osx/7 bitcode/libfile.c b/test cases/osx/7 bitcode/libfile.c index cc87aa0a1..8edc66b27 100644 --- a/test cases/osx/7 bitcode/libfile.c +++ b/test cases/osx/7 bitcode/libfile.c @@ -1,5 +1,5 @@ #include "vis.h" -int EXPORT_PUBLIC libfunc() { +int EXPORT_PUBLIC libfunc(void) { return 3; } diff --git a/test cases/osx/7 bitcode/libfoo.m b/test cases/osx/7 bitcode/libfoo.m index 7981ab409..f1c35a9f3 100644 --- a/test cases/osx/7 bitcode/libfoo.m +++ b/test cases/osx/7 bitcode/libfoo.m @@ -1,7 +1,7 @@ #import <stdio.h> #import "vis.h" -int EXPORT_PUBLIC libfoo(int arg) { +int EXPORT_PUBLIC libfoo(void) { return 0; } diff --git a/test cases/osx/8 pie/main.c b/test cases/osx/8 pie/main.c index 2417ad849..0a072187a 100644 --- a/test cases/osx/8 pie/main.c +++ b/test cases/osx/8 pie/main.c @@ -1,5 +1,5 @@ #include <CoreFoundation/CoreFoundation.h> -int main(int argc, char **argv) { +int main(void) { return 0; } diff --git a/test cases/windows/10 vs module defs generated custom target/prog.c b/test cases/windows/10 vs module defs generated custom target/prog.c index 51f780587..066ac227a 100644 --- a/test cases/windows/10 vs module defs generated custom target/prog.c +++ b/test cases/windows/10 vs module defs generated custom target/prog.c @@ -1,4 +1,4 @@ -int somedllfunc(); +int somedllfunc(void); int main(void) { return somedllfunc() == 42 ? 0 : 1; diff --git a/test cases/windows/10 vs module defs generated custom target/subdir/somedll.c b/test cases/windows/10 vs module defs generated custom target/subdir/somedll.c index b23d8fed5..f095b1839 100644 --- a/test cases/windows/10 vs module defs generated custom target/subdir/somedll.c +++ b/test cases/windows/10 vs module defs generated custom target/subdir/somedll.c @@ -1,3 +1,3 @@ -int somedllfunc() { +int somedllfunc(void) { return 42; } diff --git a/test cases/windows/11 exe implib/prog.c b/test cases/windows/11 exe implib/prog.c index 2192019d2..aa3bc5c57 100644 --- a/test cases/windows/11 exe implib/prog.c +++ b/test cases/windows/11 exe implib/prog.c @@ -1,6 +1,6 @@ #include <windows.h> int __declspec(dllexport) -main() { +main(void) { return 0; } diff --git a/test cases/windows/12 resources with custom targets/prog.c b/test cases/windows/12 resources with custom targets/prog.c index 2bef6a278..cb6892d04 100644 --- a/test cases/windows/12 resources with custom targets/prog.c +++ b/test cases/windows/12 resources with custom targets/prog.c @@ -10,5 +10,10 @@ WinMain( int nCmdShow) { HICON hIcon; hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(MY_ICON)); + // avoid unused argument error while matching template + ((void)hInstance); + ((void)hPrevInstance); + ((void)lpszCmdLine); + ((void)nCmdShow); return hIcon ? 0 : 1; } diff --git a/test cases/windows/13 test argument extra paths/exe/main.c b/test cases/windows/13 test argument extra paths/exe/main.c index 0ac9e3892..1032ae20d 100644 --- a/test cases/windows/13 test argument extra paths/exe/main.c +++ b/test cases/windows/13 test argument extra paths/exe/main.c @@ -1,5 +1,5 @@ #include <foo.h> -int main(int ac, char **av) { +int main(void) { return foo_process(); } diff --git a/test cases/windows/14 resources with custom target depend_files/prog.c b/test cases/windows/14 resources with custom target depend_files/prog.c index 2bef6a278..cb6892d04 100644 --- a/test cases/windows/14 resources with custom target depend_files/prog.c +++ b/test cases/windows/14 resources with custom target depend_files/prog.c @@ -10,5 +10,10 @@ WinMain( int nCmdShow) { HICON hIcon; hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(MY_ICON)); + // avoid unused argument error while matching template + ((void)hInstance); + ((void)hPrevInstance); + ((void)lpszCmdLine); + ((void)nCmdShow); return hIcon ? 0 : 1; } diff --git a/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/main.c b/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/main.c index 673b5e4f9..2bd8cd297 100644 --- a/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/main.c +++ b/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/main.c @@ -2,5 +2,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { + // avoid unused argument error while matching template + ((void)hinstDLL); + ((void)fdwReason); + ((void)lpvReserved); return TRUE; } diff --git a/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/main.c b/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/main.c index 11b7fad8e..9b6bdc2ec 100644 --- a/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/main.c +++ b/test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/main.c @@ -1,3 +1,3 @@ -int main(int argc, char **argv) { +int main(void) { return 0; } diff --git a/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/main.c b/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/main.c index 673b5e4f9..2bd8cd297 100644 --- a/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/main.c +++ b/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/main.c @@ -2,5 +2,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { + // avoid unused argument error while matching template + ((void)hinstDLL); + ((void)fdwReason); + ((void)lpvReserved); return TRUE; } diff --git a/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/main.c b/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/main.c index 11b7fad8e..9b6bdc2ec 100644 --- a/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/main.c +++ b/test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/main.c @@ -1,3 +1,3 @@ -int main(int argc, char **argv) { +int main(void) { return 0; } diff --git a/test cases/windows/15 resource scripts with duplicate filenames/verify.c b/test cases/windows/15 resource scripts with duplicate filenames/verify.c index 4d2ccf028..8f5b88e94 100644 --- a/test cases/windows/15 resource scripts with duplicate filenames/verify.c +++ b/test cases/windows/15 resource scripts with duplicate filenames/verify.c @@ -1,7 +1,7 @@ #include <assert.h> #include <windows.h> -int main(int arc, char *argv[]) +int main(int argc, char *argv[]) { // verify that the expected resource exists and has the expected contents HRSRC hRsrc; @@ -9,6 +9,8 @@ int main(int arc, char *argv[]) HGLOBAL hGlobal; void* data; + ((void)argc); + hRsrc = FindResource(NULL, argv[1], RT_RCDATA); assert(hRsrc); diff --git a/test cases/windows/16 gui app/gui_prog.c b/test cases/windows/16 gui app/gui_prog.c index 4bc688a35..9cdf17023 100644 --- a/test cases/windows/16 gui app/gui_prog.c +++ b/test cases/windows/16 gui app/gui_prog.c @@ -2,5 +2,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { + // avoid unused argument error while matching template + ((void)hInstance); + ((void)hPrevInstance); + ((void)lpCmdLine); + ((void)nCmdShow); return 0; } diff --git a/test cases/windows/2 winmain/prog.c b/test cases/windows/2 winmain/prog.c index 77d698206..3bd4c9528 100644 --- a/test cases/windows/2 winmain/prog.c +++ b/test cases/windows/2 winmain/prog.c @@ -6,5 +6,10 @@ WinMain( HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { +// avoid unused argument error while matching template + ((void)hInstance); + ((void)hPrevInstance); + ((void)lpszCmdLine); + ((void)nCmdShow); return 0; } diff --git a/test cases/windows/3 cpp/prog.cpp b/test cases/windows/3 cpp/prog.cpp index cf6733510..69092f7b7 100644 --- a/test cases/windows/3 cpp/prog.cpp +++ b/test cases/windows/3 cpp/prog.cpp @@ -2,6 +2,6 @@ class Foo; -int main(int argc, char **argv) { +int main(void) { return 0; } diff --git a/test cases/windows/4 winmaincpp/prog.cpp b/test cases/windows/4 winmaincpp/prog.cpp index aeecb7b82..618225771 100644 --- a/test cases/windows/4 winmaincpp/prog.cpp +++ b/test cases/windows/4 winmaincpp/prog.cpp @@ -8,5 +8,10 @@ WinMain( HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { +// avoid unused argument error while matching template + ((void)hInstance); + ((void)hPrevInstance); + ((void)lpszCmdLine); + ((void)nCmdShow); return 0; } diff --git a/test cases/windows/5 resources/prog.c b/test cases/windows/5 resources/prog.c index afbb6ae70..3409c398c 100644 --- a/test cases/windows/5 resources/prog.c +++ b/test cases/windows/5 resources/prog.c @@ -12,5 +12,10 @@ WinMain( int nCmdShow) { HICON hIcon; hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(MY_ICON)); +// avoid unused argument error while matching template + ((void)hInstance); + ((void)hPrevInstance); + ((void)lpszCmdLine); + ((void)nCmdShow); return hIcon ? 0 : 1; } diff --git a/test cases/windows/6 vs module defs/prog.c b/test cases/windows/6 vs module defs/prog.c index 51f780587..066ac227a 100644 --- a/test cases/windows/6 vs module defs/prog.c +++ b/test cases/windows/6 vs module defs/prog.c @@ -1,4 +1,4 @@ -int somedllfunc(); +int somedllfunc(void); int main(void) { return somedllfunc() == 42 ? 0 : 1; diff --git a/test cases/windows/6 vs module defs/subdir/somedll.c b/test cases/windows/6 vs module defs/subdir/somedll.c index b23d8fed5..f095b1839 100644 --- a/test cases/windows/6 vs module defs/subdir/somedll.c +++ b/test cases/windows/6 vs module defs/subdir/somedll.c @@ -1,3 +1,3 @@ -int somedllfunc() { +int somedllfunc(void) { return 42; } diff --git a/test cases/windows/7 dll versioning/lib.c b/test cases/windows/7 dll versioning/lib.c index cf7dfdd07..37e0d1d7e 100644 --- a/test cases/windows/7 dll versioning/lib.c +++ b/test cases/windows/7 dll versioning/lib.c @@ -1,6 +1,6 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int myFunc() { +int myFunc(void) { return 55; } diff --git a/test cases/windows/9 vs module defs generated/prog.c b/test cases/windows/9 vs module defs generated/prog.c index 51f780587..066ac227a 100644 --- a/test cases/windows/9 vs module defs generated/prog.c +++ b/test cases/windows/9 vs module defs generated/prog.c @@ -1,4 +1,4 @@ -int somedllfunc(); +int somedllfunc(void); int main(void) { return somedllfunc() == 42 ? 0 : 1; diff --git a/test cases/windows/9 vs module defs generated/subdir/somedll.c b/test cases/windows/9 vs module defs generated/subdir/somedll.c index b23d8fed5..f095b1839 100644 --- a/test cases/windows/9 vs module defs generated/subdir/somedll.c +++ b/test cases/windows/9 vs module defs generated/subdir/somedll.c @@ -1,3 +1,3 @@ -int somedllfunc() { +int somedllfunc(void) { return 42; } |
