diff options
| author | Paul Eggert | 2012-08-02 00:31:34 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-08-02 00:31:34 -0700 |
| commit | f162bcc31c3d7d168da47ca2f007f58e11a36948 (patch) | |
| tree | eef19d0a840bd99304751fef539ba100134c91b9 | |
| parent | 8922df07b2f370debf70424f778073e1ca32e5e3 (diff) | |
| download | emacs-f162bcc31c3d7d168da47ca2f007f58e11a36948.tar.gz emacs-f162bcc31c3d7d168da47ca2f007f58e11a36948.zip | |
Use C99-style 'extern inline' if available.
* lib-src/profile.c (SYSTIME_INLINE): Define.
* nt/config.nt: Sync with autogen/config.in.
(_GL_INLINE, _GL_EXTERN_INLINE, _GL_INLINE_HEADER_BEGIN)
(_GL_INLINE_HEADER_END): New macros.
* src/buffer.h (BUFFER_INLINE):
* src/category.h (CATEGORY_INLINE):
* src/character.h (CHARACTER_INLINE):
* src/charset.h (CHARSET_INLINE):
* src/composite.h (COMPOSITE_INLINE):
* src/dispextern.h (DISPEXTERN_INLINE):
* src/lisp.h (LISP_INLINE):
* src/systime.h (SYSTIME_INLINE):
New macro, replacing 'static inline' in this header.
* src/buffer.h, src/category.h, src/character.h, src/charset.h:
* src/composite.h, src/dispextern.h, lisp.h, systime.h:
Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
* src/alloc.c (LISP_INLINE):
* src/buffer.c (BUFFER_INLINE):
* src/category.c (CATEGORY_INLINE):
* src/character.c (CHARACTER_INLINE):
* src/charset.c (CHARSET_INLINE):
* src/composite.c (COMPOSITE_INLINE):
* src/dispnew.c (DISPEXTERN_INLINE):
* src/sysdep.c (SYSTIME_INLINE):
Define to EXTERN_INLINE, so that the corresponding functions
are compiled into code.
* src/conf_post.h (INLINE, EXTERN_INLINE, INLINE_HEADER_BEGIN)
(INLINE_HEADER_END): New macros.
* src/lisp.h (PSEUDOVECTOR_FLAG): Now a macro as well as a constant,
since it's used in non-static inline functions now.
| -rw-r--r-- | lib-src/ChangeLog | 5 | ||||
| -rw-r--r-- | lib-src/profile.c | 2 | ||||
| -rw-r--r-- | nt/ChangeLog | 7 | ||||
| -rw-r--r-- | nt/config.nt | 29 | ||||
| -rw-r--r-- | src/ChangeLog | 30 | ||||
| -rw-r--r-- | src/alloc.c | 3 | ||||
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | src/buffer.h | 21 | ||||
| -rw-r--r-- | src/category.c | 3 | ||||
| -rw-r--r-- | src/category.h | 9 | ||||
| -rw-r--r-- | src/character.c | 2 | ||||
| -rw-r--r-- | src/character.h | 11 | ||||
| -rw-r--r-- | src/charset.c | 2 | ||||
| -rw-r--r-- | src/charset.h | 9 | ||||
| -rw-r--r-- | src/composite.c | 3 | ||||
| -rw-r--r-- | src/composite.h | 9 | ||||
| -rw-r--r-- | src/conf_post.h | 5 | ||||
| -rw-r--r-- | src/dispextern.h | 9 | ||||
| -rw-r--r-- | src/dispnew.c | 3 | ||||
| -rw-r--r-- | src/lisp.h | 41 | ||||
| -rw-r--r-- | src/sysdep.c | 3 | ||||
| -rw-r--r-- | src/systime.h | 43 |
22 files changed, 204 insertions, 47 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 1e543346707..955f8cd0330 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-08-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use C99-style 'extern inline' if available. | ||
| 4 | * profile.c (SYSTIME_INLINE): Define. | ||
| 5 | |||
| 1 | 2012-08-02 Glenn Morris <rgm@gnu.org> | 6 | 2012-08-02 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * makefile.w32-in (MS_W32_H): Update for new ms-w32.h location. | 8 | * makefile.w32-in (MS_W32_H): Update for new ms-w32.h location. |
diff --git a/lib-src/profile.c b/lib-src/profile.c index d21f2c28e58..3489e492543 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c | |||
| @@ -30,6 +30,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | */ | 30 | */ |
| 31 | #include <config.h> | 31 | #include <config.h> |
| 32 | 32 | ||
| 33 | #define SYSTIME_INLINE EXTERN_INLINE | ||
| 34 | |||
| 33 | #include <inttypes.h> | 35 | #include <inttypes.h> |
| 34 | #include <stdio.h> | 36 | #include <stdio.h> |
| 35 | 37 | ||
diff --git a/nt/ChangeLog b/nt/ChangeLog index e903b4375db..8b9163c9f78 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-08-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use C99-style 'extern inline' if available. | ||
| 4 | * config.nt: Sync with autogen/config.in. | ||
| 5 | (_GL_INLINE, _GL_EXTERN_INLINE, _GL_INLINE_HEADER_BEGIN) | ||
| 6 | (_GL_INLINE_HEADER_END): New macros. | ||
| 7 | |||
| 1 | 2012-08-02 Glenn Morris <rgm@gnu.org> | 8 | 2012-08-02 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * inc/ms-w32.h: Move here from ../src/s. | 10 | * inc/ms-w32.h: Move here from ../src/s. |
diff --git a/nt/config.nt b/nt/config.nt index 4687630589b..1c05fcb6497 100644 --- a/nt/config.nt +++ b/nt/config.nt | |||
| @@ -1540,6 +1540,35 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 1540 | configuration information. */ | 1540 | configuration information. */ |
| 1541 | #define config_opsysfile <ms-w32.h> | 1541 | #define config_opsysfile <ms-w32.h> |
| 1542 | 1542 | ||
| 1543 | /* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'. | ||
| 1544 | _GL_EXTERN_INLINE is a portable alternative to 'extern inline'. | ||
| 1545 | _GL_INLINE_HEADER_BEGIN contains useful stuff to put | ||
| 1546 | in an include file, before uses of _GL_INLINE. | ||
| 1547 | It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic, | ||
| 1548 | when FOO is an inline function in the header; see | ||
| 1549 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. | ||
| 1550 | _GL_INLINE_HEADER_END contains useful stuff to put | ||
| 1551 | in the same include file, after uses of _GL_INLINE. */ | ||
| 1552 | #if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ | ||
| 1553 | # define _GL_INLINE inline | ||
| 1554 | # define _GL_EXTERN_INLINE extern inline | ||
| 1555 | # if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ | ||
| 1556 | # define _GL_INLINE_HEADER_BEGIN \ | ||
| 1557 | _Pragma ("GCC diagnostic push") \ | ||
| 1558 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") | ||
| 1559 | # define _GL_INLINE_HEADER_END \ | ||
| 1560 | _Pragma ("GCC diagnostic pop") | ||
| 1561 | # endif | ||
| 1562 | #else | ||
| 1563 | # define _GL_INLINE static inline | ||
| 1564 | # define _GL_EXTERN_INLINE static inline | ||
| 1565 | #endif | ||
| 1566 | |||
| 1567 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
| 1568 | # define _GL_INLINE_HEADER_BEGIN | ||
| 1569 | # define _GL_INLINE_HEADER_END | ||
| 1570 | #endif | ||
| 1571 | |||
| 1543 | /* A replacement for va_copy, if needed. */ | 1572 | /* A replacement for va_copy, if needed. */ |
| 1544 | #define gl_va_copy(a,b) ((a) = (b)) | 1573 | #define gl_va_copy(a,b) ((a) = (b)) |
| 1545 | 1574 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index d1f539bcf2d..1cd500b6053 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,33 @@ | |||
| 1 | 2012-08-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use C99-style 'extern inline' if available. | ||
| 4 | * buffer.h (BUFFER_INLINE): | ||
| 5 | * category.h (CATEGORY_INLINE): | ||
| 6 | * character.h (CHARACTER_INLINE): | ||
| 7 | * charset.h (CHARSET_INLINE): | ||
| 8 | * composite.h (COMPOSITE_INLINE): | ||
| 9 | * dispextern.h (DISPEXTERN_INLINE): | ||
| 10 | * lisp.h (LISP_INLINE): | ||
| 11 | * systime.h (SYSTIME_INLINE): | ||
| 12 | New macro, replacing 'static inline' in this header. | ||
| 13 | * buffer.h, category.h, character.h, charset.h, composite.h: | ||
| 14 | * dispextern.h, lisp.h, systime.h: | ||
| 15 | Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. | ||
| 16 | * alloc.c (LISP_INLINE): | ||
| 17 | * buffer.c (BUFFER_INLINE): | ||
| 18 | * category.c (CATEGORY_INLINE): | ||
| 19 | * character.c (CHARACTER_INLINE): | ||
| 20 | * charset.c (CHARSET_INLINE): | ||
| 21 | * composite.c (COMPOSITE_INLINE): | ||
| 22 | * dispnew.c (DISPEXTERN_INLINE): | ||
| 23 | * sysdep.c (SYSTIME_INLINE): | ||
| 24 | Define to EXTERN_INLINE, so that the corresponding functions | ||
| 25 | are compiled into code. | ||
| 26 | * conf_post.h (INLINE, EXTERN_INLINE, INLINE_HEADER_BEGIN) | ||
| 27 | (INLINE_HEADER_END): New macros. | ||
| 28 | * lisp.h (PSEUDOVECTOR_FLAG): Now a macro as well as a constant, | ||
| 29 | since it's used in non-static inline functions now. | ||
| 30 | |||
| 1 | 2012-08-02 Glenn Morris <rgm@gnu.org> | 31 | 2012-08-02 Glenn Morris <rgm@gnu.org> |
| 2 | 32 | ||
| 3 | * s/: Remove empty directory. | 33 | * s/: Remove empty directory. |
diff --git a/src/alloc.c b/src/alloc.c index 2d5149a6772..aef68a1c070 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -19,6 +19,9 @@ You should have received a copy of the GNU General Public License | |||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | |||
| 23 | #define LISP_INLINE EXTERN_INLINE | ||
| 24 | |||
| 22 | #include <stdio.h> | 25 | #include <stdio.h> |
| 23 | #include <limits.h> /* For CHAR_BIT. */ | 26 | #include <limits.h> /* For CHAR_BIT. */ |
| 24 | #include <setjmp.h> | 27 | #include <setjmp.h> |
diff --git a/src/buffer.c b/src/buffer.c index 8b7f524e27a..a8af8a84f7f 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | #define BUFFER_INLINE EXTERN_INLINE | ||
| 23 | |||
| 22 | #include <sys/types.h> | 24 | #include <sys/types.h> |
| 23 | #include <sys/stat.h> | 25 | #include <sys/stat.h> |
| 24 | #include <sys/param.h> | 26 | #include <sys/param.h> |
diff --git a/src/buffer.h b/src/buffer.h index cf571e06b53..b13aab8443e 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -21,6 +21,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | #include <sys/types.h> /* for off_t, time_t */ | 21 | #include <sys/types.h> /* for off_t, time_t */ |
| 22 | #include "systime.h" /* for EMACS_TIME */ | 22 | #include "systime.h" /* for EMACS_TIME */ |
| 23 | 23 | ||
| 24 | INLINE_HEADER_BEGIN | ||
| 25 | #ifndef BUFFER_INLINE | ||
| 26 | # define BUFFER_INLINE INLINE | ||
| 27 | #endif | ||
| 28 | |||
| 24 | /* Accessing the parameters of the current buffer. */ | 29 | /* Accessing the parameters of the current buffer. */ |
| 25 | 30 | ||
| 26 | /* These macros come in pairs, one for the char position | 31 | /* These macros come in pairs, one for the char position |
| @@ -961,7 +966,7 @@ extern Lisp_Object Qfirst_change_hook; | |||
| 961 | the buffer to the next character after fetching this one. Instead, | 966 | the buffer to the next character after fetching this one. Instead, |
| 962 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ | 967 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ |
| 963 | 968 | ||
| 964 | static inline int | 969 | BUFFER_INLINE int |
| 965 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | 970 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) |
| 966 | { | 971 | { |
| 967 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) | 972 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) |
| @@ -973,7 +978,7 @@ FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | |||
| 973 | If POS doesn't point the head of valid multi-byte form, only the byte at | 978 | If POS doesn't point the head of valid multi-byte form, only the byte at |
| 974 | POS is returned. No range checking. */ | 979 | POS is returned. No range checking. */ |
| 975 | 980 | ||
| 976 | static inline int | 981 | BUFFER_INLINE int |
| 977 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | 982 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) |
| 978 | { | 983 | { |
| 979 | unsigned char *p | 984 | unsigned char *p |
| @@ -1090,7 +1095,7 @@ extern int last_per_buffer_idx; | |||
| 1090 | (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) | 1095 | (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) |
| 1091 | 1096 | ||
| 1092 | /* Downcase a character C, or make no change if that cannot be done. */ | 1097 | /* Downcase a character C, or make no change if that cannot be done. */ |
| 1093 | static inline int | 1098 | BUFFER_INLINE int |
| 1094 | downcase (int c) | 1099 | downcase (int c) |
| 1095 | { | 1100 | { |
| 1096 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); | 1101 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); |
| @@ -1099,10 +1104,10 @@ downcase (int c) | |||
| 1099 | } | 1104 | } |
| 1100 | 1105 | ||
| 1101 | /* 1 if C is upper case. */ | 1106 | /* 1 if C is upper case. */ |
| 1102 | static inline int uppercasep (int c) { return downcase (c) != c; } | 1107 | BUFFER_INLINE int uppercasep (int c) { return downcase (c) != c; } |
| 1103 | 1108 | ||
| 1104 | /* Upcase a character C known to be not upper case. */ | 1109 | /* Upcase a character C known to be not upper case. */ |
| 1105 | static inline int | 1110 | BUFFER_INLINE int |
| 1106 | upcase1 (int c) | 1111 | upcase1 (int c) |
| 1107 | { | 1112 | { |
| 1108 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); | 1113 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); |
| @@ -1111,8 +1116,10 @@ upcase1 (int c) | |||
| 1111 | } | 1116 | } |
| 1112 | 1117 | ||
| 1113 | /* 1 if C is lower case. */ | 1118 | /* 1 if C is lower case. */ |
| 1114 | static inline int lowercasep (int c) | 1119 | BUFFER_INLINE int lowercasep (int c) |
| 1115 | { return !uppercasep (c) && upcase1 (c) != c; } | 1120 | { return !uppercasep (c) && upcase1 (c) != c; } |
| 1116 | 1121 | ||
| 1117 | /* Upcase a character C, or make no change if that cannot be done. */ | 1122 | /* Upcase a character C, or make no change if that cannot be done. */ |
| 1118 | static inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } | 1123 | BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } |
| 1124 | |||
| 1125 | INLINE_HEADER_END | ||
diff --git a/src/category.c b/src/category.c index 7d0f72d284d..507f880a0ad 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -29,6 +29,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 29 | table. Read comments in the file category.h to understand them. */ | 29 | table. Read comments in the file category.h to understand them. */ |
| 30 | 30 | ||
| 31 | #include <config.h> | 31 | #include <config.h> |
| 32 | |||
| 33 | #define CATEGORY_INLINE EXTERN_INLINE | ||
| 34 | |||
| 32 | #include <ctype.h> | 35 | #include <ctype.h> |
| 33 | #include <setjmp.h> | 36 | #include <setjmp.h> |
| 34 | #include "lisp.h" | 37 | #include "lisp.h" |
diff --git a/src/category.h b/src/category.h index 580e516afd9..f29034acff1 100644 --- a/src/category.h +++ b/src/category.h | |||
| @@ -53,6 +53,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 53 | The second extra slot is a version number of the category table. | 53 | The second extra slot is a version number of the category table. |
| 54 | But, for the moment, we are not using this slot. */ | 54 | But, for the moment, we are not using this slot. */ |
| 55 | 55 | ||
| 56 | INLINE_HEADER_BEGIN | ||
| 57 | #ifndef CATEGORY_INLINE | ||
| 58 | # define CATEGORY_INLINE INLINE | ||
| 59 | #endif | ||
| 60 | |||
| 56 | #define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E) | 61 | #define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E) |
| 57 | 62 | ||
| 58 | #define CHECK_CATEGORY(x) \ | 63 | #define CHECK_CATEGORY(x) \ |
| @@ -79,7 +84,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 79 | >> ((category) % 8)) & 1) | 84 | >> ((category) % 8)) & 1) |
| 80 | 85 | ||
| 81 | /* Return 1 if category set of CH contains CATEGORY, else return 0. */ | 86 | /* Return 1 if category set of CH contains CATEGORY, else return 0. */ |
| 82 | static inline int | 87 | CATEGORY_INLINE int |
| 83 | CHAR_HAS_CATEGORY (int ch, int category) | 88 | CHAR_HAS_CATEGORY (int ch, int category) |
| 84 | { | 89 | { |
| 85 | Lisp_Object category_set = CATEGORY_SET (ch); | 90 | Lisp_Object category_set = CATEGORY_SET (ch); |
| @@ -108,3 +113,5 @@ CHAR_HAS_CATEGORY (int ch, int category) | |||
| 108 | && word_boundary_p (c1, c2)) | 113 | && word_boundary_p (c1, c2)) |
| 109 | 114 | ||
| 110 | extern int word_boundary_p (int, int); | 115 | extern int word_boundary_p (int, int); |
| 116 | |||
| 117 | INLINE_HEADER_END | ||
diff --git a/src/character.c b/src/character.c index f4c74a93d39..093f63d8ba7 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -29,6 +29,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 29 | #include <config.h> | 29 | #include <config.h> |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #define CHARACTER_INLINE EXTERN_INLINE | ||
| 33 | |||
| 32 | #include <stdio.h> | 34 | #include <stdio.h> |
| 33 | 35 | ||
| 34 | #ifdef emacs | 36 | #ifdef emacs |
diff --git a/src/character.h b/src/character.h index 2cfeff85fee..332dfee373a 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -25,6 +25,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | 25 | ||
| 26 | #include <verify.h> | 26 | #include <verify.h> |
| 27 | 27 | ||
| 28 | INLINE_HEADER_BEGIN | ||
| 29 | #ifndef CHARACTER_INLINE | ||
| 30 | # define CHARACTER_INLINE INLINE | ||
| 31 | #endif | ||
| 32 | |||
| 28 | /* character code 1st byte byte sequence | 33 | /* character code 1st byte byte sequence |
| 29 | -------------- -------- ------------- | 34 | -------------- -------- ------------- |
| 30 | 0-7F 00..7F 0xxxxxxx | 35 | 0-7F 00..7F 0xxxxxxx |
| @@ -570,7 +575,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 570 | 575 | ||
| 571 | #define SANE_TAB_WIDTH(buf) \ | 576 | #define SANE_TAB_WIDTH(buf) \ |
| 572 | sanitize_tab_width (XFASTINT (BVAR (buf, tab_width))) | 577 | sanitize_tab_width (XFASTINT (BVAR (buf, tab_width))) |
| 573 | static inline int | 578 | CHARACTER_INLINE int |
| 574 | sanitize_tab_width (EMACS_INT width) | 579 | sanitize_tab_width (EMACS_INT width) |
| 575 | { | 580 | { |
| 576 | return 0 < width && width <= 1000 ? width : 8; | 581 | return 0 < width && width <= 1000 ? width : 8; |
| @@ -591,7 +596,7 @@ sanitize_tab_width (EMACS_INT width) | |||
| 591 | 596 | ||
| 592 | /* Return a non-outlandish value for a character width. */ | 597 | /* Return a non-outlandish value for a character width. */ |
| 593 | 598 | ||
| 594 | static inline int | 599 | CHARACTER_INLINE int |
| 595 | sanitize_char_width (EMACS_INT width) | 600 | sanitize_char_width (EMACS_INT width) |
| 596 | { | 601 | { |
| 597 | return 0 <= width && width <= 1000 ? width : 1000; | 602 | return 0 <= width && width <= 1000 ? width : 1000; |
| @@ -695,4 +700,6 @@ extern Lisp_Object string_escape_byte8 (Lisp_Object); | |||
| 695 | #define GET_TRANSLATION_TABLE(id) \ | 700 | #define GET_TRANSLATION_TABLE(id) \ |
| 696 | (XCDR(XVECTOR(Vtranslation_table_vector)->contents[(id)])) | 701 | (XCDR(XVECTOR(Vtranslation_table_vector)->contents[(id)])) |
| 697 | 702 | ||
| 703 | INLINE_HEADER_END | ||
| 704 | |||
| 698 | #endif /* EMACS_CHARACTER_H */ | 705 | #endif /* EMACS_CHARACTER_H */ |
diff --git a/src/charset.c b/src/charset.c index ec3c522e3dc..0054854e80e 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -26,6 +26,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | 26 | ||
| 27 | #include <config.h> | 27 | #include <config.h> |
| 28 | 28 | ||
| 29 | #define CHARSET_INLINE EXTERN_INLINE | ||
| 30 | |||
| 29 | #include <stdio.h> | 31 | #include <stdio.h> |
| 30 | #include <unistd.h> | 32 | #include <unistd.h> |
| 31 | #include <ctype.h> | 33 | #include <ctype.h> |
diff --git a/src/charset.h b/src/charset.h index 40dd012b780..4ef8ddc2c33 100644 --- a/src/charset.h +++ b/src/charset.h | |||
| @@ -29,6 +29,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 29 | 29 | ||
| 30 | #include <verify.h> | 30 | #include <verify.h> |
| 31 | 31 | ||
| 32 | INLINE_HEADER_BEGIN | ||
| 33 | #ifndef CHARSET_INLINE | ||
| 34 | # define CHARSET_INLINE INLINE | ||
| 35 | #endif | ||
| 36 | |||
| 32 | /* Index to arguments of Fdefine_charset_internal. */ | 37 | /* Index to arguments of Fdefine_charset_internal. */ |
| 33 | 38 | ||
| 34 | enum define_charset_arg_index | 39 | enum define_charset_arg_index |
| @@ -325,7 +330,7 @@ extern int emacs_mule_charset[256]; | |||
| 325 | #define CHARSET_DEUNIFIER(charset) \ | 330 | #define CHARSET_DEUNIFIER(charset) \ |
| 326 | (CHARSET_ATTR_DEUNIFIER (CHARSET_ATTRIBUTES (charset))) | 331 | (CHARSET_ATTR_DEUNIFIER (CHARSET_ATTRIBUTES (charset))) |
| 327 | 332 | ||
| 328 | static inline void | 333 | CHARSET_INLINE void |
| 329 | set_charset_attr (struct charset *charset, enum charset_attr_index idx, | 334 | set_charset_attr (struct charset *charset, enum charset_attr_index idx, |
| 330 | Lisp_Object val) | 335 | Lisp_Object val) |
| 331 | { | 336 | { |
| @@ -541,4 +546,6 @@ extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object), | |||
| 541 | Lisp_Object, Lisp_Object, | 546 | Lisp_Object, Lisp_Object, |
| 542 | struct charset *, unsigned, unsigned); | 547 | struct charset *, unsigned, unsigned); |
| 543 | 548 | ||
| 549 | INLINE_HEADER_END | ||
| 550 | |||
| 544 | #endif /* EMACS_CHARSET_H */ | 551 | #endif /* EMACS_CHARSET_H */ |
diff --git a/src/composite.c b/src/composite.c index f5e9d2f9fdd..269bdc88bfe 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -23,6 +23,9 @@ You should have received a copy of the GNU General Public License | |||
| 23 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 23 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 24 | 24 | ||
| 25 | #include <config.h> | 25 | #include <config.h> |
| 26 | |||
| 27 | #define COMPOSITE_INLINE EXTERN_INLINE | ||
| 28 | |||
| 26 | #include <setjmp.h> | 29 | #include <setjmp.h> |
| 27 | #include "lisp.h" | 30 | #include "lisp.h" |
| 28 | #include "character.h" | 31 | #include "character.h" |
diff --git a/src/composite.h b/src/composite.h index 18edc66b1b0..6a7e0a5e2c7 100644 --- a/src/composite.h +++ b/src/composite.h | |||
| @@ -25,6 +25,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | #ifndef EMACS_COMPOSITE_H | 25 | #ifndef EMACS_COMPOSITE_H |
| 26 | #define EMACS_COMPOSITE_H | 26 | #define EMACS_COMPOSITE_H |
| 27 | 27 | ||
| 28 | INLINE_HEADER_BEGIN | ||
| 29 | #ifndef COMPOSITE_INLINE | ||
| 30 | # define COMPOSITE_INLINE INLINE | ||
| 31 | #endif | ||
| 32 | |||
| 28 | /* Methods to display a sequence of components of a composition. */ | 33 | /* Methods to display a sequence of components of a composition. */ |
| 29 | enum composition_method { | 34 | enum composition_method { |
| 30 | /* Compose relatively without alternate characters. */ | 35 | /* Compose relatively without alternate characters. */ |
| @@ -247,7 +252,7 @@ extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object, | |||
| 247 | #define LGSTRING_GLYPH_LEN(lgs) (ASIZE ((lgs)) - 2) | 252 | #define LGSTRING_GLYPH_LEN(lgs) (ASIZE ((lgs)) - 2) |
| 248 | #define LGSTRING_GLYPH(lgs, idx) AREF ((lgs), (idx) + 2) | 253 | #define LGSTRING_GLYPH(lgs, idx) AREF ((lgs), (idx) + 2) |
| 249 | #define LGSTRING_SET_GLYPH(lgs, idx, val) ASET ((lgs), (idx) + 2, (val)) | 254 | #define LGSTRING_SET_GLYPH(lgs, idx, val) ASET ((lgs), (idx) + 2, (val)) |
| 250 | static inline Lisp_Object * | 255 | COMPOSITE_INLINE Lisp_Object * |
| 251 | lgstring_glyph_addr (Lisp_Object lgs, ptrdiff_t idx) | 256 | lgstring_glyph_addr (Lisp_Object lgs, ptrdiff_t idx) |
| 252 | { | 257 | { |
| 253 | return aref_addr (lgs, idx + 2); | 258 | return aref_addr (lgs, idx + 2); |
| @@ -321,4 +326,6 @@ extern int composition_update_it (struct composition_it *, | |||
| 321 | 326 | ||
| 322 | extern ptrdiff_t composition_adjust_point (ptrdiff_t, ptrdiff_t); | 327 | extern ptrdiff_t composition_adjust_point (ptrdiff_t, ptrdiff_t); |
| 323 | 328 | ||
| 329 | INLINE_HEADER_END | ||
| 330 | |||
| 324 | #endif /* not EMACS_COMPOSITE_H */ | 331 | #endif /* not EMACS_COMPOSITE_H */ |
diff --git a/src/conf_post.h b/src/conf_post.h index 356c17b4503..e935940e54a 100644 --- a/src/conf_post.h +++ b/src/conf_post.h | |||
| @@ -213,4 +213,9 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ | |||
| 213 | #undef noinline | 213 | #undef noinline |
| 214 | #endif | 214 | #endif |
| 215 | 215 | ||
| 216 | #define INLINE _GL_INLINE | ||
| 217 | #define EXTERN_INLINE _GL_EXTERN_INLINE | ||
| 218 | #define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN | ||
| 219 | #define INLINE_HEADER_END _GL_INLINE_HEADER_END | ||
| 220 | |||
| 216 | /* conf_post.h ends here */ | 221 | /* conf_post.h ends here */ |
diff --git a/src/dispextern.h b/src/dispextern.h index add228e0088..47a3f971f25 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -46,8 +46,13 @@ typedef struct { | |||
| 46 | #include "msdos.h" | 46 | #include "msdos.h" |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | INLINE_HEADER_BEGIN | ||
| 50 | #ifndef DISPEXTERN_INLINE | ||
| 51 | # define DISPEXTERN_INLINE INLINE | ||
| 52 | #endif | ||
| 53 | |||
| 49 | #include <c-strcase.h> | 54 | #include <c-strcase.h> |
| 50 | static inline int | 55 | DISPEXTERN_INLINE int |
| 51 | xstrcasecmp (char const *a, char const *b) | 56 | xstrcasecmp (char const *a, char const *b) |
| 52 | { | 57 | { |
| 53 | return c_strcasecmp (a, b); | 58 | return c_strcasecmp (a, b); |
| @@ -3400,4 +3405,6 @@ extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object, | |||
| 3400 | 3405 | ||
| 3401 | #endif /* HAVE_WINDOW_SYSTEM */ | 3406 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3402 | 3407 | ||
| 3408 | INLINE_HEADER_END | ||
| 3409 | |||
| 3403 | #endif /* not DISPEXTERN_H_INCLUDED */ | 3410 | #endif /* not DISPEXTERN_H_INCLUDED */ |
diff --git a/src/dispnew.c b/src/dispnew.c index f6b5e426071..9246c35d9c6 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License | |||
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | |||
| 22 | #define DISPEXTERN_INLINE EXTERN_INLINE | ||
| 23 | |||
| 21 | #include <signal.h> | 24 | #include <signal.h> |
| 22 | #include <stdio.h> | 25 | #include <stdio.h> |
| 23 | #include <ctype.h> | 26 | #include <ctype.h> |
diff --git a/src/lisp.h b/src/lisp.h index dfddb09f2e9..1661ac1caa0 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -28,6 +28,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | 28 | ||
| 29 | #include <intprops.h> | 29 | #include <intprops.h> |
| 30 | 30 | ||
| 31 | INLINE_HEADER_BEGIN | ||
| 32 | #ifndef LISP_INLINE | ||
| 33 | # define LISP_INLINE INLINE | ||
| 34 | #endif | ||
| 35 | |||
| 31 | /* The ubiquitous max and min macros. */ | 36 | /* The ubiquitous max and min macros. */ |
| 32 | #undef min | 37 | #undef min |
| 33 | #undef max | 38 | #undef max |
| @@ -295,14 +300,14 @@ enum Lisp_Fwd_Type | |||
| 295 | typedef struct { EMACS_INT i; } Lisp_Object; | 300 | typedef struct { EMACS_INT i; } Lisp_Object; |
| 296 | 301 | ||
| 297 | #define XLI(o) (o).i | 302 | #define XLI(o) (o).i |
| 298 | static inline Lisp_Object | 303 | LISP_INLINE Lisp_Object |
| 299 | XIL (EMACS_INT i) | 304 | XIL (EMACS_INT i) |
| 300 | { | 305 | { |
| 301 | Lisp_Object o = { i }; | 306 | Lisp_Object o = { i }; |
| 302 | return o; | 307 | return o; |
| 303 | } | 308 | } |
| 304 | 309 | ||
| 305 | static inline Lisp_Object | 310 | LISP_INLINE Lisp_Object |
| 306 | LISP_MAKE_RVALUE (Lisp_Object o) | 311 | LISP_MAKE_RVALUE (Lisp_Object o) |
| 307 | { | 312 | { |
| 308 | return o; | 313 | return o; |
| @@ -330,7 +335,9 @@ static ptrdiff_t const ARRAY_MARK_FLAG = PTRDIFF_MIN; | |||
| 330 | 335 | ||
| 331 | /* In the size word of a struct Lisp_Vector, this bit means it's really | 336 | /* In the size word of a struct Lisp_Vector, this bit means it's really |
| 332 | some other vector-like object. */ | 337 | some other vector-like object. */ |
| 333 | static ptrdiff_t const PSEUDOVECTOR_FLAG = PTRDIFF_MAX - PTRDIFF_MAX / 2; | 338 | static ptrdiff_t const PSEUDOVECTOR_FLAG |
| 339 | #define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) | ||
| 340 | = PSEUDOVECTOR_FLAG; | ||
| 334 | 341 | ||
| 335 | /* In a pseudovector, the size field actually contains a word with one | 342 | /* In a pseudovector, the size field actually contains a word with one |
| 336 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to | 343 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to |
| @@ -480,7 +487,7 @@ static EMACS_INT const MOST_NEGATIVE_FIXNUM = | |||
| 480 | #define FIXNUM_OVERFLOW_P(i) \ | 487 | #define FIXNUM_OVERFLOW_P(i) \ |
| 481 | (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) | 488 | (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) |
| 482 | 489 | ||
| 483 | static inline ptrdiff_t | 490 | LISP_INLINE ptrdiff_t |
| 484 | clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) | 491 | clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) |
| 485 | { | 492 | { |
| 486 | return num < lower ? lower : num <= upper ? num : upper; | 493 | return num < lower ? lower : num <= upper ? num : upper; |
| @@ -2338,37 +2345,37 @@ struct frame; | |||
| 2338 | 2345 | ||
| 2339 | /* Simple access functions. */ | 2346 | /* Simple access functions. */ |
| 2340 | 2347 | ||
| 2341 | static inline Lisp_Object * | 2348 | LISP_INLINE Lisp_Object * |
| 2342 | aref_addr (Lisp_Object array, ptrdiff_t idx) | 2349 | aref_addr (Lisp_Object array, ptrdiff_t idx) |
| 2343 | { | 2350 | { |
| 2344 | return & XVECTOR (array)->contents[idx]; | 2351 | return & XVECTOR (array)->contents[idx]; |
| 2345 | } | 2352 | } |
| 2346 | 2353 | ||
| 2347 | static inline void | 2354 | LISP_INLINE void |
| 2348 | set_hash_key (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2355 | set_hash_key (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) |
| 2349 | { | 2356 | { |
| 2350 | ASET (h->key_and_value, 2 * idx, val); | 2357 | ASET (h->key_and_value, 2 * idx, val); |
| 2351 | } | 2358 | } |
| 2352 | 2359 | ||
| 2353 | static inline void | 2360 | LISP_INLINE void |
| 2354 | set_hash_value (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2361 | set_hash_value (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) |
| 2355 | { | 2362 | { |
| 2356 | ASET (h->key_and_value, 2 * idx + 1, val); | 2363 | ASET (h->key_and_value, 2 * idx + 1, val); |
| 2357 | } | 2364 | } |
| 2358 | 2365 | ||
| 2359 | static inline void | 2366 | LISP_INLINE void |
| 2360 | set_hash_next (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2367 | set_hash_next (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) |
| 2361 | { | 2368 | { |
| 2362 | ASET (h->next, idx, val); | 2369 | ASET (h->next, idx, val); |
| 2363 | } | 2370 | } |
| 2364 | 2371 | ||
| 2365 | static inline void | 2372 | LISP_INLINE void |
| 2366 | set_hash_hash (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2373 | set_hash_hash (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) |
| 2367 | { | 2374 | { |
| 2368 | ASET (h->hash, idx, val); | 2375 | ASET (h->hash, idx, val); |
| 2369 | } | 2376 | } |
| 2370 | 2377 | ||
| 2371 | static inline void | 2378 | LISP_INLINE void |
| 2372 | set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2379 | set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) |
| 2373 | { | 2380 | { |
| 2374 | ASET (h->index, idx, val); | 2381 | ASET (h->index, idx, val); |
| @@ -2692,7 +2699,7 @@ extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t); | |||
| 2692 | 2699 | ||
| 2693 | /* Make unibyte string from C string when the length isn't known. */ | 2700 | /* Make unibyte string from C string when the length isn't known. */ |
| 2694 | 2701 | ||
| 2695 | static inline Lisp_Object | 2702 | LISP_INLINE Lisp_Object |
| 2696 | build_unibyte_string (const char *str) | 2703 | build_unibyte_string (const char *str) |
| 2697 | { | 2704 | { |
| 2698 | return make_unibyte_string (str, strlen (str)); | 2705 | return make_unibyte_string (str, strlen (str)); |
| @@ -2710,7 +2717,7 @@ extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t); | |||
| 2710 | 2717 | ||
| 2711 | /* Make a string allocated in pure space, use STR as string data. */ | 2718 | /* Make a string allocated in pure space, use STR as string data. */ |
| 2712 | 2719 | ||
| 2713 | static inline Lisp_Object | 2720 | LISP_INLINE Lisp_Object |
| 2714 | build_pure_c_string (const char *str) | 2721 | build_pure_c_string (const char *str) |
| 2715 | { | 2722 | { |
| 2716 | return make_pure_c_string (str, strlen (str)); | 2723 | return make_pure_c_string (str, strlen (str)); |
| @@ -2719,7 +2726,7 @@ build_pure_c_string (const char *str) | |||
| 2719 | /* Make a string from the data at STR, treating it as multibyte if the | 2726 | /* Make a string from the data at STR, treating it as multibyte if the |
| 2720 | data warrants. */ | 2727 | data warrants. */ |
| 2721 | 2728 | ||
| 2722 | static inline Lisp_Object | 2729 | LISP_INLINE Lisp_Object |
| 2723 | build_string (const char *str) | 2730 | build_string (const char *str) |
| 2724 | { | 2731 | { |
| 2725 | return make_string (str, strlen (str)); | 2732 | return make_string (str, strlen (str)); |
| @@ -2838,13 +2845,13 @@ extern void init_obarray (void); | |||
| 2838 | extern void init_lread (void); | 2845 | extern void init_lread (void); |
| 2839 | extern void syms_of_lread (void); | 2846 | extern void syms_of_lread (void); |
| 2840 | 2847 | ||
| 2841 | static inline Lisp_Object | 2848 | LISP_INLINE Lisp_Object |
| 2842 | intern (const char *str) | 2849 | intern (const char *str) |
| 2843 | { | 2850 | { |
| 2844 | return intern_1 (str, strlen (str)); | 2851 | return intern_1 (str, strlen (str)); |
| 2845 | } | 2852 | } |
| 2846 | 2853 | ||
| 2847 | static inline Lisp_Object | 2854 | LISP_INLINE Lisp_Object |
| 2848 | intern_c_string (const char *str) | 2855 | intern_c_string (const char *str) |
| 2849 | { | 2856 | { |
| 2850 | return intern_c_string_1 (str, strlen (str)); | 2857 | return intern_c_string_1 (str, strlen (str)); |
| @@ -3493,7 +3500,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3493 | 3500 | ||
| 3494 | /* Check whether it's time for GC, and run it if so. */ | 3501 | /* Check whether it's time for GC, and run it if so. */ |
| 3495 | 3502 | ||
| 3496 | static inline void | 3503 | LISP_INLINE void |
| 3497 | maybe_gc (void) | 3504 | maybe_gc (void) |
| 3498 | { | 3505 | { |
| 3499 | if ((consing_since_gc > gc_cons_threshold | 3506 | if ((consing_since_gc > gc_cons_threshold |
| @@ -3503,4 +3510,6 @@ maybe_gc (void) | |||
| 3503 | Fgarbage_collect (); | 3510 | Fgarbage_collect (); |
| 3504 | } | 3511 | } |
| 3505 | 3512 | ||
| 3513 | INLINE_HEADER_END | ||
| 3514 | |||
| 3506 | #endif /* EMACS_LISP_H */ | 3515 | #endif /* EMACS_LISP_H */ |
diff --git a/src/sysdep.c b/src/sysdep.c index 597228c3de6..4452298d103 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License | |||
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | |||
| 22 | #define SYSTIME_INLINE EXTERN_INLINE | ||
| 23 | |||
| 21 | #include <ctype.h> | 24 | #include <ctype.h> |
| 22 | #include <signal.h> | 25 | #include <signal.h> |
| 23 | #include <stdio.h> | 26 | #include <stdio.h> |
diff --git a/src/systime.h b/src/systime.h index 29886248527..d3bdeb83019 100644 --- a/src/systime.h +++ b/src/systime.h | |||
| @@ -21,6 +21,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #include <timespec.h> | 22 | #include <timespec.h> |
| 23 | 23 | ||
| 24 | INLINE_HEADER_BEGIN | ||
| 25 | #ifndef SYSTIME_INLINE | ||
| 26 | # define SYSTIME_INLINE INLINE | ||
| 27 | #endif | ||
| 28 | |||
| 24 | #ifdef emacs | 29 | #ifdef emacs |
| 25 | # ifdef HAVE_X_WINDOWS | 30 | # ifdef HAVE_X_WINDOWS |
| 26 | # include <X11/X.h> | 31 | # include <X11/X.h> |
| @@ -54,12 +59,12 @@ enum { LOG10_EMACS_TIME_RESOLUTION = 9 }; | |||
| 54 | /* EMACS_SECS (TIME) is the seconds component of TIME. | 59 | /* EMACS_SECS (TIME) is the seconds component of TIME. |
| 55 | EMACS_NSECS (TIME) is the nanoseconds component of TIME. | 60 | EMACS_NSECS (TIME) is the nanoseconds component of TIME. |
| 56 | emacs_secs_addr (PTIME) is the address of *PTIME's seconds component. */ | 61 | emacs_secs_addr (PTIME) is the address of *PTIME's seconds component. */ |
| 57 | static inline time_t EMACS_SECS (EMACS_TIME t) { return t.tv_sec; } | 62 | SYSTIME_INLINE time_t EMACS_SECS (EMACS_TIME t) { return t.tv_sec; } |
| 58 | static inline int EMACS_NSECS (EMACS_TIME t) { return t.tv_nsec; } | 63 | SYSTIME_INLINE int EMACS_NSECS (EMACS_TIME t) { return t.tv_nsec; } |
| 59 | static inline time_t *emacs_secs_addr (EMACS_TIME *t) { return &t->tv_sec; } | 64 | SYSTIME_INLINE time_t *emacs_secs_addr (EMACS_TIME *t) { return &t->tv_sec; } |
| 60 | 65 | ||
| 61 | /* Return an Emacs time with seconds S and nanoseconds NS. */ | 66 | /* Return an Emacs time with seconds S and nanoseconds NS. */ |
| 62 | static inline EMACS_TIME | 67 | SYSTIME_INLINE EMACS_TIME |
| 63 | make_emacs_time (time_t s, int ns) | 68 | make_emacs_time (time_t s, int ns) |
| 64 | { | 69 | { |
| 65 | EMACS_TIME r = { s, ns }; | 70 | EMACS_TIME r = { s, ns }; |
| @@ -67,7 +72,7 @@ make_emacs_time (time_t s, int ns) | |||
| 67 | } | 72 | } |
| 68 | 73 | ||
| 69 | /* Return an invalid Emacs time. */ | 74 | /* Return an invalid Emacs time. */ |
| 70 | static inline EMACS_TIME | 75 | SYSTIME_INLINE EMACS_TIME |
| 71 | invalid_emacs_time (void) | 76 | invalid_emacs_time (void) |
| 72 | { | 77 | { |
| 73 | EMACS_TIME r = { 0, -1 }; | 78 | EMACS_TIME r = { 0, -1 }; |
| @@ -75,7 +80,7 @@ invalid_emacs_time (void) | |||
| 75 | } | 80 | } |
| 76 | 81 | ||
| 77 | /* Return current system time. */ | 82 | /* Return current system time. */ |
| 78 | static inline EMACS_TIME | 83 | SYSTIME_INLINE EMACS_TIME |
| 79 | current_emacs_time (void) | 84 | current_emacs_time (void) |
| 80 | { | 85 | { |
| 81 | EMACS_TIME r; | 86 | EMACS_TIME r; |
| @@ -92,12 +97,12 @@ current_emacs_time (void) | |||
| 92 | be used with their first argument an absolute time since the epoch | 97 | be used with their first argument an absolute time since the epoch |
| 93 | and the second argument a non-negative offset. Do NOT use them for | 98 | and the second argument a non-negative offset. Do NOT use them for |
| 94 | anything else. */ | 99 | anything else. */ |
| 95 | static inline EMACS_TIME | 100 | SYSTIME_INLINE EMACS_TIME |
| 96 | add_emacs_time (EMACS_TIME a, EMACS_TIME b) | 101 | add_emacs_time (EMACS_TIME a, EMACS_TIME b) |
| 97 | { | 102 | { |
| 98 | return timespec_add (a, b); | 103 | return timespec_add (a, b); |
| 99 | } | 104 | } |
| 100 | static inline EMACS_TIME | 105 | SYSTIME_INLINE EMACS_TIME |
| 101 | sub_emacs_time (EMACS_TIME a, EMACS_TIME b) | 106 | sub_emacs_time (EMACS_TIME a, EMACS_TIME b) |
| 102 | { | 107 | { |
| 103 | return timespec_sub (a, b); | 108 | return timespec_sub (a, b); |
| @@ -106,14 +111,14 @@ sub_emacs_time (EMACS_TIME a, EMACS_TIME b) | |||
| 106 | /* Return the sign of the valid time stamp TIME, either -1, 0, or 1. | 111 | /* Return the sign of the valid time stamp TIME, either -1, 0, or 1. |
| 107 | Note: this can only return a negative value if time_t is a signed | 112 | Note: this can only return a negative value if time_t is a signed |
| 108 | data type. */ | 113 | data type. */ |
| 109 | static inline int | 114 | SYSTIME_INLINE int |
| 110 | EMACS_TIME_SIGN (EMACS_TIME t) | 115 | EMACS_TIME_SIGN (EMACS_TIME t) |
| 111 | { | 116 | { |
| 112 | return timespec_sign (t); | 117 | return timespec_sign (t); |
| 113 | } | 118 | } |
| 114 | 119 | ||
| 115 | /* Return 1 if TIME is a valid time stamp. */ | 120 | /* Return 1 if TIME is a valid time stamp. */ |
| 116 | static inline int | 121 | SYSTIME_INLINE int |
| 117 | EMACS_TIME_VALID_P (EMACS_TIME t) | 122 | EMACS_TIME_VALID_P (EMACS_TIME t) |
| 118 | { | 123 | { |
| 119 | return 0 <= t.tv_nsec; | 124 | return 0 <= t.tv_nsec; |
| @@ -123,14 +128,14 @@ EMACS_TIME_VALID_P (EMACS_TIME t) | |||
| 123 | On overflow, return an extremal value; in particular, if time_t is | 128 | On overflow, return an extremal value; in particular, if time_t is |
| 124 | an unsigned data type and D is negative, return zero. Return the | 129 | an unsigned data type and D is negative, return zero. Return the |
| 125 | minimum EMACS_TIME if D is not a number. */ | 130 | minimum EMACS_TIME if D is not a number. */ |
| 126 | static inline EMACS_TIME | 131 | SYSTIME_INLINE EMACS_TIME |
| 127 | EMACS_TIME_FROM_DOUBLE (double d) | 132 | EMACS_TIME_FROM_DOUBLE (double d) |
| 128 | { | 133 | { |
| 129 | return dtotimespec (d); | 134 | return dtotimespec (d); |
| 130 | } | 135 | } |
| 131 | 136 | ||
| 132 | /* Convert the Emacs time T to an approximate double value D. */ | 137 | /* Convert the Emacs time T to an approximate double value D. */ |
| 133 | static inline double | 138 | SYSTIME_INLINE double |
| 134 | EMACS_TIME_TO_DOUBLE (EMACS_TIME t) | 139 | EMACS_TIME_TO_DOUBLE (EMACS_TIME t) |
| 135 | { | 140 | { |
| 136 | return timespectod (t); | 141 | return timespectod (t); |
| @@ -155,35 +160,37 @@ extern EMACS_TIME lisp_time_argument (Lisp_Object); | |||
| 155 | #endif | 160 | #endif |
| 156 | 161 | ||
| 157 | /* Compare times T1 and T2 for equality, inequality etc. */ | 162 | /* Compare times T1 and T2 for equality, inequality etc. */ |
| 158 | static inline int | 163 | SYSTIME_INLINE int |
| 159 | EMACS_TIME_EQ (EMACS_TIME t1, EMACS_TIME t2) | 164 | EMACS_TIME_EQ (EMACS_TIME t1, EMACS_TIME t2) |
| 160 | { | 165 | { |
| 161 | return timespec_cmp (t1, t2) == 0; | 166 | return timespec_cmp (t1, t2) == 0; |
| 162 | } | 167 | } |
| 163 | static inline int | 168 | SYSTIME_INLINE int |
| 164 | EMACS_TIME_NE (EMACS_TIME t1, EMACS_TIME t2) | 169 | EMACS_TIME_NE (EMACS_TIME t1, EMACS_TIME t2) |
| 165 | { | 170 | { |
| 166 | return timespec_cmp (t1, t2) != 0; | 171 | return timespec_cmp (t1, t2) != 0; |
| 167 | } | 172 | } |
| 168 | static inline int | 173 | SYSTIME_INLINE int |
| 169 | EMACS_TIME_GT (EMACS_TIME t1, EMACS_TIME t2) | 174 | EMACS_TIME_GT (EMACS_TIME t1, EMACS_TIME t2) |
| 170 | { | 175 | { |
| 171 | return timespec_cmp (t1, t2) > 0; | 176 | return timespec_cmp (t1, t2) > 0; |
| 172 | } | 177 | } |
| 173 | static inline int | 178 | SYSTIME_INLINE int |
| 174 | EMACS_TIME_GE (EMACS_TIME t1, EMACS_TIME t2) | 179 | EMACS_TIME_GE (EMACS_TIME t1, EMACS_TIME t2) |
| 175 | { | 180 | { |
| 176 | return timespec_cmp (t1, t2) >= 0; | 181 | return timespec_cmp (t1, t2) >= 0; |
| 177 | } | 182 | } |
| 178 | static inline int | 183 | SYSTIME_INLINE int |
| 179 | EMACS_TIME_LT (EMACS_TIME t1, EMACS_TIME t2) | 184 | EMACS_TIME_LT (EMACS_TIME t1, EMACS_TIME t2) |
| 180 | { | 185 | { |
| 181 | return timespec_cmp (t1, t2) < 0; | 186 | return timespec_cmp (t1, t2) < 0; |
| 182 | } | 187 | } |
| 183 | static inline int | 188 | SYSTIME_INLINE int |
| 184 | EMACS_TIME_LE (EMACS_TIME t1, EMACS_TIME t2) | 189 | EMACS_TIME_LE (EMACS_TIME t1, EMACS_TIME t2) |
| 185 | { | 190 | { |
| 186 | return timespec_cmp (t1, t2) <= 0; | 191 | return timespec_cmp (t1, t2) <= 0; |
| 187 | } | 192 | } |
| 188 | 193 | ||
| 194 | INLINE_HEADER_END | ||
| 195 | |||
| 189 | #endif /* EMACS_SYSTIME_H */ | 196 | #endif /* EMACS_SYSTIME_H */ |