From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Help etags parse lisp.j Date: Sun, 20 Mar 2016 19:19:32 +0200 Message-ID: <83fuvl6p97.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1458494407 30503 80.91.229.3 (20 Mar 2016 17:20:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Mar 2016 17:20:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 20 18:20:07 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ahh1K-0002qp-Cd for ged-emacs-devel@m.gmane.org; Sun, 20 Mar 2016 18:20:06 +0100 Original-Received: from localhost ([::1]:53781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahh1J-0000aj-NH for ged-emacs-devel@m.gmane.org; Sun, 20 Mar 2016 13:20:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahh1F-0000YJ-Bv for emacs-devel@gnu.org; Sun, 20 Mar 2016 13:20:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahh1C-0006H2-59 for emacs-devel@gnu.org; Sun, 20 Mar 2016 13:20:01 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahh1C-0006Gy-1V for emacs-devel@gnu.org; Sun, 20 Mar 2016 13:19:58 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1378 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ahh1B-0007yR-CL for emacs-devel@gnu.org; Sun, 20 Mar 2016 13:19:57 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:201948 Archived-At: Today I found that some inline functions defined in lisp.h are not in src/TAGS. For example, lispstpcpy is not there. After some digging, it turned out that lines like the one below confuse etags: extern _Noreturn void emacs_abort (void) NO_INLINE; Specifically, the very next inline function doesn't wind up in TAGS. The problem is that NO_INLINE part after the argument list. These macros expand either to __attribute__((SOMETHING)) or to nothing; etags knows about __attribute__, but it cannot know about the macros we use for that. The problem happens with any attribute we hide behind a macro, not just with NO_INLINE. I could think about several possible solutions, but they are all ugly. One is the patch shown below (if acceptable, it will have to be augmented by a comment explaining the kludge). Another one is to move all the inline functions to a separate header, say inlines.h, and include it in lisp.h near its end. The disadvantage is that it will be harder to understand the code of those inline functions because their context (support declarations and macros) will be elsewhere. Same thing if we just move them to the end of lisp.h. Yet another idea would be to explicitly expand these macros in lisp.h, so, for example, the line above becomes #if __GNUC__ >= 3 extern _Noreturn void emacs_abort (void) __attribute__((noinline)); #else extern _Noreturn void emacs_abort (void); #endif Not too pretty, either. We could also teach etags about the macros we use that expand into __attribute__, but that would be fragile. Running C files through cpp will solve this particular problem, but all the cpp macros will disappear from TAGS, which I think is much worse. Any other ideas? --- src/lisp.h~ 2016-03-20 08:36:00.925638700 +0200 +++ src/lisp.h 2016-03-20 19:10:02.914122700 +0200 @@ -3428,6 +3428,7 @@ /* Defined in fns.c. */ enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST; +enum { dummy1 = 1 }; extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t); extern void sweep_weak_hash_tables (void); EMACS_UINT hash_string (char const *, ptrdiff_t); @@ -3542,6 +3543,7 @@ extern Lisp_Object current_message (void); extern void clear_message (bool, bool); extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); +enum { dummy2 = 1 }; extern void message1 (const char *); extern void message1_nolog (const char *); extern void message3 (Lisp_Object); @@ -3632,6 +3634,7 @@ extern Lisp_Object make_string (const char *, ptrdiff_t); extern Lisp_Object make_formatted_string (char *, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3); +enum { dummy3 = 1 }; extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t); /* Make unibyte string from C string when the length isn't known. */ @@ -3760,6 +3763,7 @@ extern void *r_alloc (void **, size_t) ATTRIBUTE_ALLOC_SIZE ((2)); extern void r_alloc_free (void **); extern void *r_re_alloc (void **, size_t) ATTRIBUTE_ALLOC_SIZE ((2)); +enum { dummy4 = 1 }; extern void r_alloc_reset_variable (void **, void **); extern void r_alloc_inhibit_buffer_relocation (int); #endif @@ -3782,6 +3786,7 @@ /* Defined in print.c. */ extern Lisp_Object Vprin1_to_string_buffer; extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE; +enum { dummy5 = 1 }; extern void temp_output_buffer_setup (const char *); extern int print_level; extern void write_string (const char *); @@ -3805,6 +3810,7 @@ extern ptrdiff_t evxprintf (char **, ptrdiff_t *, char const *, ptrdiff_t, char const *, va_list) ATTRIBUTE_FORMAT_PRINTF (5, 0); +enum { dummy6 = 1 }; /* Defined in lread.c. */ extern Lisp_Object check_obarray (Lisp_Object); @@ -3900,6 +3906,7 @@ extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); extern _Noreturn void verror (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); +enum { dummy7 = 1 }; extern void un_autoload (Lisp_Object); extern Lisp_Object call_debugger (Lisp_Object arg); extern void *near_C_stack_top (void); @@ -4255,6 +4262,7 @@ extern void init_random (void); extern void emacs_backtrace (int); extern _Noreturn void emacs_abort (void) NO_INLINE; +enum { dummy8 = 1 }; extern int emacs_open (const char *, int, int); extern int emacs_pipe (int[2]); extern int emacs_close (int); @@ -4292,6 +4300,7 @@ extern void syms_of_term (void); extern _Noreturn void fatal (const char *msgid, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); +enum { dummy9 = 1 }; /* Defined in terminal.c. */ extern void syms_of_terminal (void); @@ -4400,6 +4409,7 @@ extern char *xstrdup (const char *) ATTRIBUTE_MALLOC; extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC; +enum { dummy10 = 1 }; extern void dupstring (char **, char const *); /* Make DEST a copy of STRING's data. Return a pointer to DEST's terminating @@ -4445,6 +4455,7 @@ enum MAX_ALLOCA { MAX_ALLOCA = 16 * 1024 }; extern void *record_xmalloc (size_t) ATTRIBUTE_ALLOC_SIZE ((1)); +enum { dummy11 = 1 }; #define USE_SAFE_ALLOCA \ ptrdiff_t sa_avail = MAX_ALLOCA; \