diff mbox series

[ndctl] meson: Avoid an unnecessary compiler run test.

Message ID 20220918194133.24415-1-kilobyte@angband.pl (mailing list archive)
State Accepted
Commit 8cf5897a1d1940d285e03904b4ba3e0c802b4709
Headers show
Series [ndctl] meson: Avoid an unnecessary compiler run test. | expand

Commit Message

Adam Borowski Sept. 18, 2022, 7:41 p.m. UTC
From: Helmut Grohne <helmut@subdivi.de>

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
 meson.build | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 20a646d..70911b1 100644
--- a/meson.build
+++ b/meson.build
@@ -231,19 +231,18 @@  conf.set('ENABLE_DESTRUCTIVE', get_option('destructive').enabled())
 conf.set('ENABLE_LOGGING', get_option('logging').enabled())
 conf.set('ENABLE_DEBUG', get_option('dbg').enabled())
 
-typeof = cc.run('''
-  int main() {
+typeof_code = '''
+  void func() {
     struct {
       char a[16];
     } x;
     typeof(x) y;
 
-    return sizeof(x) == sizeof(y);
+    char static_assert[2 * (sizeof(x) == sizeof(y)) - 1];
   }
   '''
-)
 
-if typeof.compiled() and typeof.returncode() == 1
+if cc.compiles(typeof_code)
   conf.set('HAVE_TYPEOF', 1)
   conf.set('HAVE_STATEMENT_EXPR', 1)
 endif