From patchwork Wed Sep 7 07:12:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Heiser X-Patchwork-Id: 9318319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 02968601C0 for ; Wed, 7 Sep 2016 07:13:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E358E290B1 for ; Wed, 7 Sep 2016 07:13:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8347290B3; Wed, 7 Sep 2016 07:13:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 885F7290B1 for ; Wed, 7 Sep 2016 07:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754373AbcIGHNv (ORCPT ); Wed, 7 Sep 2016 03:13:51 -0400 Received: from smtp2.goneo.de ([85.220.129.33]:41642 "EHLO smtp2.goneo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbcIGHNt (ORCPT ); Wed, 7 Sep 2016 03:13:49 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp2.goneo.de (Postfix) with ESMTP id 37F0E2427DC; Wed, 7 Sep 2016 09:13:47 +0200 (CEST) X-Virus-Scanned: by goneo Received: from smtp2.goneo.de ([127.0.0.1]) by localhost (smtp2.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k2VFSgyHG8iC; Wed, 7 Sep 2016 09:13:07 +0200 (CEST) Received: from ubu1604.fritz.box (dyndsl-095-033-002-234.ewe-ip-backbone.de [95.33.2.234]) by smtp2.goneo.de (Postfix) with ESMTPSA id 45BF7243423; Wed, 7 Sep 2016 09:13:07 +0200 (CEST) From: Markus Heiser To: Jonathan Corbet , Mauro Carvalho Chehab , Jani Nikula Cc: Markus Heiser , Linux Media Mailing List , linux-doc@vger.kernel.org, Markus Heiser Subject: [RFC v2 3/3] doc-rst:c-domain: function-like macros index entry Date: Wed, 7 Sep 2016 09:12:58 +0200 Message-Id: <1473232378-11869-4-git-send-email-markus.heiser@darmarit.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473232378-11869-1-git-send-email-markus.heiser@darmarit.de> References: <1473232378-11869-1-git-send-email-markus.heiser@darmarit.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Heiser 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 --- Documentation/sphinx/cdomain.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py index df0419c..ead81b5 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 @@ -65,6 +66,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."""