Merge branch 'master' into fix_buildmessage_escaping
This commit is contained in:
commit
bd5da71ce3
@ -156,7 +156,7 @@
|
||||
<CLRSupport>Pure</CLRSupport>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.clrSupport_onClrNetCore()
|
||||
clr "NetCore"
|
||||
prepare()
|
||||
@ -353,3 +353,96 @@
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- If the sanitizer flags are set, add the correct elements.
|
||||
--
|
||||
|
||||
function suite.onSanitizeAddress()
|
||||
p.action.set("vs2019")
|
||||
sanitize { "Address" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<EnableASAN>true</EnableASAN>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSanitizeAddress_BeforeVS2019()
|
||||
p.action.set("vs2017")
|
||||
sanitize { "Address" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSanitizeFuzzer()
|
||||
p.action.set("vs2022")
|
||||
sanitize { "Fuzzer" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<EnableFuzzer>true</EnableFuzzer>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSanitizeFuzzer_BeforeVS2022()
|
||||
p.action.set("vs2019")
|
||||
sanitize { "Fuzzer" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSanitizeAddressFuzzer()
|
||||
p.action.set("vs2022")
|
||||
sanitize { "Address", "Fuzzer" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<EnableASAN>true</EnableASAN>
|
||||
<EnableFuzzer>true</EnableFuzzer>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSanitizeAddressFuzzer_BeforeVS2022()
|
||||
p.action.set("vs2019")
|
||||
sanitize { "Address", "Fuzzer" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<EnableASAN>true</EnableASAN>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
@ -195,6 +195,7 @@
|
||||
m.clrSupport,
|
||||
m.characterSet,
|
||||
m.platformToolset,
|
||||
m.sanitizers,
|
||||
m.toolsVersion,
|
||||
m.wholeProgramOptimization,
|
||||
m.nmakeOutDirs,
|
||||
@ -2507,6 +2508,19 @@
|
||||
end
|
||||
end
|
||||
|
||||
function m.sanitizers(cfg)
|
||||
if _ACTION >= "vs2019" and cfg.sanitize then
|
||||
if table.contains(cfg.sanitize, "Address") then
|
||||
m.element("EnableASAN", nil, "true")
|
||||
end
|
||||
end
|
||||
if _ACTION >= "vs2022" and cfg.sanitize then
|
||||
if table.contains(cfg.sanitize, "Fuzzer") then
|
||||
m.element("EnableFuzzer", nil, "true")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function m.precompiledHeaderFile(fileName, cfg)
|
||||
m.element("PrecompiledHeaderFile", nil, "%s", fileName)
|
||||
end
|
||||
|
@ -190,7 +190,7 @@
|
||||
"HeaderUnit"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
api.register {
|
||||
name = "allmodulespublic",
|
||||
scope = "config",
|
||||
@ -1118,6 +1118,16 @@
|
||||
kind = "list:string",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "sanitize",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
allowed = {
|
||||
"Address",
|
||||
"Fuzzer", -- Visual Studio 2022+ only
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "startproject",
|
||||
scope = "workspace",
|
||||
|
@ -115,6 +115,9 @@
|
||||
--
|
||||
|
||||
clang.cxxflags = table.merge(gcc.cxxflags, {
|
||||
sanitize = {
|
||||
Fuzzer = "-fsanitize=fuzzer",
|
||||
},
|
||||
})
|
||||
|
||||
function clang.getcxxflags(cfg)
|
||||
|
@ -229,6 +229,9 @@
|
||||
rtti = {
|
||||
Off = "-fno-rtti"
|
||||
},
|
||||
sanitize = {
|
||||
Address = "-fsanitize=address",
|
||||
},
|
||||
visibility = {
|
||||
Default = "-fvisibility=default",
|
||||
Hidden = "-fvisibility=hidden",
|
||||
|
@ -161,6 +161,10 @@
|
||||
},
|
||||
rtti = {
|
||||
Off = "/GR-"
|
||||
},
|
||||
sanitize = {
|
||||
Address = "/fsanitize=address",
|
||||
Fuzzer = "/fsanitize=fuzzer",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
prepare()
|
||||
test.contains({ "-mmacosx-version-min=10.9" }, clang.getcflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
function suite.cxxflags_macosx_systemversion()
|
||||
system "MacOSX"
|
||||
systemversion "10.9"
|
||||
@ -50,7 +50,7 @@
|
||||
prepare()
|
||||
test.excludes({ "-mmacosx-version-min=10.9" }, clang.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check iOS deployment target flags
|
||||
--
|
||||
@ -61,7 +61,7 @@
|
||||
prepare()
|
||||
test.contains({ "-miphoneos-version-min=12.1" }, clang.getcflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
function suite.cxxflags_ios_systemversion()
|
||||
system "iOS"
|
||||
systemversion "5.0"
|
||||
@ -85,3 +85,12 @@
|
||||
test.excludes("-fopenmp", clang.getcflags(cfg))
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the translation of CXXFLAGS.
|
||||
--
|
||||
|
||||
function suite.cxxflags_onSanitizeFuzzer()
|
||||
sanitize { "Fuzzer" }
|
||||
prepare()
|
||||
test.contains({ "-fsanitize=fuzzer" }, clang.getcxxflags(cfg))
|
||||
end
|
||||
|
@ -356,18 +356,24 @@
|
||||
-- Check the translation of CXXFLAGS.
|
||||
--
|
||||
|
||||
function suite.cflags_onNoExceptions()
|
||||
function suite.cxxflags_onNoExceptions()
|
||||
exceptionhandling "Off"
|
||||
prepare()
|
||||
test.contains({ "-fno-exceptions" }, gcc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onNoBufferSecurityCheck()
|
||||
function suite.cxxflags_onNoBufferSecurityCheck()
|
||||
flags { "NoBufferSecurityCheck" }
|
||||
prepare()
|
||||
test.contains({ "-fno-stack-protector" }, gcc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onSanitizeAddress()
|
||||
sanitize { "Address" }
|
||||
prepare()
|
||||
test.contains({ "-fsanitize=address" }, gcc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the basic translation of LDFLAGS for a Posix system.
|
||||
--
|
||||
|
@ -441,6 +441,25 @@
|
||||
test.contains("/GR-", msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onSanitizeAddress()
|
||||
sanitize { "Address" }
|
||||
prepare()
|
||||
test.contains("/fsanitize=address", msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onSanitizeFuzzer()
|
||||
sanitize { "Fuzzer" }
|
||||
prepare()
|
||||
test.contains("/fsanitize=fuzzer", msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onSanitizeAddressFuzzer()
|
||||
sanitize { "Address", "Fuzzer" }
|
||||
prepare()
|
||||
test.contains("/fsanitize=address", msc.getcxxflags(cfg))
|
||||
test.contains("/fsanitize=fuzzer", msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of additional linker options.
|
||||
@ -573,9 +592,9 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of Run-Time Library flags.
|
||||
--
|
||||
--
|
||||
-- Check handling of Run-Time Library flags.
|
||||
--
|
||||
|
||||
function suite.cflags_onStaticRuntime()
|
||||
staticruntime "On"
|
||||
|
@ -150,6 +150,7 @@
|
||||
| [rule](rule.md) | |
|
||||
| [rules](rules.md) | |
|
||||
| [runtime](runtime.md) | |
|
||||
| [sanitize](sanitize.md) | Enable `fsanitize` compiler options |
|
||||
| [sharedlibtype](sharedlibtype.md) | |
|
||||
| [startproject](startproject.md) | |
|
||||
| [strictaliasing](strictaliasing.md) | |
|
||||
|
28
website/docs/sanitize.md
Normal file
28
website/docs/sanitize.md
Normal file
@ -0,0 +1,28 @@
|
||||
Enables various `fsanitize` options for compilers.
|
||||
|
||||
```lua
|
||||
sanitize { "value_list" }
|
||||
```
|
||||
|
||||
### Parameters ###
|
||||
|
||||
`value_list` specifies the desired `fsanitize` options to enable.
|
||||
|
||||
| Value | Description |
|
||||
|-------------|--------------------------------------------------------|
|
||||
| Address | Enables compiler support for AddressSanitizer. | Visual Studio support starts with 2019 16.9 |
|
||||
| Fuzzer | Enables support for LibFuzzer, a coverage-guided fuzzing library. | Visual Studio support starts with 2019 16.9 |
|
||||
|
||||
### Applies To ###
|
||||
|
||||
Project configurations.
|
||||
|
||||
### Availability ###
|
||||
|
||||
Premake 5.0 or later.
|
||||
|
||||
### Examples ###
|
||||
|
||||
```lua
|
||||
sanitize { "Address", "Fuzzer" }
|
||||
```
|
Loading…
Reference in New Issue
Block a user