Commit 7468e0b5 by Zack Weinberg

safe-ctype.h (HC_UNKNOWN, [...]): New #defines.

include:
	* safe-ctype.h (HC_UNKNOWN, HC_ASCII, HC_EBCDIC, HOST_CHARSET):
	New #defines.
libiberty:
	* safe-ctype.c: Separate out EOF==-1 check.  Use HOST_CHARSET
	for charset determination.
gcc:
	* aclocal.m4 (gcc_AC_C_CHARSET): Delete.
	* configure.in: Don't use gcc_AC_C_CHARSET.
	* configure, config.in: Regenerate.
	* config/i370/i370.c, config/i370/i370.h: Use
	(HOST_CHARSET == HC_EBCDIC) or (HOST_CHARSET == HC_ASCII)
	instead of HOST_EBCDIC or !HOST_EBCDIC.  Clarify comments a tad.

From-SVN: r68317
parent de32c0cb
2003-06-21 Zack Weinberg <zack@codesourcery.com>
* aclocal.m4 (gcc_AC_C_CHARSET): Delete.
* configure.in: Don't use gcc_AC_C_CHARSET.
* configure, config.in: Regenerate.
* config/i370/i370.c, config/i370/i370.h: Use
(HOST_CHARSET == HC_EBCDIC) or (HOST_CHARSET == HC_ASCII)
instead of HOST_EBCDIC or !HOST_EBCDIC. Clarify comments a tad.
2003-06-21 Neil Booth <neil@daikokuya.co.uk> 2003-06-21 Neil Booth <neil@daikokuya.co.uk>
* Makefile.in: Update. * Makefile.in: Update.
...@@ -58,7 +67,7 @@ Sat Jun 21 13:41:00 CEST 2003 Jan Hubicka <jh@suse.cz> ...@@ -58,7 +67,7 @@ Sat Jun 21 13:41:00 CEST 2003 Jan Hubicka <jh@suse.cz>
* toplev.h (decode_g_option): New. * toplev.h (decode_g_option): New.
2003-06-20 Aldy Hernandez <aldyh@redhat.com> 2003-06-20 Aldy Hernandez <aldyh@redhat.com>
PR/11092 PR/11092
* config/rs6000/rs6000.h (LEGITIMATE_CONSTANT_P): Adjust for * config/rs6000/rs6000.h (LEGITIMATE_CONSTANT_P): Adjust for
vectors. vectors.
...@@ -120,7 +129,7 @@ Sat Jun 21 13:41:00 CEST 2003 Jan Hubicka <jh@suse.cz> ...@@ -120,7 +129,7 @@ Sat Jun 21 13:41:00 CEST 2003 Jan Hubicka <jh@suse.cz>
to ASM_OUTPUT_SOURCE_LINE. to ASM_OUTPUT_SOURCE_LINE.
2003-06-20 Daniel Egger <degger@fhm.edu> 2003-06-20 Daniel Egger <degger@fhm.edu>
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* doc/install.texi (Building): Correct and improve statement * doc/install.texi (Building): Correct and improve statement
about parallel builds. about parallel builds.
......
...@@ -564,34 +564,6 @@ AC_CACHE_CHECK(for __int64, ac_cv_c___int64, ...@@ -564,34 +564,6 @@ AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
fi fi
]) ])
dnl Host character set probe.
dnl The EBCDIC values match the table in config/i370/i370.c;
dnl there are other versions of EBCDIC but GCC won't work with them.
dnl
AC_DEFUN([gcc_AC_C_CHARSET],
[AC_CACHE_CHECK(execution character set, ac_cv_c_charset,
[AC_EGREP_CPP(ASCII,
[#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
&& 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
ASCII
#endif], ac_cv_c_charset=ASCII)
if test x${ac_cv_c_charset+set} != xset; then
AC_EGREP_CPP(EBCDIC,
[#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
&& 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
EBCDIC
#endif], ac_cv_c_charset=EBCDIC)
fi
if test x${ac_cv_c_charset+set} != xset; then
ac_cv_c_charset=unknown
fi])
if test $ac_cv_c_charset = unknown; then
AC_MSG_ERROR([*** Cannot determine host character set.])
elif test $ac_cv_c_charset = EBCDIC; then
AC_DEFINE(HOST_EBCDIC, 1,
[Define if the host execution character set is EBCDIC.])
fi])
#serial AM2 #serial AM2
dnl From Bruno Haible. dnl From Bruno Haible.
......
...@@ -321,9 +321,6 @@ ...@@ -321,9 +321,6 @@
/* The number of bytes in type __int64 */ /* The number of bytes in type __int64 */
#undef SIZEOF___INT64 #undef SIZEOF___INT64
/* Define if the host execution character set is EBCDIC. */
#undef HOST_EBCDIC
/* Define if you want more run-time sanity checks. This one gets a grab /* Define if you want more run-time sanity checks. This one gets a grab
bag of miscellaneous but relatively cheap checks. */ bag of miscellaneous but relatively cheap checks. */
#undef ENABLE_CHECKING #undef ENABLE_CHECKING
......
...@@ -121,7 +121,7 @@ static bool i370_rtx_costs PARAMS ((rtx, int, int, int *)); ...@@ -121,7 +121,7 @@ static bool i370_rtx_costs PARAMS ((rtx, int, int, int *));
#ifdef TARGET_HLASM #ifdef TARGET_HLASM
#define MVS_HASH_PRIME 999983 #define MVS_HASH_PRIME 999983
#if defined(HOST_EBCDIC) #if HOST_CHARSET == HC_EBCDIC
#define MVS_SET_SIZE 256 #define MVS_SET_SIZE 256
#else #else
#define MVS_SET_SIZE 128 #define MVS_SET_SIZE 128
...@@ -156,7 +156,7 @@ static alias_node_t *alias_anchor = 0; ...@@ -156,7 +156,7 @@ static alias_node_t *alias_anchor = 0;
and must handled in a special manner. */ and must handled in a special manner. */
static const char *const mvs_function_table[MVS_FUNCTION_TABLE_LENGTH] = static const char *const mvs_function_table[MVS_FUNCTION_TABLE_LENGTH] =
{ {
#if defined(HOST_EBCDIC) /* Changed for EBCDIC collating sequence */ #if HOST_CHARSET == HC_EBCDIC /* Changed for EBCDIC collating sequence */
"ceil", "edc_acos", "edc_asin", "edc_atan", "edc_ata2", "edc_cos", "ceil", "edc_acos", "edc_asin", "edc_atan", "edc_ata2", "edc_cos",
"edc_cosh", "edc_erf", "edc_erfc", "edc_exp", "edc_gamm", "edc_lg10", "edc_cosh", "edc_erf", "edc_erfc", "edc_exp", "edc_gamm", "edc_lg10",
"edc_log", "edc_sin", "edc_sinh", "edc_sqrt", "edc_tan", "edc_tanh", "edc_log", "edc_sin", "edc_sinh", "edc_sqrt", "edc_tan", "edc_tanh",
...@@ -176,7 +176,7 @@ static const char *const mvs_function_table[MVS_FUNCTION_TABLE_LENGTH] = ...@@ -176,7 +176,7 @@ static const char *const mvs_function_table[MVS_FUNCTION_TABLE_LENGTH] =
#endif /* TARGET_HLASM */ #endif /* TARGET_HLASM */
/* ===================================================== */ /* ===================================================== */
#if defined(TARGET_EBCDIC) && !defined(HOST_EBCDIC) #if defined(TARGET_EBCDIC) && HOST_CHARSET == HC_ASCII
/* ASCII to EBCDIC conversion table. */ /* ASCII to EBCDIC conversion table. */
static const unsigned char ascebc[256] = static const unsigned char ascebc[256] =
{ {
...@@ -229,10 +229,9 @@ static const unsigned char ascebc[256] = ...@@ -229,10 +229,9 @@ static const unsigned char ascebc[256] =
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF
}; };
#endif /* TARGET_EBCDIC && ! HOST_EBCDIC */ #endif /* target EBCDIC, host ASCII */
#if !defined(TARGET_EBCDIC) && HOST_CHARSET == HC_EBCDIC
#if defined(HOST_EBCDIC) && !defined(TARGET_EBCDIC)
/* EBCDIC to ASCII conversion table. */ /* EBCDIC to ASCII conversion table. */
static const unsigned char ebcasc[256] = static const unsigned char ebcasc[256] =
{ {
...@@ -301,7 +300,7 @@ static const unsigned char ebcasc[256] = ...@@ -301,7 +300,7 @@ static const unsigned char ebcasc[256] =
/*F8 8 9 */ /*F8 8 9 */
0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
}; };
#endif /* HOST_EBCDIC && ! TARGET_EBCDIC */ #endif /* target ASCII, host EBCDIC */
/* Initialize the GCC target structure. */ /* Initialize the GCC target structure. */
#ifdef TARGET_HLASM #ifdef TARGET_HLASM
...@@ -351,11 +350,11 @@ char ...@@ -351,11 +350,11 @@ char
mvs_map_char (c) mvs_map_char (c)
int c; int c;
{ {
#if defined(TARGET_EBCDIC) && !defined(HOST_EBCDIC) #if defined(TARGET_EBCDIC) && HOST_CHARSET == HC_ASCII
fprintf (stderr, "mvs_map_char: TE & !HE: c = %02x\n", c); fprintf (stderr, "mvs_map_char: TE & !HE: c = %02x\n", c);
return ascebc[c]; return ascebc[c];
#else #else
#if defined(HOST_EBCDIC) && !defined(TARGET_EBCDIC) #if !defined(TARGET_EBCDIC) && HOST_CHARSET == HC_EBCDIC
fprintf (stderr, "mvs_map_char: !TE & HE: c = %02x\n", c); fprintf (stderr, "mvs_map_char: !TE & HE: c = %02x\n", c);
return ebcasc[c]; return ebcasc[c];
#else #else
......
...@@ -141,7 +141,7 @@ extern size_t mvs_function_name_length; ...@@ -141,7 +141,7 @@ extern size_t mvs_function_name_length;
/* but only define it if really needed, since otherwise it will break builds */ /* but only define it if really needed, since otherwise it will break builds */
#ifdef TARGET_EBCDIC #ifdef TARGET_EBCDIC
#ifdef HOST_EBCDIC #if HOST_CHARSET == HC_EBCDIC
#define MAP_CHARACTER(c) ((char)(c)) #define MAP_CHARACTER(c) ((char)(c))
#else #else
#define MAP_CHARACTER(c) ((char)mvs_map_char (c)) #define MAP_CHARACTER(c) ((char)mvs_map_char (c))
......
...@@ -259,8 +259,6 @@ if test $ac_cv_c___int64 = yes; then ...@@ -259,8 +259,6 @@ if test $ac_cv_c___int64 = yes; then
AC_COMPILE_CHECK_SIZEOF(__int64) AC_COMPILE_CHECK_SIZEOF(__int64)
fi fi
gcc_AC_C_CHARSET
# ----------------- # -----------------
# Find Ada compiler # Find Ada compiler
# ----------------- # -----------------
......
2003-06-21 Zack Weinberg <zack@codesourcery.com>
* safe-ctype.h (HC_UNKNOWN, HC_ASCII, HC_EBCDIC, HOST_CHARSET):
New #defines.
2003-06-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-06-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* ansidecl.h: Delete HAVE_LONG_DOUBLE GCC bootstrap support. * ansidecl.h: Delete HAVE_LONG_DOUBLE GCC bootstrap support.
...@@ -383,7 +388,7 @@ ...@@ -383,7 +388,7 @@
2000-09-04 Alex Samuel <samuel@codesourcery.com> 2000-09-04 Alex Samuel <samuel@codesourcery.com>
* dyn-string.h: Adjust formatting. * dyn-string.h: Adjust formatting.
(dyn_string_insert_char): New macro. New declaration. (dyn_string_insert_char): New macro. New declaration.
2000-08-28 Jason Merrill <jason@redhat.com> 2000-08-28 Jason Merrill <jason@redhat.com>
...@@ -408,7 +413,7 @@ ...@@ -408,7 +413,7 @@
dyn_string_insert_cstr, dyn_string_append, dyn_string_append_cstr, dyn_string_insert_cstr, dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring): Change return type dyn_string_append_char, dyn_string_substring): Change return type
to int. to int.
2000-06-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-06-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* demangle.h (demangling_styles): Remove trailing comma in enum. * demangle.h (demangling_styles): Remove trailing comma in enum.
...@@ -421,12 +426,12 @@ ...@@ -421,12 +426,12 @@
* dyn-string.h: Move here from gcc/dyn-string.h. Add new functions. * dyn-string.h: Move here from gcc/dyn-string.h. Add new functions.
* demangle.h (DMGL_GNU_NEW_ABI): New macro. * demangle.h (DMGL_GNU_NEW_ABI): New macro.
(DMGL_STYLE_MASK): Or in DMGL_GNU_NEW_ABI. (DMGL_STYLE_MASK): Or in DMGL_GNU_NEW_ABI.
(current_demangling_style): Add gnu_new_abi_demangling. (current_demangling_style): Add gnu_new_abi_demangling.
(GNU_NEW_ABI_DEMANGLING_STYLE_STRING): New macro. (GNU_NEW_ABI_DEMANGLING_STYLE_STRING): New macro.
(GNU_NEW_ABI_DEMANGLING): Likewise. (GNU_NEW_ABI_DEMANGLING): Likewise.
(cplus_demangle_new_abi): New declaration. (cplus_demangle_new_abi): New declaration.
Tue May 30 16:53:34 2000 Andrew Cagney <cagney@b1.cygnus.com> Tue May 30 16:53:34 2000 Andrew Cagney <cagney@b1.cygnus.com>
* floatformat.h (struct floatformat): Add field name. * floatformat.h (struct floatformat): Add field name.
...@@ -458,9 +463,9 @@ Thu May 4 17:15:26 2000 Philippe De Muyter <phdm@macqel.be> ...@@ -458,9 +463,9 @@ Thu May 4 17:15:26 2000 Philippe De Muyter <phdm@macqel.be>
2000-04-28 Kenneth Block <block@zk3.dec.com> 2000-04-28 Kenneth Block <block@zk3.dec.com>
Jason Merrill <jason@casey.cygnus.com> Jason Merrill <jason@casey.cygnus.com>
* demangle.h (libiberty_demanglers): new table for different styles. * demangle.h (libiberty_demanglers): new table for different styles.
(cplus_demangle_set_style): New function for setting style. (cplus_demangle_set_style): New function for setting style.
(cplus_demangle_name_to_style): New function to translate name. (cplus_demangle_name_to_style): New function to translate name.
2000-04-24 Mark Mitchell <mark@codesourcery.com> 2000-04-24 Mark Mitchell <mark@codesourcery.com>
......
...@@ -37,7 +37,24 @@ Boston, MA 02111-1307, USA. */ ...@@ -37,7 +37,24 @@ Boston, MA 02111-1307, USA. */
#ifdef isalpha #ifdef isalpha
#error "safe-ctype.h and ctype.h may not be used simultaneously" #error "safe-ctype.h and ctype.h may not be used simultaneously"
#endif
/* Determine host character set. */
#define HC_UNKNOWN 0
#define HC_ASCII 1
#define HC_EBCDIC 2
#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
&& 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
# define HOST_CHARSET HC_ASCII
#else #else
# if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
&& 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
# define HOST_CHARSET HC_EBCDIC
# else
# define HOST_CHARSET HC_UNKNOWN
# endif
#endif
/* Categories. */ /* Categories. */
...@@ -99,5 +116,4 @@ extern const unsigned char _sch_tolower[256]; ...@@ -99,5 +116,4 @@ extern const unsigned char _sch_tolower[256];
#define TOUPPER(c) _sch_toupper[(c) & 0xff] #define TOUPPER(c) _sch_toupper[(c) & 0xff]
#define TOLOWER(c) _sch_tolower[(c) & 0xff] #define TOLOWER(c) _sch_tolower[(c) & 0xff]
#endif /* no ctype.h */
#endif /* SAFE_CTYPE_H */ #endif /* SAFE_CTYPE_H */
2003-06-21 Zack Weinberg <zack@codesourcery.com>
* safe-ctype.c: Separate out EOF==-1 check. Use HOST_CHARSET
for charset determination.
2003-06-19 Dara Hazeghi <dhazeghi@yahoo.com> 2003-06-19 Dara Hazeghi <dhazeghi@yahoo.com>
* configure.in: Add check for malloc.h needed by * configure.in: Add check for malloc.h needed by
...@@ -8,14 +13,14 @@ ...@@ -8,14 +13,14 @@
free(). free().
2003-06-09 Albert Chin-A-Young <china@thewrittenword.com> 2003-06-09 Albert Chin-A-Young <china@thewrittenword.com>
PR bootstrap/10974 PR bootstrap/10974
* physmem.c: Update comment. * physmem.c: Update comment.
* configure.in: Modify test for _system_configuration for older * configure.in: Modify test for _system_configuration for older
AIX systems. AIX systems.
* config.in, configure: Regenerated. * config.in, configure: Regenerated.
2003-06-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2003-06-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR other/10810 PR other/10810
...@@ -109,7 +114,7 @@ ...@@ -109,7 +114,7 @@
ANSI_PROTOTYPES. ANSI_PROTOTYPES.
* vsprintf.c: Include "ansidecl.h" earlier, rely on * vsprintf.c: Include "ansidecl.h" earlier, rely on
ANSI_PROTOTYPES and possibly include <stdarg.h>. ANSI_PROTOTYPES and possibly include <stdarg.h>.
* Makefile.in: Regenerate dependencies. * Makefile.in: Regenerate dependencies.
2003-04-15 DJ Delorie <dj@redhat.com> 2003-04-15 DJ Delorie <dj@redhat.com>
...@@ -207,7 +212,7 @@ ...@@ -207,7 +212,7 @@
2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Richard Earnshaw <rearnsha@arm.com> Richard Earnshaw <rearnsha@arm.com>
Geoffrey Keating <geoffk@apple.com> Geoffrey Keating <geoffk@apple.com>
* configure.in: Check for sys/sysctl.h and sysctl. * configure.in: Check for sys/sysctl.h and sysctl.
* physmem.c: Add support for *bsd and darwin. * physmem.c: Add support for *bsd and darwin.
* Makefile.in: Generate depedency for physmem.o. * Makefile.in: Generate depedency for physmem.o.
...@@ -236,7 +241,7 @@ ...@@ -236,7 +241,7 @@
* physmem.c (physmem_total, physmem_available): De-ANSI-fy. * physmem.c (physmem_total, physmem_available): De-ANSI-fy.
* configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and * configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and
pstat_getdynamic. pstat_getdynamic.
2003-02-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-02-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (CFILES): Add physmem.c. * Makefile.in (CFILES): Add physmem.c.
......
...@@ -33,6 +33,10 @@ Boston, MA 02111-1307, USA. */ ...@@ -33,6 +33,10 @@ Boston, MA 02111-1307, USA. */
#include <safe-ctype.h> #include <safe-ctype.h>
#include <stdio.h> /* for EOF */ #include <stdio.h> /* for EOF */
#if EOF != -1
#error "<safe-ctype.h> requires EOF == -1"
#endif
/* Shorthand */ /* Shorthand */
#define bl _sch_isblank #define bl _sch_isblank
#define cn _sch_iscntrl #define cn _sch_iscntrl
...@@ -64,9 +68,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -64,9 +68,7 @@ Boston, MA 02111-1307, USA. */
#define S (const unsigned short) (nv|sp|bl|pr) /* space */ #define S (const unsigned short) (nv|sp|bl|pr) /* space */
/* Are we ASCII? */ /* Are we ASCII? */
#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \ #if HOST_CHARSET == HC_ASCII
&& 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
&& EOF == -1
const unsigned short _sch_istable[256] = const unsigned short _sch_istable[256] =
{ {
...@@ -159,5 +161,9 @@ const unsigned char _sch_toupper[256] = ...@@ -159,5 +161,9 @@ const unsigned char _sch_toupper[256] =
}; };
#else #else
#error "Unsupported host character set" # if HOST_CHARSET == HC_EBCDIC
#endif /* not ASCII */ #error "FIXME: write tables for EBCDIC"
# else
#error "Unrecognized host character set"
# endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment