diff options
author | N. Engelhardt <nak@symbioticeda.com> | 2020-01-29 15:21:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-29 15:21:28 +0100 |
commit | 177a7cb23e5ae8f3879d3b33629bfad0139a0162 (patch) | |
tree | db137dcbdcef701da5f2077baf3d563a61f5fa53 | |
parent | 71d148bcaa19c0339e214ba21ac9ec22f3cfbc6b (diff) | |
parent | 1e92e2d1de8c3fc4a04666e0b8db2225026598e9 (diff) | |
download | yosys-177a7cb23e5ae8f3879d3b33629bfad0139a0162.tar.gz yosys-177a7cb23e5ae8f3879d3b33629bfad0139a0162.tar.bz2 yosys-177a7cb23e5ae8f3879d3b33629bfad0139a0162.zip |
Merge pull request #1510 from pumbor/master
handle anonymous unions to fix #1080
-rw-r--r-- | misc/py_wrap_generator.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/misc/py_wrap_generator.py b/misc/py_wrap_generator.py index c58c3f66a..9b4e644c0 100644 --- a/misc/py_wrap_generator.py +++ b/misc/py_wrap_generator.py @@ -1935,6 +1935,19 @@ def parse_header(source): line = source_text[i].replace("YOSYS_NAMESPACE_BEGIN", " namespace YOSYS_NAMESPACE{").replace("YOSYS_NAMESPACE_END"," }") ugly_line = unpretty_string(line) + # for anonymous unions, ignore union enclosure by skipping start line and replacing end line with new line + if 'union {' in line: + j = i+1 + while j < len(source_text): + union_line = source_text[j] + if '};' in union_line: + source_text[j] = '\n' + break + j += 1 + if j != len(source_text): + i += 1 + continue + if str.startswith(ugly_line, "namespace "):# and ugly_line.find("std") == -1 and ugly_line.find("__") == -1: namespace_name = ugly_line[10:].replace("{","").strip() namespaces.append((namespace_name, ugly_line.count("{"))) |