Use strict function prototypes

pull/6209/head
Michael Hirsch, Ph.D 5 years ago committed by Jussi Pakkanen
parent 0435691e83
commit 83b4e981c4
  1. 7
      .github/workflows/unusedargs_missingreturn.yml
  2. 2
      manual tests/9 nostdlib/prog.c
  3. 4
      mesonbuild/compilers/c.py
  4. 4
      mesonbuild/compilers/cpp.py
  5. 2
      mesonbuild/compilers/cuda.py
  6. 38
      mesonbuild/compilers/mixins/clike.py
  7. 2
      mesonbuild/compilers/objc.py
  8. 2
      mesonbuild/compilers/objcpp.py
  9. 4
      run_unittests.py
  10. 2
      test cases/cmake/1 basic/main.cpp
  11. 2
      test cases/cmake/10 header only/main.cpp
  12. 2
      test cases/cmake/12 generator expressions/main.cpp
  13. 2
      test cases/cmake/13 system includes/main.cpp
  14. 2
      test cases/cmake/2 advanced/main.cpp
  15. 2
      test cases/cmake/2 advanced/subprojects/cmMod/main.cpp
  16. 2
      test cases/cmake/3 advanced no dep/main.cpp
  17. 2
      test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp
  18. 2
      test cases/cmake/4 code gen/main.cpp
  19. 2
      test cases/cmake/5 object library/main.cpp
  20. 2
      test cases/cmake/6 object library no dep/main.cpp
  21. 2
      test cases/cmake/8 custom command/main.cpp
  22. 2
      test cases/common/102 subproject subdir/subprojects/sub/lib/sub.c
  23. 2
      test cases/common/102 subproject subdir/subprojects/sub/lib/sub.h
  24. 2
      test cases/common/106 extract same name/lib.c
  25. 4
      test cases/common/106 extract same name/main.c
  26. 2
      test cases/common/106 extract same name/src/lib.c
  27. 2
      test cases/common/114 allgenerate/foobar.cpp.in
  28. 2
      test cases/common/116 subdir subproject/subprojects/sub/sub.c
  29. 2
      test cases/common/116 subdir subproject/subprojects/sub/sub.h
  30. 2
      test cases/common/119 subproject project arguments/exe.cpp
  31. 4
      test cases/common/121 shared module/module.c
  32. 2
      test cases/common/122 llvm ir and assembly/main.cpp
  33. 2
      test cases/common/123 cpp and asm/trivial.cc
  34. 8
      test cases/common/124 extract all shared library/extractor.h
  35. 2
      test cases/common/124 extract all shared library/four.c
  36. 2
      test cases/common/124 extract all shared library/one.c
  37. 2
      test cases/common/124 extract all shared library/three.c
  38. 2
      test cases/common/124 extract all shared library/two.c
  39. 6
      test cases/common/125 object only target/prog.c
  40. 2
      test cases/common/125 object only target/source.c
  41. 2
      test cases/common/125 object only target/source2.c
  42. 2
      test cases/common/125 object only target/source3.c
  43. 2
      test cases/common/126 no buildincdir/include/header.h
  44. 2
      test cases/common/13 pch/c/prog.c
  45. 4
      test cases/common/13 pch/cpp/prog.cc
  46. 4
      test cases/common/13 pch/mixed/func.c
  47. 4
      test cases/common/13 pch/mixed/main.cc
  48. 2
      test cases/common/13 pch/userDefined/pch/pch.c
  49. 2
      test cases/common/13 pch/withIncludeDirectories/prog.c
  50. 4
      test cases/common/135 override options/four.c
  51. 2
      test cases/common/135 override options/one.c
  52. 4
      test cases/common/135 override options/three.c
  53. 2
      test cases/common/137 c cpp and asm/main.cpp
  54. 2
      test cases/common/138 compute int/prog.c.in
  55. 2
      test cases/common/139 custom target object output/objdir/source.c
  56. 2
      test cases/common/139 custom target object output/progdir/prog.c
  57. 2
      test cases/common/141 whole archive/func1.c
  58. 2
      test cases/common/141 whole archive/func2.c
  59. 4
      test cases/common/141 whole archive/mylib.h
  60. 2
      test cases/common/149 recursive linking/3rdorderdeps/main.c.in
  61. 6
      test cases/common/151 simd/simd_avx.c
  62. 6
      test cases/common/151 simd/simd_avx2.c
  63. 8
      test cases/common/151 simd/simd_mmx.c
  64. 2
      test cases/common/151 simd/simd_neon.c
  65. 6
      test cases/common/151 simd/simd_sse.c
  66. 6
      test cases/common/151 simd/simd_sse2.c
  67. 6
      test cases/common/151 simd/simd_sse3.c
  68. 6
      test cases/common/151 simd/simd_sse41.c
  69. 6
      test cases/common/151 simd/simd_sse42.c
  70. 4
      test cases/common/151 simd/simd_ssse3.c
  71. 22
      test cases/common/151 simd/simdfuncs.h
  72. 2
      test cases/common/157 wrap file should not failed/subprojects/foo-1.0/foo.c
  73. 2
      test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/foo.c
  74. 4
      test cases/common/159 subproject dir name collision/a.c
  75. 4
      test cases/common/159 subproject dir name collision/custom_subproject_dir/B/b.c
  76. 2
      test cases/common/159 subproject dir name collision/custom_subproject_dir/C/c.c
  77. 2
      test cases/common/159 subproject dir name collision/other_subdir/custom_subproject_dir/other.c
  78. 2
      test cases/common/161 custom target subdir depend files/subdir/foo.c.in
  79. 2
      test cases/common/165 custom target template substitution/foo.c.in
  80. 2
      test cases/common/166 not-found dependency/subprojects/trivial/trivial.c
  81. 4
      test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/a.c
  82. 2
      test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/b.c
  83. 2
      test cases/common/172 subproject nested subproject dirs/prog.c
  84. 4
      test cases/common/173 preserve gendir/genprog.py
  85. 4
      test cases/common/174 source in dep/bar.cpp
  86. 2
      test cases/common/174 source in dep/foo.c
  87. 2
      test cases/common/174 source in dep/generated/genheader.py
  88. 4
      test cases/common/175 generator link whole/generator.py
  89. 2
      test cases/common/175 generator link whole/pull_meson_test_function.c
  90. 2
      test cases/common/178 as-needed/main.cpp
  91. 2
      test cases/common/18 array/func.c
  92. 2
      test cases/common/18 array/prog.c
  93. 2
      test cases/common/183 bothlibraries/libfile.c
  94. 2
      test cases/common/183 bothlibraries/main.c
  95. 2
      test cases/common/184 escape and unicode/file.c.in
  96. 2
      test cases/common/184 escape and unicode/fun.c
  97. 4
      test cases/common/184 escape and unicode/main.c
  98. 2
      test cases/common/187 find override/otherdir/main.c
  99. 2
      test cases/common/187 find override/otherdir/main2.c
  100. 2
      test cases/common/187 find override/subdir/converter.py
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,5 +1,8 @@
name: UnusedMissingReturn
# this workflow checks for usused input arguments or missing return values in test cases.
# this workflow checks for
# * unused input arguments
# * missing return values
# * strict prototypes
# some users have default configs that will needlessly fail Meson self-tests due to these syntax.
on:
@ -33,6 +36,6 @@ jobs:
sudo apt install -yq --no-install-recommends g++ gfortran ninja-build
- run: python run_project_tests.py --only cmake common fortran platform-linux
env:
CFLAGS: "-Werror=unused-parameter -Werror=return-type"
CFLAGS: "-Werror=unused-parameter -Werror=return-type -Werror=strict-prototypes"
CPPFLAGS: "-Werror=unused-parameter -Werror=return-type"
FFLAGS: "-fimplicit-none"

@ -1,7 +1,7 @@
#include<stdio.h>
int main() {
int main(void) {
const char *message = "Hello without stdlib.\n";
return simple_print(message, simple_strlen(message));
}

@ -59,14 +59,14 @@ class CCompiler(CLikeCompiler, Compiler):
return ['-nostdinc']
def sanity_check(self, work_dir, environment):
code = 'int main() { int class=0; return class; }\n'
code = 'int main(void) { int class=0; return class; }\n'
return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code)
def has_header_symbol(self, hname, symbol, prefix, env, *, extra_args=None, dependencies=None):
fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
t = '''{prefix}
#include <{header}>
int main () {{
int main(void) {{
/* If it's not defined as a macro, try to use as a symbol */
#ifndef {symbol}
{symbol};

@ -73,7 +73,7 @@ class CPPCompiler(CLikeCompiler, Compiler):
return ['-nostdinc++']
def sanity_check(self, work_dir, environment):
code = 'class breakCCompiler;int main() { return 0; }\n'
code = 'class breakCCompiler;int main(void) { return 0; }\n'
return self.sanity_check_impl(work_dir, environment, 'sanitycheckcpp.cc', code)
def get_compiler_check_args(self):
@ -96,7 +96,7 @@ class CPPCompiler(CLikeCompiler, Compiler):
t = '''{prefix}
#include <{header}>
using {symbol};
int main () {{ return 0; }}'''
int main(void) {{ return 0; }}'''
return self.compiles(t.format(**fargs), env, extra_args=extra_args,
dependencies=dependencies)

@ -174,7 +174,7 @@ class CudaCompiler(Compiler):
t = '''{prefix}
#include <{header}>
using {symbol};
int main () {{ return 0; }}'''
int main(void) {{ return 0; }}'''
return self.compiles(t.format(**fargs), env, extra_args, dependencies)
def get_options(self):

@ -258,7 +258,7 @@ class CLikeCompiler:
raise mesonlib.EnvironmentException('Executables created by {0} compiler {1} are not runnable.'.format(self.language, self.name_string()))
def sanity_check(self, work_dir, environment):
code = 'int main() { int class=0; return class; }\n'
code = 'int main(void) { int class=0; return class; }\n'
return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code)
def check_header(self, hname, prefix, env, *, extra_args=None, dependencies=None):
@ -285,7 +285,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
t = '''{prefix}
#include <{header}>
int main () {{
int main(void) {{
/* If it's not defined as a macro, try to use as a symbol */
#ifndef {symbol}
{symbol};
@ -398,7 +398,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'expression': expression}
t = '''#include <stdio.h>
{prefix}
int main() {{ static int a[1-2*!({expression})]; a[0]=0; return 0; }}'''
int main(void) {{ static int a[1-2*!({expression})]; a[0]=0; return 0; }}'''
return self.compiles(t.format(**fargs), env, extra_args=extra_args,
dependencies=dependencies)[0]
@ -458,7 +458,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'expression': expression}
t = '''#include<stdio.h>
{prefix}
int main() {{
int main(void) {{
printf("%ld\\n", (long)({expression}));
return 0;
}};'''
@ -476,7 +476,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'type': typename}
t = '''#include <stdio.h>
{prefix}
int main() {{
int main(void) {{
{type} something;
return 0;
}}'''
@ -494,7 +494,7 @@ class CLikeCompiler:
dependencies=dependencies)
t = '''#include<stdio.h>
{prefix}
int main() {{
int main(void) {{
printf("%ld\\n", (long)(sizeof({type})));
return 0;
}};'''
@ -512,7 +512,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'type': typename}
t = '''#include <stdio.h>
{prefix}
int main() {{
int main(void) {{
{type} something;
return 0;
}}'''
@ -541,7 +541,7 @@ class CLikeCompiler:
char c;
{type} target;
}};
int main() {{
int main(void) {{
printf("%d", (int)offsetof(struct tmp, target));
return 0;
}}'''
@ -591,7 +591,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'f': fname, 'cast': cast, 'fmt': fmt}
code = '''{prefix}
#include <stdio.h>
int main() {{
int main(void) {{
printf ("{fmt}", {cast} {f}());
return 0;
}}'''.format(**fargs)
@ -634,11 +634,11 @@ class CLikeCompiler:
#ifdef __cplusplus
extern "C"
#endif
char {func} ();
char {func} (void);
'''
# The actual function call
main = '''
int main () {{
int main(void) {{
return {func} ();
}}'''
return head, main
@ -657,7 +657,7 @@ class CLikeCompiler:
# Just taking the address or comparing it to void is not enough because
# compilers are smart enough to optimize it away. The resulting binary
# is not run so we don't care what the return value is.
main = '''\nint main() {{
main = '''\nint main(void) {{
void *a = (void*) &{func};
long b = (long) a;
return (int) b;
@ -729,7 +729,7 @@ class CLikeCompiler:
# can just directly use the __has_builtin() macro.
fargs['no_includes'] = '#include' not in prefix
t = '''{prefix}
int main() {{
int main(void) {{
#ifdef __has_builtin
#if !__has_builtin(__builtin_{func})
#error "__builtin_{func} not found"
@ -761,7 +761,7 @@ class CLikeCompiler:
members += '{}.{};\n'.format(fargs['name'], member)
fargs['members'] = members
t = '''{prefix}
void bar() {{
void bar(void) {{
{type} {name};
{members}
}};'''
@ -771,7 +771,7 @@ class CLikeCompiler:
def has_type(self, typename, prefix, env, extra_args, dependencies=None):
fargs = {'prefix': prefix, 'type': typename}
t = '''{prefix}
void bar() {{
void bar(void) {{
sizeof({type});
}};'''
return self.compiles(t.format(**fargs), env, extra_args=extra_args,
@ -785,7 +785,7 @@ class CLikeCompiler:
code = '''#ifdef __cplusplus
extern "C" {
#endif
void ''' + symbol_name.decode() + ''' () {}
void ''' + symbol_name.decode() + ''' (void) {}
#ifdef __cplusplus
}
#endif
@ -993,7 +993,7 @@ class CLikeCompiler:
return value[:]
def find_library(self, libname, env, extra_dirs, libtype: LibType = LibType.PREFER_SHARED):
code = 'int main() { return 0; }'
code = 'int main(void) { return 0; }'
return self.find_library_impl(libname, env, extra_dirs, code, libtype)
def find_framework_paths(self, env):
@ -1023,7 +1023,7 @@ class CLikeCompiler:
return paths
def find_framework_real(self, name, env, extra_dirs, allow_system):
code = 'int main() { return 0; }'
code = 'int main(void) { return 0; }'
link_args = []
for d in extra_dirs:
link_args += ['-F' + d]
@ -1102,7 +1102,7 @@ class CLikeCompiler:
# false positive.
args = self.linker.fatal_warnings() + args
args = self.linker_to_compiler_args(args)
code = 'int main() { return 0; }'
code = 'int main(void) { return 0; }'
return self.has_arguments(args, env, code, mode='link')
@staticmethod

@ -48,7 +48,7 @@ class ObjCCompiler(CLikeCompiler, Compiler):
extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
with open(source_name, 'w') as ofile:
ofile.write('#import<stddef.h>\n'
'int main() { return 0; }\n')
'int main(void) { return 0; }\n')
pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
pc.wait()
if pc.returncode != 0:

@ -48,7 +48,7 @@ class ObjCPPCompiler(CLikeCompiler, Compiler):
with open(source_name, 'w') as ofile:
ofile.write('#import<stdio.h>\n'
'class MyClass;'
'int main() { return 0; }\n')
'int main(void) { return 0; }\n')
pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
pc.wait()
if pc.returncode != 0:

@ -3047,7 +3047,7 @@ int main(int argc, char **argv) {
if lang in ('c', 'cpp'):
with tempfile.TemporaryDirectory() as tmpdir:
with open(os.path.join(tmpdir, 'foo.' + lang), 'w') as f:
f.write('int main() {}')
f.write('int main(void) {}')
self._run(self.meson_command + ['init', '-b'], workdir=tmpdir)
# The test uses mocking and thus requires that
@ -7006,4 +7006,4 @@ def main():
return unittest.main(defaultTest=cases, buffer=True)
if __name__ == '__main__':
sys.exit(main())
raise SystemExit(main())

@ -3,7 +3,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello");
cout << obj.getStr() << endl;
return 0;

@ -3,7 +3,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello");
cout << obj.getStr() << endl;
return 0;

@ -3,7 +3,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello");
cout << obj.getStr() << endl;
return 0;

@ -3,7 +3,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello");
cout << obj.getStr() << endl;
return 0;

@ -8,7 +8,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello");
cout << obj.getStr() << endl;
return 0;

@ -4,7 +4,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello (LIB TEST)");
cout << obj.getStr() << " ZLIB: " << zlibVersion() << endl;
return 0;

@ -8,7 +8,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello");
cout << obj.getStr() << endl;
return 0;

@ -3,7 +3,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello (LIB TEST)");
cout << obj.getStr() << endl;
return 0;

@ -3,6 +3,6 @@
using namespace std;
int main() {
int main(void) {
cout << getStr() << endl;
}

@ -4,6 +4,6 @@
using namespace std;
int main() {
int main(void) {
cout << getLibStr() << " -- " << getZlibVers() << endl;
}

@ -4,6 +4,6 @@
using namespace std;
int main() {
int main(void) {
cout << getLibStr() << " -- " << getZlibVers() << endl;
}

@ -3,7 +3,7 @@
using namespace std;
int main() {
int main(void) {
cmModClass obj("Hello");
cout << obj.getStr() << endl;
cout << obj.getOther() << endl;

@ -1,5 +1,5 @@
#include "sub.h"
int sub() {
int sub(void) {
return 0;
}

@ -1,6 +1,6 @@
#ifndef SUB_H
#define SUB_H
int sub();
int sub(void);
#endif

@ -1,3 +1,3 @@
int func1() {
int func1(void) {
return 23;
}

@ -1,5 +1,5 @@
int func1();
int func2();
int func1(void);
int func2(void);
int main(void) {
return !(func1() == 23 && func2() == 42);

@ -1,3 +1,3 @@
int func2() {
int func2(void) {
return 42;
}

@ -1,6 +1,6 @@
#include<stdio.h>
int main() {
int main(void) {
printf("I am a program.\n");
return 0;
}

@ -1,5 +1,5 @@
#include "sub.h"
int sub() {
int sub(void) {
return 0;
}

@ -1,6 +1,6 @@
#ifndef SUB_H
#define SUB_H
int sub();
int sub(void);
#endif

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

@ -71,7 +71,7 @@ fptr find_any_f (const char *name) {
}
#endif
int DLL_PUBLIC func() {
int DLL_PUBLIC func(void) {
fptr f;
f = find_any_f ("func_from_language_runtime");
@ -88,7 +88,7 @@ int DLL_PUBLIC func() {
* dlopens it. We need to make sure that this works, i.e. that we do
* not pass -Wl,--no-undefined when linking modules.
*/
int func_from_language_runtime();
int func_from_language_runtime(void);
int DLL_PUBLIC func(void) {
return func_from_language_runtime();

@ -4,7 +4,7 @@ extern "C" {
unsigned square_unsigned (unsigned a);
}
int main ()
int main (void)
{
unsigned int ret = square_unsigned (2);
if (ret != 4) {

@ -4,7 +4,7 @@ extern "C" {
int get_retval(void);
}
int main() {
int main(void) {
std::cout << "C++ seems to be working." << std::endl;
#if defined(USE_ASM)
return get_retval();

@ -1,6 +1,6 @@
#pragma once
int func1();
int func2();
int func3();
int func4();
int func1(void);
int func2(void);
int func3(void);
int func4(void);

@ -1,5 +1,5 @@
#include"extractor.h"
int func4() {
int func4(void) {
return 4;
}

@ -1,5 +1,5 @@
#include"extractor.h"
int func1() {
int func1(void) {
return 1;
}

@ -1,5 +1,5 @@
#include"extractor.h"
int func3() {
int func3(void) {
return 3;
}

@ -1,5 +1,5 @@
#include"extractor.h"
int func2() {
int func2(void) {
return 2;
}

@ -1,6 +1,6 @@
int func1_in_obj();
int func2_in_obj();
int func3_in_obj();
int func1_in_obj(void);
int func2_in_obj(void);
int func3_in_obj(void);
int main(void) {
return func1_in_obj() + func2_in_obj() + func3_in_obj();

@ -1,3 +1,3 @@
int func1_in_obj() {
int func1_in_obj(void) {
return 0;
}

@ -1,3 +1,3 @@
int func2_in_obj() {
int func2_in_obj(void) {
return 0;
}

@ -1,3 +1,3 @@
int func3_in_obj() {
int func3_in_obj(void) {
return 0;
}

@ -1,3 +1,3 @@
#pragma once
int foobar();
int foobar(void);

@ -1,6 +1,6 @@
// No includes here, they need to come from the PCH
void func() {
void func(void) {
fprintf(stdout, "This is a function that fails if stdio is not #included.\n");
}

@ -1,11 +1,11 @@
// Note: if using PGI compilers, you will need to add #include "prog.hh"
// even though you're using precompiled headers.
void func() {
void func(void) {
std::cout << "This is a function that fails to compile if iostream is not included."
<< std::endl;
}
int main() {
int main(void) {
func();
return 0;
}

@ -1,7 +1,7 @@
void tmp_func() {
void tmp_func(void) {
fprintf(stdout, "This is a function that fails if stdio is not #included.\n");
}
int cfunc() {
int cfunc(void) {
return 0;
}

@ -1,10 +1,10 @@
extern "C" int cfunc();
void func() {
void func(void) {
std::cout << "This is a function that fails to compile if iostream is not included."
<< std::endl;
}
int main() {
int main(void) {
return cfunc();
}

@ -1,5 +1,5 @@
#include "pch.h"
int foo() {
int foo(void) {
return 0;
}

@ -1,6 +1,6 @@
// No includes here, they need to come from the PCH
void func() {
void func(void) {
fprintf(stdout, "This is a function that fails if stdio is not #included.\n");
}

@ -1,6 +1,6 @@
int func();
int func(void);
static int duplicate_func() {
static int duplicate_func(void) {
return -4;
}

@ -1,3 +1,3 @@
static int hidden_func() {
static int hidden_func(void) {
return 0;
}

@ -1,7 +1,7 @@
static int duplicate_func() {
static int duplicate_func(void) {
return 4;
}
int func() {
int func(void) {
return duplicate_func();
}

@ -5,7 +5,7 @@ extern "C" {
int get_cval(void);
}
int main() {
int main(void) {
std::cout << "C++ seems to be working." << std::endl;
return get_retval();
}

@ -4,7 +4,7 @@
#include <limits.h>
#include "foobar.h"
int main() {
int main(void) {
if(INTSIZE != sizeof(int)) {
fprintf(stderr, "Mismatch: computed int size %d, actual size %d.\n", INTSIZE, (int)sizeof(int));
return 1;

@ -1,3 +1,3 @@
int func1_in_obj() {
int func1_in_obj(void) {
return 0;
}

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

@ -2,6 +2,6 @@
#include<mylib.h>
int func1() {
int func1(void) {
return 42;
}

@ -2,6 +2,6 @@
#include<mylib.h>
int func2() {
int func2(void) {
return 42;
}

@ -17,5 +17,5 @@
#endif
#endif
int DLL_PUBLIC func1();
int DLL_PUBLIC func2();
int DLL_PUBLIC func1(void);
int DLL_PUBLIC func2(void);

@ -4,7 +4,7 @@
SYMBOL_IMPORT int get_@LIBTYPE@@DEPENDENCY@dep_value (void);
int main() {
int main(void) {
int val;
val = get_@LIBTYPE@@DEPENDENCY@dep_value ();

@ -10,7 +10,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int avx_available() {
int avx_available(void) {
return 1;
}
#else
@ -23,10 +23,10 @@ int avx_available() {
* some machines in the CI farm seem to be too
* old to have AVX so just always return 0 here.
*/
int avx_available() { return 0; }
int avx_available(void) { return 0; }
#else
int avx_available() {
int avx_available(void) {
return __builtin_cpu_supports("avx");
}
#endif

@ -8,7 +8,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int avx2_available() {
int avx2_available(void) {
return 0;
}
#else
@ -16,9 +16,9 @@ int avx2_available() {
#include<cpuid.h>
#if defined(__APPLE__)
int avx2_available() { return 0; }
int avx2_available(void) { return 0; }
#else
int avx2_available() {
int avx2_available(void) {
return __builtin_cpu_supports("avx2");
}
#endif

@ -5,7 +5,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int mmx_available() {
int mmx_available(void) {
return 1;
}
/* Contrary to MSDN documentation, MMX intrinsics
@ -18,7 +18,7 @@ void increment_mmx(float arr[4]) {
arr[3]++;
}
#elif defined(__MINGW32__)
int mmx_available() {
int mmx_available(void) {
return 1;
}
/* MinGW does not seem to ship with MMX or it is broken.
@ -34,9 +34,9 @@ void increment_mmx(float arr[4]) {
#include<cpuid.h>
#if defined(__APPLE__)
int mmx_available() { return 1; }
int mmx_available(void) { return 1; }
#else
int mmx_available() {
int mmx_available(void) {
return __builtin_cpu_supports("mmx");
}
#endif

@ -4,7 +4,7 @@
#include<arm_neon.h>
#include<stdint.h>
int neon_available() {
int neon_available(void) {
return 1; /* Incorrect, but I don't know how to check this properly. */
}

@ -3,7 +3,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int sse_available() {
int sse_available(void) {
return 1;
}
#else
@ -13,9 +13,9 @@ int sse_available() {
#include<stdint.h>
#if defined(__APPLE__)
int sse_available() { return 1; }
int sse_available(void) { return 1; }
#else
int sse_available() {
int sse_available(void) {
return __builtin_cpu_supports("sse");
}
#endif

@ -3,7 +3,7 @@
#include<emmintrin.h>
#ifdef _MSC_VER
int sse2_available() {
int sse2_available(void) {
return 1;
}
@ -12,9 +12,9 @@ int sse2_available() {
#include<stdint.h>
#if defined(__APPLE__)
int sse2_available() { return 1; }
int sse2_available(void) { return 1; }
#else
int sse2_available() {
int sse2_available(void) {
return __builtin_cpu_supports("sse2");
}
#endif

@ -3,7 +3,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int sse3_available() {
int sse3_available(void) {
return 1;
}
#else
@ -13,9 +13,9 @@ int sse3_available() {
#include<stdint.h>
#if defined(__APPLE__)
int sse3_available() { return 1; }
int sse3_available(void) { return 1; }
#else
int sse3_available() {
int sse3_available(void) {
return __builtin_cpu_supports("sse3");
}
#endif

@ -6,7 +6,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int sse41_available() {
int sse41_available(void) {
return 1;
}
@ -15,9 +15,9 @@ int sse41_available() {
#include<cpuid.h>
#if defined(__APPLE__)
int sse41_available() { return 1; }
int sse41_available(void) { return 1; }
#else
int sse41_available() {
int sse41_available(void) {
return __builtin_cpu_supports("sse4.1");
}
#endif

@ -5,7 +5,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int sse42_available() {
int sse42_available(void) {
return 1;
}
@ -15,11 +15,11 @@ int sse42_available() {
#include<cpuid.h>
#ifdef __APPLE__
int sse42_available() {
int sse42_available(void) {
return 1;
}
#else
int sse42_available() {
int sse42_available(void) {
return __builtin_cpu_supports("sse4.2");
}
#endif

@ -7,7 +7,7 @@
#ifdef _MSC_VER
#include<intrin.h>
int ssse3_available() {
int ssse3_available(void) {
return 1;
}
@ -16,7 +16,7 @@ int ssse3_available() {
#include<cpuid.h>
#include<stdint.h>
int ssse3_available() {
int ssse3_available(void) {
#ifdef __APPLE__
return 1;
#elif defined(__clang__)

@ -18,57 +18,57 @@
void increment_fallback(float arr[4]);
#if HAVE_MMX
int mmx_available();
int mmx_available(void);
void increment_mmx(float arr[4]);
#endif
#if HAVE_SSE
int sse_available();
int sse_available(void);
void increment_sse(float arr[4]);
#endif
#if HAVE_SSE2
int sse2_available();
int sse2_available(void);
void increment_sse2(float arr[4]);
#endif
#if HAVE_SSE3
int sse3_available();
int sse3_available(void);
void increment_sse3(float arr[4]);
#endif
#if HAVE_SSSE3
int ssse3_available();
int ssse3_available(void);
void increment_ssse3(float arr[4]);
#endif
#if HAVE_SSE41
int sse41_available();
int sse41_available(void);
void increment_sse41(float arr[4]);
#endif
#if HAVE_SSE42
int sse42_available();
int sse42_available(void);
void increment_sse42(float arr[4]);
#endif
#if HAVE_AVX
int avx_available();
int avx_available(void);
void increment_avx(float arr[4]);
#endif
#if HAVE_AVX2
int avx2_available();
int avx2_available(void);
void increment_avx2(float arr[4]);
#endif
#if HAVE_NEON
int neon_available();
int neon_available(void);
void increment_neon(float arr[4]);
#endif
#if HAVE_ALTIVEC
int altivec_available();
int altivec_available(void);
void increment_altivec(float arr[4]);
#endif

@ -1,3 +1,3 @@
int dummy_func() {
int dummy_func(void) {
return 42;
}

@ -1,3 +1,3 @@
int dummy_func() {
int dummy_func(void) {
return 42;
}

@ -1,6 +1,6 @@
#include<assert.h>
char func_b();
char func_c();
char func_b(void);
char func_c(void);
int main(void) {
if(func_b() != 'b') {

@ -1,5 +1,5 @@
#include<stdlib.h>
char func_c();
char func_c(void);
#if defined _WIN32 || defined __CYGWIN__
#define DLL_PUBLIC __declspec(dllexport)
@ -12,7 +12,7 @@ char func_c();
#endif
#endif
char DLL_PUBLIC func_b() {
char DLL_PUBLIC func_b(void) {
if(func_c() != 'c') {
exit(3);
}

@ -9,6 +9,6 @@
#endif
#endif
char DLL_PUBLIC func_c() {
char DLL_PUBLIC func_c(void) {
return 'c';
}

@ -11,7 +11,7 @@
#endif
#endif
char DLL_PUBLIC func_b() {
char DLL_PUBLIC func_b(void) {
if('c' != 'c') {
exit(3);
}

@ -1,6 +1,6 @@
#include <stdio.h>
int main() {
int main(void) {
printf("foo is working.\n");
return 0;
}

@ -1,6 +1,6 @@
#include <stdio.h>
int main() {
int main(void) {
printf("foo is working.\n");
return 0;
}

@ -1,3 +1,3 @@
int subfunc() {
int subfunc(void) {
return 42;
}

@ -1,4 +1,4 @@
int func2();
int func2(void);
#if defined _WIN32 || defined __CYGWIN__
#define DLL_PUBLIC __declspec(dllexport)
@ -11,5 +11,5 @@ int func2();
#endif
#endif
int DLL_PUBLIC func() { return func2(); }
int DLL_PUBLIC func(void) { return func2(); }

@ -9,6 +9,6 @@
#endif
#endif
int DLL_PUBLIC func2() {
int DLL_PUBLIC func2(void) {
return 42;
}

@ -1,4 +1,4 @@
int func();
int func(void);
int main(void) {
return func() == 42 ? 0 : 1;

@ -4,12 +4,12 @@ import os, sys, argparse
h_templ = '''#pragma once
int %s();
int %s(void);
'''
c_templ = '''#include"%s.h"
int %s() {
int %s(void) {
return 0;
}
'''

@ -1,5 +1,5 @@
extern "C" int foo();
extern "C" int foo(void);
int main(int, char**) {
int main(void) {
return foo() != 42;
}

@ -1,3 +1,3 @@
int foo() {
int foo(void) {
return 42;
}

@ -7,7 +7,7 @@ ofile = sys.argv[2]
templ = '''#pragma once
int %s() {
int %s(void) {
return 42;
}
'''

@ -15,12 +15,12 @@ def main():
hfile.write('''
#pragma once
#include "export.h"
int DLL_PUBLIC {name}();
int DLL_PUBLIC {name}(void);
'''.format(name=name))
with open(cname, 'w') as cfile:
cfile.write('''
#include "{name}.h"
int {name}() {{
int {name}(void) {{
return {size};
}}
'''.format(name=name, size=len(name)))

@ -1,6 +1,6 @@
#include "export.h"
#include "meson_test_function.h"
int DLL_PUBLIC function_puller() {
int DLL_PUBLIC function_puller(void) {
return meson_test_function();
}

@ -2,6 +2,6 @@
#include "libA.h"
int main() {
int main(void) {
return !meson_test_as_needed::linked ? EXIT_SUCCESS : EXIT_FAILURE;
}

@ -1 +1 @@
int func() { return 0; }
int func(void) { return 0; }

@ -1,3 +1,3 @@
extern int func();
extern int func(void);
int main(void) { return func(); }

@ -2,6 +2,6 @@
DO_EXPORT int retval = 42;
DO_EXPORT int func() {
DO_EXPORT int func(void) {
return retval;
}

@ -1,6 +1,6 @@
#include "mylib.h"
DO_IMPORT int func();
DO_IMPORT int func(void);
DO_IMPORT int retval;
int main(void) {

@ -1,5 +1,5 @@
#include<stdio.h>
const char* does_it_work() {
const char* does_it_work(void) {
printf("{NAME}\n");
return "yes it does";
}

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

@ -1,8 +1,8 @@
#include <string.h>
const char* does_it_work();
const char* does_it_work(void);
int a_fun();
int a_fun(void);
int main(void) {
if(strcmp(does_it_work(), "yes it does") != 0) {

@ -1,4 +1,4 @@
int be_seeing_you();
int be_seeing_you(void);
int main(void) {
return be_seeing_you() == 6 ? 0 : 1;

@ -1,4 +1,4 @@
int number_returner();
int number_returner(void);
int main(void) {
return number_returner() == 100 ? 0 : 1;

@ -5,7 +5,7 @@ import pathlib
[ifilename, ofilename] = sys.argv[1:3]
ftempl = '''int %s() {
ftempl = '''int %s(void) {
return 6;
}
'''

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

Loading…
Cancel
Save