aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.h
diff options
context:
space:
mode:
authorPaul Eggert2013-09-21 23:22:05 -0700
committerPaul Eggert2013-09-21 23:22:05 -0700
commitc6cfd9101e70010bcd4ba6831b0d42ebc84728fe (patch)
treef0ef00d745ba5260d9b369ec1946bdd43e47de53 /src/syntax.h
parent3a4be55b4d956799201169bb4ba49c0e948eec32 (diff)
downloademacs-c6cfd9101e70010bcd4ba6831b0d42ebc84728fe.tar.gz
emacs-c6cfd9101e70010bcd4ba6831b0d42ebc84728fe.zip
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.h36
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
83extern struct gl_state_s gl_state; 83extern struct gl_state_s gl_state;
84 84
85/* Fetch the information from the entry for character C 85/* Fetch the information from the entry for character C
86 in syntax table TABLE, or from globally kept data (gl_state). 86 in the current buffer's syntax table,
87 or (if VIA_PROPERTY) from globally kept data (gl_state).
87 Does inheritance. */ 88 Does inheritance. */
88 89
89INLINE Lisp_Object 90INLINE Lisp_Object
90SYNTAX_ENTRY (int c) 91syntax_property_entry (int c, bool via_property)
91{ 92{
92#ifdef SYNTAX_ENTRY_VIA_PROPERTY 93 if (via_property)
93 return (gl_state.use_global 94 return (gl_state.use_global
94 ? gl_state.global_code 95 ? gl_state.global_code
95 : CHAR_TABLE_REF (gl_state.current_syntax_table, c)); 96 : CHAR_TABLE_REF (gl_state.current_syntax_table, c));
96#else
97 return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c); 97 return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c);
98#endif 98}
99INLINE Lisp_Object
100SYNTAX_ENTRY (int c)
101{
102 return syntax_property_entry (c, 0);
99} 103}
100 104
101/* Extract the information from the entry for character C 105/* Extract the information from the entry for character C
102 in the current syntax table. */ 106 in the current syntax table. */
103 107
104INLINE int 108INLINE int
105SYNTAX_WITH_FLAGS (int c) 109syntax_property_with_flags (int c, bool via_property)
106{ 110{
107 Lisp_Object ent = SYNTAX_ENTRY (c); 111 Lisp_Object ent = syntax_property_entry (c, via_property);
108 return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace; 112 return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace;
109} 113}
114INLINE int
115SYNTAX_WITH_FLAGS (int c)
116{
117 return syntax_property_with_flags (c, 0);
118}
110 119
111INLINE enum syntaxcode 120INLINE enum syntaxcode
121syntax_property (int c, bool via_property)
122{
123 return syntax_property_with_flags (c, via_property) & 0xff;
124}
125INLINE enum syntaxcode
112SYNTAX (int c) 126SYNTAX (int c)
113{ 127{
114 return SYNTAX_WITH_FLAGS (c) & 0xff; 128 return syntax_property (c, 0);
115} 129}
116 130
117 131