scons: remove dead leading underscore check
e56c3d8 (2008) added it but 8e37348 (2010) removed its only use.
This commit is contained in:
parent
e385ae0c72
commit
359904194d
1 changed files with 0 additions and 31 deletions
31
SConstruct
31
SConstruct
|
@ -819,32 +819,6 @@ scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
|
||||||
# replace the scanners list that has what we want
|
# replace the scanners list that has what we want
|
||||||
main['SCANNERS'] = scanners
|
main['SCANNERS'] = scanners
|
||||||
|
|
||||||
# Add a custom Check function to the Configure context so that we can
|
|
||||||
# figure out if the compiler adds leading underscores to global
|
|
||||||
# variables. This is needed for the autogenerated asm files that we
|
|
||||||
# use for embedding the python code.
|
|
||||||
def CheckLeading(context):
|
|
||||||
context.Message("Checking for leading underscore in global variables...")
|
|
||||||
# 1) Define a global variable called x from asm so the C compiler
|
|
||||||
# won't change the symbol at all.
|
|
||||||
# 2) Declare that variable.
|
|
||||||
# 3) Use the variable
|
|
||||||
#
|
|
||||||
# If the compiler prepends an underscore, this will successfully
|
|
||||||
# link because the external symbol 'x' will be called '_x' which
|
|
||||||
# was defined by the asm statement. If the compiler does not
|
|
||||||
# prepend an underscore, this will not successfully link because
|
|
||||||
# '_x' will have been defined by assembly, while the C portion of
|
|
||||||
# the code will be trying to use 'x'
|
|
||||||
ret = context.TryLink('''
|
|
||||||
asm(".globl _x; _x: .byte 0");
|
|
||||||
extern int x;
|
|
||||||
int main() { return x; }
|
|
||||||
''', extension=".c")
|
|
||||||
context.env.Append(LEADING_UNDERSCORE=ret)
|
|
||||||
context.Result(ret)
|
|
||||||
return ret
|
|
||||||
|
|
||||||
# Add a custom Check function to test for structure members.
|
# Add a custom Check function to test for structure members.
|
||||||
def CheckMember(context, include, decl, member, include_quotes="<>"):
|
def CheckMember(context, include, decl, member, include_quotes="<>"):
|
||||||
context.Message("Checking for member %s in %s..." %
|
context.Message("Checking for member %s in %s..." %
|
||||||
|
@ -871,14 +845,9 @@ conf = Configure(main,
|
||||||
conf_dir = joinpath(build_root, '.scons_config'),
|
conf_dir = joinpath(build_root, '.scons_config'),
|
||||||
log_file = joinpath(build_root, 'scons_config.log'),
|
log_file = joinpath(build_root, 'scons_config.log'),
|
||||||
custom_tests = {
|
custom_tests = {
|
||||||
'CheckLeading' : CheckLeading,
|
|
||||||
'CheckMember' : CheckMember,
|
'CheckMember' : CheckMember,
|
||||||
})
|
})
|
||||||
|
|
||||||
# Check for leading underscores. Don't really need to worry either
|
|
||||||
# way so don't need to check the return code.
|
|
||||||
conf.CheckLeading()
|
|
||||||
|
|
||||||
# Check if we should compile a 64 bit binary on Mac OS X/Darwin
|
# Check if we should compile a 64 bit binary on Mac OS X/Darwin
|
||||||
try:
|
try:
|
||||||
import platform
|
import platform
|
||||||
|
|
Loading…
Reference in a new issue