Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754531AbbLDP2D (ORCPT ); Fri, 4 Dec 2015 10:28:03 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 11719 Lines: 262 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/' + '/\