Do not fail on passing `-Werror=unused-parameter` from environment

pull/5658/head
David Seifert 6 years ago committed by Nirbheek Chauhan
parent 6813ef1e24
commit fcf27c2a2d
  1. 2
      mesonbuild/compilers/c.py
  2. 20
      mesonbuild/compilers/clike.py
  3. 2
      mesonbuild/compilers/cpp.py
  4. 2
      mesonbuild/compilers/objc.py
  5. 2
      mesonbuild/compilers/objcpp.py

@ -58,7 +58,7 @@ class CCompiler(CLikeCompiler, Compiler):
return ['-nostdinc']
def sanity_check(self, work_dir, environment):
code = 'int main(int argc, char **argv) { int class=0; return class; }\n'
code = 'int main() { 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):

@ -295,7 +295,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 argc, char **argv) { int class=0; return class; }\n'
code = 'int main() { 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):
@ -494,7 +494,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'expression': expression}
t = '''#include<stdio.h>
{prefix}
int main(int argc, char **argv) {{
int main() {{
printf("%ld\\n", (long)({expression}));
return 0;
}};'''
@ -512,7 +512,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'type': typename}
t = '''#include <stdio.h>
{prefix}
int main(int argc, char **argv) {{
int main() {{
{type} something;
return 0;
}}'''
@ -530,7 +530,7 @@ class CLikeCompiler:
dependencies=dependencies)
t = '''#include<stdio.h>
{prefix}
int main(int argc, char **argv) {{
int main() {{
printf("%ld\\n", (long)(sizeof({type})));
return 0;
}};'''
@ -548,7 +548,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'type': typename}
t = '''#include <stdio.h>
{prefix}
int main(int argc, char **argv) {{
int main() {{
{type} something;
}}'''
if not self.compiles(t.format(**fargs), env, extra_args=extra_args,
@ -576,7 +576,7 @@ class CLikeCompiler:
char c;
{type} target;
}};
int main(int argc, char **argv) {{
int main() {{
printf("%d", (int)offsetof(struct tmp, target));
return 0;
}}'''
@ -626,7 +626,7 @@ class CLikeCompiler:
fargs = {'prefix': prefix, 'f': fname, 'cast': cast, 'fmt': fmt}
code = '''{prefix}
#include <stdio.h>
int main(int argc, char *argv[]) {{
int main() {{
printf ("{fmt}", {cast} {f}());
}}'''.format(**fargs)
res = self.run(code, env, extra_args=extra_args, dependencies=dependencies)
@ -1026,7 +1026,7 @@ class CLikeCompiler:
return value[:]
def find_library(self, libname, env, extra_dirs, libtype: LibType = LibType.PREFER_SHARED):
code = 'int main(int argc, char **argv) { return 0; }'
code = 'int main() { return 0; }'
return self.find_library_impl(libname, env, extra_dirs, code, libtype)
def find_framework_paths(self, env):
@ -1056,7 +1056,7 @@ class CLikeCompiler:
return paths
def find_framework_real(self, name, env, extra_dirs, allow_system):
code = 'int main(int argc, char **argv) { return 0; }'
code = 'int main() { return 0; }'
link_args = []
for d in extra_dirs:
link_args += ['-F' + d]
@ -1139,7 +1139,7 @@ class CLikeCompiler:
args = fatal_warnings_args + args
args = self.linker_to_compiler_args(args)
code = 'int main(int argc, char **argv) { return 0; }'
code = 'int main() { return 0; }'
return self.has_arguments(args, env, code, mode='link')
@staticmethod

@ -69,7 +69,7 @@ class CPPCompiler(CLikeCompiler, Compiler):
return ['-nostdinc++']
def sanity_check(self, work_dir, environment):
code = 'class breakCCompiler;int main(int argc, char **argv) { return 0; }\n'
code = 'class breakCCompiler;int main() { return 0; }\n'
return self.sanity_check_impl(work_dir, environment, 'sanitycheckcpp.cc', code)
def get_compiler_check_args(self):

@ -40,7 +40,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<stdio.h>\n'
'int main(int argc, char **argv) { return 0; }\n')
'int main() { return 0; }\n')
pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
pc.wait()
if pc.returncode != 0:

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

Loading…
Cancel
Save