From d3d8269e7aa52fdd1e602b79fed513459981697c Mon Sep 17 00:00:00 2001 From: David Ely Date: Tue, 19 Jul 2016 16:29:26 +1000 Subject: [PATCH] symbols api introduced and working, with tests. --- modules/codelite | 2 +- modules/d | 2 +- modules/monodevelop | 2 +- modules/xcode | 2 +- premake5.lua | 2 +- src/_premake_init.lua | 1 + src/actions/vstudio/vs2010_vcxproj.lua | 6 +-- src/base/config.lua | 2 +- src/tools/clang.lua | 3 +- src/tools/dotnet.lua | 4 +- src/tools/gcc.lua | 17 +++++-- src/tools/msc.lua | 8 +++- tests/actions/make/cpp/test_ldflags.lua | 2 +- tests/actions/make/cpp/test_make_linking.lua | 6 +-- tests/actions/make/cpp/test_wiidev.lua | 2 +- .../vstudio/cs2005/test_debug_props.lua | 2 +- .../vstudio/vc200x/test_compiler_block.lua | 17 ++++--- .../vstudio/vc200x/test_linker_block.lua | 4 +- .../vstudio/vc2010/test_compile_settings.lua | 46 +++++++++++++++---- .../vstudio/vc2010/test_config_props.lua | 5 +- tests/actions/vstudio/vc2010/test_link.lua | 2 +- tests/tools/test_gcc.lua | 24 +++++++++- tests/tools/test_msc.lua | 24 +++++++++- 23 files changed, 137 insertions(+), 48 deletions(-) diff --git a/modules/codelite b/modules/codelite index 721837bb..236ee785 160000 --- a/modules/codelite +++ b/modules/codelite @@ -1 +1 @@ -Subproject commit 721837bbbcae8430491d5bf5d50a863ee48a8dff +Subproject commit 236ee78540e3aa83c689ca441447dabdaf2881ba diff --git a/modules/d b/modules/d index 6dd5717b..e854b35c 160000 --- a/modules/d +++ b/modules/d @@ -1 +1 @@ -Subproject commit 6dd5717ba3a9dc50dc97e4e39596d9d80e2a4597 +Subproject commit e854b35cf1d0bedfe16239c27a69909996af12d0 diff --git a/modules/monodevelop b/modules/monodevelop index bb091353..4a9f26f9 160000 --- a/modules/monodevelop +++ b/modules/monodevelop @@ -1 +1 @@ -Subproject commit bb09135391ad1f8f1ba5ed0e6b0def3337fe3977 +Subproject commit 4a9f26f9a46795cb46492f32f1814ff74c23a339 diff --git a/modules/xcode b/modules/xcode index dc1eb551..9427f337 160000 --- a/modules/xcode +++ b/modules/xcode @@ -1 +1 @@ -Subproject commit dc1eb5514408a5bbfc1e7c03efde6d38f1e30cf1 +Subproject commit 9427f3373074795b16d25d2efcc836c2a2501902 diff --git a/premake5.lua b/premake5.lua index 1cb7ed49..c69eaaaa 100644 --- a/premake5.lua +++ b/premake5.lua @@ -102,7 +102,7 @@ filter "configurations:Debug" defines "_DEBUG" - flags { "Symbols" } + symbols "On" filter "configurations:Release" defines "NDEBUG" diff --git a/src/_premake_init.lua b/src/_premake_init.lua index 89822394..13f75d11 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -1433,6 +1433,7 @@ editorintegration "Off" exceptionhandling "Default" rtti "Default" + symbols "Default" -- Setting a default language makes some validation easier later diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index b202a18e..d93b8517 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -1180,9 +1180,9 @@ value = "EditAndContinue" end - if value then - m.element("DebugInformationFormat", nil, value) - end + m.element("DebugInformationFormat", nil, value) + elseif cfg.symbols == p.OFF then + m.element("DebugInformationFormat", nil, "None") end end diff --git a/src/base/config.lua b/src/base/config.lua index 45aed44c..58b5f9be 100755 --- a/src/base/config.lua +++ b/src/base/config.lua @@ -413,7 +413,7 @@ -- function config.isDebugBuild(cfg) - return cfg.flags.Symbols and not config.isOptimizedBuild(cfg) + return cfg.symbols == p.ON and not config.isOptimizedBuild(cfg) end diff --git a/src/tools/clang.lua b/src/tools/clang.lua index affaa09f..6f6c260a 100644 --- a/src/tools/clang.lua +++ b/src/tools/clang.lua @@ -56,7 +56,8 @@ }, pic = gcc.cflags.pic, vectorextensions = gcc.cflags.vectorextensions, - warnings = gcc.cflags.warnings + warnings = gcc.cflags.warnings, + symbols = gcc.cflags.symbols } function clang.getcflags(cfg) diff --git a/src/tools/dotnet.lua b/src/tools/dotnet.lua index 84b266f7..c9d93a83 100644 --- a/src/tools/dotnet.lua +++ b/src/tools/dotnet.lua @@ -234,13 +234,15 @@ }, flags = { FatalWarning = "/warnaserror", - Symbols = "/debug", }, optimize = { On = "/optimize", Size = "/optimize", Speed = "/optimize", }, + symbols = { + On = "/debug", + } } function dotnet.getflags(cfg) diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index 08786c77..f9b8beea 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -45,7 +45,6 @@ LinkTimeOptimization = "-flto", NoFramePointer = "-fomit-frame-pointer", ShadowedVariables = "-Wshadow", - Symbols = "-g", UndefinedIdentifiers = "-Wundef", }, floatingpoint = { @@ -81,6 +80,9 @@ warnings = { Extra = "-Wall -Wextra", Off = "-w", + }, + symbols = { + On = "-g" } } @@ -194,6 +196,11 @@ -- Return a list of LDFLAGS for a specific configuration. -- + function gcc.ldsymbols(cfg) + -- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html + return iif(cfg.system == premake.MACOSX, "-Wl,-x", "-s") + end + gcc.ldflags = { architecture = { x86 = "-m32", @@ -201,10 +208,6 @@ }, flags = { LinkTimeOptimization = "-flto", - _Symbols = function(cfg) - -- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html - return iif(cfg.system == premake.MACOSX, "-Wl,-x", "-s") - end, }, kind = { SharedLib = function(cfg) @@ -220,6 +223,10 @@ }, system = { wii = "$(MACHDEP)", + }, + symbols = { + Off = gcc.ldsymbols, + Default = gcc.ldsymbols, } } diff --git a/src/tools/msc.lua b/src/tools/msc.lua index 6592724e..f52b7793 100644 --- a/src/tools/msc.lua +++ b/src/tools/msc.lua @@ -40,7 +40,6 @@ MultiProcessorCompile = "/MP", NoFramePointer = "/Oy", NoMinimalRebuild = "/Gm-", - Symbols = "/Z7", OmitDefaultLibrary = "/Zl", }, floatingpoint = { @@ -73,6 +72,9 @@ warnings = { Extra = "/W4", Off = "/W0", + }, + symbols = { + On = "/Z7" } } @@ -213,10 +215,12 @@ NoIncrementalLink = "/INCREMENTAL:NO", NoManifest = "/MANIFEST:NO", OmitDefaultLibrary = "/NODEFAULTLIB", - Symbols = "/DEBUG", }, kind = { SharedLib = "/DLL", + }, + symbols = { + On = "/DEBUG" } } diff --git a/tests/actions/make/cpp/test_ldflags.lua b/tests/actions/make/cpp/test_ldflags.lua index 2bccd284..afa4853f 100644 --- a/tests/actions/make/cpp/test_ldflags.lua +++ b/tests/actions/make/cpp/test_ldflags.lua @@ -16,7 +16,7 @@ function suite.setup() wks, prj = test.createWorkspace() - flags("Symbols") + symbols "On" end local function prepare(calls) diff --git a/tests/actions/make/cpp/test_make_linking.lua b/tests/actions/make/cpp/test_make_linking.lua index 3daf37b1..5a750ec4 100644 --- a/tests/actions/make/cpp/test_make_linking.lua +++ b/tests/actions/make/cpp/test_make_linking.lua @@ -35,7 +35,7 @@ kind "SharedLib" prepare { "ldFlags", "linkCmd" } test.capture [[ - ALL_LDFLAGS += $(LDFLAGS) -s -shared + ALL_LDFLAGS += $(LDFLAGS) -shared -s LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) ]] end @@ -50,7 +50,7 @@ kind "SharedLib" prepare { "ldFlags", "linkCmd" } test.capture [[ - ALL_LDFLAGS += $(LDFLAGS) -s -shared + ALL_LDFLAGS += $(LDFLAGS) -shared -s LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) ]] end @@ -163,7 +163,7 @@ -- Check a linking multiple siblings. -- - function suite.links_onSiblingStaticLib() + function suite.links_onMultipleSiblingStaticLib() links "MyProject2" links "MyProject3" diff --git a/tests/actions/make/cpp/test_wiidev.lua b/tests/actions/make/cpp/test_wiidev.lua index 5b92c11a..4294ba8b 100644 --- a/tests/actions/make/cpp/test_wiidev.lua +++ b/tests/actions/make/cpp/test_wiidev.lua @@ -18,7 +18,7 @@ function suite.setup() local wks, prj = test.createWorkspace() system "wii" - flags "Symbols" + symbols "On" cfg = test.getconfig(prj, "Debug") end diff --git a/tests/actions/vstudio/cs2005/test_debug_props.lua b/tests/actions/vstudio/cs2005/test_debug_props.lua index 591c3e55..917ecbf4 100644 --- a/tests/actions/vstudio/cs2005/test_debug_props.lua +++ b/tests/actions/vstudio/cs2005/test_debug_props.lua @@ -39,7 +39,7 @@ end function suite.debugSymbols_onSymbolsFlag() - flags { "Symbols" } + symbols "On" prepare() test.capture [[ true diff --git a/tests/actions/vstudio/vc200x/test_compiler_block.lua b/tests/actions/vstudio/vc200x/test_compiler_block.lua index f3685dc1..2fee6b2d 100644 --- a/tests/actions/vstudio/vc200x/test_compiler_block.lua +++ b/tests/actions/vstudio/vc200x/test_compiler_block.lua @@ -86,7 +86,7 @@ -- function suite.looksGood_onSymbolsFlag() - flags "Symbols" + symbols "On" prepare() test.capture [[ @@ -432,8 +433,32 @@ -- Check the handling of the Symbols flag. -- - function suite.onSymbolsFlag() - flags "Symbols" + function suite.onDefaultSymbols() + prepare() + test.capture [[ + + NotUsing + Level3 + Disabled + + ]] + end + + function suite.onNoSymbols() + symbols "Off" + prepare() + test.capture [[ + + NotUsing + Level3 + None + Disabled + + ]] + end + + function suite.onSymbols() + symbols "On" prepare() test.capture [[ @@ -451,7 +476,7 @@ -- function suite.onC7DebugFormat() - flags "Symbols" + symbols "On" debugformat "c7" prepare() test.capture [[ @@ -551,7 +576,7 @@ -- function suite.debugFormat_onWin32() - flags "Symbols" + symbols "On" architecture "x86" prepare() test.capture [[ @@ -568,7 +593,7 @@ -- function suite.debugFormat_onWin64() - flags "Symbols" + symbols "On" architecture "x86_64" prepare() test.capture [[ @@ -585,7 +610,7 @@ -- function suite.debugFormat_onEditAndContinueOff() - flags { "Symbols" } + symbols "On" editandcontinue "Off" prepare() test.capture [[ @@ -602,7 +627,7 @@ -- function suite.debugFormat_onOptimizedBuild() - flags { "Symbols" } + symbols "On" optimize "On" prepare() test.capture [[ @@ -619,7 +644,7 @@ -- function suite.debugFormat_onManagedCode() - flags "Symbols" + symbols "On" clr "On" prepare() test.capture [[ @@ -699,7 +724,8 @@ -- function suite.releaseRuntime_onStaticAndReleaseRuntime() - flags { "Symbols", "ReleaseRuntime", "StaticRuntime" } + flags { "ReleaseRuntime", "StaticRuntime" } + symbols "On" prepare() test.capture [[ diff --git a/tests/actions/vstudio/vc2010/test_config_props.lua b/tests/actions/vstudio/vc2010/test_config_props.lua index 160c6264..7d702dc9 100755 --- a/tests/actions/vstudio/vc2010/test_config_props.lua +++ b/tests/actions/vstudio/vc2010/test_config_props.lua @@ -87,7 +87,7 @@ -- function suite.debugLibraries_onDebugConfig() - flags "Symbols" + symbols "On" prepare() test.capture [[ @@ -215,7 +215,8 @@ -- function suite.releaseRuntime_onFlag() - flags { "Symbols", "ReleaseRuntime" } + flags { "ReleaseRuntime" } + symbols "On" prepare() test.capture [[ diff --git a/tests/actions/vstudio/vc2010/test_link.lua b/tests/actions/vstudio/vc2010/test_link.lua index 24f36c05..98f44021 100644 --- a/tests/actions/vstudio/vc2010/test_link.lua +++ b/tests/actions/vstudio/vc2010/test_link.lua @@ -137,7 +137,7 @@ -- function suite.generateDebugInfo_onSymbols() - flags "Symbols" + symbols "On" prepare() test.capture [[ diff --git a/tests/tools/test_gcc.lua b/tests/tools/test_gcc.lua index 59d3aecd..ce5b33e9 100644 --- a/tests/tools/test_gcc.lua +++ b/tests/tools/test_gcc.lua @@ -194,6 +194,28 @@ end +-- +-- 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 + + -- -- Check the translation of CXXFLAGS. -- @@ -221,7 +243,7 @@ end function suite.ldflags_onSymbols() - flags { "Symbols" } + symbols "On" prepare() test.excludes("-s", gcc.getldflags(cfg)) end diff --git a/tests/tools/test_msc.lua b/tests/tools/test_msc.lua index 87d495ae..944fc524 100644 --- a/tests/tools/test_msc.lua +++ b/tests/tools/test_msc.lua @@ -78,12 +78,34 @@ end +-- +-- Check the translation of symbols. +-- + + function suite.cflags_onDefaultSymbols() + prepare() + test.excludes({ "/Z7" }, msc.getcflags(cfg)) + end + + function suite.cflags_onNoSymbols() + symbols "Off" + prepare() + test.excludes({ "/Z7" }, msc.getcflags(cfg)) + end + + function suite.cflags_onSymbols() + symbols "On" + prepare() + test.contains({ "/Z7" }, msc.getcflags(cfg)) + end + + -- -- Check handling of debugging support. -- function suite.ldflags_onSymbols() - flags "Symbols" + symbols "On" prepare() test.contains("/DEBUG", msc.getldflags(cfg)) end