Mercurial > hg > octave-kai > gnulib-hg
changeset 17175:3aff72f6c8ba
wctype-h: better 'inline'
* lib/wctype-h.c: New file.
* lib/wctype.in.h (_GL_WCTYPE_INLINE):
New macro. Replace all uses of 'static inline' with it.
Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
* m4/wctype_h.m4 (gl_WCTYPE_H): Do not require AC_C_INLINE.
* modules/wctype-h (Files, lib_SOURCES): Add lib/wctype-h.c.
(Depends-on): Add extern-inline.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 20 Nov 2012 22:25:07 -0800 |
parents | 263910906d80 |
children | fe213f3f2c57 |
files | ChangeLog lib/wctype-h.c lib/wctype.in.h m4/wctype_h.m4 modules/wctype-h |
diffstat | 5 files changed, 39 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2012-11-29 Paul Eggert <eggert@cs.ucla.edu> + wctype-h: better 'inline' + * lib/wctype-h.c: New file. + * lib/wctype.in.h (_GL_WCTYPE_INLINE): + New macro. Replace all uses of 'static inline' with it. + Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. + * m4/wctype_h.m4 (gl_WCTYPE_H): Do not require AC_C_INLINE. + * modules/wctype-h (Files, lib_SOURCES): Add lib/wctype-h.c. + (Depends-on): Add extern-inline. + unistd: better 'inline' * lib/unistd.c: New file. * lib/unistd.in.h (_GL_UNISTD_INLINE):
new file mode 100644 --- /dev/null +++ b/lib/wctype-h.c @@ -0,0 +1,4 @@ +/* Normally this would be wctype.c, but that name's already taken. */ +#include <config.h> +#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE +#include "wctype.h"
--- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -54,6 +54,11 @@ #ifndef _@GUARD_PREFIX@_WCTYPE_H #define _@GUARD_PREFIX@_WCTYPE_H +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_WCTYPE_INLINE +# define _GL_WCTYPE_INLINE _GL_INLINE +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ @@ -148,7 +153,7 @@ # endif # endif -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswalnum # else @@ -160,7 +165,7 @@ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswalpha # else @@ -171,7 +176,7 @@ return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswblank # else @@ -182,7 +187,7 @@ return wc == ' ' || wc == '\t'; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswcntrl # else @@ -193,7 +198,7 @@ return (wc & ~0x1f) == 0 || wc == 0x7f; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswdigit # else @@ -204,7 +209,7 @@ return wc >= '0' && wc <= '9'; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswgraph # else @@ -215,7 +220,7 @@ return wc >= '!' && wc <= '~'; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswlower # else @@ -226,7 +231,7 @@ return wc >= 'a' && wc <= 'z'; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswprint # else @@ -237,7 +242,7 @@ return wc >= ' ' && wc <= '~'; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswpunct # else @@ -250,7 +255,7 @@ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswspace # else @@ -262,7 +267,7 @@ || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswupper # else @@ -273,7 +278,7 @@ return wc >= 'A' && wc <= 'Z'; } -static inline int +_GL_WCTYPE_INLINE int # if @REPLACE_ISWCNTRL@ rpl_iswxdigit # else @@ -285,7 +290,7 @@ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); } -static inline wint_t +_GL_WCTYPE_INLINE wint_t # if @REPLACE_TOWLOWER@ rpl_towlower # else @@ -296,7 +301,7 @@ return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); } -static inline wint_t +_GL_WCTYPE_INLINE wint_t # if @REPLACE_TOWLOWER@ rpl_towupper # else @@ -336,7 +341,7 @@ result register. We need to fix this by adding a zero-extend from wchar_t to wint_t after the call. */ -static inline wint_t +_GL_WCTYPE_INLINE wint_t rpl_towlower (wint_t wc) { return (wint_t) (wchar_t) towlower (wc); @@ -345,7 +350,7 @@ # define towlower rpl_towlower # endif -static inline wint_t +_GL_WCTYPE_INLINE wint_t rpl_towupper (wint_t wc) { return (wint_t) (wchar_t) towupper (wc); @@ -493,6 +498,7 @@ # endif #endif +_GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_WCTYPE_H */ #endif /* _@GUARD_PREFIX@_WCTYPE_H */
--- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -1,4 +1,4 @@ -# wctype_h.m4 serial 17 +# wctype_h.m4 serial 18 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. @@ -22,8 +22,6 @@ fi AC_SUBST([HAVE_ISWCNTRL]) - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then HAVE_WINT_T=1
--- a/modules/wctype-h +++ b/modules/wctype-h @@ -3,10 +3,12 @@ Files: lib/wctype.in.h +lib/wctype-h.c m4/wctype_h.m4 m4/wint_t.m4 Depends-on: +extern-inline include_next snippet/c++defs snippet/warn-on-use @@ -16,6 +18,7 @@ Makefile.am: BUILT_SOURCES += wctype.h +lib_SOURCES += wctype-h.c # We need the following in order to create <wctype.h> when the system # doesn't have one that works with the given compiler.