This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/2] Doxygen: transform ENUM_BITFIELD and comments starting with '/**'.
- From: Martin Liška <mliska at suse dot cz>
- To: David Malcolm <dmalcolm at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 28 Apr 2017 14:18:01 +0200
- Subject: [PATCH 2/2] Doxygen: transform ENUM_BITFIELD and comments starting with '/**'.
- Authentication-results: sourceware.org; auth=none
- References: <CAD_=9DQv_8bgSxpPNGyHTYsRgCvM77fQikY6eN_-MSHG6bmqbg@mail.gmail.com> <1489715500-63153-1-git-send-email-dmalcolm@redhat.com>
Hi.
As mentioned in the subject, another 2 transformations. With David's patch applied and
my 2 hunks, I can see just these 3 warnings related to verbatim/end verbatim decoration:
/home/marxin/Programming/gcc/gcc/gcov-io.c:464: warning: unexpected command endverbatim
/home/marxin/Programming/gcc/gcc/common.md:19: warning: unexpected command endverbatim
/home/marxin/Programming/gcc/gcc/domwalk.h:47: warning: unexpected command endverbatim
Martin
>From a29b960344128d34f9dbe8f0bbf1e282694beb5b Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 28 Apr 2017 13:52:57 +0200
Subject: [PATCH 2/2] Doxygen: transform ENUM_BITFIELD and comments starting
with '/**'.
contrib/ChangeLog:
2017-04-28 Martin Liska <mliska@suse.cz>
* filter_params.py:
Transform ENUM_BITFIELD and comments starting with '/**'
---
contrib/filter_params.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/contrib/filter_params.py b/contrib/filter_params.py
index f94d201bbf8..a82a8d5728c 100644
--- a/contrib/filter_params.py
+++ b/contrib/filter_params.py
@@ -34,6 +34,11 @@ def filter_src(text):
# so that doxygen will parse them.
#
# Only comments that begin on the left-most column are converted.
+ #
+ text = re.sub(r'^/\*\* ',
+ r'/** @verbatim ',
+ text,
+ flags=re.MULTILINE)
text = re.sub(r'^/\* ',
r'/** @verbatim ',
text,
@@ -58,6 +63,11 @@ def filter_src(text):
r'(\1)',
text)
+ # Replace 'ENUM_BITFIELD(enum_name)' with 'enum enum_name'.
+ text = re.sub('ENUM_BITFIELD\s*\(([^\)]*)\)',
+ r'enum \1',
+ text)
+
return text
class FilteringTests(unittest.TestCase):
@@ -81,6 +91,21 @@ class FilteringTests(unittest.TestCase):
' NEXT_LINE\n'
' FINAL_LINE. @endverbatim */\n'))
+ def test_comment_example_gengtype(self):
+ self.assert_filters_to(
+ ('/** Allocate and initialize an input buffer state.\n'
+ ' * @param file A readable stream.\n'
+ ' * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\n'
+ ' * \n'
+ ' * @return the allocated buffer state.\n'
+ ' */'),
+ ('/** @verbatim Allocate and initialize an input buffer state.\n'
+ ' * @param file A readable stream.\n'
+ ' * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\n'
+ ' * \n'
+ ' * @return the allocated buffer state.\n'
+ ' @endverbatim */'))
+
def test_oneliner_comment(self):
self.assert_filters_to(
'/* Returns the string representing CLASS. */\n',
@@ -131,6 +156,11 @@ class FilteringTests(unittest.TestCase):
'char *strcpy PARAMS ((char *dest, char *source));\n',
'char *strcpy (char *dest, char *source);\n')
+ def test_ENUM_BITFIELD(self):
+ self.assert_filters_to(
+ ' ENUM_BITFIELD (sym_intent) intent:2;\n',
+ ' enum sym_intent intent:2;\n')
+
def act_on_files(argv):
for filename in argv[1:]:
with open(filename) as f:
--
2.12.2