diff options
| author | Thomas Haller <thaller@redhat.com> | 2024-02-07 11:12:22 +0100 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-09-11 09:36:53 -0400 |
| commit | fa8bd9306c01a1268d1a4cd7417ad753b1aa09e1 (patch) | |
| tree | 5725a17fb953d9675165ac1086318ed63ccf1f9b | |
| parent | a22a50a6739160bdf93a5a11f5026112007ccf4e (diff) | |
| download | meson-fa8bd9306c01a1268d1a4cd7417ad753b1aa09e1.tar.gz | |
compilers: avoid -Wunused-value compiler warning in CLikeCompiler.has_type()
Otherwise, `CFLAGS='-Wall -Werror' meson build` can fail detection:
Running compile:
Working directory: ./project/build/meson-private/tmpk86bgc04
Code:
#include <sys/types.h>
void bar(void) {
sizeof(loff_t);
}
-----------
Command line: `cc ./project/build/meson-private/tmpk86bgc04/testfile.c -o ./project/build/meson-private/tmpk86bgc04/output.obj -c -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
stderr:
./project/build/meson-private/tmpk86bgc04/testfile.c: In function 'bar':
./project/build/meson-private/tmpk86bgc04/testfile.c:3:13: error: statement with no effect [-Werror=unused-value]
3 | sizeof(loff_t);
| ^~~~~~
cc1: all warnings being treated as errors
-----------
Checking for type "loff_t" : NO
| -rw-r--r-- | mesonbuild/compilers/mixins/clike.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index a0d6094ab..e982ca023 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -885,7 +885,7 @@ class CLikeCompiler(Compiler): dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]: t = f'''{prefix} void bar(void) {{ - sizeof({typename}); + (void) sizeof({typename}); }}''' return self.compiles(t, env, extra_args=extra_args, dependencies=dependencies) |
