mem-ruby: Fix file extension detection in code_formatter.py.
Insufficiently specific regular expressions were causing the C/C++ pattern to match the `.html` extension. This resulted in C-style comments being inserted into generated HTML files. This was causing the SLICC HTML documentation to be unreadable in a web browser. Change-Id: Iebad9896db393bba7ec9b0836693012959222455 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/60871 Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
# Copyright (c) 2022 Arm Limited
|
||||
# All rights reserved.
|
||||
#
|
||||
# The license below extends only to copyright in the software and shall
|
||||
# not be construed as granting a license to any other intellectual
|
||||
# property including but not limited to intellectual property relating
|
||||
# to a hardware implementation of the functionality of the software
|
||||
# licensed hereunder. You may use the software subject to the license
|
||||
# terms below provided that you ensure that this notice is replicated
|
||||
# unmodified and in its entirety in all distributions of the software,
|
||||
# modified or unmodified, in source code or in binary form.
|
||||
#
|
||||
# Copyright (c) 2006-2009 Nathan Binkert <nate@binkert.org>
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -159,7 +171,7 @@ class code_formatter(object, metaclass=code_formatter_meta):
|
||||
# Add a comment to inform which file generated the generated file
|
||||
# to make it easier to backtrack and modify generated code
|
||||
frame = inspect.currentframe().f_back
|
||||
if re.match('\.(cc|hh|c|h)', extension) is not None:
|
||||
if re.match(r'^\.(cc|hh|c|h)$', extension) is not None:
|
||||
f.write(f'''/**
|
||||
* DO NOT EDIT THIS FILE!
|
||||
* File automatically generated by
|
||||
@@ -167,7 +179,7 @@ class code_formatter(object, metaclass=code_formatter_meta):
|
||||
*/
|
||||
|
||||
''')
|
||||
elif re.match('\.py', extension) is not None:
|
||||
elif re.match(r'^\.py$', extension) is not None:
|
||||
f.write(f'''#
|
||||
# DO NOT EDIT THIS FILE!
|
||||
# File automatically generated by
|
||||
@@ -175,7 +187,7 @@ class code_formatter(object, metaclass=code_formatter_meta):
|
||||
#
|
||||
|
||||
''')
|
||||
elif re.match('\.html', extension) is not None:
|
||||
elif re.match(r'^\.html$', extension) is not None:
|
||||
f.write(f'''<!--
|
||||
DO NOT EDIT THIS FILE!
|
||||
File automatically generated by
|
||||
|
||||
Reference in New Issue
Block a user