diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-09-21 23:22:05 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-09-21 23:22:05 -0700 |
commit | c6cfd9101e70010bcd4ba6831b0d42ebc84728fe (patch) | |
tree | f0ef00d745ba5260d9b369ec1946bdd43e47de53 /src/syntax.h | |
parent | 3a4be55b4d956799201169bb4ba49c0e948eec32 (diff) | |
download | emacs-c6cfd9101e70010bcd4ba6831b0d42ebc84728fe.tar.gz |
Fix syntax.h bug introduced by recent INLINE change.
syntax.h defined an extern inline function SYNTAX_ENTRY that was
conditionally compiled one way in some modules, and a different
way in others. This doesn't work with extern inline functions,
which must have the same definition in all modules, because the
defining code might be shared across modules, depending on the
implementation. Symptoms reported by Martin Rudalics in:
http://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00414.html
* regex.c, syntax.c (SYNTAX_ENTRY_VIA_PROPERTY): Remove.
(SYNTAX, SYNTAX_ENTRY, SYNTAX_WITH_FLAGS): New macros,
overriding the corresponding functions in syntax.h.
* syntax.h (syntax_property_entry, syntax_property_with_flags)
(syntax_property): New inline functions.
(SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX):
Rewrite in terms of these new functions.
Diffstat (limited to 'src/syntax.h')
-rw-r--r-- | src/syntax.h | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/syntax.h b/src/syntax.h index 1350d87162b..73fbb153338 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -83,35 +83,49 @@ struct gl_state_s extern struct gl_state_s gl_state; /* Fetch the information from the entry for character C - in syntax table TABLE, or from globally kept data (gl_state). + in the current buffer's syntax table, + or (if VIA_PROPERTY) from globally kept data (gl_state). Does inheritance. */ INLINE Lisp_Object -SYNTAX_ENTRY (int c) +syntax_property_entry (int c, bool via_property) { -#ifdef SYNTAX_ENTRY_VIA_PROPERTY - return (gl_state.use_global - ? gl_state.global_code - : CHAR_TABLE_REF (gl_state.current_syntax_table, c)); -#else + if (via_property) + return (gl_state.use_global + ? gl_state.global_code + : CHAR_TABLE_REF (gl_state.current_syntax_table, c)); return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c); -#endif +} +INLINE Lisp_Object +SYNTAX_ENTRY (int c) +{ + return syntax_property_entry (c, 0); } /* Extract the information from the entry for character C in the current syntax table. */ INLINE int -SYNTAX_WITH_FLAGS (int c) +syntax_property_with_flags (int c, bool via_property) { - Lisp_Object ent = SYNTAX_ENTRY (c); + Lisp_Object ent = syntax_property_entry (c, via_property); return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace; } +INLINE int +SYNTAX_WITH_FLAGS (int c) +{ + return syntax_property_with_flags (c, 0); +} INLINE enum syntaxcode +syntax_property (int c, bool via_property) +{ + return syntax_property_with_flags (c, via_property) & 0xff; +} +INLINE enum syntaxcode SYNTAX (int c) { - return SYNTAX_WITH_FLAGS (c) & 0xff; + return syntax_property (c, 0); } |