[master] 62a25a97b build: test-run our compiler in wflags.py

Nils Goroll nils.goroll at uplex.de
Thu Jun 10 13:43:06 UTC 2021


commit 62a25a97b0171aa1359687c9cbe9801e965893ca
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Jun 10 12:43:39 2021 +0200

    build: test-run our compiler in wflags.py
    
    ... to have a solid baseline

diff --git a/wflags.py b/wflags.py
index 7912f47c8..1778fd41b 100644
--- a/wflags.py
+++ b/wflags.py
@@ -83,17 +83,13 @@ UNDESIRABLE_WFLAGS = [
 
 
 def cc(compiler, opt, obj, src):
+    a = [compiler, "-c"]
+    if opt is not None:
+        a.append(opt)
+    a += ["-o", obj, src]
+
     try:
-        j = subprocess.check_output(
-            [
-                compiler,
-                "-c",
-                opt,
-                "-o", obj,
-                src
-            ],
-            stderr=subprocess.STDOUT
-        )
+        j = subprocess.check_output(a, stderr=subprocess.STDOUT)
     except subprocess.CalledProcessError as err:
         if err.output:
             j = err.output
@@ -110,6 +106,12 @@ def main():
     src_file.flush()
     obj_file = tempfile.NamedTemporaryFile(suffix='.o')
 
+    j = cc(compiler, None, obj_file.name, src_file.name)
+    if j:
+        sys.stderr.write(compiler + " failed without flags\n\t" +
+                         j.decode('utf8') + '\n')
+        sys.exit(1)
+
     use_flags = []
     for i in DESIRABLE_OPTIONS + DESIRABLE_WFLAGS + UNDESIRABLE_WFLAGS:
         j = cc(compiler, i, obj_file.name, src_file.name)


More information about the varnish-commit mailing list