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
pull/13664/head
Thomas Haller 10 months ago committed by Eli Schwartz
parent a22a50a673
commit fa8bd9306c
  1. 2
      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)

Loading…
Cancel
Save