[hawkmoth] [PATCH 07/11] parser: start using c:macro also for function-like macros

  • From: Jani Nikula <jani@xxxxxxxxxx>
  • To: hawkmoth@xxxxxxxxxxxxx
  • Date: Tue, 15 Dec 2020 21:00:04 +0200

From: Bruno Santos <brunomanuelsantos@xxxxxxxxxxxxxxxxxx>

Sphinx 3 added support for using c:macro for function-like macros.

[Jani: Split this out from the rest of the Sphinx 3 changes.]
---
 hawkmoth/util/docstr.py      | 4 ++--
 test/example-10-macro.rst    | 6 +++---
 test/function-like-macro.rst | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hawkmoth/util/docstr.py b/hawkmoth/util/docstr.py
index c6c2ff533c39..ca3faa9a5801 100644
--- a/hawkmoth/util/docstr.py
+++ b/hawkmoth/util/docstr.py
@@ -1,5 +1,5 @@
 # Copyright (c) 2016-2020 Jani Nikula <jani@xxxxxxxxxx>
-# Copyright (c) 2018-2019 Bruno Santos <brunomanuelsantos@xxxxxxxxxxxxxxxxxx>
+# Copyright (c) 2018-2020 Bruno Santos <brunomanuelsantos@xxxxxxxxxxxxxxxxxx>
 # Licensed under the terms of BSD 2-Clause, see LICENSE for details.
 """
 Documentation strings manipulation library
@@ -34,7 +34,7 @@ _doc_fmt = {
     Type.ENUM_VAL:   (1, '\n.. c:enumerator:: {name}\n\n{text}\n'),
     Type.MEMBER:     (1, '\n.. c:member:: {ttype} {name}\n\n{text}\n'),
     Type.MACRO:      (1, '\n.. c:macro:: {name}\n\n{text}\n'),
-    Type.MACRO_FUNC: (1, '\n.. c:function:: {name}({args})\n\n{text}\n'),
+    Type.MACRO_FUNC: (1, '\n.. c:macro:: {name}({args})\n\n{text}\n'),
     Type.FUNC:       (1, '\n.. c:function:: {ttype} 
{name}({args})\n\n{text}\n')
 }
 
diff --git a/test/example-10-macro.rst b/test/example-10-macro.rst
index 36db739622ee..e843044c029c 100644
--- a/test/example-10-macro.rst
+++ b/test/example-10-macro.rst
@@ -4,14 +4,14 @@
    Failure status.
 
 
-.. c:function:: DIE()
+.. c:macro:: DIE()
 
    Terminate immediately with failure status.
 
    See :c:macro:`FAILURE`.
 
 
-.. c:function:: ARRAY_SIZE(array)
+.. c:macro:: ARRAY_SIZE(array)
 
    Get the number of elements in an array.
 
@@ -19,7 +19,7 @@
    :return: Array size
 
 
-.. c:function:: VARIADIC_MACRO(foo, ...)
+.. c:macro:: VARIADIC_MACRO(foo, ...)
 
    Variadic macros
 
diff --git a/test/function-like-macro.rst b/test/function-like-macro.rst
index b9e37ba79113..de171cac4d0e 100644
--- a/test/function-like-macro.rst
+++ b/test/function-like-macro.rst
@@ -1,10 +1,10 @@
 
-.. c:function:: FOO(bar, baz)
+.. c:macro:: FOO(bar, baz)
 
    A function-like macro.
 
 
-.. c:function:: BAR()
+.. c:macro:: BAR()
 
    Another
 
-- 
2.20.1


Other related posts:

  • » [hawkmoth] [PATCH 07/11] parser: start using c:macro also for function-like macros - Jani Nikula