Merge pull request #1043 from tdesveauxPKFX/omit-frame-pointer
Add omitframepointer API
This commit is contained in:
commit
2061b151b9
@ -239,18 +239,6 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.omitFrames_onNoFramePointer()
|
||||
flags "NoFramePointer"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
|
||||
@ -1284,3 +1272,58 @@
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check OmitFramePointer
|
||||
--
|
||||
|
||||
function suite.omitFramePointer_Default()
|
||||
omitframepointer "Default"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.omitFramePointer_On()
|
||||
omitframepointer "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.omitFramePointer_Off()
|
||||
omitframepointer "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.omitFramePointer_DeprecationFlag()
|
||||
flags "NoFramePointer"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
@ -1333,7 +1333,7 @@
|
||||
|
||||
|
||||
function m.omitFramePointers(cfg)
|
||||
if cfg.flags.NoFramePointer then
|
||||
if cfg.omitframepointer == "On" then
|
||||
p.w('OmitFramePointers="true"')
|
||||
end
|
||||
end
|
||||
|
@ -2196,8 +2196,11 @@
|
||||
|
||||
|
||||
function m.omitFramePointers(cfg)
|
||||
if cfg.flags.NoFramePointer then
|
||||
m.element("OmitFramePointers", nil, "true")
|
||||
local map = { Off = "false", On = "true" }
|
||||
local value = map[cfg.omitframepointer]
|
||||
|
||||
if value then
|
||||
m.element("OmitFramePointers", nil, value)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1700,6 +1700,62 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnOmitFramePointer()
|
||||
omitframepointer "On"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
||||
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
OBJROOT = obj/Debug;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
OTHER_CFLAGS = (
|
||||
"-fomit-frame-pointer",
|
||||
);
|
||||
SYMROOT = bin/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnNoOmitFramePointer()
|
||||
omitframepointer "Off"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
||||
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
OBJROOT = obj/Debug;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
OTHER_CFLAGS = (
|
||||
"-fno-omit-frame-pointer",
|
||||
);
|
||||
SYMROOT = bin/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnNoPCH()
|
||||
pchheader "MyProject_Prefix.pch"
|
||||
flags { "NoPCH" }
|
||||
|
@ -1143,8 +1143,9 @@
|
||||
|
||||
-- build list of "other" C/C++ flags
|
||||
local checks = {
|
||||
["-ffast-math"] = cfg.floatingpoint == "Fast",
|
||||
["-fomit-frame-pointer"] = cfg.flags.NoFramePointer,
|
||||
["-ffast-math"] = cfg.floatingpoint == "Fast",
|
||||
["-fomit-frame-pointer"] = cfg.omitframepointer == "On",
|
||||
["-fno-omit-frame-pointer"] = cfg.omitframepointer == "Off",
|
||||
}
|
||||
|
||||
local flags = { }
|
||||
|
@ -507,7 +507,7 @@
|
||||
"No64BitChecks",
|
||||
"NoCopyLocal",
|
||||
"NoEditAndContinue", -- DEPRECATED
|
||||
"NoFramePointer",
|
||||
"NoFramePointer", -- DEPRECATED
|
||||
"NoImplicitLink",
|
||||
"NoImportLib",
|
||||
"NoIncrementalLink",
|
||||
@ -1355,6 +1355,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "omitframepointer",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"On",
|
||||
"Off"
|
||||
}
|
||||
}
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Field name aliases for backward compatibility
|
||||
@ -1596,6 +1607,16 @@
|
||||
staticruntime "Default"
|
||||
end)
|
||||
|
||||
-- 08 April 2018
|
||||
|
||||
api.deprecateValue("flags", "NoFramePointer", 'Use `omitframepointer "On"` instead.',
|
||||
function(value)
|
||||
omitframepointer("On")
|
||||
end,
|
||||
function(value)
|
||||
omitframepointer("Default")
|
||||
end)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Install Premake's default set of command line arguments.
|
||||
|
@ -62,7 +62,8 @@
|
||||
isaextensions = gcc.shared.isaextensions,
|
||||
warnings = gcc.shared.warnings,
|
||||
symbols = gcc.shared.symbols,
|
||||
unsignedchar = gcc.shared.unsignedchar
|
||||
unsignedchar = gcc.shared.unsignedchar,
|
||||
omitframepointer = gcc.shared.omitframepointer
|
||||
}
|
||||
|
||||
clang.cflags = table.merge(gcc.cflags, {
|
||||
|
@ -42,7 +42,6 @@
|
||||
flags = {
|
||||
FatalCompileWarnings = "-Werror",
|
||||
LinkTimeOptimization = "-flto",
|
||||
NoFramePointer = "-fomit-frame-pointer",
|
||||
ShadowedVariables = "-Wshadow",
|
||||
UndefinedIdentifiers = "-Wundef",
|
||||
},
|
||||
@ -100,6 +99,10 @@
|
||||
unsignedchar = {
|
||||
On = "-funsigned-char",
|
||||
Off = "-fno-unsigned-char"
|
||||
},
|
||||
omitframepointer = {
|
||||
On = "-fomit-frame-pointer",
|
||||
Off = "-fno-omit-frame-pointer"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
flags = {
|
||||
FatalCompileWarnings = "/WX",
|
||||
MultiProcessorCompile = "/MP",
|
||||
NoFramePointer = "/Oy",
|
||||
NoMinimalRebuild = "/Gm-",
|
||||
OmitDefaultLibrary = "/Zl"
|
||||
},
|
||||
@ -102,6 +101,9 @@
|
||||
},
|
||||
unsignedchar = {
|
||||
On = "/J",
|
||||
},
|
||||
omitframepointer = {
|
||||
On = "/Oy"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -808,3 +808,31 @@
|
||||
test.contains({ "-fno-unsigned-char" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ "-fno-unsigned-char" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
--
|
||||
-- Test omit-frame-pointer flags.
|
||||
--
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
@ -72,6 +72,18 @@
|
||||
test.contains("/Oy", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onOmitFramePointer()
|
||||
omitframepointer "On"
|
||||
prepare()
|
||||
test.contains("/Oy", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onNoOmitFramePointers()
|
||||
omitframepointer "Off"
|
||||
prepare()
|
||||
test.excludes("/Oy", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onLinkTimeOptimizations()
|
||||
flags "LinkTimeOptimization"
|
||||
prepare()
|
||||
|
Reference in New Issue
Block a user