diff options
author | brobecke <brobecke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-04 17:05:58 +0000 |
---|---|---|
committer | brobecke <brobecke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-04 17:05:58 +0000 |
commit | 3725d22e61ec5c3cfce882149a2d842bf1dd5dc7 (patch) | |
tree | 4f0c8bc0a90795bc88ce374ce9b4d7f2a5bb54c4 /include | |
parent | f6df473d0b84b3e1395566afd032d55794bc5708 (diff) | |
download | gcc-3725d22e61ec5c3cfce882149a2d842bf1dd5dc7.tar.gz |
* safe-ctype.h: Remove #error when detecting that ctype.h has been
included. Redefine the various macros provided by ctype.h as
undefined variables.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137480 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'include')
-rw-r--r-- | include/ChangeLog | 6 | ||||
-rw-r--r-- | include/safe-ctype.h | 36 |
2 files changed, 38 insertions, 4 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index bf1af8da2cc..66f6249ce6d 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2008-07-04 Joel Brobecker <brobecker@adacore.com> + + * safe-ctype.h: Remove #error when detecting that ctype.h has been + included. Redefine the various macros provided by ctype.h as + undefined variables. + 2008-06-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * libiberty.h (XALLOCA, XDUP, XALLOCAVEC, XDUPVEC, XALLOCAVAR, diff --git a/include/safe-ctype.h b/include/safe-ctype.h index e59b357ccfb..b3e911e07bd 100644 --- a/include/safe-ctype.h +++ b/include/safe-ctype.h @@ -35,10 +35,6 @@ Boston, MA 02110-1301, USA. */ #ifndef SAFE_CTYPE_H #define SAFE_CTYPE_H -#ifdef isalpha - #error "safe-ctype.h and ctype.h may not be used simultaneously" -#endif - /* Determine host character set. */ #define HOST_CHARSET_UNKNOWN 0 #define HOST_CHARSET_ASCII 1 @@ -116,4 +112,36 @@ extern const unsigned char _sch_tolower[256]; #define TOUPPER(c) _sch_toupper[(c) & 0xff] #define TOLOWER(c) _sch_tolower[(c) & 0xff] +/* Prevent the users of safe-ctype.h from accidently using the routines + from ctype.h. Initially, the approach was to produce an error when + detecting that ctype.h has been included. But this was causing + trouble as ctype.h might get indirectly included as a result of + including another system header (for instance gnulib's stdint.h). */ +#undef isalpha +#define isalpha(c) do_not_use_isalpha_with_safe_ctype +#undef isalnum +#define isalnum(c) do_not_use_isalnum_with_safe_ctype +#undef iscntrl +#define iscntrl(c) do_not_use_iscntrl_with_safe_ctype +#undef isdigit +#define isdigit(c) do_not_use_isdigit_with_safe_ctype +#undef isgraph +#define isgraph(c) do_not_use_isgraph_with_safe_ctype +#undef islower +#define islower(c) do_not_use_islower_with_safe_ctype +#undef isprint +#define isprint(c) do_not_use_isprint_with_safe_ctype +#undef ispunct +#define ispunct(c) do_not_use_ispunct_with_safe_ctype +#undef isspace +#define isspace(c) do_not_use_isspace_with_safe_ctype +#undef isupper +#define isupper(c) do_not_use_isupper_with_safe_ctype +#undef isxdigit +#define isxdigit(c) do_not_use_isxdigit_with_safe_ctype +#undef toupper +#define toupper(c) do_not_use_toupper_with_safe_ctype +#undef tolower +#define tolower(c) do_not_use_tolower_with_safe_ctype + #endif /* SAFE_CTYPE_H */ |