From patchwork Fri Dec 4 15:26:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Marek X-Patchwork-Id: 7769161 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 151CE9F350 for ; Fri, 4 Dec 2015 15:28:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C17CB205D1 for ; Fri, 4 Dec 2015 15:28:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 659EE205BA for ; Fri, 4 Dec 2015 15:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754246AbbLDP2B (ORCPT ); Fri, 4 Dec 2015 10:28:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:53883 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753230AbbLDP0t (ORCPT ); Fri, 4 Dec 2015 10:26:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AB703AD8E; Fri, 4 Dec 2015 15:26:45 +0000 (UTC) Received: by sepie.suse.cz (Postfix, from userid 10020) id 697D640C9C; Fri, 4 Dec 2015 16:26:45 +0100 (CET) From: Michal Marek To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 7/8] tags: Unify emacs and exuberant rules Date: Fri, 4 Dec 2015 16:26:26 +0100 Message-Id: <1449242787-16598-8-git-send-email-mmarek@suse.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449242787-16598-1-git-send-email-mmarek@suse.com> References: <1449242787-16598-1-git-send-email-mmarek@suse.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The emacs rules were constantly lagging behind the exuberant ones. Use a single set of rules for both, to make the script easier to maintain. The language understood by both tools is basic regular expression with some limitations, which are documented in a comment. To be able to store the rules in an array and easily iterate over it, the script requires bash now. In the exuberant case, the change fixes some false matches in and also some too greedy matches in the arguments of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously not working rules are matching now. Tested with these versions of the tools: Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert etags (GNU Emacs 24.5) Signed-off-by: Michal Marek --- v2: Rebased onto current linux-next scripts/tags.sh | 199 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 108 insertions(+), 91 deletions(-) mode change 100755 => 100644 scripts/tags.sh diff --git a/scripts/tags.sh b/scripts/tags.sh old mode 100755 new mode 100644 index 17ff331f8840..23ba1c6a0a59 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Generate tags or cscope files # Usage tags.sh # @@ -145,8 +145,107 @@ dogtags() all_target_sources | gtags -i -f - } +# Basic regular expressions with an optional /kind-spec/ for ctags and +# the following limitations: +# - No regex modifiers +# - Use \{0,1\} instead of \?, because etags expects an unescaped ? +# - \s is not working with etags, use a space or [ \t] +# - \w works, but does not match underscores in etags +# - etags regular expressions have to match at the start of a line; +# a ^[^#] is prepended by setup_regex unless an anchor is already present +regex_asm=( + '/^\(ENTRY\|_GLOBAL\)(\([[:alnum:]_\\]*\)).*/\2/' +) +regex_c=( + '/^SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/sys_\1/' + '/^COMPAT_SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/compat_sys_\1/' + '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1/' + '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/' + '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/' + '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/' + '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/' + '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/' + '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/' + '/^TESTSETFLAG(\([[:alnum:]_]*\).*/TestSetPage\1/' + '/^TESTPAGEFLAG(\([[:alnum:]_]*\).*/Page\1/' + '/^SETPAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/' + '/\<__SETPAGEFLAG(\([[:alnum:]_]*\).*/__SetPage\1/' + '/\