[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/11] wctype-h: better 'inline'
From: |
Paul Eggert |
Subject: |
[PATCH 11/11] wctype-h: better 'inline' |
Date: |
Mon, 29 Oct 2012 00:20:40 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 |
* 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.
---
ChangeLog | 9 +++++++++
lib/wctype-h.c | 4 ++++
lib/wctype.in.h | 38 ++++++++++++++++++++++----------------
m4/wctype_h.m4 | 4 +---
modules/wctype-h | 3 +++
5 files changed, 39 insertions(+), 19 deletions(-)
create mode 100644 lib/wctype-h.c
diff --git a/ChangeLog b/ChangeLog
index 9e3a90c..94caadc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2012-10-28 Paul Eggert <address@hidden>
+ 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):
diff --git a/lib/wctype-h.c b/lib/wctype-h.c
new file mode 100644
index 0000000..bb5f847
--- /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"
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index e904be2..5cfd180 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -54,6 +54,11 @@
#ifndef address@hidden@_WCTYPE_H
#define address@hidden@_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 @@ typedef unsigned int rpl_wint_t;
# endif
# endif
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswalnum
# else
@@ -160,7 +165,7 @@ iswalnum
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswalpha
# else
@@ -171,7 +176,7 @@ iswalpha
return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswblank
# else
@@ -182,7 +187,7 @@ iswblank
return wc == ' ' || wc == '\t';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswcntrl
# else
@@ -193,7 +198,7 @@ iswcntrl
return (wc & ~0x1f) == 0 || wc == 0x7f;
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswdigit
# else
@@ -204,7 +209,7 @@ iswdigit
return wc >= '0' && wc <= '9';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswgraph
# else
@@ -215,7 +220,7 @@ iswgraph
return wc >= '!' && wc <= '~';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswlower
# else
@@ -226,7 +231,7 @@ iswlower
return wc >= 'a' && wc <= 'z';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswprint
# else
@@ -237,7 +242,7 @@ iswprint
return wc >= ' ' && wc <= '~';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswpunct
# else
@@ -250,7 +255,7 @@ iswpunct
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswspace
# else
@@ -262,7 +267,7 @@ iswspace
|| 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 @@ iswupper
return wc >= 'A' && wc <= 'Z';
}
-static inline int
+_GL_WCTYPE_INLINE int
# if @REPLACE_ISWCNTRL@
rpl_iswxdigit
# else
@@ -285,7 +290,7 @@ iswxdigit
|| ((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 @@ towlower
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 @@ _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
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 @@ rpl_towlower (wint_t wc)
# 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 @@ _GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
# endif
#endif
+_GL_INLINE_HEADER_END
#endif /* address@hidden@_WCTYPE_H */
#endif /* address@hidden@_WCTYPE_H */
diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4
index 4b19f64..885e6fc 100644
--- 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 @@ AC_DEFUN([gl_WCTYPE_H],
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
diff --git a/modules/wctype-h b/modules/wctype-h
index f7b7b59..b2cbdcd 100644
--- a/modules/wctype-h
+++ b/modules/wctype-h
@@ -3,10 +3,12 @@ A <wctype.h> that conforms better to C99.
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 @@ gl_WCTYPE_H
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.
--
1.7.11.7
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH 11/11] wctype-h: better 'inline',
Paul Eggert <=