Solve the <runetype.h> pollution problem by disabling inline

optimizations when a standard has been requested, except when the
inline optimizations are also specifically requested.
This commit is contained in:
Mike Barcroft 2002-09-09 05:38:05 +00:00
parent 3b257bf450
commit 86eedb4ef4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103113
2 changed files with 32 additions and 8 deletions

View File

@ -45,10 +45,8 @@
#ifndef _CTYPE_H_ #ifndef _CTYPE_H_
#define _CTYPE_H_ #define _CTYPE_H_
/* #include <sys/cdefs.h>
* XXX <runetype.h> brings namespace pollution (struct member names). #include <sys/_types.h>
*/
#include <runetype.h>
#define _CTYPE_A 0x00000100L /* Alpha */ #define _CTYPE_A 0x00000100L /* Alpha */
#define _CTYPE_C 0x00000200L /* Control */ #define _CTYPE_C 0x00000200L /* Control */
@ -163,11 +161,25 @@ __END_DECLS
#define __inline #define __inline
#endif #endif
/*
* <runetype.h> brings namespace pollution (struct member names). This prevents
* us from using the inline optimizations in the more strict __POSIX_VISIBLE and
* __XSI_VISIBLE namespaces. To fix this properly would require that we rename
* member names of long-standing structs, or something equally evil.
*/
#if !__BSD_VISIBLE && !defined(_USE_CTYPE_INLINE_) && \
!defined(_DONT_USE_CTYPE_INLINE_)
#define _DONT_USE_CTYPE_INLINE_
#endif
/* /*
* Use inline functions if we are allowed to and the compiler supports them. * Use inline functions if we are allowed to and the compiler supports them.
*/ */
#if !defined(_DONT_USE_CTYPE_INLINE_) && \ #if !defined(_DONT_USE_CTYPE_INLINE_) && \
(defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
#include <runetype.h>
static __inline int static __inline int
__maskrune(__ct_rune_t _c, unsigned long _f) __maskrune(__ct_rune_t _c, unsigned long _f)
{ {

View File

@ -45,10 +45,8 @@
#ifndef _CTYPE_H_ #ifndef _CTYPE_H_
#define _CTYPE_H_ #define _CTYPE_H_
/* #include <sys/cdefs.h>
* XXX <runetype.h> brings namespace pollution (struct member names). #include <sys/_types.h>
*/
#include <runetype.h>
#define _CTYPE_A 0x00000100L /* Alpha */ #define _CTYPE_A 0x00000100L /* Alpha */
#define _CTYPE_C 0x00000200L /* Control */ #define _CTYPE_C 0x00000200L /* Control */
@ -163,11 +161,25 @@ __END_DECLS
#define __inline #define __inline
#endif #endif
/*
* <runetype.h> brings namespace pollution (struct member names). This prevents
* us from using the inline optimizations in the more strict __POSIX_VISIBLE and
* __XSI_VISIBLE namespaces. To fix this properly would require that we rename
* member names of long-standing structs, or something equally evil.
*/
#if !__BSD_VISIBLE && !defined(_USE_CTYPE_INLINE_) && \
!defined(_DONT_USE_CTYPE_INLINE_)
#define _DONT_USE_CTYPE_INLINE_
#endif
/* /*
* Use inline functions if we are allowed to and the compiler supports them. * Use inline functions if we are allowed to and the compiler supports them.
*/ */
#if !defined(_DONT_USE_CTYPE_INLINE_) && \ #if !defined(_DONT_USE_CTYPE_INLINE_) && \
(defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
#include <runetype.h>
static __inline int static __inline int
__maskrune(__ct_rune_t _c, unsigned long _f) __maskrune(__ct_rune_t _c, unsigned long _f)
{ {