unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help etags parse lisp.j
@ 2016-03-20 17:19 Eli Zaretskii
  2016-03-20 17:34 ` Andreas Schwab
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2016-03-20 17:19 UTC (permalink / raw)
  To: emacs-devel

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;	\



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-03-22 16:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20 17:19 Help etags parse lisp.j Eli Zaretskii
2016-03-20 17:34 ` Andreas Schwab
2016-03-20 17:59   ` Eli Zaretskii
2016-03-20 18:11     ` Help etags parse lisp.h Eli Zaretskii
2016-03-21  7:54     ` Help etags parse lisp.j Paul Eggert
2016-03-21 10:58       ` Andreas Schwab
2016-03-21 16:10         ` Eli Zaretskii
2016-03-22 12:46           ` Stefan Monnier
2016-03-22 16:24             ` Eli Zaretskii
2016-03-21 13:40     ` Stefan Monnier
2016-03-21 16:22       ` Eli Zaretskii
2016-03-21 17:40         ` Paul Eggert
2016-03-21 18:13           ` Eli Zaretskii
2016-03-21 21:28             ` John Wiegley
2016-03-22 12:25             ` Stefan Monnier
2016-03-21 18:10         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).