diff options
| author | Paul Eggert | 2011-11-06 13:12:10 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-11-06 13:12:10 -0800 |
| commit | cb41b32a2325b0bd6e12d62cc82f2bc6dd00047a (patch) | |
| tree | cac980e6ca70924145e6b79705a252c8e4f49a57 /src | |
| parent | b70413668a72cbc36fba7d505131a71a847d602b (diff) | |
| download | emacs-cb41b32a2325b0bd6e12d62cc82f2bc6dd00047a.tar.gz emacs-cb41b32a2325b0bd6e12d62cc82f2bc6dd00047a.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/dispextern.h | 16 | ||||
| -rw-r--r-- | src/intervals.c | 22 |
3 files changed, 36 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a134b5f4871..4074ee4e924 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2011-11-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix some portability problems with 'inline'. | ||
| 4 | * dispextern.h (window_box, window_box_height, window_text_bottom_y) | ||
| 5 | (window_box_width, window_box_left, window_box_left_offset) | ||
| 6 | (window_box_right, window_box_right_offset): Declare extern. | ||
| 7 | Otherwise, these inline functions do not conform to C99 and | ||
| 8 | are miscompiled by Microsoft compilers. Reported by Eli Zaretskii in | ||
| 9 | <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00084.html>. | ||
| 10 | * intervals.c (adjust_intervals_for_insertion) | ||
| 11 | (adjust_intervals_for_deletion): Now extern, because otherwise the | ||
| 12 | extern inline functions 'offset_intervals' couldn't refer to it. | ||
| 13 | (static_offset_intervals): Remove. | ||
| 14 | (offset_intervals): Rewrite using the old contents of | ||
| 15 | static_offset_intervals. The old version didn't conform to C99 | ||
| 16 | because an extern inline function contained a reference to an | ||
| 17 | identifier with static linkage. | ||
| 18 | |||
| 1 | 2011-11-06 Andreas Schwab <schwab@linux-m68k.org> | 19 | 2011-11-06 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 20 | ||
| 3 | * keyboard.c (interrupt_signal): Don't call kill-emacs while in | 21 | * keyboard.c (interrupt_signal): Don't call kill-emacs while in |
diff --git a/src/dispextern.h b/src/dispextern.h index 5c60a5499da..fdc7f2f908d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3006,14 +3006,14 @@ int resize_mini_window (struct window *, int); | |||
| 3006 | void set_vertical_scroll_bar (struct window *); | 3006 | void set_vertical_scroll_bar (struct window *); |
| 3007 | #endif | 3007 | #endif |
| 3008 | int try_window (Lisp_Object, struct text_pos, int); | 3008 | int try_window (Lisp_Object, struct text_pos, int); |
| 3009 | void window_box (struct window *, int, int *, int *, int *, int *); | 3009 | extern void window_box (struct window *, int, int *, int *, int *, int *); |
| 3010 | int window_box_height (struct window *); | 3010 | extern int window_box_height (struct window *); |
| 3011 | int window_text_bottom_y (struct window *); | 3011 | extern int window_text_bottom_y (struct window *); |
| 3012 | int window_box_width (struct window *, int); | 3012 | extern int window_box_width (struct window *, int); |
| 3013 | int window_box_left (struct window *, int); | 3013 | extern int window_box_left (struct window *, int); |
| 3014 | int window_box_left_offset (struct window *, int); | 3014 | extern int window_box_left_offset (struct window *, int); |
| 3015 | int window_box_right (struct window *, int); | 3015 | extern int window_box_right (struct window *, int); |
| 3016 | int window_box_right_offset (struct window *, int); | 3016 | extern int window_box_right_offset (struct window *, int); |
| 3017 | int estimate_mode_line_height (struct frame *, enum face_id); | 3017 | int estimate_mode_line_height (struct frame *, enum face_id); |
| 3018 | void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, | 3018 | void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, |
| 3019 | NativeRectangle *, int); | 3019 | NativeRectangle *, int); |
diff --git a/src/intervals.c b/src/intervals.c index 1f3f8cf793e..be1bdfb9056 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -52,6 +52,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 52 | 52 | ||
| 53 | #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set)) | 53 | #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set)) |
| 54 | 54 | ||
| 55 | extern INTERVAL adjust_intervals_for_insertion (INTERVAL, | ||
| 56 | EMACS_INT, EMACS_INT); | ||
| 57 | extern void adjust_intervals_for_deletion (struct buffer *, | ||
| 58 | EMACS_INT, EMACS_INT); | ||
| 59 | |||
| 55 | static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object); | 60 | static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object); |
| 56 | static INTERVAL merge_interval_right (INTERVAL); | 61 | static INTERVAL merge_interval_right (INTERVAL); |
| 57 | static INTERVAL reproduce_tree (INTERVAL, INTERVAL); | 62 | static INTERVAL reproduce_tree (INTERVAL, INTERVAL); |
| @@ -798,7 +803,7 @@ update_interval (register INTERVAL i, EMACS_INT pos) | |||
| 798 | and check the hungry bits of both. Then add the length going back up | 803 | and check the hungry bits of both. Then add the length going back up |
| 799 | to the root. */ | 804 | to the root. */ |
| 800 | 805 | ||
| 801 | static INTERVAL | 806 | INTERVAL |
| 802 | adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position, | 807 | adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position, |
| 803 | EMACS_INT length) | 808 | EMACS_INT length) |
| 804 | { | 809 | { |
| @@ -859,7 +864,7 @@ adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position, | |||
| 859 | interval. Another possibility would be to create a new interval for | 864 | interval. Another possibility would be to create a new interval for |
| 860 | this text, and make it have the merged properties of both ends. */ | 865 | this text, and make it have the merged properties of both ends. */ |
| 861 | 866 | ||
| 862 | static INTERVAL | 867 | INTERVAL |
| 863 | adjust_intervals_for_insertion (INTERVAL tree, | 868 | adjust_intervals_for_insertion (INTERVAL tree, |
| 864 | EMACS_INT position, EMACS_INT length) | 869 | EMACS_INT position, EMACS_INT length) |
| 865 | { | 870 | { |
| @@ -1369,7 +1374,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | |||
| 1369 | text. The deletion is effected at position START (which is a | 1374 | text. The deletion is effected at position START (which is a |
| 1370 | buffer position, i.e. origin 1). */ | 1375 | buffer position, i.e. origin 1). */ |
| 1371 | 1376 | ||
| 1372 | static void | 1377 | void |
| 1373 | adjust_intervals_for_deletion (struct buffer *buffer, | 1378 | adjust_intervals_for_deletion (struct buffer *buffer, |
| 1374 | EMACS_INT start, EMACS_INT length) | 1379 | EMACS_INT start, EMACS_INT length) |
| 1375 | { | 1380 | { |
| @@ -1425,9 +1430,8 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1425 | compiler that does not allow calling a static function (here, | 1430 | compiler that does not allow calling a static function (here, |
| 1426 | adjust_intervals_for_deletion) from a non-static inline function. */ | 1431 | adjust_intervals_for_deletion) from a non-static inline function. */ |
| 1427 | 1432 | ||
| 1428 | static inline void | 1433 | inline void |
| 1429 | static_offset_intervals (struct buffer *buffer, EMACS_INT start, | 1434 | offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length) |
| 1430 | EMACS_INT length) | ||
| 1431 | { | 1435 | { |
| 1432 | if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) | 1436 | if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) |
| 1433 | return; | 1437 | return; |
| @@ -1440,12 +1444,6 @@ static_offset_intervals (struct buffer *buffer, EMACS_INT start, | |||
| 1440 | adjust_intervals_for_deletion (buffer, start, -length); | 1444 | adjust_intervals_for_deletion (buffer, start, -length); |
| 1441 | } | 1445 | } |
| 1442 | } | 1446 | } |
| 1443 | |||
| 1444 | inline void | ||
| 1445 | offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length) | ||
| 1446 | { | ||
| 1447 | static_offset_intervals (buffer, start, length); | ||
| 1448 | } | ||
| 1449 | 1447 | ||
| 1450 | /* Merge interval I with its lexicographic successor. The resulting | 1448 | /* Merge interval I with its lexicographic successor. The resulting |
| 1451 | interval is returned, and has the properties of the original | 1449 | interval is returned, and has the properties of the original |