mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-07 17:32:14 +00:00
[waf] Add --variant=asan (#186)
This commit is contained in:
parent
2ffc068760
commit
338db49637
11
wscript
11
wscript
@ -117,17 +117,26 @@ def configure(ctx):
|
|||||||
|
|
||||||
ctx.load('compiler_cxx')
|
ctx.load('compiler_cxx')
|
||||||
cxxflags = ['-g', '-std=c++11', '-Wall', '-Wno-sign-compare', '-Werror']
|
cxxflags = ['-g', '-std=c++11', '-Wall', '-Wno-sign-compare', '-Werror']
|
||||||
|
ldflags = []
|
||||||
# /Zi: -g, /WX: -Werror, /W3: roughly -Wall, there is no -std=c++11 equivalent in MSVC.
|
# /Zi: -g, /WX: -Werror, /W3: roughly -Wall, there is no -std=c++11 equivalent in MSVC.
|
||||||
# /wd4722: ignores warning C4722 (destructor never returns) in loguru
|
# /wd4722: ignores warning C4722 (destructor never returns) in loguru
|
||||||
# /wd4267: ignores warning C4267 (conversion from 'size_t' to 'type'), roughly -Wno-sign-compare
|
# /wd4267: ignores warning C4267 (conversion from 'size_t' to 'type'), roughly -Wno-sign-compare
|
||||||
msvcflags = ['/nologo', '/FS', '/EHsc', '/Zi', '/W3', '/WX', '/wd4996', '/wd4722', '/wd4267', '/wd4800']
|
msvcflags = ['/nologo', '/FS', '/EHsc', '/Zi', '/W3', '/WX', '/wd4996', '/wd4722', '/wd4267', '/wd4800']
|
||||||
if ctx.options.variant != 'debug':
|
if ctx.options.variant == 'asan':
|
||||||
|
cxxflags.append('-fsanitize=address,undefined')
|
||||||
|
cxxflags.append('-O')
|
||||||
|
ldflags.append('-fsanitize=address,undefined')
|
||||||
|
elif ctx.options.variant == 'debug':
|
||||||
|
pass
|
||||||
|
else:
|
||||||
cxxflags.append('-O3')
|
cxxflags.append('-O3')
|
||||||
msvcflags.append('/O2') # There is no O3
|
msvcflags.append('/O2') # There is no O3
|
||||||
if ctx.env.CXX_NAME != 'msvc':
|
if ctx.env.CXX_NAME != 'msvc':
|
||||||
# If environment variable CXXFLAGS is unset, provide a sane default.
|
# If environment variable CXXFLAGS is unset, provide a sane default.
|
||||||
if not ctx.env.CXXFLAGS:
|
if not ctx.env.CXXFLAGS:
|
||||||
ctx.env.CXXFLAGS = cxxflags
|
ctx.env.CXXFLAGS = cxxflags
|
||||||
|
if not ctx.env.LDFLAGS:
|
||||||
|
ctx.env.LDFLAGS = ldflags
|
||||||
else:
|
else:
|
||||||
ctx.env.CXXFLAGS = msvcflags
|
ctx.env.CXXFLAGS = msvcflags
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user