diff mbox

[ovs-dev] ctags: include symbols with locking annotations.

Message ID 20170627005550.24136-1-fbl@redhat.com
State Accepted
Headers show

Commit Message

Flavio Leitner June 27, 2017, 12:55 a.m. UTC
OVS uses extensively clang annotations for thread safety
checks. The ctags tool can't parse them, so they are not
included in the tag file.

This patch improves the configure script to generate a list
of identifiers from the header compiler.h to be ignored by
ctags.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
 Makefile.am  | 2 ++
 acinclude.m4 | 8 ++++++++
 configure.ac | 1 +
 3 files changed, 11 insertions(+)

Comments

Aaron Conole June 29, 2017, 9:02 p.m. UTC | #1
Flavio Leitner <fbl@redhat.com> writes:

> OVS uses extensively clang annotations for thread safety
> checks. The ctags tool can't parse them, so they are not
> included in the tag file.
>
> This patch improves the configure script to generate a list
> of identifiers from the header compiler.h to be ignored by
> ctags.
>
> Signed-off-by: Flavio Leitner <fbl@redhat.com>
> ---

LGTM, although I use gnu global, not ctags.

Reviewed-by: Aaron Conole <aconole@redhat.com>
Ben Pfaff July 13, 2017, 5:57 p.m. UTC | #2
On Mon, Jun 26, 2017 at 09:55:50PM -0300, Flavio Leitner wrote:
> OVS uses extensively clang annotations for thread safety
> checks. The ctags tool can't parse them, so they are not
> included in the tag file.
> 
> This patch improves the configure script to generate a list
> of identifiers from the header compiler.h to be ignored by
> ctags.
> 
> Signed-off-by: Flavio Leitner <fbl@redhat.com>

This problem bugged me too but I did not know that it could be solved.
Thank you!  I applied this to master.
diff mbox

Patch

diff --git a/Makefile.am b/Makefile.am
index d810a5e..1c4dc3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,6 +42,8 @@  AM_CPPFLAGS += -DNDEBUG
 AM_CFLAGS += -fomit-frame-pointer
 endif
 
+AM_CTAGSFLAGS = $(OVS_CTAGS_IDENTIFIERS_LIST)
+
 if WIN32
 psep=";"
 else
diff --git a/acinclude.m4 b/acinclude.m4
index 7d7b683..4fc8190 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -952,6 +952,14 @@  AC_DEFUN([OVS_ENABLE_SPARSE],
    AC_CONFIG_COMMANDS_PRE(
      [CC='$(if $(C),env REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')'])])
 
+dnl OVS_CTAGS_IDENTIFIERS
+dnl
+dnl ctags ignores symbols with extras identifiers. This builds a list of
+dnl specially handled identifiers to be ignored.
+AC_DEFUN([OVS_CTAGS_IDENTIFIERS],
+    AC_SUBST([OVS_CTAGS_IDENTIFIERS_LIST],
+           [`echo -n '-I "'; sed -n 's/^#define \(OVS_[A-Z_]\+\)(\.\.\.)$/\1+/p' ${srcdir}/include/openvswitch/compiler.h  | tr \\\n ' ' ; echo -n '"'`] ))
+
 dnl OVS_PTHREAD_SET_NAME
 dnl
 dnl This checks for three known variants of pthreads functions for setting
diff --git a/configure.ac b/configure.ac
index 6404b5f..058c954 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,6 +170,7 @@  OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED])
 OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter], [HAVE_WNO_UNUSED_PARAMETER])
 OVS_ENABLE_WERROR
 OVS_ENABLE_SPARSE
+OVS_CTAGS_IDENTIFIERS
 
 AC_ARG_VAR(KARCH, [Kernel Architecture String])
 AC_SUBST(KARCH)