1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-19 06:15:14 +03:00

[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.
This commit is contained in:
Alberto García Hierro 2020-05-16 17:13:44 +01:00
parent 074c4dec1c
commit 55943a0630
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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|