2009-05-12 21:44:45 +00:00
|
|
|
--
|
|
|
|
-- tests/test_gcc.lua
|
|
|
|
-- Automated test suite for the GCC toolset interface.
|
2013-05-16 15:40:47 +00:00
|
|
|
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
2009-05-12 21:44:45 +00:00
|
|
|
--
|
|
|
|
|
2017-04-25 05:44:13 +00:00
|
|
|
local p = premake
|
2013-09-11 14:57:44 +00:00
|
|
|
local suite = test.declare("tools_gcc")
|
2012-02-17 00:51:14 +00:00
|
|
|
|
2017-04-25 05:44:13 +00:00
|
|
|
local gcc = p.tools.gcc
|
|
|
|
local project = p.project
|
2012-02-17 00:51:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup/teardown
|
|
|
|
--
|
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
local wks, prj, cfg
|
2009-05-12 21:44:45 +00:00
|
|
|
|
2009-12-31 22:46:45 +00:00
|
|
|
function suite.setup()
|
2015-08-28 20:16:14 +00:00
|
|
|
wks, prj = test.createWorkspace()
|
2012-02-17 00:51:14 +00:00
|
|
|
system "Linux"
|
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare()
|
2013-11-14 13:52:55 +00:00
|
|
|
cfg = test.getconfig(prj, "Debug")
|
2009-05-12 21:44:45 +00:00
|
|
|
end
|
|
|
|
|
2009-12-31 22:46:45 +00:00
|
|
|
|
2012-09-27 16:18:03 +00:00
|
|
|
--
|
|
|
|
-- Check the selection of tools based on the target system.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.tools_onDefaults()
|
|
|
|
prepare()
|
|
|
|
test.isnil(gcc.gettoolname(cfg, "cc"))
|
|
|
|
test.isnil(gcc.gettoolname(cfg, "cxx"))
|
|
|
|
test.isnil(gcc.gettoolname(cfg, "ar"))
|
2013-09-26 23:37:24 +00:00
|
|
|
test.isequal("windres", gcc.gettoolname(cfg, "rc"))
|
2012-09-27 16:18:03 +00:00
|
|
|
end
|
|
|
|
|
2015-03-10 11:45:41 +00:00
|
|
|
function suite.tools_withPrefix()
|
|
|
|
gccprefix "test-prefix-"
|
|
|
|
prepare()
|
|
|
|
test.isequal("test-prefix-gcc", gcc.gettoolname(cfg, "cc"))
|
|
|
|
test.isequal("test-prefix-g++", gcc.gettoolname(cfg, "cxx"))
|
|
|
|
test.isequal("test-prefix-ar", gcc.gettoolname(cfg, "ar"))
|
|
|
|
test.isequal("test-prefix-windres", gcc.gettoolname(cfg, "rc"))
|
|
|
|
end
|
|
|
|
|
2012-09-27 16:18:03 +00:00
|
|
|
|
2011-02-10 17:24:51 +00:00
|
|
|
--
|
2012-02-17 00:51:14 +00:00
|
|
|
-- By default, the -MMD -MP are used to generate dependencies.
|
2011-02-10 17:24:51 +00:00
|
|
|
--
|
|
|
|
|
2022-04-08 12:50:40 +00:00
|
|
|
function suite.cppflags_defaultWithMD()
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2022-04-08 12:50:40 +00:00
|
|
|
test.contains({"-MD", "-MP"}, gcc.getcppflags(cfg))
|
2009-05-12 21:44:45 +00:00
|
|
|
end
|
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Haiku OS doesn't support the -MP flag yet (that's weird, isn't it?)
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cppflagsExcludeMP_onHaiku()
|
|
|
|
system "Haiku"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.excludes({ "-MP" }, gcc.getcppflags(cfg))
|
2011-02-10 17:24:51 +00:00
|
|
|
end
|
2009-12-31 22:46:45 +00:00
|
|
|
|
2011-02-10 17:24:51 +00:00
|
|
|
|
|
|
|
--
|
2012-02-17 00:51:14 +00:00
|
|
|
-- Check the translation of CFLAGS.
|
2011-02-10 17:24:51 +00:00
|
|
|
--
|
|
|
|
|
2020-06-19 18:09:14 +00:00
|
|
|
function suite.cflags_onNoWarnings()
|
|
|
|
warnings "Off"
|
2013-09-27 18:25:10 +00:00
|
|
|
prepare()
|
2020-06-19 18:09:14 +00:00
|
|
|
test.contains({ "-w" }, gcc.getcflags(cfg))
|
2013-09-27 18:25:10 +00:00
|
|
|
end
|
|
|
|
|
2021-11-13 17:16:16 +00:00
|
|
|
function suite.cflags_onDefaultWarnings()
|
|
|
|
warnings "Default"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-w", "-Wall", "-Wextra", "-Weverything" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2017-06-28 22:26:56 +00:00
|
|
|
function suite.cflags_onHighWarnings()
|
2020-06-19 18:09:14 +00:00
|
|
|
warnings "High"
|
2017-06-28 22:26:56 +00:00
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wall" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2020-06-19 18:09:14 +00:00
|
|
|
function suite.cflags_onExtraWarnings()
|
|
|
|
warnings "Extra"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wall", "-Wextra" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onEverythingWarnings()
|
|
|
|
warnings "Everything"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Weverything" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
function suite.cflags_onFatalWarnings()
|
|
|
|
flags { "FatalWarnings" }
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-Werror" }, gcc.getcflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
2015-03-10 10:59:28 +00:00
|
|
|
function suite.cflags_onSpecificWarnings()
|
|
|
|
enablewarnings { "enable" }
|
|
|
|
disablewarnings { "disable" }
|
|
|
|
fatalwarnings { "fatal" }
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wenable", "-Wno-disable", "-Werror=fatal" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2021-11-13 17:16:16 +00:00
|
|
|
function suite.cflags_onNoExternalWarnings()
|
|
|
|
externalwarnings "Off"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-Wsystem-headers" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onDefaultExternalWarnings()
|
|
|
|
externalwarnings "Default"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wsystem-headers" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onHighExternalWarnings()
|
|
|
|
externalwarnings "High"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wsystem-headers" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onExtraExternalWarnings()
|
|
|
|
externalwarnings "Extra"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wsystem-headers" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onEverythingExternalWarnings()
|
|
|
|
externalwarnings "Everything"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wsystem-headers" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2013-09-27 18:49:21 +00:00
|
|
|
function suite.cflags_onFloastFast()
|
|
|
|
floatingpoint "Fast"
|
2012-07-30 11:12:01 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-ffast-math" }, gcc.getcflags(cfg))
|
2013-09-27 18:49:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onFloastStrict()
|
|
|
|
floatingpoint "Strict"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-ffloat-store" }, gcc.getcflags(cfg))
|
2012-07-30 11:12:01 +00:00
|
|
|
end
|
2009-09-29 20:28:13 +00:00
|
|
|
|
2013-09-27 18:49:21 +00:00
|
|
|
function suite.cflags_onSSE()
|
|
|
|
vectorextensions "SSE"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-msse" }, gcc.getcflags(cfg))
|
2013-09-27 18:49:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onSSE2()
|
|
|
|
vectorextensions "SSE2"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-msse2" }, gcc.getcflags(cfg))
|
2013-09-27 18:49:21 +00:00
|
|
|
end
|
|
|
|
|
2021-09-30 18:30:50 +00:00
|
|
|
function suite.cflags_onSSE4_2()
|
|
|
|
vectorextensions "SSE4.2"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-msse4.2" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2015-03-26 12:17:13 +00:00
|
|
|
function suite.cflags_onAVX()
|
|
|
|
vectorextensions "AVX"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mavx" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2015-03-26 16:24:11 +00:00
|
|
|
function suite.cflags_onAVX2()
|
2015-03-26 12:17:13 +00:00
|
|
|
vectorextensions "AVX2"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mavx2" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2018-01-09 15:01:51 +00:00
|
|
|
function suite.cflags_onMOVBE()
|
|
|
|
isaextensions "MOVBE"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mmovbe" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onPOPCNT()
|
|
|
|
isaextensions "POPCNT"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mpopcnt" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onPCLMUL()
|
|
|
|
isaextensions "PCLMUL"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mpclmul" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onLZCNT()
|
|
|
|
isaextensions "LZCNT"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mlzcnt" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onBMI()
|
|
|
|
isaextensions "BMI"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mbmi" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onBMI2()
|
|
|
|
isaextensions "BMI2"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mbmi2" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onF16C()
|
|
|
|
isaextensions "F16C"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mf16c" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onAES()
|
|
|
|
isaextensions "AES"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-maes" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onFMA()
|
|
|
|
isaextensions "FMA"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mfma" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onFMA4()
|
|
|
|
isaextensions "FMA4"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mfma4" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onRDRND()
|
|
|
|
isaextensions "RDRND"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mrdrnd" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onMultipleISA()
|
|
|
|
isaextensions {
|
|
|
|
"RDRND",
|
|
|
|
"FMA4"
|
|
|
|
}
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mrdrnd", "-mfma4" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onAdditionalISA()
|
|
|
|
isaextensions "RDRND"
|
|
|
|
isaextensions "FMA4"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mrdrnd", "-mfma4" }, gcc.getcflags(cfg))
|
|
|
|
end
|
2013-10-16 17:47:09 +00:00
|
|
|
|
2015-03-10 10:41:44 +00:00
|
|
|
--
|
|
|
|
-- Check the defines and undefines.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.defines()
|
|
|
|
defines "DEF"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-DDEF" }, gcc.getdefines(cfg.defines))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.undefines()
|
|
|
|
undefines "UNDEF"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-UUNDEF" }, gcc.getundefines(cfg.undefines))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-10-16 17:47:09 +00:00
|
|
|
--
|
|
|
|
-- Check the optimization flags.
|
|
|
|
--
|
|
|
|
|
2013-10-09 01:05:17 +00:00
|
|
|
function suite.cflags_onNoOptimize()
|
|
|
|
optimize "Off"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-O0" }, gcc.getcflags(cfg))
|
2013-10-09 01:05:17 +00:00
|
|
|
end
|
2013-09-27 18:49:21 +00:00
|
|
|
|
2013-10-16 17:47:09 +00:00
|
|
|
function suite.cflags_onOptimize()
|
|
|
|
optimize "On"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-O2" }, gcc.getcflags(cfg))
|
2013-10-16 17:47:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onOptimizeSize()
|
|
|
|
optimize "Size"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-Os" }, gcc.getcflags(cfg))
|
2013-10-16 17:47:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onOptimizeSpeed()
|
|
|
|
optimize "Speed"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-O3" }, gcc.getcflags(cfg))
|
2013-10-16 17:47:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onOptimizeFull()
|
|
|
|
optimize "Full"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-O3" }, gcc.getcflags(cfg))
|
2013-10-16 17:47:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onOptimizeDebug()
|
|
|
|
optimize "Debug"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-Og" }, gcc.getcflags(cfg))
|
2013-10-16 17:47:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2016-07-19 06:29:26 +00:00
|
|
|
--
|
|
|
|
-- Check the translation of symbols.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onDefaultSymbols()
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-g" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onNoSymbols()
|
|
|
|
symbols "Off"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-g" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onSymbols()
|
|
|
|
symbols "On"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-g" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
--
|
|
|
|
-- Check the translation of CXXFLAGS.
|
|
|
|
--
|
2009-12-31 22:46:45 +00:00
|
|
|
|
2022-08-07 19:09:19 +00:00
|
|
|
function suite.cxxflags_onNoExceptions()
|
2015-06-23 20:53:10 +00:00
|
|
|
exceptionhandling "Off"
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-fno-exceptions" }, gcc.getcxxflags(cfg))
|
2009-09-29 20:28:13 +00:00
|
|
|
end
|
|
|
|
|
2022-08-07 19:09:19 +00:00
|
|
|
function suite.cxxflags_onNoBufferSecurityCheck()
|
2013-08-15 22:22:23 +00:00
|
|
|
flags { "NoBufferSecurityCheck" }
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-fno-stack-protector" }, gcc.getcxxflags(cfg))
|
2013-08-15 22:22:23 +00:00
|
|
|
end
|
2009-12-31 22:46:45 +00:00
|
|
|
|
2022-08-08 14:29:49 +00:00
|
|
|
function suite.cxxflags_onSanitizeAddress()
|
|
|
|
sanitize { "Address" }
|
2022-08-07 19:09:19 +00:00
|
|
|
prepare()
|
|
|
|
test.contains({ "-fsanitize=address" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
--
|
|
|
|
-- Check the basic translation of LDFLAGS for a Posix system.
|
|
|
|
--
|
|
|
|
|
2014-09-17 23:19:47 +00:00
|
|
|
function suite.ldflags_onNoSymbols()
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-s" }, gcc.getldflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.ldflags_onSymbols()
|
2016-07-19 06:29:26 +00:00
|
|
|
symbols "On"
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.excludes("-s", gcc.getldflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.ldflags_onSharedLib()
|
|
|
|
kind "SharedLib"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-shared" }, gcc.getldflags(cfg))
|
2009-09-29 20:28:13 +00:00
|
|
|
end
|
2009-12-31 22:46:45 +00:00
|
|
|
|
2011-02-10 17:24:51 +00:00
|
|
|
--
|
2012-02-17 00:51:14 +00:00
|
|
|
-- Check Mac OS X variants on LDFLAGS.
|
2011-02-10 17:24:51 +00:00
|
|
|
--
|
|
|
|
|
2015-05-04 18:48:01 +00:00
|
|
|
function suite.ldflags_onMacOSXBundle()
|
|
|
|
system "MacOSX"
|
|
|
|
kind "SharedLib"
|
|
|
|
sharedlibtype "OSXBundle"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wl,-x", "-bundle" }, gcc.getldflags(cfg))
|
|
|
|
end
|
|
|
|
|
2019-01-09 04:12:44 +00:00
|
|
|
function suite.ldflags_onMacOSXXCTest()
|
|
|
|
system "MacOSX"
|
|
|
|
kind "SharedLib"
|
|
|
|
sharedlibtype "XCTest"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wl,-x", "-bundle" }, gcc.getldflags(cfg))
|
|
|
|
end
|
|
|
|
|
2015-05-04 18:48:01 +00:00
|
|
|
function suite.ldflags_onMacOSXFramework()
|
|
|
|
system "MacOSX"
|
|
|
|
kind "SharedLib"
|
|
|
|
sharedlibtype "OSXFramework"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-Wl,-x", "-framework" }, gcc.getldflags(cfg))
|
|
|
|
end
|
|
|
|
|
2014-09-17 23:19:47 +00:00
|
|
|
function suite.ldflags_onMacOSXNoSymbols()
|
2012-02-17 00:51:14 +00:00
|
|
|
system "MacOSX"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-Wl,-x" }, gcc.getldflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.ldflags_onMacOSXSharedLib()
|
|
|
|
system "MacOSX"
|
|
|
|
kind "SharedLib"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-dynamiclib" }, gcc.getldflags(cfg))
|
2011-02-10 17:24:51 +00:00
|
|
|
end
|
2021-11-13 17:16:16 +00:00
|
|
|
|
2020-06-11 18:34:05 +00:00
|
|
|
--
|
|
|
|
-- Check Mac OS X deployment target flags
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_macosx_systemversion()
|
|
|
|
system "MacOSX"
|
|
|
|
systemversion "10.9"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mmacosx-version-min=10.9" }, gcc.getcflags(cfg))
|
|
|
|
end
|
2021-11-13 17:16:16 +00:00
|
|
|
|
2020-06-11 18:34:05 +00:00
|
|
|
function suite.cxxflags_macosx_systemversion()
|
|
|
|
system "MacOSX"
|
|
|
|
systemversion "10.9:10.15"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-mmacosx-version-min=10.9" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
2021-11-13 17:16:16 +00:00
|
|
|
|
2020-06-15 08:29:16 +00:00
|
|
|
function suite.cxxflags_macosx_systemversion_unspecified()
|
2020-06-11 18:34:05 +00:00
|
|
|
system "MacOSX"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-mmacosx-version-min=10.9" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
2011-02-10 17:24:51 +00:00
|
|
|
|
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
--
|
|
|
|
-- Check Windows variants on LDFLAGS.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.ldflags_onWindowsharedLib()
|
|
|
|
system "Windows"
|
|
|
|
kind "SharedLib"
|
|
|
|
prepare()
|
2015-07-02 14:14:26 +00:00
|
|
|
test.contains({ "-shared", '-Wl,--out-implib="bin/Debug/MyProject.lib"' }, gcc.getldflags(cfg))
|
2009-12-31 22:46:45 +00:00
|
|
|
end
|
2012-02-17 00:51:14 +00:00
|
|
|
|
|
|
|
function suite.ldflags_onWindowsApp()
|
|
|
|
system "Windows"
|
|
|
|
kind "WindowedApp"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-mwindows" }, gcc.getldflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
2013-01-31 14:38:45 +00:00
|
|
|
|
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Make sure system or architecture flags are added properly.
|
|
|
|
--
|
|
|
|
|
2015-04-13 22:27:11 +00:00
|
|
|
function suite.cflags_onX86()
|
2015-04-10 13:02:19 +00:00
|
|
|
architecture "x86"
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-m32" }, gcc.getcflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
2015-04-13 22:27:11 +00:00
|
|
|
function suite.ldflags_onX86()
|
2015-04-10 13:02:19 +00:00
|
|
|
architecture "x86"
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-m32" }, gcc.getldflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
2015-04-13 22:27:11 +00:00
|
|
|
function suite.cflags_onX86_64()
|
2015-04-10 13:02:19 +00:00
|
|
|
architecture "x86_64"
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-m64" }, gcc.getcflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
2015-04-13 22:27:11 +00:00
|
|
|
function suite.ldflags_onX86_64()
|
2015-04-10 13:02:19 +00:00
|
|
|
architecture "x86_64"
|
2012-02-17 00:51:14 +00:00
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-m64" }, gcc.getldflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Non-Windows shared libraries should marked as position independent.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onWindowsSharedLib()
|
|
|
|
system "MacOSX"
|
|
|
|
kind "SharedLib"
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-fPIC" }, gcc.getcflags(cfg))
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
2012-02-28 21:15:46 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Check the formatting of linked system libraries.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onSystemLibs()
|
|
|
|
links { "fs_stub", "net_stub" }
|
|
|
|
prepare()
|
2014-09-17 23:19:47 +00:00
|
|
|
test.contains({ "-lfs_stub", "-lnet_stub" }, gcc.getlinks(cfg))
|
2012-02-28 21:15:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.links_onFramework()
|
|
|
|
links { "Cocoa.framework" }
|
|
|
|
prepare()
|
2016-08-17 15:48:41 +00:00
|
|
|
test.contains({ "-framework Cocoa" }, {table.implode (gcc.getlinks(cfg), '', '', ' ')})
|
2012-02-28 21:15:46 +00:00
|
|
|
end
|
|
|
|
|
2015-02-12 23:29:48 +00:00
|
|
|
function suite.links_onSystemLibs_onWindows()
|
2015-02-14 19:56:02 +00:00
|
|
|
system "windows"
|
|
|
|
links { "ole32" }
|
2015-02-12 23:29:48 +00:00
|
|
|
prepare()
|
2015-02-14 19:56:02 +00:00
|
|
|
test.contains({ "-lole32" }, gcc.getlinks(cfg))
|
2015-02-12 23:29:48 +00:00
|
|
|
end
|
|
|
|
|
2012-02-28 21:15:46 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- When linking to a static sibling library, the relative path to the library
|
|
|
|
-- should be used instead of the "-l" flag. This prevents linking against a
|
|
|
|
-- shared library of the same name, should one be present.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onStaticSiblingLibrary()
|
|
|
|
links { "MyProject2" }
|
2012-06-28 19:48:05 +00:00
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
test.createproject(wks)
|
2012-06-28 19:48:05 +00:00
|
|
|
system "Linux"
|
2012-02-28 21:15:46 +00:00
|
|
|
kind "StaticLib"
|
|
|
|
targetdir "lib"
|
2012-06-28 19:48:05 +00:00
|
|
|
|
2012-02-28 21:15:46 +00:00
|
|
|
prepare()
|
|
|
|
test.isequal({ "lib/libMyProject2.a" }, gcc.getlinks(cfg))
|
|
|
|
end
|
2012-02-29 21:05:45 +00:00
|
|
|
|
|
|
|
|
2012-06-13 19:21:22 +00:00
|
|
|
--
|
|
|
|
-- Use the -lname format when linking to sibling shared libraries.
|
|
|
|
--
|
|
|
|
|
2013-05-16 15:40:47 +00:00
|
|
|
function suite.links_onSharedSiblingLibrary()
|
2012-06-13 19:21:22 +00:00
|
|
|
links { "MyProject2" }
|
2012-06-28 19:48:05 +00:00
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
test.createproject(wks)
|
2012-06-28 19:48:05 +00:00
|
|
|
system "Linux"
|
2012-06-13 19:21:22 +00:00
|
|
|
kind "SharedLib"
|
|
|
|
targetdir "lib"
|
2012-06-28 19:48:05 +00:00
|
|
|
|
2012-06-13 19:21:22 +00:00
|
|
|
prepare()
|
2013-05-16 15:40:47 +00:00
|
|
|
test.isequal({ "lib/libMyProject2.so" }, gcc.getlinks(cfg))
|
2012-06-13 19:21:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2020-02-02 06:46:52 +00:00
|
|
|
--
|
|
|
|
-- Test that sibling and external links are grouped when required
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.linkgroups_onSiblingAndExternalLibrary()
|
|
|
|
links { "MyProject2", "ExternalProj" }
|
|
|
|
linkgroups "On"
|
|
|
|
|
|
|
|
test.createproject(wks)
|
|
|
|
system "Linux"
|
|
|
|
kind "StaticLib"
|
|
|
|
targetdir "lib"
|
|
|
|
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "-Wl,--start-group", "lib/libMyProject2.a", "-lExternalProj", "-Wl,--end-group" }, gcc.getlinks(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-02-29 21:05:45 +00:00
|
|
|
--
|
|
|
|
-- When linking object files, leave off the "-l".
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onObjectFile()
|
|
|
|
links { "generated.o" }
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "generated.o" }, gcc.getlinks(cfg))
|
|
|
|
end
|
|
|
|
|
2012-06-28 18:17:19 +00:00
|
|
|
|
2013-01-31 14:38:45 +00:00
|
|
|
--
|
|
|
|
-- If the object file is referenced with a path, it should be
|
|
|
|
-- made relative to the project.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onObjectFileOutsideProject()
|
|
|
|
location "MyProject"
|
|
|
|
links { "obj/Debug/generated.o" }
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "../obj/Debug/generated.o" }, gcc.getlinks(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Make sure shell variables are kept intact for object file paths.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onObjectFileWithShellVar()
|
|
|
|
location "MyProject"
|
|
|
|
links { "$(IntDir)/generated.o" }
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "$(IntDir)/generated.o" }, gcc.getlinks(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-28 18:17:19 +00:00
|
|
|
--
|
|
|
|
-- Include directories should be made project relative.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.includeDirsAreRelative()
|
|
|
|
includedirs { "../include", "src/include" }
|
2021-11-13 17:16:16 +00:00
|
|
|
externalincludedirs { "test/include" }
|
2012-06-28 18:17:19 +00:00
|
|
|
prepare()
|
2021-11-13 17:16:16 +00:00
|
|
|
test.isequal({ '-I../include', '-Isrc/include', '-isystem test/include' }, gcc.getincludedirs(cfg, cfg.includedirs, cfg.externalincludedirs))
|
2012-06-28 18:17:19 +00:00
|
|
|
end
|
|
|
|
|
2012-06-30 12:25:30 +00:00
|
|
|
|
2012-11-06 21:42:44 +00:00
|
|
|
--
|
|
|
|
-- Check handling of forced includes.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.forcedIncludeFiles()
|
|
|
|
forceincludes { "stdafx.h", "include/sys.h" }
|
|
|
|
prepare()
|
2013-09-11 14:57:44 +00:00
|
|
|
test.isequal({'-include stdafx.h', '-include include/sys.h'}, gcc.getforceincludes(cfg))
|
2012-11-06 21:42:44 +00:00
|
|
|
end
|
2013-09-11 14:57:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Include directories containing spaces (or which could contain spaces)
|
|
|
|
-- should be wrapped in quotes.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.includeDirs_onSpaces()
|
|
|
|
includedirs { "include files" }
|
2021-11-13 17:16:16 +00:00
|
|
|
externalincludedirs { "test include" }
|
2013-09-11 14:57:44 +00:00
|
|
|
prepare()
|
2021-11-13 17:16:16 +00:00
|
|
|
test.isequal({ '-I"include files"', '-isystem "test include"' }, gcc.getincludedirs(cfg, cfg.includedirs, cfg.externalincludedirs))
|
2013-09-11 14:57:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.includeDirs_onEnvVars()
|
|
|
|
includedirs { "$(IntDir)/includes" }
|
2021-11-13 17:16:16 +00:00
|
|
|
externalincludedirs { "$(BinDir)/include" }
|
2013-09-11 14:57:44 +00:00
|
|
|
prepare()
|
2021-11-13 17:16:16 +00:00
|
|
|
test.isequal({ '-I"$(IntDir)/includes"', '-isystem "$(BinDir)/include"' }, gcc.getincludedirs(cfg, cfg.includedirs, cfg.externalincludedirs))
|
2013-09-11 14:57:44 +00:00
|
|
|
end
|
|
|
|
|
2014-11-04 23:25:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check handling of strict aliasing flags.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onNoStrictAliasing()
|
|
|
|
strictaliasing "Off"
|
|
|
|
prepare()
|
|
|
|
test.contains("-fno-strict-aliasing", gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onLevel1Aliasing()
|
|
|
|
strictaliasing "Level1"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-fstrict-aliasing", "-Wstrict-aliasing=1" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onLevel2Aliasing()
|
|
|
|
strictaliasing "Level2"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-fstrict-aliasing", "-Wstrict-aliasing=2" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onLevel3Aliasing()
|
|
|
|
strictaliasing "Level3"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-fstrict-aliasing", "-Wstrict-aliasing=3" }, gcc.getcflags(cfg))
|
|
|
|
end
|
2015-05-19 19:35:28 +00:00
|
|
|
|
2022-04-12 21:50:47 +00:00
|
|
|
--
|
|
|
|
-- Check handling of openmp.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onOpenmpOn()
|
|
|
|
openmp "On"
|
|
|
|
prepare()
|
|
|
|
test.contains("-fopenmp", gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onOpenmpOff()
|
|
|
|
openmp "Off"
|
|
|
|
prepare()
|
|
|
|
test.excludes("-fopenmp", gcc.getcflags(cfg))
|
|
|
|
end
|
2015-05-19 19:35:28 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Check handling of system search paths.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.libDirs_onSysLibDirs()
|
|
|
|
syslibdirs { "/usr/local/lib" }
|
|
|
|
prepare()
|
|
|
|
test.contains("-L/usr/local/lib", gcc.getLibraryDirectories(cfg))
|
|
|
|
end
|
2015-06-30 20:20:10 +00:00
|
|
|
|
2020-11-04 09:55:30 +00:00
|
|
|
--
|
|
|
|
-- Check handling of Apple frameworks search paths
|
|
|
|
--
|
|
|
|
function suite.includeDirs_notDarwin_onFrameworkDirs()
|
|
|
|
system "Linux"
|
|
|
|
frameworkdirs { "/Library/Frameworks" }
|
|
|
|
prepare()
|
|
|
|
test.excludes("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.libDirs_notDarwin_onFrameworkDirs()
|
|
|
|
system "Windows"
|
|
|
|
frameworkdirs { "/Library/Frameworks" }
|
|
|
|
prepare()
|
|
|
|
test.excludes("-F/Library/Frameworks", gcc.getLibraryDirectories(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.includeDirs_macosx_onFrameworkDirs()
|
|
|
|
system "MacOSX"
|
|
|
|
location "subdir"
|
2021-11-13 17:16:16 +00:00
|
|
|
frameworkdirs {
|
2020-11-04 09:55:30 +00:00
|
|
|
"/Library/Frameworks",
|
2021-11-13 17:16:16 +00:00
|
|
|
"subdir/Relative/Frameworks"
|
2020-11-04 09:55:30 +00:00
|
|
|
}
|
|
|
|
prepare()
|
|
|
|
test.contains("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
|
|
|
test.contains("-FRelative/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.libDirs_macosx_onFrameworkDirs()
|
|
|
|
system "MacOSX"
|
|
|
|
location "subdir"
|
2021-11-13 17:16:16 +00:00
|
|
|
frameworkdirs {
|
2020-11-04 09:55:30 +00:00
|
|
|
"/Library/Frameworks",
|
|
|
|
"subdir/Relative/Frameworks"
|
|
|
|
}
|
|
|
|
prepare()
|
|
|
|
test.contains("-F/Library/Frameworks", gcc.getLibraryDirectories(cfg))
|
|
|
|
test.contains("-FRelative/Frameworks", gcc.getLibraryDirectories(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.includeDirs_ios_onFrameworkDirs()
|
|
|
|
system "iOS"
|
|
|
|
frameworkdirs { "/Library/Frameworks" }
|
|
|
|
prepare()
|
|
|
|
test.contains("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
|
|
|
end
|
|
|
|
|
2015-06-30 20:20:10 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Check handling of link time optimization flag.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onLinkTimeOptimization()
|
|
|
|
flags "LinkTimeOptimization"
|
|
|
|
prepare()
|
|
|
|
test.contains("-flto", gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.ldflags_onLinkTimeOptimization()
|
|
|
|
flags "LinkTimeOptimization"
|
|
|
|
prepare()
|
|
|
|
test.contains("-flto", gcc.getldflags(cfg))
|
|
|
|
end
|
2016-01-15 12:46:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check link mode preference for system libraries.
|
|
|
|
--
|
|
|
|
function suite.linksModePreference_onAllStatic()
|
|
|
|
links { "fs_stub:static", "net_stub:static" }
|
|
|
|
prepare()
|
2016-01-15 16:02:01 +00:00
|
|
|
test.contains({ "-Wl,-Bstatic", "-lfs_stub", "-Wl,-Bdynamic", "-lnet_stub"}, gcc.getlinks(cfg))
|
2016-01-15 12:46:05 +00:00
|
|
|
end
|
|
|
|
|
2016-01-15 16:02:01 +00:00
|
|
|
function suite.linksModePreference_onStaticAndShared()
|
2016-01-15 12:46:05 +00:00
|
|
|
links { "fs_stub:static", "net_stub" }
|
|
|
|
prepare()
|
2016-01-15 16:02:01 +00:00
|
|
|
test.contains({ "-Wl,-Bstatic", "-lfs_stub", "-Wl,-Bdynamic", "-lnet_stub"}, gcc.getlinks(cfg))
|
2016-01-15 12:46:05 +00:00
|
|
|
end
|
|
|
|
|
2016-01-15 16:02:01 +00:00
|
|
|
function suite.linksModePreference_onAllShared()
|
|
|
|
links { "fs_stub:shared", "net_stub:shared" }
|
2016-01-15 12:46:05 +00:00
|
|
|
prepare()
|
2016-01-15 16:02:01 +00:00
|
|
|
test.excludes({ "-Wl,-Bstatic" }, gcc.getlinks(cfg))
|
2016-01-15 12:46:05 +00:00
|
|
|
end
|
2017-05-04 00:01:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Test language flags are added properly.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onCDefault()
|
|
|
|
cdialect "Default"
|
|
|
|
prepare()
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onC89()
|
|
|
|
cdialect "C89"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c89" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onC90()
|
|
|
|
cdialect "C90"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c90" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onC99()
|
|
|
|
cdialect "C99"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c99" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_onC11()
|
|
|
|
cdialect "C11"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c11" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
2021-11-07 06:10:58 +00:00
|
|
|
function suite.cflags_onC17()
|
|
|
|
cdialect "C17"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c17" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
2017-05-04 00:01:33 +00:00
|
|
|
function suite.cflags_ongnu89()
|
|
|
|
cdialect "gnu89"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu89" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_ongnu90()
|
|
|
|
cdialect "gnu90"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu90" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_ongnu99()
|
|
|
|
cdialect "gnu99"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu99" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_ongnu11()
|
|
|
|
cdialect "gnu11"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu11" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
2021-11-07 06:10:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cflags_ongnu17()
|
|
|
|
cdialect "gnu17"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu17" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
2017-05-04 00:01:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCppDefault()
|
|
|
|
cppdialect "Default"
|
|
|
|
prepare()
|
|
|
|
test.contains({ }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCpp98()
|
|
|
|
cppdialect "C++98"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c++98" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCpp11()
|
|
|
|
cppdialect "C++11"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c++11" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCpp14()
|
|
|
|
cppdialect "C++14"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c++14" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCpp17()
|
|
|
|
cppdialect "C++17"
|
|
|
|
prepare()
|
2017-11-09 21:45:01 +00:00
|
|
|
test.contains({ "-std=c++17" }, gcc.getcxxflags(cfg))
|
2017-05-04 00:01:33 +00:00
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2020-06-01 23:49:55 +00:00
|
|
|
function suite.cxxflags_onCpp2a()
|
|
|
|
cppdialect "C++2a"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c++2a" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCpp20()
|
|
|
|
cppdialect "C++20"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c++20" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2020-08-21 18:39:55 +00:00
|
|
|
function suite.cxxflags_onCppLatest()
|
|
|
|
cppdialect "C++latest"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=c++20" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2017-05-04 00:01:33 +00:00
|
|
|
function suite.cxxflags_onCppGnu98()
|
|
|
|
cppdialect "gnu++98"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu++98" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCppGnu11()
|
|
|
|
cppdialect "gnu++11"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu++11" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCppGnu14()
|
|
|
|
cppdialect "gnu++14"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu++14" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onCppGnu17()
|
|
|
|
cppdialect "gnu++17"
|
|
|
|
prepare()
|
2017-11-09 21:45:01 +00:00
|
|
|
test.contains({ "-std=gnu++17" }, gcc.getcxxflags(cfg))
|
2017-05-04 00:01:33 +00:00
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
2018-04-10 17:46:36 +00:00
|
|
|
|
2020-06-01 23:49:55 +00:00
|
|
|
function suite.cxxflags_onCppGnu2a()
|
|
|
|
cppdialect "gnu++2a"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu++2a" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2020-06-02 15:52:44 +00:00
|
|
|
function suite.cxxflags_onCppGnu20()
|
|
|
|
cppdialect "gnu++20"
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-std=gnu++20" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2018-04-09 14:57:11 +00:00
|
|
|
--
|
|
|
|
-- Test unsigned-char flags.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.sharedflags_onUnsignedChar()
|
|
|
|
unsignedchar "On"
|
|
|
|
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-funsigned-char" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ "-funsigned-char" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.sharedflags_onNoUnsignedChar()
|
|
|
|
unsignedchar "Off"
|
|
|
|
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-fno-unsigned-char" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ "-fno-unsigned-char" }, gcc.getcflags(cfg))
|
|
|
|
end
|
2018-04-12 17:27:27 +00:00
|
|
|
|
2018-04-09 15:11:38 +00:00
|
|
|
--
|
|
|
|
-- Test omit-frame-pointer flags.
|
|
|
|
--
|
|
|
|
|
2018-04-12 17:51:08 +00:00
|
|
|
function suite.sharedflags_onOmitFramePointerDefault()
|
|
|
|
omitframepointer "Default"
|
|
|
|
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-fomit-frame-pointer", "-fno-omit-frame-pointer" }, gcc.getcxxflags(cfg))
|
|
|
|
test.excludes({ "-fomit-frame-pointer", "-fno-omit-frame-pointer" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
2018-04-09 15:11:38 +00:00
|
|
|
function suite.sharedflags_onOmitFramePointer()
|
|
|
|
omitframepointer "On"
|
|
|
|
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-fomit-frame-pointer" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ "-fomit-frame-pointer" }, gcc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.sharedflags_onNoOmitFramePointer()
|
|
|
|
omitframepointer "Off"
|
|
|
|
|
|
|
|
prepare()
|
|
|
|
test.contains({ "-fno-omit-frame-pointer" }, gcc.getcxxflags(cfg))
|
|
|
|
test.contains({ "-fno-omit-frame-pointer" }, gcc.getcflags(cfg))
|
|
|
|
end
|
2018-04-17 12:46:11 +00:00
|
|
|
|
2018-04-10 17:46:36 +00:00
|
|
|
--
|
|
|
|
-- Test visibility.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cxxflags_onVisibilityDefault()
|
|
|
|
visibility "Default"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-fvisibility=default" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ "-fvisibility=default" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onVisibilityHidden()
|
|
|
|
visibility "Hidden"
|
|
|
|
prepare()
|
2018-04-12 17:30:32 +00:00
|
|
|
test.excludes({ "-fvisibility=hidden" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ "-fvisibility=hidden" }, gcc.getcxxflags(cfg))
|
2018-04-10 17:46:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onVisibilityInternal()
|
|
|
|
visibility "Internal"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-fvisibility=internal" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ "-fvisibility=internal" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onVisibilityProtected()
|
|
|
|
visibility "Protected"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-fvisibility=protected" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ "-fvisibility=protected" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
2018-04-12 17:44:38 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Test inlines visibility flags.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cxxflags_onInlinesVisibilityDefault()
|
|
|
|
inlinesvisibility "Default"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-fvisibility-inlines-hidden" }, gcc.getcflags(cfg))
|
|
|
|
test.excludes({ "-fvisibility-inlines-hidden" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.cxxflags_onInlinesVisibilityHidden()
|
|
|
|
inlinesvisibility "Hidden"
|
|
|
|
prepare()
|
|
|
|
test.excludes({ "-fvisibility-inlines-hidden" }, gcc.getcflags(cfg))
|
|
|
|
test.contains({ "-fvisibility-inlines-hidden" }, gcc.getcxxflags(cfg))
|
|
|
|
end
|