Merge pull request #623 from mikisch81/gcc-add-c90-c99-flags

Added C90 and C99 flags to gcc
This commit is contained in:
Tom van Dijck 2016-11-22 09:12:07 -08:00 committed by GitHub
commit 24f2da8842
5 changed files with 40 additions and 21 deletions

View File

@ -196,7 +196,7 @@
end end
local toolset = m.getcompiler(cfg) local toolset = m.getcompiler(cfg)
local cxxflags = table.concat(table.join(toolset.getcflags(cfg), toolset.getcxxflags(cfg), cfg.buildoptions), ";") local cxxflags = table.concat(table.join(toolset.getcxxflags(cfg), cfg.buildoptions), ";")
local cflags = table.concat(table.join(toolset.getcflags(cfg), cfg.buildoptions), ";") local cflags = table.concat(table.join(toolset.getcflags(cfg), cfg.buildoptions), ";")
local asmflags = "" local asmflags = ""
local pch = "" local pch = ""

View File

@ -503,6 +503,8 @@
"WPF", "WPF",
"C++11", "C++11",
"C++14", "C++14",
"C90",
"C99",
}, },
aliases = { aliases = {
FatalWarnings = { "FatalWarnings", "FatalCompileWarnings", "FatalLinkWarnings" }, FatalWarnings = { "FatalWarnings", "FatalCompileWarnings", "FatalLinkWarnings" },

View File

@ -335,7 +335,7 @@
function make.cxxFlags(cfg, toolset) function make.cxxFlags(cfg, toolset)
_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(toolset.getcxxflags(cfg))) _p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS)%s', make.list(table.join(toolset.getcxxflags(cfg), cfg.buildoptions)))
end end

View File

@ -41,11 +41,11 @@
-- An array of C compiler flags. -- An array of C compiler flags.
-- --
clang.cflags = { clang.shared = {
architecture = gcc.cflags.architecture, architecture = gcc.shared.architecture,
flags = gcc.cflags.flags, flags = gcc.shared.flags,
floatingpoint = gcc.cflags.floatingpoint, floatingpoint = gcc.shared.floatingpoint,
strictaliasing = gcc.cflags.strictaliasing, strictaliasing = gcc.shared.strictaliasing,
optimize = { optimize = {
Off = "-O0", Off = "-O0",
On = "-O2", On = "-O2",
@ -54,18 +54,21 @@
Size = "-Os", Size = "-Os",
Speed = "-O3", Speed = "-O3",
}, },
pic = gcc.cflags.pic, pic = gcc.shared.pic,
vectorextensions = gcc.cflags.vectorextensions, vectorextensions = gcc.shared.vectorextensions,
warnings = gcc.cflags.warnings, warnings = gcc.shared.warnings,
symbols = gcc.cflags.symbols symbols = gcc.shared.symbols
} }
function clang.getcflags(cfg) function clang.getcflags(cfg)
local shared_flags = config.mapFlags(cfg, clang.shared)
local flags = config.mapFlags(cfg, clang.cflags) -- Just pass through to GCC for now
local cflags = config.mapFlags(cfg, gcc.cflags)
local flags = table.join(shared_flags, cflags)
flags = table.join(flags, clang.getwarnings(cfg)) flags = table.join(flags, clang.getwarnings(cfg))
return flags return flags
end end
function clang.getwarnings(cfg) function clang.getwarnings(cfg)
@ -88,11 +91,14 @@
-- --
function clang.getcxxflags(cfg) function clang.getcxxflags(cfg)
local shared_flags = config.mapFlags(cfg, clang.shared)
-- Just pass through to GCC for now -- Just pass through to GCC for now
local flags = gcc.getcxxflags(cfg) local cxxflags = config.mapFlags(cfg, gcc.cxxflags)
return flags
local flags = table.join(shared_flags, cxxflags)
flags = table.join(flags, clang.getwarnings(cfg))
return flags
end end

View File

@ -34,8 +34,7 @@
-- --
-- Returns list of C compiler flags for a configuration. -- Returns list of C compiler flags for a configuration.
-- --
gcc.shared = {
gcc.cflags = {
architecture = { architecture = {
x86 = "-m32", x86 = "-m32",
x86_64 = "-m64", x86_64 = "-m64",
@ -86,8 +85,17 @@
} }
} }
gcc.cflags = {
flags = {
["C90"] = "-std=gnu90",
["C99"] = "-std=gnu99",
},
}
function gcc.getcflags(cfg) function gcc.getcflags(cfg)
local flags = config.mapFlags(cfg, gcc.cflags) local shared_flags = config.mapFlags(cfg, gcc.shared)
local cflags = config.mapFlags(cfg, gcc.cflags)
local flags = table.join(shared_flags, cflags)
flags = table.join(flags, gcc.getwarnings(cfg)) flags = table.join(flags, gcc.getwarnings(cfg))
return flags return flags
end end
@ -126,7 +134,10 @@
} }
function gcc.getcxxflags(cfg) function gcc.getcxxflags(cfg)
local flags = config.mapFlags(cfg, gcc.cxxflags) local shared_flags = config.mapFlags(cfg, gcc.shared)
local cxxflags = config.mapFlags(cfg, gcc.cxxflags)
local flags = table.join(shared_flags, cxxflags)
flags = table.join(flags, gcc.getwarnings(cfg))
return flags return flags
end end
@ -192,7 +203,7 @@
end end
-- --
-- Return a list of decorated rpaths -- Return a list of decorated rpaths
-- --
function gcc.getrunpathdirs(cfg, dirs) function gcc.getrunpathdirs(cfg, dirs)
@ -386,7 +397,7 @@
return ptrn == string.sub(s, -string.len(ptrn)) return ptrn == string.sub(s, -string.len(ptrn))
end end
local name = path.getname(link) local name = path.getname(link)
-- Check whether link mode decorator is present -- Check whether link mode decorator is present
if endswith(name, ":static") then if endswith(name, ":static") then
name = string.sub(name, 0, -8) name = string.sub(name, 0, -8)
table.insert(static_syslibs, "-l" .. name) table.insert(static_syslibs, "-l" .. name)