aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-07-15 10:06:17 +0200
committerMartin Liska <mliska@suse.cz>2019-07-16 09:49:03 +0200
commitc1870889b13b9284867d2c544822cb0a12f62123 (patch)
tree41bcefae62be1fdbdc475ca93ad8205e687cb3c4 /mesonbuild/compilers/c.py
parentd7a682fdede536dd95f76425ac9e06faf334199c (diff)
downloadmeson-c1870889b13b9284867d2c544822cb0a12f62123.zip
meson-c1870889b13b9284867d2c544822cb0a12f62123.tar.gz
meson-c1870889b13b9284867d2c544822cb0a12f62123.tar.bz2
Fix missing return statements that are seen with -Werror=return-type.
Error example: Code: #include <locale.h> int main () { /* If it's not defined as a macro, try to use as a symbol */ #ifndef LC_MESSAGES LC_MESSAGES; #endif } Compiler stdout: Compiler stderr: In file included from /usr/include/locale.h:25, from /tmp/tmpep_i4iwg/testfile.c:2: /usr/include/features.h:382:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] 382 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O) | ^~~~~~~ /tmp/tmpep_i4iwg/testfile.c: In function 'main': /tmp/tmpep_i4iwg/testfile.c:8:9: error: control reaches end of non-void function [-Werror=return-type] 8 | } | ^ cc1: some warnings being treated as errors
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r--mesonbuild/compilers/c.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 47cfd98..eff7161 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -67,6 +67,7 @@ class CCompiler(CLikeCompiler, Compiler):
#ifndef {symbol}
{symbol};
#endif
+ return 0;
}}'''
return self.compiles(t.format(**fargs), env, extra_args=extra_args,
dependencies=dependencies)