emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114424: Fix syntax.h bug introduced by recent INLIN


From: Paul Eggert
Subject: [Emacs-diffs] trunk r114424: Fix syntax.h bug introduced by recent INLINE change.
Date: Sun, 22 Sep 2013 06:22:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114424
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2013-09-21 23:22:05 -0700
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/regex.c                    regex.c-20091113204419-o5vbwnq5f7feedwu-518
  src/syntax.c                   syntax.c-20091113204419-o5vbwnq5f7feedwu-180
  src/syntax.h                   syntax.h-20091113204419-o5vbwnq5f7feedwu-439
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-09-21 11:48:19 +0000
+++ b/src/ChangeLog     2013-09-22 06:22:05 +0000
@@ -1,3 +1,21 @@
+2013-09-22  Paul Eggert  <address@hidden>
+
+       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.
+
 2013-09-21  Eli Zaretskii  <address@hidden>
 
        * dired.c (directory_files_internal): Use multibyte_chars_in_text,

=== modified file 'src/regex.c'
--- a/src/regex.c       2013-08-28 13:50:55 +0000
+++ b/src/regex.c       2013-09-22 06:22:05 +0000
@@ -131,12 +131,12 @@
 # include "character.h"
 # include "buffer.h"
 
-/* Make syntax table lookup grant data in gl_state.  */
-# define SYNTAX_ENTRY_VIA_PROPERTY
-
 # include "syntax.h"
 # include "category.h"
 
+/* Make syntax table lookup grant data in gl_state.  */
+# define SYNTAX(c) syntax_property (c, 1)
+
 # ifdef malloc
 #  undef malloc
 # endif

=== modified file 'src/syntax.c'
--- a/src/syntax.c      2013-09-20 15:34:36 +0000
+++ b/src/syntax.c      2013-09-22 06:22:05 +0000
@@ -29,13 +29,15 @@
 #include "keymap.h"
 #include "regex.h"
 
-/* Make syntax table lookup grant data in gl_state.  */
-#define SYNTAX_ENTRY_VIA_PROPERTY
-
 #include "syntax.h"
 #include "intervals.h"
 #include "category.h"
 
+/* Make syntax table lookup grant data in gl_state.  */
+#define SYNTAX(c) syntax_property (c, 1)
+#define SYNTAX_ENTRY(c) syntax_property_entry (c, 1)
+#define SYNTAX_WITH_FLAGS(c) syntax_property_with_flags (c, 1)
+
 /* Eight single-bit flags have the following meanings:
   1. This character is the first of a two-character comment-start sequence.
   2. This character is the second of a two-character comment-start sequence.

=== modified file 'src/syntax.h'
--- a/src/syntax.h      2013-09-20 15:34:36 +0000
+++ b/src/syntax.h      2013-09-22 06:22:05 +0000
@@ -83,35 +83,49 @@
 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_property_entry (int c, bool via_property)
+{
+  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);
+}
+INLINE Lisp_Object
 SYNTAX_ENTRY (int c)
 {
-#ifdef SYNTAX_ENTRY_VIA_PROPERTY
-  return (gl_state.use_global
-         ? gl_state.global_code
-         : CHAR_TABLE_REF (gl_state.current_syntax_table, c));
-#else
-  return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c);
-#endif
+  return syntax_property_entry (c, 0);
 }
 
 /* Extract the information from the entry for character C
    in the current syntax table.  */
 
 INLINE int
+syntax_property_with_flags (int c, bool via_property)
+{
+  Lisp_Object ent = syntax_property_entry (c, via_property);
+  return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace;
+}
+INLINE int
 SYNTAX_WITH_FLAGS (int c)
 {
-  Lisp_Object ent = SYNTAX_ENTRY (c);
-  return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace;
+  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);
 }
 
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]