emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106307: Fix some portability problem


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106307: Fix some portability problems with 'inline'.
Date: Sun, 06 Nov 2011 13:12:10 -0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106307
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2011-11-06 13:12:10 -0800
message:
  Fix some portability problems with 'inline'.
  
  * dispextern.h (window_box, window_box_height, window_text_bottom_y)
  (window_box_width, window_box_left, window_box_left_offset)
  (window_box_right, window_box_right_offset): Declare extern.
  Otherwise, these inline functions do not conform to C99 and
  are miscompiled by Microsoft compilers.  Reported by Eli Zaretskii in
  <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00084.html>.
  * intervals.c (adjust_intervals_for_insertion)
  (adjust_intervals_for_deletion): Now extern, because otherwise the
  extern inline functions 'offset_intervals' couldn't refer to it.
  (static_offset_intervals): Remove.
  (offset_intervals): Rewrite using the old contents of
  static_offset_intervals.  The old version didn't conform to C99
  because an extern inline function contained a reference to an
  identifier with static linkage.
modified:
  src/ChangeLog
  src/dispextern.h
  src/intervals.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-11-06 19:42:14 +0000
+++ b/src/ChangeLog     2011-11-06 21:12:10 +0000
@@ -1,3 +1,21 @@
+2011-11-06  Paul Eggert  <address@hidden>
+
+       Fix some portability problems with 'inline'.
+       * dispextern.h (window_box, window_box_height, window_text_bottom_y)
+       (window_box_width, window_box_left, window_box_left_offset)
+       (window_box_right, window_box_right_offset): Declare extern.
+       Otherwise, these inline functions do not conform to C99 and
+       are miscompiled by Microsoft compilers.  Reported by Eli Zaretskii in
+       <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00084.html>.
+       * intervals.c (adjust_intervals_for_insertion)
+       (adjust_intervals_for_deletion): Now extern, because otherwise the
+       extern inline functions 'offset_intervals' couldn't refer to it.
+       (static_offset_intervals): Remove.
+       (offset_intervals): Rewrite using the old contents of
+       static_offset_intervals.  The old version didn't conform to C99
+       because an extern inline function contained a reference to an
+       identifier with static linkage.
+
 2011-11-06  Andreas Schwab  <address@hidden>
 
        * keyboard.c (interrupt_signal): Don't call kill-emacs while in

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2011-10-25 16:36:20 +0000
+++ b/src/dispextern.h  2011-11-06 21:12:10 +0000
@@ -3006,14 +3006,14 @@
 void set_vertical_scroll_bar (struct window *);
 #endif
 int try_window (Lisp_Object, struct text_pos, int);
-void window_box (struct window *, int, int *, int *, int *, int *);
-int window_box_height (struct window *);
-int window_text_bottom_y (struct window *);
-int window_box_width (struct window *, int);
-int window_box_left (struct window *, int);
-int window_box_left_offset (struct window *, int);
-int window_box_right (struct window *, int);
-int window_box_right_offset (struct window *, int);
+extern void window_box (struct window *, int, int *, int *, int *, int *);
+extern int window_box_height (struct window *);
+extern int window_text_bottom_y (struct window *);
+extern int window_box_width (struct window *, int);
+extern int window_box_left (struct window *, int);
+extern int window_box_left_offset (struct window *, int);
+extern int window_box_right (struct window *, int);
+extern int window_box_right_offset (struct window *, int);
 int estimate_mode_line_height (struct frame *, enum face_id);
 void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
                             NativeRectangle *, int);

=== modified file 'src/intervals.c'
--- a/src/intervals.c   2011-10-26 01:18:13 +0000
+++ b/src/intervals.c   2011-11-06 21:12:10 +0000
@@ -52,6 +52,11 @@
 
 #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set))
 
+extern INTERVAL adjust_intervals_for_insertion (INTERVAL,
+                                               EMACS_INT, EMACS_INT);
+extern void adjust_intervals_for_deletion (struct buffer *,
+                                          EMACS_INT, EMACS_INT);
+
 static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object);
 static INTERVAL merge_interval_right (INTERVAL);
 static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
@@ -798,7 +803,7 @@
    and check the hungry bits of both.  Then add the length going back up
    to the root.  */
 
-static INTERVAL
+INTERVAL
 adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
                                EMACS_INT length)
 {
@@ -859,7 +864,7 @@
    interval.  Another possibility would be to create a new interval for
    this text, and make it have the merged properties of both ends.  */
 
-static INTERVAL
+INTERVAL
 adjust_intervals_for_insertion (INTERVAL tree,
                                EMACS_INT position, EMACS_INT length)
 {
@@ -1369,7 +1374,7 @@
    text.  The deletion is effected at position START (which is a
    buffer position, i.e. origin 1).  */
 
-static void
+void
 adjust_intervals_for_deletion (struct buffer *buffer,
                               EMACS_INT start, EMACS_INT length)
 {
@@ -1425,9 +1430,8 @@
    compiler that does not allow calling a static function (here,
    adjust_intervals_for_deletion) from a non-static inline function.  */
 
-static inline void
-static_offset_intervals (struct buffer *buffer, EMACS_INT start,
-                        EMACS_INT length)
+inline void
+offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
 {
   if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0)
     return;
@@ -1440,12 +1444,6 @@
       adjust_intervals_for_deletion (buffer, start, -length);
     }
 }
-
-inline void
-offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
-{
-  static_offset_intervals (buffer, start, length);
-}
 
 /* Merge interval I with its lexicographic successor. The resulting
    interval is returned, and has the properties of the original


reply via email to

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