mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-19 22:35:19 +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:
parent
074c4dec1c
commit
55943a0630
2 changed files with 4 additions and 3 deletions
|
@ -57,6 +57,7 @@ class Compiler
|
||||||
def default_args
|
def default_args
|
||||||
cflags = Shellwords.split(ENV["CFLAGS"] || "")
|
cflags = Shellwords.split(ENV["CFLAGS"] || "")
|
||||||
args = [@path]
|
args = [@path]
|
||||||
|
args << "-std=c++11"
|
||||||
cflags.each do |flag|
|
cflags.each do |flag|
|
||||||
# Don't generate temporary files
|
# Don't generate temporary files
|
||||||
if flag == "" || flag == "-MMD" || flag == "-MP" || flag.start_with?("-save-temps")
|
if flag == "" || flag == "-MMD" || flag == "-MP" || flag.start_with?("-save-temps")
|
||||||
|
@ -67,7 +68,7 @@ class Compiler
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
if flag.start_with? "-std="
|
if flag.start_with? "-std="
|
||||||
flag = "-std=c++11"
|
next
|
||||||
end
|
end
|
||||||
if flag.start_with? "-D'"
|
if flag.start_with? "-D'"
|
||||||
# Cleanup flag. Done by the shell when called from
|
# Cleanup flag. Done by the shell when called from
|
||||||
|
|
|
@ -718,7 +718,7 @@ class Generator
|
||||||
def compile_test_file(prog)
|
def compile_test_file(prog)
|
||||||
buf = StringIO.new
|
buf = StringIO.new
|
||||||
# cstddef for offsetof()
|
# cstddef for offsetof()
|
||||||
headers = ["platform.h", "target.h", "cstddef"]
|
headers = ["platform.h", "cstddef"]
|
||||||
@data["groups"].each do |group|
|
@data["groups"].each do |group|
|
||||||
gh = group["headers"]
|
gh = group["headers"]
|
||||||
if gh
|
if gh
|
||||||
|
@ -925,7 +925,7 @@ class Generator
|
||||||
buf << "static_assert(V == 42 && 0 == 1, \"FAIL\");\n"
|
buf << "static_assert(V == 42 && 0 == 1, \"FAIL\");\n"
|
||||||
buf << "public:\n"
|
buf << "public:\n"
|
||||||
buf << "Fail() {};\n"
|
buf << "Fail() {};\n"
|
||||||
buf << "int64_t v = V\n"
|
buf << "int64_t v = V;\n"
|
||||||
buf << "};\n"
|
buf << "};\n"
|
||||||
ii = 0
|
ii = 0
|
||||||
s.each do |c|
|
s.each do |c|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue