From 55943a06309e6ac491cbddba157c828a92bb64c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Sat, 16 May 2020 17:13:44 +0100 Subject: [PATCH] [SETTINGS] Cleanup the settings generator a bit - Don't include target.h explicitely, it's already included by platform.h - Fix an error in compiled file as a test for discovering contstants. Since we rely on compiler errors to give us the resolved value, that lets us get one extra value on each run - Always compile the test files for setting discovery in c++11 even if no -std=XXX argument is passed from the caller. --- src/utils/compiler.rb | 3 ++- src/utils/settings.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/compiler.rb b/src/utils/compiler.rb index 8cc243f608..39f7d57184 100644 --- a/src/utils/compiler.rb +++ b/src/utils/compiler.rb @@ -57,6 +57,7 @@ class Compiler def default_args cflags = Shellwords.split(ENV["CFLAGS"] || "") args = [@path] + args << "-std=c++11" cflags.each do |flag| # Don't generate temporary files if flag == "" || flag == "-MMD" || flag == "-MP" || flag.start_with?("-save-temps") @@ -67,7 +68,7 @@ class Compiler next end if flag.start_with? "-std=" - flag = "-std=c++11" + next end if flag.start_with? "-D'" # Cleanup flag. Done by the shell when called from diff --git a/src/utils/settings.rb b/src/utils/settings.rb index 7795552308..bb517de362 100644 --- a/src/utils/settings.rb +++ b/src/utils/settings.rb @@ -718,7 +718,7 @@ class Generator def compile_test_file(prog) buf = StringIO.new # cstddef for offsetof() - headers = ["platform.h", "target.h", "cstddef"] + headers = ["platform.h", "cstddef"] @data["groups"].each do |group| gh = group["headers"] if gh @@ -925,7 +925,7 @@ class Generator buf << "static_assert(V == 42 && 0 == 1, \"FAIL\");\n" buf << "public:\n" buf << "Fail() {};\n" - buf << "int64_t v = V\n" + buf << "int64_t v = V;\n" buf << "};\n" ii = 0 s.each do |c|