diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-08-02 00:31:34 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-08-02 00:31:34 -0700 |
commit | f162bcc31c3d7d168da47ca2f007f58e11a36948 (patch) | |
tree | eef19d0a840bd99304751fef539ba100134c91b9 | |
parent | 8922df07b2f370debf70424f778073e1ca32e5e3 (diff) | |
download | emacs-f162bcc31c3d7d168da47ca2f007f58e11a36948.tar.gz |
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 @@ +2012-08-02 Paul Eggert <eggert@cs.ucla.edu> + + Use C99-style 'extern inline' if available. + * profile.c (SYSTIME_INLINE): Define. + 2012-08-02 Glenn Morris <rgm@gnu.org> * 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/>. */ */ #include <config.h> +#define SYSTIME_INLINE EXTERN_INLINE + #include <inttypes.h> #include <stdio.h> diff --git a/nt/ChangeLog b/nt/ChangeLog index e903b4375db..8b9163c9f78 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,10 @@ +2012-08-02 Paul Eggert <eggert@cs.ucla.edu> + + Use C99-style 'extern inline' if available. + * config.nt: Sync with autogen/config.in. + (_GL_INLINE, _GL_EXTERN_INLINE, _GL_INLINE_HEADER_BEGIN) + (_GL_INLINE_HEADER_END): New macros. + 2012-08-02 Glenn Morris <rgm@gnu.org> * 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/>. */ configuration information. */ #define config_opsysfile <ms-w32.h> +/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'. + _GL_EXTERN_INLINE is a portable alternative to 'extern inline'. + _GL_INLINE_HEADER_BEGIN contains useful stuff to put + in an include file, before uses of _GL_INLINE. + It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic, + when FOO is an inline function in the header; see + <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. + _GL_INLINE_HEADER_END contains useful stuff to put + in the same include file, after uses of _GL_INLINE. */ +#if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ +# define _GL_INLINE inline +# define _GL_EXTERN_INLINE extern inline +# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +# endif +#else +# define _GL_INLINE static inline +# define _GL_EXTERN_INLINE static inline +#endif + +#ifndef _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_END +#endif + /* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b)) diff --git a/src/ChangeLog b/src/ChangeLog index d1f539bcf2d..1cd500b6053 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,33 @@ +2012-08-02 Paul Eggert <eggert@cs.ucla.edu> + + Use C99-style 'extern inline' if available. + * buffer.h (BUFFER_INLINE): + * category.h (CATEGORY_INLINE): + * character.h (CHARACTER_INLINE): + * charset.h (CHARSET_INLINE): + * composite.h (COMPOSITE_INLINE): + * dispextern.h (DISPEXTERN_INLINE): + * lisp.h (LISP_INLINE): + * systime.h (SYSTIME_INLINE): + New macro, replacing 'static inline' in this header. + * buffer.h, category.h, character.h, charset.h, composite.h: + * dispextern.h, lisp.h, systime.h: + Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + * alloc.c (LISP_INLINE): + * buffer.c (BUFFER_INLINE): + * category.c (CATEGORY_INLINE): + * character.c (CHARACTER_INLINE): + * charset.c (CHARSET_INLINE): + * composite.c (COMPOSITE_INLINE): + * dispnew.c (DISPEXTERN_INLINE): + * sysdep.c (SYSTIME_INLINE): + Define to EXTERN_INLINE, so that the corresponding functions + are compiled into code. + * conf_post.h (INLINE, EXTERN_INLINE, INLINE_HEADER_BEGIN) + (INLINE_HEADER_END): New macros. + * lisp.h (PSEUDOVECTOR_FLAG): Now a macro as well as a constant, + since it's used in non-static inline functions now. + 2012-08-02 Glenn Morris <rgm@gnu.org> * 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 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> + +#define LISP_INLINE EXTERN_INLINE + #include <stdio.h> #include <limits.h> /* For CHAR_BIT. */ #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/>. */ #include <config.h> +#define BUFFER_INLINE EXTERN_INLINE + #include <sys/types.h> #include <sys/stat.h> #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/>. */ #include <sys/types.h> /* for off_t, time_t */ #include "systime.h" /* for EMACS_TIME */ +INLINE_HEADER_BEGIN +#ifndef BUFFER_INLINE +# define BUFFER_INLINE INLINE +#endif + /* Accessing the parameters of the current buffer. */ /* These macros come in pairs, one for the char position @@ -961,7 +966,7 @@ extern Lisp_Object Qfirst_change_hook; the buffer to the next character after fetching this one. Instead, use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ -static inline int +BUFFER_INLINE int FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) { unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) @@ -973,7 +978,7 @@ FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) If POS doesn't point the head of valid multi-byte form, only the byte at POS is returned. No range checking. */ -static inline int +BUFFER_INLINE int BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) { unsigned char *p @@ -1090,7 +1095,7 @@ extern int last_per_buffer_idx; (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) /* Downcase a character C, or make no change if that cannot be done. */ -static inline int +BUFFER_INLINE int downcase (int c) { Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); @@ -1099,10 +1104,10 @@ downcase (int c) } /* 1 if C is upper case. */ -static inline int uppercasep (int c) { return downcase (c) != c; } +BUFFER_INLINE int uppercasep (int c) { return downcase (c) != c; } /* Upcase a character C known to be not upper case. */ -static inline int +BUFFER_INLINE int upcase1 (int c) { Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); @@ -1111,8 +1116,10 @@ upcase1 (int c) } /* 1 if C is lower case. */ -static inline int lowercasep (int c) +BUFFER_INLINE int lowercasep (int c) { return !uppercasep (c) && upcase1 (c) != c; } /* Upcase a character C, or make no change if that cannot be done. */ -static inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } +BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } + +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/>. */ table. Read comments in the file category.h to understand them. */ #include <config.h> + +#define CATEGORY_INLINE EXTERN_INLINE + #include <ctype.h> #include <setjmp.h> #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/>. */ The second extra slot is a version number of the category table. But, for the moment, we are not using this slot. */ +INLINE_HEADER_BEGIN +#ifndef CATEGORY_INLINE +# define CATEGORY_INLINE INLINE +#endif + #define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E) #define CHECK_CATEGORY(x) \ @@ -79,7 +84,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ >> ((category) % 8)) & 1) /* Return 1 if category set of CH contains CATEGORY, else return 0. */ -static inline int +CATEGORY_INLINE int CHAR_HAS_CATEGORY (int ch, int category) { Lisp_Object category_set = CATEGORY_SET (ch); @@ -108,3 +113,5 @@ CHAR_HAS_CATEGORY (int ch, int category) && word_boundary_p (c1, c2)) extern int word_boundary_p (int, int); + +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/>. */ #include <config.h> #endif +#define CHARACTER_INLINE EXTERN_INLINE + #include <stdio.h> #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/>. */ #include <verify.h> +INLINE_HEADER_BEGIN +#ifndef CHARACTER_INLINE +# define CHARACTER_INLINE INLINE +#endif + /* character code 1st byte byte sequence -------------- -------- ------------- 0-7F 00..7F 0xxxxxxx @@ -570,7 +575,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define SANE_TAB_WIDTH(buf) \ sanitize_tab_width (XFASTINT (BVAR (buf, tab_width))) -static inline int +CHARACTER_INLINE int sanitize_tab_width (EMACS_INT width) { return 0 < width && width <= 1000 ? width : 8; @@ -591,7 +596,7 @@ sanitize_tab_width (EMACS_INT width) /* Return a non-outlandish value for a character width. */ -static inline int +CHARACTER_INLINE int sanitize_char_width (EMACS_INT width) { return 0 <= width && width <= 1000 ? width : 1000; @@ -695,4 +700,6 @@ extern Lisp_Object string_escape_byte8 (Lisp_Object); #define GET_TRANSLATION_TABLE(id) \ (XCDR(XVECTOR(Vtranslation_table_vector)->contents[(id)])) +INLINE_HEADER_END + #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/>. */ #include <config.h> +#define CHARSET_INLINE EXTERN_INLINE + #include <stdio.h> #include <unistd.h> #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/>. */ #include <verify.h> +INLINE_HEADER_BEGIN +#ifndef CHARSET_INLINE +# define CHARSET_INLINE INLINE +#endif + /* Index to arguments of Fdefine_charset_internal. */ enum define_charset_arg_index @@ -325,7 +330,7 @@ extern int emacs_mule_charset[256]; #define CHARSET_DEUNIFIER(charset) \ (CHARSET_ATTR_DEUNIFIER (CHARSET_ATTRIBUTES (charset))) -static inline void +CHARSET_INLINE void set_charset_attr (struct charset *charset, enum charset_attr_index idx, Lisp_Object val) { @@ -541,4 +546,6 @@ extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, struct charset *, unsigned, unsigned); +INLINE_HEADER_END + #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 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> + +#define COMPOSITE_INLINE EXTERN_INLINE + #include <setjmp.h> #include "lisp.h" #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/>. */ #ifndef EMACS_COMPOSITE_H #define EMACS_COMPOSITE_H +INLINE_HEADER_BEGIN +#ifndef COMPOSITE_INLINE +# define COMPOSITE_INLINE INLINE +#endif + /* Methods to display a sequence of components of a composition. */ enum composition_method { /* Compose relatively without alternate characters. */ @@ -247,7 +252,7 @@ extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object, #define LGSTRING_GLYPH_LEN(lgs) (ASIZE ((lgs)) - 2) #define LGSTRING_GLYPH(lgs, idx) AREF ((lgs), (idx) + 2) #define LGSTRING_SET_GLYPH(lgs, idx, val) ASET ((lgs), (idx) + 2, (val)) -static inline Lisp_Object * +COMPOSITE_INLINE Lisp_Object * lgstring_glyph_addr (Lisp_Object lgs, ptrdiff_t idx) { return aref_addr (lgs, idx + 2); @@ -321,4 +326,6 @@ extern int composition_update_it (struct composition_it *, extern ptrdiff_t composition_adjust_point (ptrdiff_t, ptrdiff_t); +INLINE_HEADER_END + #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 */ #undef noinline #endif +#define INLINE _GL_INLINE +#define EXTERN_INLINE _GL_EXTERN_INLINE +#define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN +#define INLINE_HEADER_END _GL_INLINE_HEADER_END + /* 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 { #include "msdos.h" #endif +INLINE_HEADER_BEGIN +#ifndef DISPEXTERN_INLINE +# define DISPEXTERN_INLINE INLINE +#endif + #include <c-strcase.h> -static inline int +DISPEXTERN_INLINE int xstrcasecmp (char const *a, char const *b) { return c_strcasecmp (a, b); @@ -3400,4 +3405,6 @@ extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object, #endif /* HAVE_WINDOW_SYSTEM */ +INLINE_HEADER_END + #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 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> + +#define DISPEXTERN_INLINE EXTERN_INLINE + #include <signal.h> #include <stdio.h> #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/>. */ #include <intprops.h> +INLINE_HEADER_BEGIN +#ifndef LISP_INLINE +# define LISP_INLINE INLINE +#endif + /* The ubiquitous max and min macros. */ #undef min #undef max @@ -295,14 +300,14 @@ enum Lisp_Fwd_Type typedef struct { EMACS_INT i; } Lisp_Object; #define XLI(o) (o).i -static inline Lisp_Object +LISP_INLINE Lisp_Object XIL (EMACS_INT i) { Lisp_Object o = { i }; return o; } -static inline Lisp_Object +LISP_INLINE Lisp_Object LISP_MAKE_RVALUE (Lisp_Object o) { return o; @@ -330,7 +335,9 @@ static ptrdiff_t const ARRAY_MARK_FLAG = PTRDIFF_MIN; /* In the size word of a struct Lisp_Vector, this bit means it's really some other vector-like object. */ -static ptrdiff_t const PSEUDOVECTOR_FLAG = PTRDIFF_MAX - PTRDIFF_MAX / 2; +static ptrdiff_t const PSEUDOVECTOR_FLAG +#define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) + = PSEUDOVECTOR_FLAG; /* In a pseudovector, the size field actually contains a word with one PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to @@ -480,7 +487,7 @@ static EMACS_INT const MOST_NEGATIVE_FIXNUM = #define FIXNUM_OVERFLOW_P(i) \ (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) -static inline ptrdiff_t +LISP_INLINE ptrdiff_t clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) { return num < lower ? lower : num <= upper ? num : upper; @@ -2338,37 +2345,37 @@ struct frame; /* Simple access functions. */ -static inline Lisp_Object * +LISP_INLINE Lisp_Object * aref_addr (Lisp_Object array, ptrdiff_t idx) { return & XVECTOR (array)->contents[idx]; } -static inline void +LISP_INLINE void set_hash_key (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) { ASET (h->key_and_value, 2 * idx, val); } -static inline void +LISP_INLINE void set_hash_value (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) { ASET (h->key_and_value, 2 * idx + 1, val); } -static inline void +LISP_INLINE void set_hash_next (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) { ASET (h->next, idx, val); } -static inline void +LISP_INLINE void set_hash_hash (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) { ASET (h->hash, idx, val); } -static inline void +LISP_INLINE void set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) { ASET (h->index, idx, val); @@ -2692,7 +2699,7 @@ extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t); /* Make unibyte string from C string when the length isn't known. */ -static inline Lisp_Object +LISP_INLINE Lisp_Object build_unibyte_string (const char *str) { return make_unibyte_string (str, strlen (str)); @@ -2710,7 +2717,7 @@ extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t); /* Make a string allocated in pure space, use STR as string data. */ -static inline Lisp_Object +LISP_INLINE Lisp_Object build_pure_c_string (const char *str) { return make_pure_c_string (str, strlen (str)); @@ -2719,7 +2726,7 @@ build_pure_c_string (const char *str) /* Make a string from the data at STR, treating it as multibyte if the data warrants. */ -static inline Lisp_Object +LISP_INLINE Lisp_Object build_string (const char *str) { return make_string (str, strlen (str)); @@ -2838,13 +2845,13 @@ extern void init_obarray (void); extern void init_lread (void); extern void syms_of_lread (void); -static inline Lisp_Object +LISP_INLINE Lisp_Object intern (const char *str) { return intern_1 (str, strlen (str)); } -static inline Lisp_Object +LISP_INLINE Lisp_Object intern_c_string (const char *str) { return intern_c_string_1 (str, strlen (str)); @@ -3493,7 +3500,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); /* Check whether it's time for GC, and run it if so. */ -static inline void +LISP_INLINE void maybe_gc (void) { if ((consing_since_gc > gc_cons_threshold @@ -3503,4 +3510,6 @@ maybe_gc (void) Fgarbage_collect (); } +INLINE_HEADER_END + #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 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> + +#define SYSTIME_INLINE EXTERN_INLINE + #include <ctype.h> #include <signal.h> #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/>. */ #include <timespec.h> +INLINE_HEADER_BEGIN +#ifndef SYSTIME_INLINE +# define SYSTIME_INLINE INLINE +#endif + #ifdef emacs # ifdef HAVE_X_WINDOWS # include <X11/X.h> @@ -54,12 +59,12 @@ enum { LOG10_EMACS_TIME_RESOLUTION = 9 }; /* EMACS_SECS (TIME) is the seconds component of TIME. EMACS_NSECS (TIME) is the nanoseconds component of TIME. emacs_secs_addr (PTIME) is the address of *PTIME's seconds component. */ -static inline time_t EMACS_SECS (EMACS_TIME t) { return t.tv_sec; } -static inline int EMACS_NSECS (EMACS_TIME t) { return t.tv_nsec; } -static inline time_t *emacs_secs_addr (EMACS_TIME *t) { return &t->tv_sec; } +SYSTIME_INLINE time_t EMACS_SECS (EMACS_TIME t) { return t.tv_sec; } +SYSTIME_INLINE int EMACS_NSECS (EMACS_TIME t) { return t.tv_nsec; } +SYSTIME_INLINE time_t *emacs_secs_addr (EMACS_TIME *t) { return &t->tv_sec; } /* Return an Emacs time with seconds S and nanoseconds NS. */ -static inline EMACS_TIME +SYSTIME_INLINE EMACS_TIME make_emacs_time (time_t s, int ns) { EMACS_TIME r = { s, ns }; @@ -67,7 +72,7 @@ make_emacs_time (time_t s, int ns) } /* Return an invalid Emacs time. */ -static inline EMACS_TIME +SYSTIME_INLINE EMACS_TIME invalid_emacs_time (void) { EMACS_TIME r = { 0, -1 }; @@ -75,7 +80,7 @@ invalid_emacs_time (void) } /* Return current system time. */ -static inline EMACS_TIME +SYSTIME_INLINE EMACS_TIME current_emacs_time (void) { EMACS_TIME r; @@ -92,12 +97,12 @@ current_emacs_time (void) be used with their first argument an absolute time since the epoch and the second argument a non-negative offset. Do NOT use them for anything else. */ -static inline EMACS_TIME +SYSTIME_INLINE EMACS_TIME add_emacs_time (EMACS_TIME a, EMACS_TIME b) { return timespec_add (a, b); } -static inline EMACS_TIME +SYSTIME_INLINE EMACS_TIME sub_emacs_time (EMACS_TIME a, EMACS_TIME b) { return timespec_sub (a, b); @@ -106,14 +111,14 @@ sub_emacs_time (EMACS_TIME a, EMACS_TIME b) /* Return the sign of the valid time stamp TIME, either -1, 0, or 1. Note: this can only return a negative value if time_t is a signed data type. */ -static inline int +SYSTIME_INLINE int EMACS_TIME_SIGN (EMACS_TIME t) { return timespec_sign (t); } /* Return 1 if TIME is a valid time stamp. */ -static inline int +SYSTIME_INLINE int EMACS_TIME_VALID_P (EMACS_TIME t) { return 0 <= t.tv_nsec; @@ -123,14 +128,14 @@ EMACS_TIME_VALID_P (EMACS_TIME t) On overflow, return an extremal value; in particular, if time_t is an unsigned data type and D is negative, return zero. Return the minimum EMACS_TIME if D is not a number. */ -static inline EMACS_TIME +SYSTIME_INLINE EMACS_TIME EMACS_TIME_FROM_DOUBLE (double d) { return dtotimespec (d); } /* Convert the Emacs time T to an approximate double value D. */ -static inline double +SYSTIME_INLINE double EMACS_TIME_TO_DOUBLE (EMACS_TIME t) { return timespectod (t); @@ -155,35 +160,37 @@ extern EMACS_TIME lisp_time_argument (Lisp_Object); #endif /* Compare times T1 and T2 for equality, inequality etc. */ -static inline int +SYSTIME_INLINE int EMACS_TIME_EQ (EMACS_TIME t1, EMACS_TIME t2) { return timespec_cmp (t1, t2) == 0; } -static inline int +SYSTIME_INLINE int EMACS_TIME_NE (EMACS_TIME t1, EMACS_TIME t2) { return timespec_cmp (t1, t2) != 0; } -static inline int +SYSTIME_INLINE int EMACS_TIME_GT (EMACS_TIME t1, EMACS_TIME t2) { return timespec_cmp (t1, t2) > 0; } -static inline int +SYSTIME_INLINE int EMACS_TIME_GE (EMACS_TIME t1, EMACS_TIME t2) { return timespec_cmp (t1, t2) >= 0; } -static inline int +SYSTIME_INLINE int EMACS_TIME_LT (EMACS_TIME t1, EMACS_TIME t2) { return timespec_cmp (t1, t2) < 0; } -static inline int +SYSTIME_INLINE int EMACS_TIME_LE (EMACS_TIME t1, EMACS_TIME t2) { return timespec_cmp (t1, t2) <= 0; } +INLINE_HEADER_END + #endif /* EMACS_SYSTIME_H */ |