Merged in mendsley/premake-dev/nobuffersecuritycheck (pull request #58)

adding flag 'NoBufferSecurityCheck' to disable the feature in Visual Studio and GCC projects (/GS-  and -fno-stack-protector respectively)
This commit is contained in:
Jason Perkins 2013-08-17 14:51:33 -04:00
commit c4af5ff1d4
7 changed files with 53 additions and 0 deletions

View File

@ -402,6 +402,7 @@
vc200x.minimalRebuild(cfg)
vc200x.basicRuntimeChecks(cfg)
vc200x.bufferSecurityCheck(cfg)
if vc200x.optimization(cfg) ~= 0 then
_p(4,'StringPooling="%s"', vc200x.bool(true))
@ -981,6 +982,11 @@
end
end
function vc200x.bufferSecurityCheck(cfg)
if cfg.flags.NoBufferSecurityCheck then
_p(4,'BufferSecurityCheck="false"')
end
end
function vc200x.characterSet(cfg)
if not vstudio.isMakefile(cfg) then

View File

@ -287,6 +287,7 @@
"runtimeLibrary",
"exceptionHandling",
"runtimeTypeInfo",
"bufferSecurityCheck",
"treatWChar_tAsBuiltInType",
"floatingPointModel",
"enableEnhancedInstructionSet",
@ -1046,6 +1047,11 @@
end
end
function vc2010.bufferSecurityCheck(cfg)
if cfg.flags.NoBufferSecurityCheck then
_p(3,'<BufferSecurityCheck>false</BufferSecurityCheck>')
end
end
function vc2010.stringPooling(cfg)
if premake.config.isoptimizedbuild(cfg) then

View File

@ -731,6 +731,7 @@
"NoPCH",
"NoRuntimeChecks",
"NoRTTI",
"NoBufferSecurityCheck",
"NoWarnings",
"Optimize",
"OptimizeSize",

View File

@ -127,6 +127,7 @@
gcc.cxxflags = {
NoExceptions = "-fno-exceptions",
NoRTTI = "-fno-rtti",
NoBufferSecurityCheck = "-fno-stack-protector"
}
function gcc.getcxxflags(cfg)

View File

@ -254,6 +254,28 @@
]]
end
--
-- Check that the "no buffer security check" flag is applied correctly.
--
function suite.noBufferSecurityFlagSet_onBufferSecurityCheck()
flags { "NoBufferSecurityCheck" }
prepare()
test.capture [[
<Tool
Name="VCCLCompilerTool"
Optimization="0"
BasicRuntimeChecks="3"
BufferSecurityCheck="false"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\MyProject.pdb"
WarningLevel="3"
DebugInformationFormat="0"
/>
]]
end
--
-- Check that the CompileAs value is set correctly for C language projects.

View File

@ -466,6 +466,18 @@
]]
end
function suite.runtimeTypeInfo_onNoRTTI()
flags "NoBufferSecurityCheck"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<BufferSecurityCheck>false</BufferSecurityCheck>
]]
end
--
-- On Win32 builds, use the Edit-and-Continue debug information format.

View File

@ -96,6 +96,11 @@
test.isequal({ "-fno-exceptions" }, gcc.getcxxflags(cfg))
end
function suite.cflags_onNoBufferSecurityCheck()
flags { "NoBufferSecurityCheck" }
prepare()
test.isequal({ "-fno-stack-protector" }, gcc.getcxxflags(cfg))
end
--
-- Check the basic translation of LDFLAGS for a Posix system.