From patchwork Wed Aug 31 15:29:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Heiser X-Patchwork-Id: 9307385 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 3A59D60756 for ; Wed, 31 Aug 2016 15:30:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29E0B28E74 for ; Wed, 31 Aug 2016 15:30:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BAC728F7B; Wed, 31 Aug 2016 15:30:00 +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 C2CF028E74 for ; Wed, 31 Aug 2016 15:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935416AbcHaP36 (ORCPT ); Wed, 31 Aug 2016 11:29:58 -0400 Received: from smtp2.goneo.de ([85.220.129.33]:37466 "EHLO smtp2.goneo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935148AbcHaP3z (ORCPT ); Wed, 31 Aug 2016 11:29:55 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp2.goneo.de (Postfix) with ESMTP id D6D7023F56F; Wed, 31 Aug 2016 17:29:52 +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 IMWZaQ5AxzPA; Wed, 31 Aug 2016 17:29:44 +0200 (CEST) Received: from ubu1604.fritz.box (dyndsl-095-033-012-111.ewe-ip-backbone.de [95.33.12.111]) by smtp2.goneo.de (Postfix) with ESMTPSA id ED86424363A; Wed, 31 Aug 2016 17:29:43 +0200 (CEST) From: Markus Heiser To: Jonathan Corbet Cc: Markus Heiser , Mauro Carvalho Chehab , Jani Nikula , Linux Media Mailing List , 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 Message-Id: <1472657372-21039-4-git-send-email-markus.heiser@darmarit.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472657372-21039-1-git-send-email-markus.heiser@darmarit.de> References: <1472657372-21039-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 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."""