aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog18
-rw-r--r--src/regex.c6
-rw-r--r--src/syntax.c8
-rw-r--r--src/syntax.h36
4 files changed, 51 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 37e04f03c85..084ae983b6f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12013-09-22 Paul Eggert <eggert@cs.ucla.edu>
2
3 Fix syntax.h bug introduced by recent INLINE change.
4 syntax.h defined an extern inline function SYNTAX_ENTRY that was
5 conditionally compiled one way in some modules, and a different
6 way in others. This doesn't work with extern inline functions,
7 which must have the same definition in all modules, because the
8 defining code might be shared across modules, depending on the
9 implementation. Symptoms reported by Martin Rudalics in:
10 http://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00414.html
11 * regex.c, syntax.c (SYNTAX_ENTRY_VIA_PROPERTY): Remove.
12 (SYNTAX, SYNTAX_ENTRY, SYNTAX_WITH_FLAGS): New macros,
13 overriding the corresponding functions in syntax.h.
14 * syntax.h (syntax_property_entry, syntax_property_with_flags)
15 (syntax_property): New inline functions.
16 (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX):
17 Rewrite in terms of these new functions.
18
12013-09-21 Eli Zaretskii <eliz@gnu.org> 192013-09-21 Eli Zaretskii <eliz@gnu.org>
2 20
3 * dired.c (directory_files_internal): Use multibyte_chars_in_text, 21 * dired.c (directory_files_internal): Use multibyte_chars_in_text,
diff --git a/src/regex.c b/src/regex.c
index 1befececd22..4ab98bbf098 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -131,12 +131,12 @@
131# include "character.h" 131# include "character.h"
132# include "buffer.h" 132# include "buffer.h"
133 133
134/* Make syntax table lookup grant data in gl_state. */
135# define SYNTAX_ENTRY_VIA_PROPERTY
136
137# include "syntax.h" 134# include "syntax.h"
138# include "category.h" 135# include "category.h"
139 136
137/* Make syntax table lookup grant data in gl_state. */
138# define SYNTAX(c) syntax_property (c, 1)
139
140# ifdef malloc 140# ifdef malloc
141# undef malloc 141# undef malloc
142# endif 142# endif
diff --git a/src/syntax.c b/src/syntax.c
index 3785bf45515..e18db029309 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -29,13 +29,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include "keymap.h" 29#include "keymap.h"
30#include "regex.h" 30#include "regex.h"
31 31
32/* Make syntax table lookup grant data in gl_state. */
33#define SYNTAX_ENTRY_VIA_PROPERTY
34
35#include "syntax.h" 32#include "syntax.h"
36#include "intervals.h" 33#include "intervals.h"
37#include "category.h" 34#include "category.h"
38 35
36/* Make syntax table lookup grant data in gl_state. */
37#define SYNTAX(c) syntax_property (c, 1)
38#define SYNTAX_ENTRY(c) syntax_property_entry (c, 1)
39#define SYNTAX_WITH_FLAGS(c) syntax_property_with_flags (c, 1)
40
39/* Eight single-bit flags have the following meanings: 41/* Eight single-bit flags have the following meanings:
40 1. This character is the first of a two-character comment-start sequence. 42 1. This character is the first of a two-character comment-start sequence.
41 2. This character is the second of a two-character comment-start sequence. 43 2. This character is the second of a two-character comment-start sequence.
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