aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rwxr-xr-xcc/gen_stub_libs.py8
-rwxr-xr-xcc/test_gen_stub_libs.py14
2 files changed, 19 insertions, 3 deletions
diff --git a/cc/gen_stub_libs.py b/cc/gen_stub_libs.py
index eb233f8f..d6cd973e 100755
--- a/cc/gen_stub_libs.py
+++ b/cc/gen_stub_libs.py
@@ -289,6 +289,7 @@ class Generator(object):
if should_omit_version(name, tags, self.arch, self.api):
return
+ section_versioned = symbol_versioned_in_api(tags, self.api)
version_empty = True
pruned_symbols = []
for symbol in version.symbols:
@@ -302,11 +303,12 @@ class Generator(object):
pruned_symbols.append(symbol)
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(' global:\n')
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')
if 'var' in symbol.tags:
@@ -314,7 +316,7 @@ class Generator(object):
else:
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
self.version_script.write('}' + base + ';\n')
diff --git a/cc/test_gen_stub_libs.py b/cc/test_gen_stub_libs.py
index e9e72498..8683d318 100755
--- a/cc/test_gen_stub_libs.py
+++ b/cc/test_gen_stub_libs.py
@@ -407,6 +407,14 @@ class IntegrationTest(unittest.TestCase):
woodly;
doodly; # var
} VERSION_2;
+
+ VERSION_4 { # versioned=9
+ wibble;
+ } VERSION_2;
+
+ VERSION_5 { # versioned=14
+ wobble;
+ } VERSION_4;
"""))
parser = gsl.SymbolFileParser(input_file)
versions = parser.parse()
@@ -420,6 +428,8 @@ class IntegrationTest(unittest.TestCase):
int foo = 0;
void baz() {}
void qux() {}
+ void wibble() {}
+ void wobble() {}
""")
self.assertEqual(expected_src, src_file.getvalue())
@@ -432,6 +442,10 @@ class IntegrationTest(unittest.TestCase):
global:
baz;
} VERSION_1;
+ VERSION_4 {
+ global:
+ wibble;
+ } VERSION_2;
""")
self.assertEqual(expected_version, version_file.getvalue())