]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Doxygen: transform ENUM_BITFIELD and comments starting with '/**'.
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 May 2017 14:08:36 +0000 (14:08 +0000)
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 May 2017 14:08:36 +0000 (14:08 +0000)
2017-05-31  Martin Liska  <mliska@suse.cz>

* filter_params.py:
Transform ENUM_BITFIELD and comments starting with '/**'

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248741 138bc75d-0d04-0410-961f-82ee72b054a4

contrib/ChangeLog
contrib/filter_params.py

index 20b390db22399bc03cb5fbea46baf44fc0fe49f6..e2cbd7902fc5eef43e0232aa505eaeea8d41671c 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-31  Martin Liska  <mliska@suse.cz>
+
+       * filter_params.py:
+       Transform ENUM_BITFIELD and comments starting with '/**'
+
 2017-05-31  David Malcolm  <dmalcolm@redhat.com>
            Martin Liska  <mliska@suse.cz>
 
index f94d201bbf82afb69144b9ba8c7f41c13f4da2c1..a82a8d5728cdb3b282ec80e2c5fb991c1de19702 100644 (file)
@@ -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: