Support versioned=%d at the section level.
Test: nose2 Bug: https://github.com/android-ndk/ndk/issues/265 Change-Id: I4c22cb8069f41861613ecf01f7e1adbe1d3118a9
This commit is contained in:
@@ -289,6 +289,7 @@ class Generator(object):
|
|||||||
if should_omit_version(name, tags, self.arch, self.api):
|
if should_omit_version(name, tags, self.arch, self.api):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
section_versioned = symbol_versioned_in_api(tags, self.api)
|
||||||
version_empty = True
|
version_empty = True
|
||||||
pruned_symbols = []
|
pruned_symbols = []
|
||||||
for symbol in version.symbols:
|
for symbol in version.symbols:
|
||||||
@@ -302,11 +303,12 @@ class Generator(object):
|
|||||||
pruned_symbols.append(symbol)
|
pruned_symbols.append(symbol)
|
||||||
|
|
||||||
if len(pruned_symbols) > 0:
|
if len(pruned_symbols) > 0:
|
||||||
if not version_empty:
|
if not version_empty and section_versioned:
|
||||||
self.version_script.write(version.name + ' {\n')
|
self.version_script.write(version.name + ' {\n')
|
||||||
self.version_script.write(' global:\n')
|
self.version_script.write(' global:\n')
|
||||||
for symbol in pruned_symbols:
|
for symbol in pruned_symbols:
|
||||||
if symbol_versioned_in_api(symbol.tags, self.api):
|
emit_version = symbol_versioned_in_api(symbol.tags, self.api)
|
||||||
|
if section_versioned and emit_version:
|
||||||
self.version_script.write(' ' + symbol.name + ';\n')
|
self.version_script.write(' ' + symbol.name + ';\n')
|
||||||
|
|
||||||
if 'var' in symbol.tags:
|
if 'var' in symbol.tags:
|
||||||
@@ -314,7 +316,7 @@ class Generator(object):
|
|||||||
else:
|
else:
|
||||||
self.src_file.write('void {}() {{}}\n'.format(symbol.name))
|
self.src_file.write('void {}() {{}}\n'.format(symbol.name))
|
||||||
|
|
||||||
if not version_empty:
|
if not version_empty and section_versioned:
|
||||||
base = '' if version.base is None else ' ' + version.base
|
base = '' if version.base is None else ' ' + version.base
|
||||||
self.version_script.write('}' + base + ';\n')
|
self.version_script.write('}' + base + ';\n')
|
||||||
|
|
||||||
|
@@ -407,6 +407,14 @@ class IntegrationTest(unittest.TestCase):
|
|||||||
woodly;
|
woodly;
|
||||||
doodly; # var
|
doodly; # var
|
||||||
} VERSION_2;
|
} VERSION_2;
|
||||||
|
|
||||||
|
VERSION_4 { # versioned=9
|
||||||
|
wibble;
|
||||||
|
} VERSION_2;
|
||||||
|
|
||||||
|
VERSION_5 { # versioned=14
|
||||||
|
wobble;
|
||||||
|
} VERSION_4;
|
||||||
"""))
|
"""))
|
||||||
parser = gsl.SymbolFileParser(input_file)
|
parser = gsl.SymbolFileParser(input_file)
|
||||||
versions = parser.parse()
|
versions = parser.parse()
|
||||||
@@ -420,6 +428,8 @@ class IntegrationTest(unittest.TestCase):
|
|||||||
int foo = 0;
|
int foo = 0;
|
||||||
void baz() {}
|
void baz() {}
|
||||||
void qux() {}
|
void qux() {}
|
||||||
|
void wibble() {}
|
||||||
|
void wobble() {}
|
||||||
""")
|
""")
|
||||||
self.assertEqual(expected_src, src_file.getvalue())
|
self.assertEqual(expected_src, src_file.getvalue())
|
||||||
|
|
||||||
@@ -432,6 +442,10 @@ class IntegrationTest(unittest.TestCase):
|
|||||||
global:
|
global:
|
||||||
baz;
|
baz;
|
||||||
} VERSION_1;
|
} VERSION_1;
|
||||||
|
VERSION_4 {
|
||||||
|
global:
|
||||||
|
wibble;
|
||||||
|
} VERSION_2;
|
||||||
""")
|
""")
|
||||||
self.assertEqual(expected_version, version_file.getvalue())
|
self.assertEqual(expected_version, version_file.getvalue())
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user