symbols api introduced and working, with tests.

This commit is contained in:
David Ely 2016-07-19 16:29:26 +10:00
parent 38ddf0b8eb
commit d3d8269e7a
23 changed files with 137 additions and 48 deletions

@ -1 +1 @@
Subproject commit 721837bbbcae8430491d5bf5d50a863ee48a8dff
Subproject commit 236ee78540e3aa83c689ca441447dabdaf2881ba

@ -1 +1 @@
Subproject commit 6dd5717ba3a9dc50dc97e4e39596d9d80e2a4597
Subproject commit e854b35cf1d0bedfe16239c27a69909996af12d0

@ -1 +1 @@
Subproject commit bb09135391ad1f8f1ba5ed0e6b0def3337fe3977
Subproject commit 4a9f26f9a46795cb46492f32f1814ff74c23a339

@ -1 +1 @@
Subproject commit dc1eb5514408a5bbfc1e7c03efde6d38f1e30cf1
Subproject commit 9427f3373074795b16d25d2efcc836c2a2501902

View File

@ -102,7 +102,7 @@
filter "configurations:Debug"
defines "_DEBUG"
flags { "Symbols" }
symbols "On"
filter "configurations:Release"
defines "NDEBUG"

View File

@ -1433,6 +1433,7 @@
editorintegration "Off"
exceptionhandling "Default"
rtti "Default"
symbols "Default"
-- Setting a default language makes some validation easier later

View File

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

View File

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

View File

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

View File

@ -234,13 +234,15 @@
},
flags = {
FatalWarning = "/warnaserror",
Symbols = "/debug",
},
optimize = {
On = "/optimize",
Size = "/optimize",
Speed = "/optimize",
},
symbols = {
On = "/debug",
}
}
function dotnet.getflags(cfg)

View File

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

View File

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

View File

@ -16,7 +16,7 @@
function suite.setup()
wks, prj = test.createWorkspace()
flags("Symbols")
symbols "On"
end
local function prepare(calls)

View File

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

View File

@ -18,7 +18,7 @@
function suite.setup()
local wks, prj = test.createWorkspace()
system "wii"
flags "Symbols"
symbols "On"
cfg = test.getconfig(prj, "Debug")
end

View File

@ -39,7 +39,7 @@
end
function suite.debugSymbols_onSymbolsFlag()
flags { "Symbols" }
symbols "On"
prepare()
test.capture [[
<DebugSymbols>true</DebugSymbols>

View File

@ -86,7 +86,7 @@
--
function suite.looksGood_onSymbolsFlag()
flags "Symbols"
symbols "On"
prepare()
test.capture [[
<Tool
@ -110,7 +110,7 @@
--
function suite.looksGood_onSymbolsAndOptimizeFlags()
flags { "Symbols" }
symbols "On"
optimize "On"
prepare()
test.capture [[
@ -133,7 +133,7 @@
--
function suite.looksGood_onC7DebugFormat()
flags "Symbols"
symbols "On"
debugformat "C7"
prepare()
test.capture [[
@ -225,7 +225,8 @@
--
function suite.minimalRebuildFlagsSet_onMinimalRebuildAndSymbols()
flags { "Symbols", "NoMinimalRebuild" }
flags { "NoMinimalRebuild" }
symbols "On"
prepare()
test.capture [[
<Tool
@ -291,7 +292,7 @@
--
function suite.runtimeLibraryIsDebug_onSymbolsNoOptimize()
flags { "Symbols" }
symbols "On"
prepare()
test.capture [[
<Tool
@ -542,7 +543,8 @@
--
function suite.releaseRuntime_onFlag()
flags { "Symbols", "ReleaseRuntime" }
flags { "ReleaseRuntime" }
symbols "On"
prepare()
test.capture [[
<Tool
@ -555,7 +557,8 @@
end
function suite.releaseRuntime_onStaticAndReleaseRuntime()
flags { "Symbols", "ReleaseRuntime", "StaticRuntime" }
flags { "ReleaseRuntime", "StaticRuntime" }
symbols "On"
prepare()
test.capture [[
<Tool

View File

@ -110,7 +110,7 @@
--
function suite.onSymbolsFlag()
flags "Symbols"
symbols "On"
prepare()
test.capture [[
<Tool
@ -127,7 +127,7 @@
--
function suite.onC7DebugFormat()
flags "Symbols"
symbols "On"
debugformat "C7"
prepare()
test.capture [[

View File

@ -399,7 +399,8 @@
end
function suite.runtimeLibrary_onStaticRuntimeAndSymbols()
flags { "StaticRuntime", "Symbols" }
flags { "StaticRuntime" }
symbols "On"
prepare()
test.capture [[
<ClCompile>
@ -432,8 +433,32 @@
-- Check the handling of the Symbols flag.
--
function suite.onSymbolsFlag()
flags "Symbols"
function suite.onDefaultSymbols()
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
function suite.onNoSymbols()
symbols "Off"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
function suite.onSymbols()
symbols "On"
prepare()
test.capture [[
<ClCompile>
@ -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 [[
<ClCompile>

View File

@ -87,7 +87,7 @@
--
function suite.debugLibraries_onDebugConfig()
flags "Symbols"
symbols "On"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -215,7 +215,8 @@
--
function suite.releaseRuntime_onFlag()
flags { "Symbols", "ReleaseRuntime" }
flags { "ReleaseRuntime" }
symbols "On"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

View File

@ -137,7 +137,7 @@
--
function suite.generateDebugInfo_onSymbols()
flags "Symbols"
symbols "On"
prepare()
test.capture [[
<Link>

View File

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

View File

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