diff options
| author | Paul Eggert | 2013-06-18 11:36:13 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-06-18 11:36:13 -0700 |
| commit | 0d6224d432dee9781baadc8a833826e42fe7acda (patch) | |
| tree | 348d5dfbde7808972c1e0002e0d46270de7144da /src | |
| parent | 4ba54f7d9d2c39a245ba6f527a956cd775133e86 (diff) | |
| download | emacs-0d6224d432dee9781baadc8a833826e42fe7acda.tar.gz emacs-0d6224d432dee9781baadc8a833826e42fe7acda.zip | |
* conf_post.h: Add comments for INLINE, EXTERN_INLINE, etc.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/conf_post.h | 31 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c432c1ad8bb..f8d4063b352 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-06-18 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * conf_post.h: Add comments for INLINE, EXTERN_INLINE, etc. | ||
| 4 | |||
| 1 | 2013-06-18 Kenichi Handa <handa@gnu.org> | 5 | 2013-06-18 Kenichi Handa <handa@gnu.org> |
| 2 | 6 | ||
| 3 | * font.c (Ffont_spec): Signal an error for an invalid font name | 7 | * font.c (Ffont_spec): Signal an error for an invalid font name |
diff --git a/src/conf_post.h b/src/conf_post.h index 5cb385d9029..46aea32ef30 100644 --- a/src/conf_post.h +++ b/src/conf_post.h | |||
| @@ -207,6 +207,37 @@ extern void _DebPrint (const char *fmt, ...); | |||
| 207 | #undef noinline | 207 | #undef noinline |
| 208 | #endif | 208 | #endif |
| 209 | 209 | ||
| 210 | /* Use Gnulib's extern-inline module for extern inline functions. | ||
| 211 | An include file foo.h should prepend FOO_INLINE to function | ||
| 212 | definitions, with the following overall pattern: | ||
| 213 | |||
| 214 | [#include any other .h files first.] | ||
| 215 | ... | ||
| 216 | INLINE_HEADER_BEGIN | ||
| 217 | #ifndef FOO_INLINE | ||
| 218 | # define FOO_INLINE INLINE | ||
| 219 | #endif | ||
| 220 | ... | ||
| 221 | FOO_INLINE int | ||
| 222 | incr (int i) | ||
| 223 | { | ||
| 224 | return i + 1; | ||
| 225 | } | ||
| 226 | ... | ||
| 227 | INLINE_HEADER_END | ||
| 228 | |||
| 229 | The corresponding foo.c file should do this: | ||
| 230 | |||
| 231 | #define FOO_INLINE EXTERN_INLINE | ||
| 232 | |||
| 233 | before including any .h file other than config.h. | ||
| 234 | Other .c files should not define FOO_INILNE. | ||
| 235 | |||
| 236 | C99 compilers compile functions like 'incr' as C99-style extern | ||
| 237 | inline functions. Pre-C99 GCCs do something similar with | ||
| 238 | GNU-specific keywords. Pre-C99 non-GCC compilers use static | ||
| 239 | functions, which bloats the code but is good enough. */ | ||
| 240 | |||
| 210 | #define INLINE _GL_INLINE | 241 | #define INLINE _GL_INLINE |
| 211 | #define EXTERN_INLINE _GL_EXTERN_INLINE | 242 | #define EXTERN_INLINE _GL_EXTERN_INLINE |
| 212 | #define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN | 243 | #define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN |