Skip to content

Commit b252b34

Browse files
thom311eli-schwartz
authored andcommitted
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 (cherry picked from commit fa8bd93)
1 parent 839c5e8 commit b252b34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mesonbuild/compilers/mixins/clike.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ def has_type(self, typename: str, prefix: str, env: 'Environment',
885885
dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]:
886886
t = f'''{prefix}
887887
void bar(void) {{
888-
sizeof({typename});
888+
(void) sizeof({typename});
889889
}}'''
890890
return self.compiles(t, env, extra_args=extra_args,
891891
dependencies=dependencies)

0 commit comments

Comments
 (0)