* [PATCH 1/9] tags: Treat header files as C code
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-15 20:16 ` [PATCH 2/9] KVM: arm: Do not indent the arguments of DECLARE_BITMAP Michal Marek
` (7 subsequent siblings)
8 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel
This allows to apply the same patters to both source and header files.
The effect is mostly visible in the case of DECLARE_BITMAP, but there
are small gains all over the place. There is also lots of random changes
in the diff, I believe this is simply because there are still lots of
unexpanded macros in the code and the C and C++ parsers fail and recover
at different points. Also, qconf.h is parsed as C, but that's a
negligible regression.
Signed-off-by: Michal Marek <mmarek@suse.com>
---
scripts/tags.sh | 64 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 262889046703..5b7828756083 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -165,41 +165,41 @@ exuberant()
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL,ACPI_EXPORT_SYMBOL \
-I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
-I static,const \
- --extra=+f --c-kinds=+px \
+ --extra=+f --c-kinds=+px --langmap=c:+.h \
--regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \
--regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
--regex-c='/^COMPAT_SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/compat_sys_\1/' \
- --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
- --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1_rcuidle/' \
- --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \
- --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1_rcuidle/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c++='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c++='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c++='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c++='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
- --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
- --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \
- --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
- --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
- --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\
- --regex-c++='/DEF_MMIO_(IN|OUT)_(X|D)\(([^,]*),\s*[^)]*\)/\3/' \
- --regex-c++='/DEBUGGER_BOILERPLATE\(([^,]*)\)/\1/' \
+ --regex-c='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
+ --regex-c='/^TRACE_EVENT\(([^,)]*).*/trace_\1_rcuidle/' \
+ --regex-c='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \
+ --regex-c='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1_rcuidle/' \
+ --regex-c='/PAGEFLAG\(([^,)]*).*/Page\1/' \
+ --regex-c='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
+ --regex-c='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
+ --regex-c='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
+ --regex-c='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
+ --regex-c='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
+ --regex-c='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
+ --regex-c='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
+ --regex-c='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
+ --regex-c='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
+ --regex-c='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
+ --regex-c='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
+ --regex-c='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
+ --regex-c='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
+ --regex-c='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
+ --regex-c='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
+ --regex-c='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
+ --regex-c='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
+ --regex-c='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
+ --regex-c='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
+ --regex-c='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
+ --regex-c='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \
+ --regex-c='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
+ --regex-c='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
+ --regex-c='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\
+ --regex-c='/DEF_MMIO_(IN|OUT)_(X|D)\(([^,]*),\s*[^)]*\)/\3/' \
+ --regex-c='/DEBUGGER_BOILERPLATE\(([^,]*)\)/\1/' \
--regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \
--regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \
--regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 2/9] KVM: arm: Do not indent the arguments of DECLARE_BITMAP
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
2015-10-15 20:16 ` [PATCH 1/9] tags: Treat header files as C code Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-18 20:34 ` Christoffer Dall
2015-10-15 20:16 ` [PATCH 3/9] aic7xxx: Avoid name collision with <linux/list.h> Michal Marek
` (6 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, kvmarm
Besides being a coding style issue, it confuses make tags:
ctags: Warning: include/kvm/arm_vgic.h:307: null expansion of name pattern "\1"
ctags: Warning: include/kvm/arm_vgic.h:308: null expansion of name pattern "\1"
ctags: Warning: include/kvm/arm_vgic.h:309: null expansion of name pattern "\1"
ctags: Warning: include/kvm/arm_vgic.h:317: null expansion of name pattern "\1"
Cc: kvmarm@lists.cs.columbia.edu
Signed-off-by: Michal Marek <mmarek@suse.com>
---
include/kvm/arm_vgic.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index d901f1a47be6..58c5c0eb8d2d 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -304,9 +304,9 @@ struct vgic_cpu {
u8 *vgic_irq_lr_map;
/* Pending/active/both interrupts on this VCPU */
- DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS);
- DECLARE_BITMAP( active_percpu, VGIC_NR_PRIVATE_IRQS);
- DECLARE_BITMAP( pend_act_percpu, VGIC_NR_PRIVATE_IRQS);
+ DECLARE_BITMAP(pending_percpu, VGIC_NR_PRIVATE_IRQS);
+ DECLARE_BITMAP(active_percpu, VGIC_NR_PRIVATE_IRQS);
+ DECLARE_BITMAP(pend_act_percpu, VGIC_NR_PRIVATE_IRQS);
/* Pending/active/both shared interrupts, dynamically sized */
unsigned long *pending_shared;
@@ -314,7 +314,7 @@ struct vgic_cpu {
unsigned long *pend_act_shared;
/* Bitmap of used/free list registers */
- DECLARE_BITMAP( lr_used, VGIC_V2_MAX_LRS);
+ DECLARE_BITMAP(lr_used, VGIC_V2_MAX_LRS);
/* Number of list registers on this CPU */
int nr_lr;
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 2/9] KVM: arm: Do not indent the arguments of DECLARE_BITMAP
2015-10-15 20:16 ` [PATCH 2/9] KVM: arm: Do not indent the arguments of DECLARE_BITMAP Michal Marek
@ 2015-10-18 20:34 ` Christoffer Dall
2015-10-19 11:55 ` Michal Marek
0 siblings, 1 reply; 20+ messages in thread
From: Christoffer Dall @ 2015-10-18 20:34 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild, linux-kernel, kvmarm
On Thu, Oct 15, 2015 at 10:16:28PM +0200, Michal Marek wrote:
> Besides being a coding style issue, it confuses make tags:
>
> ctags: Warning: include/kvm/arm_vgic.h:307: null expansion of name pattern "\1"
> ctags: Warning: include/kvm/arm_vgic.h:308: null expansion of name pattern "\1"
> ctags: Warning: include/kvm/arm_vgic.h:309: null expansion of name pattern "\1"
> ctags: Warning: include/kvm/arm_vgic.h:317: null expansion of name pattern "\1"
>
> Cc: kvmarm@lists.cs.columbia.edu
> Signed-off-by: Michal Marek <mmarek@suse.com>
> ---
Is not being able to deal with a whitespace not a make tags problem?
As for coding style, do we really entertain these kinds of changes just
to adhere to a coding style? It feels unnecessary taints the log etc.
However, I'm curious what the general concesus and previous practice for
this sort of thing is?
Thanks,
-Christoffer
> include/kvm/arm_vgic.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
> index d901f1a47be6..58c5c0eb8d2d 100644
> --- a/include/kvm/arm_vgic.h
> +++ b/include/kvm/arm_vgic.h
> @@ -304,9 +304,9 @@ struct vgic_cpu {
> u8 *vgic_irq_lr_map;
>
> /* Pending/active/both interrupts on this VCPU */
> - DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS);
> - DECLARE_BITMAP( active_percpu, VGIC_NR_PRIVATE_IRQS);
> - DECLARE_BITMAP( pend_act_percpu, VGIC_NR_PRIVATE_IRQS);
> + DECLARE_BITMAP(pending_percpu, VGIC_NR_PRIVATE_IRQS);
> + DECLARE_BITMAP(active_percpu, VGIC_NR_PRIVATE_IRQS);
> + DECLARE_BITMAP(pend_act_percpu, VGIC_NR_PRIVATE_IRQS);
>
> /* Pending/active/both shared interrupts, dynamically sized */
> unsigned long *pending_shared;
> @@ -314,7 +314,7 @@ struct vgic_cpu {
> unsigned long *pend_act_shared;
>
> /* Bitmap of used/free list registers */
> - DECLARE_BITMAP( lr_used, VGIC_V2_MAX_LRS);
> + DECLARE_BITMAP(lr_used, VGIC_V2_MAX_LRS);
>
> /* Number of list registers on this CPU */
> int nr_lr;
> --
> 2.1.4
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 2/9] KVM: arm: Do not indent the arguments of DECLARE_BITMAP
2015-10-18 20:34 ` Christoffer Dall
@ 2015-10-19 11:55 ` Michal Marek
2015-10-19 12:05 ` Christoffer Dall
0 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2015-10-19 11:55 UTC (permalink / raw)
To: Christoffer Dall; +Cc: linux-kbuild, linux-kernel, kvmarm
On 2015-10-18 22:34, Christoffer Dall wrote:
> On Thu, Oct 15, 2015 at 10:16:28PM +0200, Michal Marek wrote:
>> Besides being a coding style issue, it confuses make tags:
>>
>> ctags: Warning: include/kvm/arm_vgic.h:307: null expansion of name pattern "\1"
>> ctags: Warning: include/kvm/arm_vgic.h:308: null expansion of name pattern "\1"
>> ctags: Warning: include/kvm/arm_vgic.h:309: null expansion of name pattern "\1"
>> ctags: Warning: include/kvm/arm_vgic.h:317: null expansion of name pattern "\1"
>>
>> Cc: kvmarm@lists.cs.columbia.edu
>> Signed-off-by: Michal Marek <mmarek@suse.com>
>> ---
>
> Is not being able to deal with a whitespace not a make tags problem?
Yes, but the regular expressions are hardly readable already :-(.
> As for coding style, do we really entertain these kinds of changes just
> to adhere to a coding style? It feels unnecessary taints the log etc.
I wouldn't have submitted this just for the sake of coding style, it was
the ctags warning prompted me to do so.
> However, I'm curious what the general concesus and previous practice for
> this sort of thing is?
This KVM header was the only instance where whitespace confused the
patterns, so I'd say it's established practice not to do this. The other
ctags warnings were about multi-line macro invocations, where the
line-oriented regular expression rules cannot work.
Michal
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/9] KVM: arm: Do not indent the arguments of DECLARE_BITMAP
2015-10-19 11:55 ` Michal Marek
@ 2015-10-19 12:05 ` Christoffer Dall
2015-10-19 12:07 ` Michal Marek
0 siblings, 1 reply; 20+ messages in thread
From: Christoffer Dall @ 2015-10-19 12:05 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild, linux-kernel, kvmarm
On Mon, Oct 19, 2015 at 01:55:24PM +0200, Michal Marek wrote:
> On 2015-10-18 22:34, Christoffer Dall wrote:
> > On Thu, Oct 15, 2015 at 10:16:28PM +0200, Michal Marek wrote:
> >> Besides being a coding style issue, it confuses make tags:
> >>
> >> ctags: Warning: include/kvm/arm_vgic.h:307: null expansion of name pattern "\1"
> >> ctags: Warning: include/kvm/arm_vgic.h:308: null expansion of name pattern "\1"
> >> ctags: Warning: include/kvm/arm_vgic.h:309: null expansion of name pattern "\1"
> >> ctags: Warning: include/kvm/arm_vgic.h:317: null expansion of name pattern "\1"
> >>
> >> Cc: kvmarm@lists.cs.columbia.edu
> >> Signed-off-by: Michal Marek <mmarek@suse.com>
> >> ---
> >
> > Is not being able to deal with a whitespace not a make tags problem?
>
> Yes, but the regular expressions are hardly readable already :-(.
>
>
> > As for coding style, do we really entertain these kinds of changes just
> > to adhere to a coding style? It feels unnecessary taints the log etc.
>
> I wouldn't have submitted this just for the sake of coding style, it was
> the ctags warning prompted me to do so.
>
>
> > However, I'm curious what the general concesus and previous practice for
> > this sort of thing is?
>
> This KVM header was the only instance where whitespace confused the
> patterns, so I'd say it's established practice not to do this. The other
> ctags warnings were about multi-line macro invocations, where the
> line-oriented regular expression rules cannot work.
>
ok, I've taken the patch.
-Christoffer
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/9] aic7xxx: Avoid name collision with <linux/list.h>
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
2015-10-15 20:16 ` [PATCH 1/9] tags: Treat header files as C code Michal Marek
2015-10-15 20:16 ` [PATCH 2/9] KVM: arm: Do not indent the arguments of DECLARE_BITMAP Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-15 20:16 ` [PATCH 4/9] tags: Fix erroneous pattern match in a comment Michal Marek
` (5 subsequent siblings)
8 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, linux-scsi
Rename the local definition of LIST_HEAD to BSD_LIST_HEAD. This fixes a
ctags error if we apply the C rules to header files as well:
ctags: Warning: drivers/scsi/aic7xxx/aic79xx.h:1072: null expansion of name pattern "\3"
ctags: Warning: drivers/scsi/aic7xxx/aic7xxx.h:919: null expansion of name pattern "\3"
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Michal Marek <mmarek@suse.com>
---
drivers/scsi/aic7xxx/aic79xx.h | 4 ++--
drivers/scsi/aic7xxx/aic79xx_osm.h | 5 -----
drivers/scsi/aic7xxx/aic7xxx.h | 2 +-
drivers/scsi/aic7xxx/aic7xxx_osm.h | 5 -----
drivers/scsi/aic7xxx/queue.h | 2 +-
5 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index df2e0e5367d2..d47b527b25dd 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -624,7 +624,7 @@ struct scb {
};
TAILQ_HEAD(scb_tailq, scb);
-LIST_HEAD(scb_list, scb);
+BSD_LIST_HEAD(scb_list, scb);
struct scb_data {
/*
@@ -1069,7 +1069,7 @@ struct ahd_softc {
/*
* SCBs that have been sent to the controller
*/
- LIST_HEAD(, scb) pending_scbs;
+ BSD_LIST_HEAD(, scb) pending_scbs;
/*
* Current register window mode information.
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index c58fa33c6592..728193a42e6e 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -65,11 +65,6 @@
/* Core SCSI definitions */
#define AIC_LIB_PREFIX ahd
-/* Name space conflict with BSD queue macros */
-#ifdef LIST_HEAD
-#undef LIST_HEAD
-#endif
-
#include "cam.h"
#include "queue.h"
#include "scsi_message.h"
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index f695774645c1..4ce4e903a759 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -916,7 +916,7 @@ struct ahc_softc {
/*
* SCBs that have been sent to the controller
*/
- LIST_HEAD(, scb) pending_scbs;
+ BSD_LIST_HEAD(, scb) pending_scbs;
/*
* Counting lock for deferring the release of additional
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h
index bc4cca92ff04..54c702864103 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h
@@ -82,11 +82,6 @@
/* Core SCSI definitions */
#define AIC_LIB_PREFIX ahc
-/* Name space conflict with BSD queue macros */
-#ifdef LIST_HEAD
-#undef LIST_HEAD
-#endif
-
#include "cam.h"
#include "queue.h"
#include "scsi_message.h"
diff --git a/drivers/scsi/aic7xxx/queue.h b/drivers/scsi/aic7xxx/queue.h
index 8adf8003a164..ba602981f193 100644
--- a/drivers/scsi/aic7xxx/queue.h
+++ b/drivers/scsi/aic7xxx/queue.h
@@ -246,7 +246,7 @@ struct { \
/*
* List declarations.
*/
-#define LIST_HEAD(name, type) \
+#define BSD_LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 4/9] tags: Fix erroneous pattern match in a comment
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
` (2 preceding siblings ...)
2015-10-15 20:16 ` [PATCH 3/9] aic7xxx: Avoid name collision with <linux/list.h> Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-15 20:16 ` [PATCH 5/9] tags: Process Kconfig files in a single pass Michal Marek
` (4 subsequent siblings)
8 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel
Apparently, ctags applies the rules before deleting comments:
ctags: Warning: include/linux/completion.h:22: null expansion of name pattern "\2"
Work around this particular case by requiring the group to contain at
least one character. Leave the other patters as they are, until a better
solution is found.
Signed-off-by: Michal Marek <mmarek@suse.com>
---
scripts/tags.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 5b7828756083..996301c3883d 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -204,7 +204,7 @@ exuberant()
--regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \
--regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \
--regex-c='/DEFINE_(RAW_SPINLOCK|RWLOCK|SEQLOCK)\((\w*)/\2/v/' \
- --regex-c='/DECLARE_(RWSEM|COMPLETION)\((\w*)/\2/v/' \
+ --regex-c='/DECLARE_(RWSEM|COMPLETION)\((\w+)/\2/v/' \
--regex-c='/DECLARE_BITMAP\((\w*)/\1/v/' \
--regex-c='/(^|\s)(|L|H)LIST_HEAD\((\w*)/\3/v/' \
--regex-c='/(^|\s)RADIX_TREE\((\w*)/\2/v/' \
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 5/9] tags: Process Kconfig files in a single pass
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
` (3 preceding siblings ...)
2015-10-15 20:16 ` [PATCH 4/9] tags: Fix erroneous pattern match in a comment Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-15 20:16 ` [PATCH 6/9] tags: Do not try to index defconfigs Michal Marek
` (3 subsequent siblings)
8 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel
Signed-off-by: Michal Marek <mmarek@suse.com>
---
scripts/tags.sh | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 996301c3883d..7d496f602c4b 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -219,10 +219,7 @@ exuberant()
all_kconfigs | xargs $1 -a \
--langdef=kconfig --language-force=kconfig \
- --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'
-
- all_kconfigs | xargs $1 -a \
- --langdef=kconfig --language-force=kconfig \
+ --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' \
--regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/'
all_defconfigs | xargs -r $1 -a \
@@ -270,9 +267,7 @@ emacs()
--regex='/[^#]*DEFINE_HASHTABLE(\([^,)]*\)/\1/'
all_kconfigs | xargs $1 -a \
- --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
-
- all_kconfigs | xargs $1 -a \
+ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' \
--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
all_defconfigs | xargs -r $1 -a \
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 6/9] tags: Do not try to index defconfigs
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
` (4 preceding siblings ...)
2015-10-15 20:16 ` [PATCH 5/9] tags: Process Kconfig files in a single pass Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-15 20:16 ` [PATCH 7/9] tags: Drop the _PE rule Michal Marek
` (2 subsequent siblings)
8 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel
The defconfig files are in predictable locations, so there is no need to
index them. Plus, the script was only looking for files named
'defconfig', which only works on a few architectures nowadays.
Signed-off-by: Michal Marek <mmarek@suse.com>
---
scripts/tags.sh | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 7d496f602c4b..8a03c335d107 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -134,11 +134,6 @@ all_kconfigs()
find_other_sources 'Kconfig*'
}
-all_defconfigs()
-{
- find_sources $ALLSOURCE_ARCHS "defconfig"
-}
-
docscope()
{
(echo \-k; echo \-q; all_target_sources) > cscope.files
@@ -221,10 +216,6 @@ exuberant()
--langdef=kconfig --language-force=kconfig \
--regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' \
--regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/'
-
- all_defconfigs | xargs -r $1 -a \
- --langdef=dotconfig --language-force=dotconfig \
- --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
}
emacs()
@@ -269,9 +260,6 @@ emacs()
all_kconfigs | xargs $1 -a \
--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' \
--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
-
- all_defconfigs | xargs -r $1 -a \
- --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
}
xtags()
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 7/9] tags: Drop the _PE rule
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
` (5 preceding siblings ...)
2015-10-15 20:16 ` [PATCH 6/9] tags: Do not try to index defconfigs Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-15 20:16 ` [PATCH 8/9] tags: Unify emacs and exuberant rules Michal Marek
2015-10-15 20:16 ` [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros Michal Marek
8 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel
We are not indexing the userspace tools, so the rules only match some
false positives in the kernel code.
Signed-off-by: Michal Marek <mmarek@suse.com>
---
scripts/tags.sh | 2 --
1 file changed, 2 deletions(-)
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 8a03c335d107..06246b64c0a1 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -189,7 +189,6 @@ exuberant()
--regex-c='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
--regex-c='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
--regex-c='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
- --regex-c='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \
--regex-c='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
--regex-c='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
--regex-c='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\
@@ -252,7 +251,6 @@ emacs()
--regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
--regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
--regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \
- --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \
--regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
--regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\
--regex='/[^#]*DEFINE_HASHTABLE(\([^,)]*\)/\1/'
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 8/9] tags: Unify emacs and exuberant rules
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
` (6 preceding siblings ...)
2015-10-15 20:16 ` [PATCH 7/9] tags: Drop the _PE rule Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-15 20:16 ` [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros Michal Marek
8 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel
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
<linux/page-flags.h> 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 <mmarek@suse.com>
---
scripts/tags.sh | 200 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 108 insertions(+), 92 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 06246b64c0a1..4979ab645e5e
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Generate tags or cscope files
# Usage tags.sh <mode>
#
@@ -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/'
+ '/\<TESTCLEARFLAG(\([[:alnum:]_]*\).*/TestClearPage\1/'
+ '/\<__TESTCLEARFLAG(\([[:alnum:]_]*\).*/TestClearPage\1/'
+ '/\<CLEARPAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/'
+ '/\<__CLEARPAGEFLAG(\([[:alnum:]_]*\).*/__ClearPage\1/'
+ '/^__PAGEFLAG(\([[:alnum:]_]*\).*/__SetPage\1/'
+ '/^__PAGEFLAG(\([[:alnum:]_]*\).*/__ClearPage\1/'
+ '/^PAGEFLAG_FALSE(\([[:alnum:]_]*\).*/Page\1/'
+ '/\<TESTSCFLAG(\([[:alnum:]_]*\).*/TestSetPage\1/'
+ '/\<TESTSCFLAG(\([[:alnum:]_]*\).*/TestClearPage\1/'
+ '/\<SETPAGEFLAG_NOOP(\([[:alnum:]_]*\).*/SetPage\1/'
+ '/\<CLEARPAGEFLAG_NOOP(\([[:alnum:]_]*\).*/ClearPage\1/'
+ '/\<__CLEARPAGEFLAG_NOOP(\([[:alnum:]_]*\).*/__ClearPage\1/'
+ '/\<TESTCLEARFLAG_FALSE(\([[:alnum:]_]*\).*/TestClearPage\1/'
+ '/\<__TESTCLEARFLAG_FALSE(\([[:alnum:]_]*\).*/__TestClearPage\1/'
+ '/^TASK_PFA_TEST([^,]*, *\([[:alnum:]_]*\))/task_\1/'
+ '/^TASK_PFA_SET([^,]*, *\([[:alnum:]_]*\))/task_set_\1/'
+ '/^TASK_PFA_CLEAR([^,]*, *\([[:alnum:]_]*\))/task_clear_\1/'
+ '/^DEF_MMIO_\(IN\|OUT\)_[XD](\([[:alnum:]_]*\),[^)]*)/\2/'
+ '/^DEBUGGER_BOILERPLATE(\([[:alnum:]_]*\))/\1/'
+ '/^PCI_OP_READ(\(\w*\).*[1-4])/pci_bus_read_config_\1/'
+ '/^PCI_OP_WRITE(\(\w*\).*[1-4])/pci_bus_write_config_\1/'
+ '/\<DEFINE_\(MUTEX\|SEMAPHORE\|SPINLOCK\)(\([[:alnum:]_]*\)/\2/v/'
+ '/\<DEFINE_\(RAW_SPINLOCK\|RWLOCK\|SEQLOCK\)(\([[:alnum:]_]*\)/\2/v/'
+ '/\<DECLARE_\(RWSEM\|COMPLETION\)(\([[:alnum:]_]\+\)/\2/v/'
+ '/\<DECLARE_BITMAP(\([[:alnum:]_]*\)/\1/v/'
+ '/\(^\|\s\)\(\|L\|H\)LIST_HEAD(\([[:alnum:]_]*\)/\3/v/'
+ '/\(^\|\s\)RADIX_TREE(\([[:alnum:]_]*\)/\2/v/'
+ '/\<DEFINE_PER_CPU([^,]*, *\([[:alnum:]_]*\)/\1/v/'
+ '/\<DEFINE_PER_CPU_SHARED_ALIGNED([^,]*, *\([[:alnum:]_]*\)/\1/v/'
+ '/\<DECLARE_WAIT_QUEUE_HEAD(\([[:alnum:]_]*\)/\1/v/'
+ '/\<DECLARE_\(TASKLET\|WORK\|DELAYED_WORK\)(\([[:alnum:]_]*\)/\2/v/'
+ '/\<DEFINE_PCI_DEVICE_TABLE(\([[:alnum:]_]*\)/\1/v/'
+ '/\(^\s\)OFFSET(\([[:alnum:]_]*\)/\2/v/'
+ '/\(^\s\)DEFINE(\([[:alnum:]_]*\)/\2/v/'
+ '/\<DEFINE_HASHTABLE(\([[:alnum:]_]*\)/\1/v/'
+)
+regex_kconfig=(
+ '/^[[:blank:]]*\(menu\|\)config[[:blank:]]\+\([[:alnum:]_]\+\)/\2/'
+ '/^[[:blank:]]*\(menu\|\)config[[:blank:]]\+\([[:alnum:]_]\+\)/CONFIG_\2/'
+)
+setup_regex()
+{
+ local mode=$1 lang tmp=() r
+ shift
+
+ regex=()
+ for lang; do
+ case "$lang" in
+ asm) tmp=("${regex_asm[@]}") ;;
+ c) tmp=("${regex_c[@]}") ;;
+ kconfig) tmp=("${regex_kconfig[@]}") ;;
+ esac
+ for r in "${tmp[@]}"; do
+ if test "$mode" = "exuberant"; then
+ regex[${#regex[@]}]="--regex-$lang=${r}b"
+ else
+ # Remove ctags /kind-spec/
+ case "$r" in
+ /*/*/?/)
+ r=${r%?/}
+ esac
+ # Prepend ^[^#] unless already anchored
+ case "$r" in
+ /^*) ;;
+ *)
+ r="/^[^#]*${r#/}"
+ esac
+ regex[${#regex[@]}]="--regex=$r"
+ fi
+ done
+ done
+}
+
exuberant()
{
+ setup_regex exuberant asm c
all_target_sources | xargs $1 -a \
-I __initdata,__exitdata,__initconst, \
-I __initdata_memblock \
@@ -160,104 +259,21 @@ exuberant()
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL,ACPI_EXPORT_SYMBOL \
-I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
-I static,const \
- --extra=+f --c-kinds=+px --langmap=c:+.h \
- --regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \
- --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
- --regex-c='/^COMPAT_SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/compat_sys_\1/' \
- --regex-c='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
- --regex-c='/^TRACE_EVENT\(([^,)]*).*/trace_\1_rcuidle/' \
- --regex-c='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \
- --regex-c='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1_rcuidle/' \
- --regex-c='/PAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
- --regex-c='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
- --regex-c='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
- --regex-c='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
- --regex-c='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex-c='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
- --regex-c='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
- --regex-c='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
- --regex-c='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\
- --regex-c='/DEF_MMIO_(IN|OUT)_(X|D)\(([^,]*),\s*[^)]*\)/\3/' \
- --regex-c='/DEBUGGER_BOILERPLATE\(([^,]*)\)/\1/' \
- --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \
- --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \
- --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \
- --regex-c='/DEFINE_(RAW_SPINLOCK|RWLOCK|SEQLOCK)\((\w*)/\2/v/' \
- --regex-c='/DECLARE_(RWSEM|COMPLETION)\((\w+)/\2/v/' \
- --regex-c='/DECLARE_BITMAP\((\w*)/\1/v/' \
- --regex-c='/(^|\s)(|L|H)LIST_HEAD\((\w*)/\3/v/' \
- --regex-c='/(^|\s)RADIX_TREE\((\w*)/\2/v/' \
- --regex-c='/DEFINE_PER_CPU\(([^,]*,\s*)(\w*).*\)/\2/v/' \
- --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \
- --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \
- --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \
- --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' \
- --regex-c='/(^\s)OFFSET\((\w*)/\2/v/' \
- --regex-c='/(^\s)DEFINE\((\w*)/\2/v/' \
- --regex-c='/DEFINE_HASHTABLE\((\w*)/\1/v/'
+ --extra=+f --c-kinds=+px --langmap=c:+.h "${regex[@]}"
+ setup_regex exuberant kconfig
all_kconfigs | xargs $1 -a \
- --langdef=kconfig --language-force=kconfig \
- --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' \
- --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/'
+ --langdef=kconfig --language-force=kconfig "${regex[@]}"
+
}
emacs()
{
- all_target_sources | xargs $1 -a \
- --regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/' \
- --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
- --regex='/^COMPAT_SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/compat_sys_\1/' \
- --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
- --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1_rcuidle/' \
- --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
- --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1_rcuidle/' \
- --regex='/PAGEFLAG(\([^,)]*\).*/Page\1/' \
- --regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \
- --regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/' \
- --regex='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/' \
- --regex='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/' \
- --regex='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/' \
- --regex='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
- --regex='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \
- --regex='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \
- --regex='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
- --regex='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \
- --regex='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/' \
- --regex='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/' \
- --regex='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/' \
- --regex='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/' \
- --regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
- --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \
- --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
- --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
- --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \
- --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
- --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\
- --regex='/[^#]*DEFINE_HASHTABLE(\([^,)]*\)/\1/'
+ setup_regex emacs asm c
+ all_target_sources | xargs $1 -a "${regex[@]}"
- all_kconfigs | xargs $1 -a \
- --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' \
- --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
+ setup_regex emacs kconfig
+ all_kconfigs | xargs $1 -a "${regex[@]}"
}
xtags()
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros
2015-10-15 20:16 [PATCH 0/9] scripts/tags.sh cleanup Michal Marek
` (7 preceding siblings ...)
2015-10-15 20:16 ` [PATCH 8/9] tags: Unify emacs and exuberant rules Michal Marek
@ 2015-10-15 20:16 ` Michal Marek
2015-10-21 19:27 ` Prarit Bhargava
8 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2015-10-15 20:16 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, linux-ia64, xen-devel, linux-acpi, rds-devel,
netdev
Otherwise make tags can't parse them:
ctags: Warning: arch/ia64/kernel/smp.c:60: null expansion of name pattern "\1"
ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name pattern "\1"
ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name pattern "\1"
ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern "\1"
ctags: Warning: kernel/workqueue.c:305: null expansion of name pattern "\1"
ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
Cc: linux-ia64@vger.kernel.org
Cc: xen-devel@lists.xenproject.org
Cc: linux-acpi@vger.kernel.org
Cc: rds-devel@oss.oracle.com
Cc: netdev@vger.kernel.org
Signed-off-by: Michal Marek <mmarek@suse.com>
---
arch/ia64/kernel/smp.c | 3 +--
drivers/acpi/processor_idle.c | 3 +--
drivers/xen/events/events_2l.c | 3 +--
kernel/locking/lockdep.c | 3 +--
kernel/rcu/rcutorture.c | 6 ++----
kernel/workqueue.c | 3 +--
net/ipv4/syncookies.c | 3 +--
net/ipv6/syncookies.c | 3 +--
net/rds/page.c | 3 +--
9 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 7f706d4f84f7..1dcfe29d8a42 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -57,8 +57,7 @@ static struct local_tlb_flush_counts {
unsigned int count;
} __attribute__((__aligned__(32))) local_tlb_flush_counts[NR_CPUS];
-static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned short [NR_CPUS],
- shadow_flush_counts);
+static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned short [NR_CPUS], shadow_flush_counts);
#define IPI_CALL_FUNC 0
#define IPI_CPU_STOP 1
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 175c86bee3a9..16ca18547370 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -61,8 +61,7 @@ module_param(latency_factor, uint, 0644);
static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device);
-static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX],
- acpi_cstate);
+static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX], acpi_cstate);
static int disabled_by_idle_boot_param(void)
{
diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c
index 7dd46312c180..7ffed4c62434 100644
--- a/drivers/xen/events/events_2l.c
+++ b/drivers/xen/events/events_2l.c
@@ -38,8 +38,7 @@
/* Find the first set bit in a evtchn mask */
#define EVTCHN_FIRST_BIT(w) find_first_bit(BM(&(w)), BITS_PER_EVTCHN_WORD)
-static DEFINE_PER_CPU(xen_ulong_t [EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD],
- cpu_evtchn_mask);
+static DEFINE_PER_CPU(xen_ulong_t [EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD], cpu_evtchn_mask);
static unsigned evtchn_2l_max_channels(void)
{
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 8acfbf773e06..3b44d89faa48 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -150,8 +150,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock)
}
#ifdef CONFIG_LOCK_STAT
-static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS],
- cpu_lock_stats);
+static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], cpu_lock_stats);
static inline u64 lockstat_clock(void)
{
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 77192953dee5..588bc3374602 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -130,10 +130,8 @@ static struct rcu_torture __rcu *rcu_torture_current;
static unsigned long rcu_torture_current_version;
static struct rcu_torture rcu_tortures[10 * RCU_TORTURE_PIPE_LEN];
static DEFINE_SPINLOCK(rcu_torture_lock);
-static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1],
- rcu_torture_count) = { 0 };
-static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1],
- rcu_torture_batch) = { 0 };
+static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_count) = { 0 };
+static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_batch) = { 0 };
static atomic_t rcu_torture_wcount[RCU_TORTURE_PIPE_LEN + 1];
static atomic_t n_rcu_torture_alloc;
static atomic_t n_rcu_torture_alloc_fail;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca71582fcfab..b800c945e10b 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -302,8 +302,7 @@ static bool workqueue_freezing; /* PL: have wqs started freezing? */
static cpumask_var_t wq_unbound_cpumask; /* PL: low level cpumask for all unbound wqs */
/* the per-cpu worker pools */
-static DEFINE_PER_CPU_SHARED_ALIGNED(struct worker_pool [NR_STD_WORKER_POOLS],
- cpu_worker_pools);
+static DEFINE_PER_CPU_SHARED_ALIGNED(struct worker_pool [NR_STD_WORKER_POOLS], cpu_worker_pools);
static DEFINE_IDR(worker_pool_idr); /* PR: idr of all pools */
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index d70b1f603692..07a5fb157798 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -50,8 +50,7 @@ static u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS] __read_mostly;
#define TSBITS 6
#define TSMASK (((__u32)1 << TSBITS) - 1)
-static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS],
- ipv4_cookie_scratch);
+static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS], ipv4_cookie_scratch);
static u32 cookie_hash(__be32 saddr, __be32 daddr, __be16 sport, __be16 dport,
u32 count, int c)
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 0909f4e0d53c..5e3ee6a64127 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -41,8 +41,7 @@ static __u16 const msstab[] = {
9000 - 60,
};
-static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS],
- ipv6_cookie_scratch);
+static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS], ipv6_cookie_scratch);
static u32 cookie_hash(const struct in6_addr *saddr, const struct in6_addr *daddr,
__be16 sport, __be16 dport, u32 count, int c)
diff --git a/net/rds/page.c b/net/rds/page.c
index 9005a2c920ee..6bfb9a59ea55 100644
--- a/net/rds/page.c
+++ b/net/rds/page.c
@@ -42,8 +42,7 @@ struct rds_page_remainder {
unsigned long r_offset;
};
-static DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_page_remainder,
- rds_page_remainders);
+static DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_page_remainder, rds_page_remainders);
/*
* returns 0 on success or -errno on failure.
--
2.1.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros
2015-10-15 20:16 ` [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros Michal Marek
@ 2015-10-21 19:27 ` Prarit Bhargava
2015-10-21 19:52 ` Michal Marek
0 siblings, 1 reply; 20+ messages in thread
From: Prarit Bhargava @ 2015-10-21 19:27 UTC (permalink / raw)
To: Michal Marek, linux-kbuild
Cc: linux-kernel, linux-ia64, xen-devel, linux-acpi, rds-devel,
netdev
On 10/15/2015 04:16 PM, Michal Marek wrote:
> Otherwise make tags can't parse them:
>
> ctags: Warning: arch/ia64/kernel/smp.c:60: null expansion of name pattern "\1"
> ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name pattern "\1"
> ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name pattern "\1"
> ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern "\1"
> ctags: Warning: kernel/workqueue.c:305: null expansion of name pattern "\1"
> ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
> ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
> ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
> ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
> ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
>
> Cc: linux-ia64@vger.kernel.org
> Cc: xen-devel@lists.xenproject.org
> Cc: linux-acpi@vger.kernel.org
> Cc: rds-devel@oss.oracle.com
> Cc: netdev@vger.kernel.org
> Signed-off-by: Michal Marek <mmarek@suse.com>
> ---
> arch/ia64/kernel/smp.c | 3 +--
> drivers/acpi/processor_idle.c | 3 +--
> drivers/xen/events/events_2l.c | 3 +--
> kernel/locking/lockdep.c | 3 +--
> kernel/rcu/rcutorture.c | 6 ++----
> kernel/workqueue.c | 3 +--
> net/ipv4/syncookies.c | 3 +--
> net/ipv6/syncookies.c | 3 +--
> net/rds/page.c | 3 +--
> 9 files changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
> index 7f706d4f84f7..1dcfe29d8a42 100644
> --- a/arch/ia64/kernel/smp.c
> +++ b/arch/ia64/kernel/smp.c
> @@ -57,8 +57,7 @@ static struct local_tlb_flush_counts {
> unsigned int count;
> } __attribute__((__aligned__(32))) local_tlb_flush_counts[NR_CPUS];
>
> -static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned short [NR_CPUS],
> - shadow_flush_counts);
> +static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned short [NR_CPUS], shadow_flush_counts);
>
I guarantee you're going to end up fixing this issue over and over again as more
code is added in.
OOC, why not fix ctags to recognize newlines?
P.
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros
2015-10-21 19:27 ` Prarit Bhargava
@ 2015-10-21 19:52 ` Michal Marek
2015-10-22 11:31 ` Prarit Bhargava
0 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2015-10-21 19:52 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kbuild, linux-kernel, linux-ia64, xen-devel, linux-acpi,
rds-devel, netdev
Dne 21.10.2015 v 21:27 Prarit Bhargava napsal(a):
> On 10/15/2015 04:16 PM, Michal Marek wrote:
>> Otherwise make tags can't parse them:
>>
>> ctags: Warning: arch/ia64/kernel/smp.c:60: null expansion of name pattern "\1"
>> ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name pattern "\1"
>> ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name pattern "\1"
>> ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern "\1"
>> ctags: Warning: kernel/workqueue.c:305: null expansion of name pattern "\1"
>> ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
>> ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
>> ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
>> ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
>> ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
>
> I guarantee you're going to end up fixing this issue over and over again as more
> code is added in.
This is certainly going to happen, but it should be quickly spotted by
anybody running make tags on linux-next. And 10 instances since the
beginning of git is not too many.
> OOC, why not fix ctags to recognize newlines?
It's not ctags itself parsing the DEFINE_PER_CPU() macro, but a
user-supplied regex specified on commandline. Which can only operate on
single lines.
Michal
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros
2015-10-21 19:52 ` Michal Marek
@ 2015-10-22 11:31 ` Prarit Bhargava
2015-10-22 12:06 ` Michal Marek
0 siblings, 1 reply; 20+ messages in thread
From: Prarit Bhargava @ 2015-10-22 11:31 UTC (permalink / raw)
To: Michal Marek
Cc: linux-kbuild, linux-kernel, linux-ia64, xen-devel, linux-acpi,
rds-devel, netdev
On 10/21/2015 03:52 PM, Michal Marek wrote:
> Dne 21.10.2015 v 21:27 Prarit Bhargava napsal(a):
>> On 10/15/2015 04:16 PM, Michal Marek wrote:
>>> Otherwise make tags can't parse them:
>>>
>>> ctags: Warning: arch/ia64/kernel/smp.c:60: null expansion of name pattern "\1"
>>> ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name pattern "\1"
>>> ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name pattern "\1"
>>> ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern "\1"
>>> ctags: Warning: kernel/workqueue.c:305: null expansion of name pattern "\1"
>>> ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
>>> ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
>>> ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
>>> ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
>>> ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
>>
>> I guarantee you're going to end up fixing this issue over and over again as more
>> code is added in.
>
> This is certainly going to happen, but it should be quickly spotted by
> anybody running make tags on linux-next. And 10 instances since the
> beginning of git is not too many.
Not everyone uses 'make tags'. 'make cscope' exists and functions correctly ;)
>
>
>> OOC, why not fix ctags to recognize newlines?
>
> It's not ctags itself parsing the DEFINE_PER_CPU() macro, but a
> user-supplied regex specified on commandline. Which can only operate on
> single lines.
>
What's the regex?
P.
> Michal
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros
2015-10-22 11:31 ` Prarit Bhargava
@ 2015-10-22 12:06 ` Michal Marek
2015-10-22 12:14 ` Prarit Bhargava
0 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2015-10-22 12:06 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kbuild, linux-kernel, linux-ia64, xen-devel, linux-acpi,
rds-devel, netdev
On 2015-10-22 13:31, Prarit Bhargava wrote:
>
>
> On 10/21/2015 03:52 PM, Michal Marek wrote:
>> Dne 21.10.2015 v 21:27 Prarit Bhargava napsal(a):
>>> On 10/15/2015 04:16 PM, Michal Marek wrote:
>>>> Otherwise make tags can't parse them:
>>>>
>>>> ctags: Warning: arch/ia64/kernel/smp.c:60: null expansion of name pattern "\1"
>>>> ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name pattern "\1"
>>>> ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name pattern "\1"
>>>> ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern "\1"
>>>> ctags: Warning: kernel/workqueue.c:305: null expansion of name pattern "\1"
>>>> ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
>>>> ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
>>>> ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
>>>> ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
>>>> ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
>>>
>>> I guarantee you're going to end up fixing this issue over and over again as more
>>> code is added in.
>>
>> This is certainly going to happen, but it should be quickly spotted by
>> anybody running make tags on linux-next. And 10 instances since the
>> beginning of git is not too many.
>
> Not everyone uses 'make tags'. 'make cscope' exists and functions correctly ;)
cscope works, but unfortunately it cannot be extended to understand the
preprocessor constructs. But it does not suffer from the problem at
hand, obviously.
>> It's not ctags itself parsing the DEFINE_PER_CPU() macro, but a
>> user-supplied regex specified on commandline. Which can only operate on
>> single lines.
>>
>
> What's the regex?
See
https://lkml.kernel.org/r/1444940195-28272-9-git-send-email-mmarek@suse.com
It used to require a closing parenthesis, so it would not match the
multiline macro invocations at all. Now it matches them, but ctags
correctly warns that the empty string is probably not what we intended
to match.
Michal
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros
2015-10-22 12:06 ` Michal Marek
@ 2015-10-22 12:14 ` Prarit Bhargava
2015-10-22 12:24 ` Michal Marek
0 siblings, 1 reply; 20+ messages in thread
From: Prarit Bhargava @ 2015-10-22 12:14 UTC (permalink / raw)
To: Michal Marek
Cc: linux-kbuild, linux-kernel, linux-ia64, xen-devel, linux-acpi,
rds-devel, netdev
On 10/22/2015 08:06 AM, Michal Marek wrote:
> On 2015-10-22 13:31, Prarit Bhargava wrote:
>>
>>
>> On 10/21/2015 03:52 PM, Michal Marek wrote:
>>> Dne 21.10.2015 v 21:27 Prarit Bhargava napsal(a):
>>>> On 10/15/2015 04:16 PM, Michal Marek wrote:
>>>>> Otherwise make tags can't parse them:
>>>>>
>>>>> ctags: Warning: arch/ia64/kernel/smp.c:60: null expansion of name pattern "\1"
>>>>> ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name pattern "\1"
>>>>> ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name pattern "\1"
>>>>> ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern "\1"
>>>>> ctags: Warning: kernel/workqueue.c:305: null expansion of name pattern "\1"
>>>>> ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
>>>>> ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
>>>>> ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
>>>>> ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
>>>>> ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
>>>>
>>>> I guarantee you're going to end up fixing this issue over and over again as more
>>>> code is added in.
>>>
>>> This is certainly going to happen, but it should be quickly spotted by
>>> anybody running make tags on linux-next. And 10 instances since the
>>> beginning of git is not too many.
>>
>> Not everyone uses 'make tags'. 'make cscope' exists and functions correctly ;)
>
> cscope works, but unfortunately it cannot be extended to understand the
> preprocessor constructs. But it does not suffer from the problem at
> hand, obviously.
>
>
>>> It's not ctags itself parsing the DEFINE_PER_CPU() macro, but a
>>> user-supplied regex specified on commandline. Which can only operate on
>>> single lines.
>>>
>>
>> What's the regex?
>
> See
> https://lkml.kernel.org/r/1444940195-28272-9-git-send-email-mmarek@suse.com
>
> It used to require a closing parenthesis, so it would not match the
> multiline macro invocations at all. Now it matches them, but ctags
> correctly warns that the empty string is probably not what we intended
> to match.
It seems wrong to change kernel code, not for a bug, but for a userspace search.
P.
>
> Michal
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 9/9] treewide: Remove newlines inside DEFINE_PER_CPU() macros
2015-10-22 12:14 ` Prarit Bhargava
@ 2015-10-22 12:24 ` Michal Marek
0 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2015-10-22 12:24 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kbuild, linux-kernel, linux-ia64, xen-devel, linux-acpi,
rds-devel, netdev
On 2015-10-22 14:14, Prarit Bhargava wrote:
> On 10/22/2015 08:06 AM, Michal Marek wrote:
>> It used to require a closing parenthesis, so it would not match the
>> multiline macro invocations at all. Now it matches them, but ctags
>> correctly warns that the empty string is probably not what we intended
>> to match.
>
> It seems wrong to change kernel code, not for a bug, but for a userspace search.
The bug is that the code cannot be indexed using ctags or etags.
Michal
^ permalink raw reply [flat|nested] 20+ messages in thread