All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Heiser <markus.heiser@darmarit.de>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Markus Heiser <markus.heiser@darmarIT.de>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Jani Nikula <jani.nikula@intel.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	linux-doc@vger.kernel.org
Subject: [PATCH 3/3] doc-rst:c-domain: function-like macros index entry
Date: Wed, 31 Aug 2016 17:29:32 +0200	[thread overview]
Message-ID: <1472657372-21039-4-git-send-email-markus.heiser@darmarit.de> (raw)
In-Reply-To: <1472657372-21039-1-git-send-email-markus.heiser@darmarit.de>

From: Markus Heiser <markus.heiser@darmarIT.de>

For function-like macros, sphinx creates 'FOO (C function)' entries.
With this patch 'FOO (C macro)' are created for function-like macros,
which is the same for object-like macros.

Signed-off-by: Markus Heiser <markus.heiser@darmarIT.de>
---
 Documentation/sphinx/cdomain.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py
index 0816090..2a1bd09 100644
--- a/Documentation/sphinx/cdomain.py
+++ b/Documentation/sphinx/cdomain.py
@@ -37,6 +37,7 @@ from docutils.parsers.rst import directives
 
 import sphinx
 from sphinx import addnodes
+from sphinx.locale import _
 from sphinx.domains.c import c_funcptr_sig_re, c_sig_re
 from sphinx.domains.c import CObject as Base_CObject
 from sphinx.domains.c import CDomain as Base_CDomain
@@ -66,6 +67,8 @@ class CObject(Base_CObject):
         "name" : directives.unchanged
     }
 
+    is_function_like_macro = False
+
     def handle_func_like_macro(self, sig, signode):
         u"""Handles signatures of function-like macros.
 
@@ -104,6 +107,7 @@ class CObject(Base_CObject):
             param += nodes.emphasis(argname, argname)
             paramlist += param
 
+        self.is_function_like_macro = True
         return fullname
 
     def handle_signature(self, sig, signode):
@@ -151,6 +155,12 @@ class CObject(Base_CObject):
                 self.indexnode['entries'].append(
                     ('single', indextext, targetname, '', None))
 
+    def get_index_text(self, name):
+        if self.is_function_like_macro:
+            return _('%s (C macro)') % name
+        else:
+            return super(CObject, self).get_index_text(name)
+
 class CDomain(Base_CDomain):
 
     """C language domain."""
-- 
2.7.4


  parent reply	other threads:[~2016-08-31 15:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 15:29 [RFC PATCH 0/3] doc-rst:c-domain: fix some issues in the c-domain Markus Heiser
2016-08-31 15:29 ` [PATCH 1/3] doc-rst:c-domain: fix sphinx version incompatibility Markus Heiser
2016-09-06 12:19   ` Jonathan Corbet
2016-09-06 12:24     ` Markus Heiser
2016-09-06 12:30       ` Jonathan Corbet
2016-09-06 13:34     ` Jani Nikula
2016-09-06 15:10       ` Markus Heiser
2016-09-06 15:55         ` Mauro Carvalho Chehab
2016-09-07  8:01           ` Markus Heiser
2016-08-31 15:29 ` [PATCH 2/3] doc-rst:c-domain: function-like macros arguments Markus Heiser
2016-09-06 12:27   ` Jonathan Corbet
2016-09-07  5:26     ` Markus Heiser
2016-08-31 15:29 ` Markus Heiser [this message]
2016-09-06 12:28   ` [PATCH 3/3] doc-rst:c-domain: function-like macros index entry Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472657372-21039-4-git-send-email-markus.heiser@darmarit.de \
    --to=markus.heiser@darmarit.de \
    --cc=corbet@lwn.net \
    --cc=jani.nikula@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.