mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1025998 - part 1 - make convert_def_file.py handle the DATA keyword; r=glandium
This commit is contained in:
parent
ab2b9b8ae0
commit
1a64a17006
@ -35,19 +35,18 @@ def preprocess_file(pp, deffile):
|
|||||||
# directives are hidden behind ";", ";+", and ";-"
|
# directives are hidden behind ";", ";+", and ";-"
|
||||||
#
|
#
|
||||||
# We don't care about rule 1, as that mainly serves to eliminate LIBRARY
|
# We don't care about rule 1, as that mainly serves to eliminate LIBRARY
|
||||||
# and EXPORTS lines. We don't want to enforce rule 3, as we know how to
|
# and EXPORTS lines. Our symbol extraction routines handle DATA, so we
|
||||||
# eliminate comments. ';+' also tends to hide Unix linker-script specific
|
# don't need to bother with rule 2. We don't want to enforce rule 3, as
|
||||||
# things, which we don't want to deal with here. Rule 5 is also unnecessary;
|
# we know how to eliminate comments. ';+' also tends to hide Unix
|
||||||
# later comment-aware processing will deal with that.
|
# linker-script specific things, which we don't want to deal with here.
|
||||||
|
# Rule 5 is also unnecessary; later comment-aware processing will deal
|
||||||
|
# with that.
|
||||||
#
|
#
|
||||||
# We do need to handle rule 2, since our symbol extraction doesn't want to
|
# We need to handle rule 4, since ';;' often hides things marked with DATA.
|
||||||
# see DATA keywords. We also need to handle rule 4, since ';;' often hides
|
|
||||||
# things marked with DATA.
|
|
||||||
def nss_preprocess_file(deffile):
|
def nss_preprocess_file(deffile):
|
||||||
with open(deffile, 'r') as input:
|
with open(deffile, 'r') as input:
|
||||||
for line in input:
|
for line in input:
|
||||||
# Rule 2, and then rule 4.
|
yield line.replace(';;', '')
|
||||||
yield line.replace(' DATA ', '').replace(';;', '')
|
|
||||||
|
|
||||||
COMMENT = re.compile(';.*')
|
COMMENT = re.compile(';.*')
|
||||||
|
|
||||||
@ -67,11 +66,15 @@ def extract_symbols(lines):
|
|||||||
else:
|
else:
|
||||||
fields = line.split()
|
fields = line.split()
|
||||||
|
|
||||||
# We don't support aliases or keywords (ordinals, PRIVATE, etc.) for
|
# We don't support aliases, and we only support the DATA keyword on
|
||||||
# symbols. But since aliases can also be specified as 'SYM=ALIAS'
|
# symbols. But since aliases can also be specified as 'SYM=ALIAS'
|
||||||
# with no whitespace, we need extra checks on the original symbol.
|
# with no whitespace, we need extra checks on the original symbol.
|
||||||
if len(fields) != 1 or '=' in fields[0]:
|
if '=' in fields[0]:
|
||||||
raise 'aliases and keywords are not supported'
|
raise BaseException, 'aliases are not supported (%s)' % line
|
||||||
|
if len(fields) == 1:
|
||||||
|
pass
|
||||||
|
elif len(fields) != 2 or fields[1] != 'DATA':
|
||||||
|
raise BaseException, 'aliases and keywords other than DATA are not supported (%s)' % line
|
||||||
|
|
||||||
symbols.add(fields[0])
|
symbols.add(fields[0])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user