From 77762002aee307e603b741342790d99eae4888a2 Mon Sep 17 00:00:00 2001 From: Love Waern Date: Tue, 21 Mar 2023 11:11:04 +0100 Subject: [PATCH 1/3] Annotate third party trademarks in documentation with '*' --- RELEASENOTES-1.4.docu | 2 +- RELEASENOTES.docu | 2 +- doc/1.4/running-dmlc.md | 2 +- py/dml/dmlc.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RELEASENOTES-1.4.docu b/RELEASENOTES-1.4.docu index bb3e60c8e..74cd41f11 100644 --- a/RELEASENOTES-1.4.docu +++ b/RELEASENOTES-1.4.docu @@ -445,7 +445,7 @@ for huge (multi-megabyte) struct types . --coverity has been added as an - option to DMLC. When used, DMLC will generate Synopsys® Coverity® analysis + option to DMLC. When used, DMLC will generate Synopsys* Coverity* analysis annotations to suppress common false positives in generated C code created from DML 1.4 devices. Fixed an ICE caused by constant inlined diff --git a/RELEASENOTES.docu b/RELEASENOTES.docu index 437ed5758..fe63880e5 100644 --- a/RELEASENOTES.docu +++ b/RELEASENOTES.docu @@ -1536,7 +1536,7 @@ Adjusted DMLC code generation to silence false positives reported on dml-builtins.dml when analysing - DMLC-generated C code using the Synopsis® Coverity® + DMLC-generated C code using the Synopsys* Coverity* static analysis tool. Improved some error messages . diff --git a/doc/1.4/running-dmlc.md b/doc/1.4/running-dmlc.md index 160890dae..0c1862351 100644 --- a/doc/1.4/running-dmlc.md +++ b/doc/1.4/running-dmlc.md @@ -113,7 +113,7 @@ causes generated C code to follow the DML code more closely. --coverity
-Adds Synopsys® Coverity® analysis annotations to suppress common false positives +Adds Synopsys* Coverity* analysis annotations to suppress common false positives in generated C code created from DML 1.4 device models.
diff --git a/py/dml/dmlc.py b/py/dml/dmlc.py index c953f5c17..38d63a19e 100644 --- a/py/dml/dmlc.py +++ b/py/dml/dmlc.py @@ -374,12 +374,12 @@ def set_debuggable(option, opt, value, parser): + ' --strict-dml12.') #
--coverity
- #
Adds Synopsys® Coverity® analysis annotations to suppress common + #
Adds Synopsys* Coverity* analysis annotations to suppress common # false positives in generated C code created from DML 1.4 device models. #
optpar.add_option( '--coverity', dest = 'coverity', action = 'store_true', - help = ('Adds Synopsys® Coverity® analysis annotations to suppress ' + help = ('Adds Synopsys* Coverity* analysis annotations to suppress ' + 'common false positives in generated C code created from ' + 'DML 1.4 device models.')) #
--noline
From e213c9e349cbbe83661b8802d03c9e2334de016b Mon Sep 17 00:00:00 2001 From: Love Waern Date: Tue, 21 Mar 2023 11:13:09 +0100 Subject: [PATCH 2/3] Enforce annotation for third party trademarks in the reference manual --- validate_md_links.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/validate_md_links.py b/validate_md_links.py index 91c11d9b4..ee849b653 100644 --- a/validate_md_links.py +++ b/validate_md_links.py @@ -24,6 +24,12 @@ def toc_md_files(toc, dirs): assert anchor_re.findall('') == ['comparison-to-c'] +third_party_trademarks = {'synopsys', 'coverity'} + +third_party_trademark_re = re.compile( + r'(?i:(' + '|'.join(third_party_trademarks) + + r'))([*®™]|®|™|©|\\\*)?') + def char_range(low, high): return map(chr, range(ord(low), ord(high) + 1)) @@ -95,11 +101,40 @@ def main(): line = md_files[path][:match.start()].count('\n') + 1 sys.stderr.write(f'{path}:{line}: error: {message}\n') ok = False + + third_party_trademarks_referenced = {} + third_party_trademarks_annotated = set() + def check_third_party_trademarks(): + for (tm, line) in third_party_trademarks_referenced.items(): + if tm not in third_party_trademarks_annotated: + sys.stderr.write( + f"{path}:{line+1}: error: third party trademark " + + f"'{tm}' never annotated with '*' in this section\n") + nonlocal ok + ok = False + third_party_trademarks_referenced.clear() + third_party_trademarks_annotated.clear() + for (i, line) in enumerate(md_files[path].split('\n')): if ' -- ' in f' {line} ': sys.stderr.write( f'{path}:{i+1}: error: replace -- with —\n') ok = False + + # A third party trademark must be annotated at least once per + # (sub)section + if line.startswith('#'): + check_third_party_trademarks() + for match in third_party_trademark_re.finditer(line): + annotated = match.group(2) in {'*', '\\*'} + + tm = match.group(1).lower() + third_party_trademarks_referenced.setdefault(tm, i) + if annotated: + third_party_trademarks_annotated.add(tm) + + check_third_party_trademarks() + sys.exit(0 if ok else 1) if __name__ == '__main__': From e19ff233e66d1b82bcd00ec15c0b088a48f138e9 Mon Sep 17 00:00:00 2001 From: Love Waern Date: Tue, 21 Mar 2023 11:16:17 +0100 Subject: [PATCH 3/3] DML wiki: add acknowledgement line for any page with a third party trademark --- md_to_github.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/md_to_github.py b/md_to_github.py index 73610fcb9..0c7c3f47b 100644 --- a/md_to_github.py +++ b/md_to_github.py @@ -53,6 +53,11 @@ def toc_md_files(toc, indices): --> ''' +acknowledgement = r''' +*** +\* Other names and brands may be claimed as the property of others. +''' + frontpage_links = [] filename_map = {} @@ -93,6 +98,9 @@ def add_to_tar(tf, path, contents): end = match.end(1) if end > start: body = body[:start] + filename_map[match[1]] + body[end:] + + if validate_md_links.third_party_trademark_re.search(body) is not None: + body += acknowledgement add_to_tar(tgz, path, copyright + body) head = [copyright,