aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2001-09-19 05:33:36 +0000
committerH.J. Lu <hjl.tools@gmail.com>2001-09-19 05:33:36 +0000
commit3882b010780ca1aa1ed5d7b38e936cd2d6d5486b (patch)
treec806a73a13afd3265ba6b538ba73cae065c591f5
parent6b819c92c4512ccfba90f0caa204ab687fae8254 (diff)
downloadgdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.zip
gdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.tar.gz
gdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.tar.bz2
Locale changes from Bruno Haible <haible@clisp.cons.org>.
-rw-r--r--bfd/ChangeLog45
-rw-r--r--bfd/aoutx.h4
-rw-r--r--bfd/archive.c4
-rw-r--r--bfd/archures.c4
-rw-r--r--bfd/bfd.c9
-rw-r--r--bfd/binary.c5
-rw-r--r--bfd/cpu-v850.c5
-rw-r--r--bfd/hosts/alphavms.h3
-rw-r--r--bfd/ieee.c15
-rw-r--r--bfd/ihex.c5
-rw-r--r--bfd/merge.c2
-rw-r--r--bfd/oasys.c4
-rw-r--r--bfd/pdp11.c4
-rw-r--r--bfd/ppcboot.c5
-rw-r--r--bfd/som.c12
-rw-r--r--bfd/srec.c6
-rw-r--r--bfd/stabs.c5
-rw-r--r--bfd/syms.c10
-rw-r--r--bfd/vms-gsd.c2
-rw-r--r--bfd/vms-hdr.c6
-rw-r--r--bfd/vms-tir.c2
-rw-r--r--binutils/ChangeLog56
-rw-r--r--binutils/addr2line.c6
-rw-r--r--binutils/ar.c3
-rw-r--r--binutils/coffdump.c3
-rw-r--r--binutils/dlltool.c9
-rw-r--r--binutils/dllwrap.c12
-rw-r--r--binutils/nlmconv.c10
-rw-r--r--binutils/nlmheader.y21
-rw-r--r--binutils/nm.c3
-rw-r--r--binutils/objcopy.c3
-rw-r--r--binutils/objdump.c11
-rw-r--r--binutils/rclex.l14
-rw-r--r--binutils/rcparse.y13
-rw-r--r--binutils/readelf.c3
-rw-r--r--binutils/resrc.c18
-rw-r--r--binutils/size.c5
-rw-r--r--binutils/srconv.c3
-rw-r--r--binutils/stabs.c50
-rw-r--r--binutils/strings.c13
-rw-r--r--binutils/sysdump.c8
-rw-r--r--binutils/windres.c17
-rw-r--r--binutils/winduni.c7
-rw-r--r--binutils/wrstabs.c6
-rw-r--r--gas/ChangeLog229
-rw-r--r--gas/as.c3
-rw-r--r--gas/as.h1
-rw-r--r--gas/atof-generic.c14
-rw-r--r--gas/config/m68k-parse.y9
-rw-r--r--gas/config/obj-elf.c3
-rw-r--r--gas/config/obj-vms.c17
-rw-r--r--gas/config/tc-a29k.c21
-rw-r--r--gas/config/tc-alpha.c8
-rw-r--r--gas/config/tc-arc.c15
-rw-r--r--gas/config/tc-arm.c20
-rw-r--r--gas/config/tc-avr.c14
-rw-r--r--gas/config/tc-cris.c17
-rw-r--r--gas/config/tc-d10v.c4
-rw-r--r--gas/config/tc-d30v.c8
-rw-r--r--gas/config/tc-fr30.c4
-rw-r--r--gas/config/tc-h8300.c8
-rw-r--r--gas/config/tc-h8500.c6
-rw-r--r--gas/config/tc-hppa.c37
-rw-r--r--gas/config/tc-i370.c24
-rw-r--r--gas/config/tc-i386.c15
-rw-r--r--gas/config/tc-i860.c18
-rw-r--r--gas/config/tc-i960.c6
-rw-r--r--gas/config/tc-ia64.c19
-rw-r--r--gas/config/tc-m32r.c9
-rw-r--r--gas/config/tc-m68hc11.c8
-rw-r--r--gas/config/tc-m68k.c40
-rw-r--r--gas/config/tc-m88k.c35
-rw-r--r--gas/config/tc-mcore.c86
-rw-r--r--gas/config/tc-mips.c106
-rw-r--r--gas/config/tc-mn10200.c8
-rw-r--r--gas/config/tc-mn10300.c8
-rw-r--r--gas/config/tc-ns32k.c1
-rw-r--r--gas/config/tc-pdp11.c11
-rw-r--r--gas/config/tc-pj.c5
-rw-r--r--gas/config/tc-ppc.c19
-rw-r--r--gas/config/tc-s390.c16
-rw-r--r--gas/config/tc-sh.c60
-rw-r--r--gas/config/tc-sparc.c30
-rw-r--r--gas/config/tc-tahoe.c9
-rw-r--r--gas/config/tc-tic30.c23
-rw-r--r--gas/config/tc-tic54x.c75
-rw-r--r--gas/config/tc-tic80.c9
-rw-r--r--gas/config/tc-v850.c10
-rw-r--r--gas/config/tc-vax.c15
-rw-r--r--gas/config/tc-w65.c1
-rw-r--r--gas/config/tc-z8k.c10
-rw-r--r--gas/ecoff.c6
-rw-r--r--gas/expr.c15
-rw-r--r--gas/gasp.c51
-rw-r--r--gas/hash.c6
-rw-r--r--gas/itbl-lex.l3
-rw-r--r--gas/listing.c7
-rw-r--r--gas/macro.c33
-rw-r--r--gas/read.c36
-rw-r--r--gas/symbols.c18
-rw-r--r--gprof/ChangeLog6
-rw-r--r--gprof/gprof.c3
-rw-r--r--gprof/sym_ids.c7
-rw-r--r--ld/ChangeLog41
-rw-r--r--ld/deffilep.y14
-rw-r--r--ld/emultempl/aix.em20
-rw-r--r--ld/emultempl/elf32.em5
-rw-r--r--ld/emultempl/gld960c.em5
-rw-r--r--ld/emultempl/sunos.em7
-rw-r--r--ld/ldctor.c7
-rw-r--r--ld/ldfile.c8
-rw-r--r--ld/ldlang.c12
-rw-r--r--ld/ldlex.l6
-rw-r--r--ld/ldmain.c11
-rw-r--r--ld/lexsup.c6
-rw-r--r--ld/mpw-elfmips.c5
-rw-r--r--ld/mpw-eppcmac.c21
-rw-r--r--ld/pe-dll.c8
-rw-r--r--opcodes/ChangeLog29
-rw-r--r--opcodes/cgen-asm.c7
-rw-r--r--opcodes/cgen-opc.c10
-rw-r--r--opcodes/fr30-asm.c12
-rw-r--r--opcodes/fr30-desc.c1
-rw-r--r--opcodes/fr30-ibld.c1
-rw-r--r--opcodes/ia64-gen.c18
-rw-r--r--opcodes/m32r-asm.c12
-rw-r--r--opcodes/m32r-desc.c1
-rw-r--r--opcodes/m32r-ibld.c1
-rw-r--r--opcodes/openrisc-asm.c12
129 files changed, 1200 insertions, 836 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8d65726..e2fb365 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,48 @@
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * aoutx.h: Include "safe-ctype.h" instead of <ctype.h>.
+ (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
+ * archive.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_generic_read_ar_hdr_mag): Use ISDIGIT instead of isdigit.
+ * archures.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (bfd_default_scan): Use ISDIGIT instead of isdigit.
+ * bfd.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (bfd_scan_vma): Use ISXDIGIT/ISDIGIT/ISLOWER instead of
+ isxdigit/isdigit/islower.
+ * binary.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mangle_name): Use ISALNUM instead of isalnum.
+ * cpu-v850.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (scan): Use ISDIGIT instead of isdigit.
+ * hosts/alphavms.h: Don't include <ctype.h>.
+ * ieee.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ieee_object_p): Use TOUPPER instead of toupper.
+ * ihex.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ihex_bad_byte): Use ISPRINT instead of isprint.
+ * merge.c: Don't include <ctype.h>.
+ * oasys.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (oasys_write_sections): Use ISDIGIT instead of isdigit.
+ * pdp11.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
+ * ppcboot.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mangle_name): Use ISALNUM instead of isalnum.
+ * som.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (som_set_reloc_info): Use ISUPPER/ISLOWER/ISDIGIT instead of
+ isupper/islower/isdigit.
+ (som_decode_symclass): Use TOUPPER instead of toupper.
+ * srec.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (srec_bad_byte): Use ISPRINT instead of isprint.
+ (srec_scan): Use ISSPACE instead of isspace.
+ * stabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_link_section_stabs): Use ISDIGIT instead of isdigit.
+ * syms.c: Include "safe-ctype.h"
+ (islower, toupper): Remove macro definitions.
+ (bfd_decode_symclass): Use TOUPPER instead of toupper.
+ * vms-gsd.c: Don't include <ctype.h>.
+ * vms-hdr.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_vms_write_hdr): Use ISLOWER/TOUPPER instead of
+ islower/toupper.
+ * vms-tir.c: Don't include <ctype.h>.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* libbfd.c (bfd_bread): New function replacing bfd_read without
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 2403485..4c30e87 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -120,9 +120,9 @@ DESCRIPTION
#define KEEPIT udata.i
-#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libaout.h"
@@ -4407,7 +4407,7 @@ aout_link_write_symbols (finfo, input_bfd)
{
/* Skip the file number. */
++s;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
++s;
--s;
}
diff --git a/bfd/archive.c b/bfd/archive.c
index 1faf0c7..f158ae6 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -132,7 +132,7 @@ DESCRIPTION
#include "libbfd.h"
#include "aout/ar.h"
#include "aout/ranlib.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#ifndef errno
extern int errno;
@@ -407,7 +407,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
else if (hdr.ar_name[0] == '#'
&& hdr.ar_name[1] == '1'
&& hdr.ar_name[2] == '/'
- && isdigit ((unsigned char) hdr.ar_name[3]))
+ && ISDIGIT (hdr.ar_name[3]))
{
/* BSD-4.4 extended name */
namelen = atoi (&hdr.ar_name[3]);
diff --git a/bfd/archures.c b/bfd/archures.c
index 1a7ecbf..18925e3 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-#include <ctype.h>
+#include "safe-ctype.h"
/*
@@ -813,7 +813,7 @@ bfd_default_scan (info, string)
}
number = 0;
- while (isdigit ((unsigned char) *ptr_src))
+ while (ISDIGIT (*ptr_src))
{
number = number * 10 + *ptr_src - '0';
ptr_src++;
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 067c021..8101814 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -203,6 +203,7 @@ CODE_FRAGMENT
#endif
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -211,8 +212,6 @@ CODE_FRAGMENT
#include "libecoff.h"
#undef obj_symbols
#include "elf-bfd.h"
-
-#include <ctype.h>
/* provide storage for subsystem, stack and heap data which may have been
passed in on the command line. Ld puts this data into a bfd_link_info
@@ -1034,10 +1033,10 @@ bfd_scan_vma (string, end, base)
/* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \
- (isxdigit ((unsigned char) c) \
- ? (isdigit ((unsigned char) c) \
+ (ISXDIGIT (c) \
+ ? (ISDIGIT (c) \
? (c - '0') \
- : (10 + c - (islower ((unsigned char) c) ? 'a' : 'A'))) \
+ : (10 + c - (ISLOWER (c) ? 'a' : 'A'))) \
: 42)
for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++)
diff --git a/bfd/binary.c b/bfd/binary.c
index 4d2fe03..6ef626c 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include <ctype.h>
-
+#include "safe-ctype.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
@@ -167,7 +166,7 @@ mangle_name (abfd, suffix)
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
- if (! isalnum ((unsigned char) *p))
+ if (! ISALNUM (*p))
*p = '_';
return buf;
diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c
index 359c2c4..8836362 100644
--- a/bfd/cpu-v850.c
+++ b/bfd/cpu-v850.c
@@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
@@ -59,7 +58,7 @@ scan (info, string)
return info->the_default;
number = 0;
- while (isdigit ((unsigned char) *ptr_src))
+ while (ISDIGIT (*ptr_src))
{
number = number * 10 + * ptr_src - '0';
ptr_src ++;
diff --git a/bfd/hosts/alphavms.h b/bfd/hosts/alphavms.h
index eee391a..e77c21f 100644
--- a/bfd/hosts/alphavms.h
+++ b/bfd/hosts/alphavms.h
@@ -1,5 +1,5 @@
/* alphavms.h -- BFD definitions for an openVMS host
- Copyright 1996 Free Software Foundation, Inc.
+ Copyright 1996, 2000 Free Software Foundation, Inc.
Written by Klaus Kämpf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
@@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <ctype.h>
#include <string.h>
#include <sys/file.h>
#include <stdlib.h>
diff --git a/bfd/ieee.c b/bfd/ieee.c
index cb7dca5..42a3d40 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "ieee.h"
#include "libieee.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
struct output_buffer_struct
{
@@ -1626,12 +1625,12 @@ ieee_object_p (abfd)
strcpy (family, "68332"); /* Guess it will be CPU32 */
}
}
- else if (toupper (processor[3]) == 'F') /* 68F333 */
- strcpy (family, "68332"); /* CPU32 */
- else if ((toupper (processor[3]) == 'C') /* Embedded controllers */
- && ((toupper (processor[2]) == 'E')
- || (toupper (processor[2]) == 'H')
- || (toupper (processor[2]) == 'L')))
+ else if (TOUPPER (processor[3]) == 'F') /* 68F333 */
+ strcpy (family, "68332"); /* CPU32 */
+ else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */
+ && ((TOUPPER (processor[2]) == 'E')
+ || (TOUPPER (processor[2]) == 'H')
+ || (TOUPPER (processor[2]) == 'L')))
{
strcpy (family, "68");
strncat (family, processor + 4, 7);
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 83808ee..fbfe63c 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -123,8 +123,7 @@ The MRI compiler uses this, which is a repeat of type 5:
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
static void ihex_init PARAMS ((void));
static boolean ihex_mkobject PARAMS ((bfd *));
@@ -249,7 +248,7 @@ ihex_bad_byte (abfd, lineno, c, error)
{
char buf[10];
- if (! isprint (c))
+ if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c);
else
{
diff --git a/bfd/merge.c b/bfd/merge.c
index 150e936..2170e4e 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "hashtab.h"
-#include <ctype.h>
-
struct sec_merge_sec_info;
/* An entry in the section merge hash table. */
diff --git a/bfd/oasys.c b/bfd/oasys.c
index dcb2b73..d8dc957 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -22,7 +22,7 @@
#define UNDERSCORE_HACK 1
#include "bfd.h"
#include "sysdep.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "libbfd.h"
#include "oasys.h"
#include "liboasys.h"
@@ -1030,7 +1030,7 @@ oasys_write_sections (abfd)
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
- if (!isdigit ((unsigned char) s->name[0]))
+ if (!ISDIGIT (s->name[0]))
{
(*_bfd_error_handler)
(_("%s: can not represent section `%s' in oasys"),
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index de12563..5c1d4d2 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -304,9 +304,9 @@ DESCRIPTION
#define KEEPIT udata.i
#include <string.h> /* For strchr and friends */
-#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libaout.h"
@@ -4176,7 +4176,7 @@ aout_link_write_symbols (finfo, input_bfd)
{
/* Skip the file number. */
++s;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
++s;
--s;
}
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index 478d55a..cd196b8 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include <ctype.h>
-
+#include "safe-ctype.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
@@ -279,7 +278,7 @@ mangle_name (abfd, suffix)
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
- if (! isalnum ((unsigned char) *p))
+ if (! ISALNUM (*p))
*p = '_';
return buf;
diff --git a/bfd/som.c b/bfd/som.c
index 0ea1353..de3db50 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -31,12 +31,12 @@
#include "libbfd.h"
#include "som.h"
+#include "safe-ctype.h"
#include <sys/param.h>
#include <signal.h>
#include <machine/reg.h>
#include <sys/file.h>
-#include <ctype.h>
/* Magic not defined in standard HP-UX header files until 8.0 */
@@ -4672,13 +4672,13 @@ som_set_reloc_info (fixup, end, internal_relocs, section, symbols, just_count)
c = *cp++;
/* If this is a variable, push it on the stack. */
- if (isupper (c))
+ if (ISUPPER (c))
push (var (c));
/* If this is a lower case letter, then it represents
additional data from the fixup stream to be pushed onto
the stack. */
- else if (islower (c))
+ else if (ISLOWER (c))
{
int bits = (c - 'a') * 8;
for (v = 0; c > 'a'; --c)
@@ -4689,10 +4689,10 @@ som_set_reloc_info (fixup, end, internal_relocs, section, symbols, just_count)
}
/* A decimal constant. Push it on the stack. */
- else if (isdigit (c))
+ else if (ISDIGIT (c))
{
v = c - '0';
- while (isdigit (*cp))
+ while (ISDIGIT (*cp))
v = (v * 10) + (*cp++ - '0');
push (v);
}
@@ -5438,7 +5438,7 @@ som_decode_symclass (symbol)
else
return '?';
if (symbol->flags & BSF_GLOBAL)
- c = toupper (c);
+ c = TOUPPER (c);
return c;
}
diff --git a/bfd/srec.c b/bfd/srec.c
index 0987051..54706ac 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -108,7 +108,7 @@ DESCRIPTION
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
-#include <ctype.h>
+#include "safe-ctype.h"
static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static void srec_print_symbol
@@ -291,7 +291,7 @@ srec_bad_byte (abfd, lineno, c, error)
{
char buf[10];
- if (! isprint (c))
+ if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c);
else
{
@@ -418,7 +418,7 @@ srec_scan (abfd)
*p++ = c;
while ((c = srec_get_byte (abfd, &error)) != EOF
- && ! isspace (c))
+ && ! ISSPACE (c))
{
if ((bfd_size_type) (p - symbuf) >= alc)
{
diff --git a/bfd/stabs.c b/bfd/stabs.c
index ea7e486..f54d658 100644
--- a/bfd/stabs.c
+++ b/bfd/stabs.c
@@ -26,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
#include "aout/stab_gnu.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
/* Stabs entries use a 12 byte format:
4 byte string table index
@@ -364,7 +363,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
{
/* Skip the file number. */
++str;
- while (isdigit ((unsigned char) *str))
+ while (ISDIGIT (*str))
++str;
--str;
}
diff --git a/bfd/syms.c b/bfd/syms.c
index 9c8922b..b334c11 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -308,6 +308,7 @@ CODE_FRAGMENT
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "aout/stab_gnu.h"
@@ -556,13 +557,6 @@ coff_section_type (s)
return '?';
}
-#ifndef islower
-#define islower(c) ((c) >= 'a' && (c) <= 'z')
-#endif
-#ifndef toupper
-#define toupper(c) (islower(c) ? ((c) & ~0x20) : (c))
-#endif
-
/*
FUNCTION
bfd_decode_symclass
@@ -617,7 +611,7 @@ bfd_decode_symclass (symbol)
else
return '?';
if (symbol->flags & BSF_GLOBAL)
- c = toupper (c);
+ c = TOUPPER (c);
return c;
/* We don't have to handle these cases just yet, but we will soon:
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index 2ee015f..538c148 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -21,8 +21,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c
index c6278c1..fedfe75 100644
--- a/bfd/vms-hdr.c
+++ b/bfd/vms-hdr.c
@@ -24,11 +24,10 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
+#include "safe-ctype.h"
#include "libbfd.h"
#include "vms.h"
@@ -303,8 +302,7 @@ _bfd_vms_write_hdr (abfd, objtype)
fptr = fout;
while (*fptr != 0)
{
- if (islower (*fptr))
- *fptr = toupper (*fptr);
+ *fptr = TOUPPER (*fptr);
fptr++;
if ((*fptr == ';')
|| ((fptr - fout) > 31))
diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c
index fc9d23d..e4ce47f 100644
--- a/bfd/vms-tir.c
+++ b/bfd/vms-tir.c
@@ -33,8 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
qw quadword (8 byte, 64 bit)
da data stream */
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b659091..e25add5 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,59 @@
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * addr2line.c: Don't include <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * ar.c (main): Likewise.
+ * coffdump.c (main): Likewise.
+ * dlltool.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ Use ISALNUM instead of isalpha/isdigit.
+ * dllwrap.c: Don't include <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * nlmconv.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ Use TOUPPER instead of islower/toupper.
+ * nlmheader.y: Include "safe-ctype.h" instead of <ctype.h>.
+ (yylex): Use ISSPACE/ISALNUM instead of isspace/isalnum.
+ Use TOUPPER instead of islower/toupper.
+ * nm.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * objcopy.c (main): Likewise.
+ * objdump.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (disassemble_bytes): Use ISPRINT instead of isprint.
+ (dump_section_stabs): Use ISDIGIT instead of isdigit.
+ (dump_data): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * rclex.l: Include "safe-ctype.h" instead of <ctype.h>.
+ (cpp_line, handle_quotes): Use ISSPACE instead of isspace.
+ * rcparse.y: Include "safe-ctype.h" instead of <ctype.h>.
+ Use TOUPPER instead of islower/toupper.
+ * readelf.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * resrc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (write_rc_accelerators): Use ISPRINT instead of isprint.
+ (write_rc_rcdata): Likewise.
+ * size.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * srconv.c (main): Likewise.
+ * stabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_number): Use ISDIGIT/ISUPPER/ISLOWER instead of
+ isdigit/isupper/islower.
+ (parse_stab_string, parse_stab_type, parse_stab_argtypes,
+ parse_stab_array_type, stab_demangle_count, stab_demangle_get_count,
+ stab_demangle_prefix, stab_demangle_qualified,
+ stab_demangle_template, stab_demangle_type,
+ stab_demangle_fund_type): Use ISDIGIT instead of isdigit.
+ * strings.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (isgraphic): Use ISPRINT instead of isascii/isprint.
+ (main): Remove HAVE_LC_MESSAGES dependency.
+ * sysdump.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (pbarray): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * windres.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (format_from_filename): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * winduni.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (unicode_print): Use ISPRINT instead of isprint.
+ * wrstabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (stab_variable): Use ISDIGIT instead of isdigit.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* ar.c (print_contents): Cast args of bfd_seek to the right types.
diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index daae503..6315887 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -1,5 +1,5 @@
/* addr2line.c -- convert addresses to line number and function name
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.siemens.de>
This file is part of GNU Binutils.
@@ -28,7 +28,6 @@
both forms write results to stdout, the second form reads addresses
to be converted from stdin. */
-#include <ctype.h>
#include <string.h>
#include "bfd.h"
@@ -278,6 +277,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/ar.c b/binutils/ar.c
index c0732f0..fe46b91 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -379,6 +379,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/coffdump.c b/binutils/coffdump.c
index 42a1e70..0bd39f4 100644
--- a/binutils/coffdump.c
+++ b/binutils/coffdump.c
@@ -493,6 +493,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 4295e0a..6723060 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1,5 +1,5 @@
/* dlltool.c -- tool to generate stuff for PE style DLLs
- Copyright 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -253,8 +253,8 @@
#include "demangle.h"
#include "dyn-string.h"
#include "dlltool.h"
+#include "safe-ctype.h"
-#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
@@ -3220,6 +3220,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -3386,7 +3389,7 @@ main (ac, av)
imp_name_lab = xstrdup (imp_name);
for (p = imp_name_lab; *p; p++)
{
- if (!isalpha ((unsigned char) *p) && !isdigit ((unsigned char) *p))
+ if (!ISALNUM (*p))
*p = '_';
}
head_label = make_label("_head_", imp_name_lab);
diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c
index 8f83dda..fb92cb2 100644
--- a/binutils/dllwrap.c
+++ b/binutils/dllwrap.c
@@ -1,5 +1,5 @@
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils.
@@ -36,7 +36,6 @@
#include "getopt.h"
#include "dyn-string.h"
-#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
@@ -664,6 +663,15 @@ main (argc, argv)
program_name = argv[0];
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+ setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
saved_argv = (char **) xmalloc (argc * sizeof (char*));
dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
driver_arg_indices = (int *) xmalloc (argc * sizeof (int));
diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c
index 9c7dd37..64284da 100644
--- a/binutils/nlmconv.c
+++ b/binutils/nlmconv.c
@@ -1,5 +1,5 @@
/* nlmconv.c -- NLM conversion program
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -35,10 +35,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "libiberty.h"
#include "bucomm.h"
+#include "safe-ctype.h"
#include <ansidecl.h>
#include <time.h>
-#include <ctype.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <assert.h>
@@ -214,6 +214,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -1071,8 +1074,7 @@ main (argc, argv)
for (modname = nlm_fixed_header (outbfd)->moduleName;
*modname != '\0';
modname++)
- if (islower ((unsigned char) *modname))
- *modname = toupper (*modname);
+ *modname = TOUPPER (*modname);
strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG",
NLM_OLD_THREAD_NAME_LENGTH);
diff --git a/binutils/nlmheader.y b/binutils/nlmheader.y
index 3ab5a79..5d83f31 100644
--- a/binutils/nlmheader.y
+++ b/binutils/nlmheader.y
@@ -1,5 +1,5 @@
%{/* nlmheader.y - parse NLM header specification keywords.
- Copyright 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ansidecl.h>
#include <stdio.h>
-#include <ctype.h>
+#include "safe-ctype.h"
#include "bfd.h"
#include "bucomm.h"
#include "nlm/common.h"
@@ -682,7 +682,7 @@ tail_recurse:
c = getc (current.file);
/* Commas are treated as whitespace characters. */
- while (isspace ((unsigned char) c) || c == ',')
+ while (ISSPACE (c) || c == ',')
{
current.state = IN_LINE;
if (c == '\n')
@@ -735,9 +735,9 @@ tail_recurse:
if (c == '\n')
++current.lineno;
}
- while (isspace ((unsigned char) c));
+ while (ISSPACE (c));
BUF_INIT ();
- while (! isspace ((unsigned char) c) && c != EOF)
+ while (! ISSPACE (c) && c != EOF)
{
BUF_ADD (c);
c = getc (current.file);
@@ -755,17 +755,14 @@ tail_recurse:
if (current.state == BEGINNING_OF_LINE)
{
BUF_INIT ();
- while (isalnum ((unsigned char) c) || c == '_')
+ while (ISALNUM (c) || c == '_')
{
- if (islower ((unsigned char) c))
- BUF_ADD (toupper ((unsigned char) c));
- else
- BUF_ADD (c);
+ BUF_ADD (TOUPPER (c));
c = getc (current.file);
}
BUF_FINISH ();
- if (c != EOF && ! isspace ((unsigned char) c) && c != ',')
+ if (c != EOF && ! ISSPACE (c) && c != ',')
{
nlmheader_identify ();
fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
@@ -838,7 +835,7 @@ tail_recurse:
/* Gather a generic argument. */
BUF_INIT ();
- while (! isspace (c)
+ while (! ISSPACE (c)
&& c != ','
&& c != COMMENT_CHAR
&& c != '('
diff --git a/binutils/nm.c b/binutils/nm.c
index c422e9b..e6cc368 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -405,6 +405,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 160f28b..4be1d59 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2611,6 +2611,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 168f246..5020040 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -23,7 +23,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "getopt.h"
#include "progress.h"
#include "bucomm.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "dis-asm.h"
#include "libiberty.h"
#include "demangle.h"
@@ -1345,7 +1345,7 @@ disassemble_bytes (info, disassemble_fn, insns, data,
for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j)
{
- if (isprint (data[j]))
+ if (ISPRINT (data[j]))
buf[j - addr_offset * opb] = data[j];
else
buf[j - addr_offset * opb] = '.';
@@ -1999,7 +1999,7 @@ dump_section_stabs (abfd, stabsect_name, strsect_name)
match or a section followed by a number. */
if (strncmp (stabsect_name, s->name, len) == 0
&& (s->name[len] == '\000'
- || isdigit ((unsigned char) s->name[len])))
+ || ISDIGIT (s->name[len])))
{
if (read_section_stabs (abfd, s->name, strsect_name))
{
@@ -2286,7 +2286,7 @@ dump_data (abfd)
if (j >= stop_offset * opb)
printf (" ");
else
- printf ("%c", isprint (data[j]) ? data[j] : '.');
+ printf ("%c", ISPRINT (data[j]) ? data[j] : '.');
}
putchar ('\n');
}
@@ -2766,6 +2766,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/rclex.l b/binutils/rclex.l
index d05d1c0..c9073e2 100644
--- a/binutils/rclex.l
+++ b/binutils/rclex.l
@@ -1,5 +1,5 @@
%{ /* rclex.l -- lexer for Windows rc files parser */
-/* Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -26,10 +26,10 @@
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "windres.h"
#include "rcparse.h"
-#include <ctype.h>
#include <assert.h>
/* Whether we are in rcdata mode, in which we returns the lengths of
@@ -252,18 +252,18 @@ cpp_line (s)
char *send, *fn;
++s;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
line = strtol (s, &send, 0);
- if (*send != '\0' && ! isspace ((unsigned char) *send))
+ if (*send != '\0' && ! ISSPACE (*send))
return;
/* Subtract 1 because we are about to count the newline. */
rc_lineno = line - 1;
s = send;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s != '"')
@@ -423,8 +423,8 @@ handle_quotes (input, len)
else
{
++t;
- assert (isspace ((unsigned char) *t));
- while (isspace ((unsigned char) *t))
+ assert (ISSPACE (*t));
+ while (ISSPACE (*t))
++t;
if (*t == '\0')
break;
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index f2378c0..152c8ee 100644
--- a/binutils/rcparse.y
+++ b/binutils/rcparse.y
@@ -1,5 +1,5 @@
%{ /* rcparse.y -- parser for Windows rc files
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -26,8 +26,7 @@
#include "bucomm.h"
#include "libiberty.h"
#include "windres.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
/* The current language. */
@@ -245,7 +244,7 @@ acc_event:
$$.flags = ACC_CONTROL | ACC_VIRTKEY;
++s;
ch = *s;
- ch = toupper ((unsigned char) ch);
+ ch = TOUPPER (ch);
}
$$.key = ch;
if (s[1] != '\0')
@@ -1259,8 +1258,7 @@ id:
/* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++)
- if (islower ((unsigned char) *s))
- *s = toupper ((unsigned char) *s);
+ *s = TOUPPER (*s);
res_string_to_id (&$$, copy);
free (copy);
}
@@ -1297,8 +1295,7 @@ resref:
/* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++)
- if (islower ((unsigned char) *s))
- *s = toupper ((unsigned char) *s);
+ *s = TOUPPER (*s);
res_string_to_id (&$$, copy);
free (copy);
}
diff --git a/binutils/readelf.c b/binutils/readelf.c
index cf3c2c2..eced501 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9012,6 +9012,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/resrc.c b/binutils/resrc.c
index a29a664..eb7db96 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -1,5 +1,5 @@
/* resrc.c -- read and write Windows rc files.
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -25,10 +25,10 @@
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "windres.h"
#include <assert.h>
-#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
@@ -1976,7 +1976,7 @@ write_rc_accelerators (e, accelerators)
fprintf (e, " ");
if ((acc->key & 0x7f) == acc->key
- && isprint ((unsigned char) acc->key)
+ && ISPRINT (acc->key)
&& (acc->flags & ACC_VIRTKEY) == 0)
{
fprintf (e, "\"%c\"", acc->key);
@@ -2383,7 +2383,7 @@ write_rc_rcdata (e, rcdata, ind)
s = ri->u.string.s;
for (i = 0; i < ri->u.string.length; i++)
{
- if (isprint ((unsigned char) *s))
+ if (ISPRINT (*s))
putc (*s, e);
else
fprintf (e, "\\%03o", *s);
@@ -2421,7 +2421,7 @@ write_rc_rcdata (e, rcdata, ind)
if (i + 4 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ",");
for (j = 0; j < 4; ++j)
- if (! isprint (ri->u.buffer.data[i + j])
+ if (! ISPRINT (ri->u.buffer.data[i + j])
&& ri->u.buffer.data[i + j] != 0)
break;
if (j >= 4)
@@ -2429,7 +2429,7 @@ write_rc_rcdata (e, rcdata, ind)
fprintf (e, "\t// ");
for (j = 0; j < 4; ++j)
{
- if (! isprint (ri->u.buffer.data[i + j]))
+ if (! ISPRINT (ri->u.buffer.data[i + j]))
fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else
{
@@ -2455,7 +2455,7 @@ write_rc_rcdata (e, rcdata, ind)
if (i + 2 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ",");
for (j = 0; j < 2; ++j)
- if (! isprint (ri->u.buffer.data[i + j])
+ if (! ISPRINT (ri->u.buffer.data[i + j])
&& ri->u.buffer.data[i + j] != 0)
break;
if (j >= 2)
@@ -2463,7 +2463,7 @@ write_rc_rcdata (e, rcdata, ind)
fprintf (e, "\t// ");
for (j = 0; j < 2; ++j)
{
- if (! isprint (ri->u.buffer.data[i + j]))
+ if (! ISPRINT (ri->u.buffer.data[i + j]))
fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else
{
@@ -2483,7 +2483,7 @@ write_rc_rcdata (e, rcdata, ind)
if (! first)
indent (e, ind + 2);
if ((ri->u.buffer.data[i] & 0x7f) == ri->u.buffer.data[i]
- && isprint (ri->u.buffer.data[i]))
+ && ISPRINT (ri->u.buffer.data[i]))
fprintf (e, "\"%c\"", ri->u.buffer.data[i]);
else
fprintf (e, "\"\\%03o\"", ri->u.buffer.data[i]);
diff --git a/binutils/size.c b/binutils/size.c
index 47a91ad..4344242 100644
--- a/binutils/size.c
+++ b/binutils/size.c
@@ -1,5 +1,5 @@
/* size.c -- report size of various sections of an executable file.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -113,6 +113,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/srconv.c b/binutils/srconv.c
index a60be25..9a40f16 100644
--- a/binutils/srconv.c
+++ b/binutils/srconv.c
@@ -1965,6 +1965,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/stabs.c b/binutils/stabs.c
index 8045140..bbc0632 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -26,11 +26,11 @@
trying to identify the correct address for anything. */
#include <stdio.h>
-#include <ctype.h>
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "demangle.h"
#include "debug.h"
#include "budbg.h"
@@ -307,11 +307,11 @@ parse_number (pp, poverflow)
int d;
d = *p++;
- if (isdigit ((unsigned char) d))
+ if (ISDIGIT (d))
d -= '0';
- else if (isupper ((unsigned char) d))
+ else if (ISUPPER (d))
d -= 'A';
- else if (islower ((unsigned char) d))
+ else if (ISLOWER (d))
d -= 'a';
else
break;
@@ -781,7 +781,7 @@ parse_stab_string (dhandle, info, stabtype, desc, value, string)
}
++p;
- if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
+ if (ISDIGIT (*p) || *p == '(' || *p == '-')
type = 'l';
else
type = *p++;
@@ -1185,7 +1185,7 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
/* Read type number if present. The type number may be omitted.
for instance in a two-dimensional array declared with type
"ar1;1;10;ar1;1;10;4". */
- if (! isdigit ((unsigned char) **pp) && **pp != '(' && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '(' && **pp != '-')
{
/* 'typenums=' not present, type is anonymous. Read and return
the definition, but don't put it in the type vector. */
@@ -1228,7 +1228,7 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
const char *p = *pp + 1;
const char *attr;
- if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
+ if (ISDIGIT (*p) || *p == '(' || *p == '-')
{
/* Member type. */
break;
@@ -2913,7 +2913,7 @@ parse_stab_argtypes (dhandle, info, class_type, fieldname, tagname,
/* Constructors are sometimes handled specially. */
is_full_physname_constructor = ((argtypes[0] == '_'
&& argtypes[1] == '_'
- && (isdigit ((unsigned char) argtypes[2])
+ && (ISDIGIT (argtypes[2])
|| argtypes[2] == 'Q'
|| argtypes[2] == 't'))
|| strncmp (argtypes, "__ct", 4) == 0);
@@ -3149,7 +3149,7 @@ parse_stab_array_type (dhandle, info, pp, stringp)
adjustable = false;
- if (! isdigit ((unsigned char) **pp) && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '-')
{
++*pp;
adjustable = true;
@@ -3163,7 +3163,7 @@ parse_stab_array_type (dhandle, info, pp, stringp)
}
++*pp;
- if (! isdigit ((unsigned char) **pp) && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '-')
{
++*pp;
adjustable = true;
@@ -3772,7 +3772,7 @@ stab_demangle_count (pp)
unsigned int count;
count = 0;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
{
count *= 10;
count += **pp - '0';
@@ -3789,12 +3789,12 @@ stab_demangle_get_count (pp, pi)
const char **pp;
unsigned int *pi;
{
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
return false;
*pi = **pp - '0';
++*pp;
- if (isdigit ((unsigned char) **pp))
+ if (ISDIGIT (**pp))
{
unsigned int count;
const char *p;
@@ -3807,7 +3807,7 @@ stab_demangle_get_count (pp, pi)
count += *p - '0';
++p;
}
- while (isdigit ((unsigned char) *p));
+ while (ISDIGIT (*p));
if (*p == '_')
{
*pp = p + 1;
@@ -3902,7 +3902,7 @@ stab_demangle_prefix (minfo, pp)
scan += i - 2;
if (scan == *pp
- && (isdigit ((unsigned char) scan[2])
+ && (ISDIGIT (scan[2])
|| scan[2] == 'Q'
|| scan[2] == 't'))
{
@@ -3911,7 +3911,7 @@ stab_demangle_prefix (minfo, pp)
return true;
}
else if (scan == *pp
- && ! isdigit ((unsigned char) scan[2])
+ && ! ISDIGIT (scan[2])
&& scan[2] != 't')
{
/* Look for the `__' that separates the prefix from the
@@ -4126,13 +4126,13 @@ stab_demangle_qualified (minfo, pp, ptype)
preceded by an underscore (to distinguish it from the <= 9
case) and followed by an underscore. */
p = *pp + 2;
- if (! isdigit ((unsigned char) *p) || *p == '0')
+ if (! ISDIGIT (*p) || *p == '0')
{
stab_bad_demangle (orig);
return false;
}
qualifiers = atoi (p);
- while (isdigit ((unsigned char) *p))
+ while (ISDIGIT (*p))
++p;
if (*p != '_')
{
@@ -4397,7 +4397,7 @@ stab_demangle_template (minfo, pp, pname)
{
if (**pp == 'm')
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
else if (charp)
@@ -4428,18 +4428,18 @@ stab_demangle_template (minfo, pp, pname)
{
if (**pp == 'm')
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
if (**pp == '.')
{
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
if (**pp == 'e')
{
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
}
@@ -4692,7 +4692,7 @@ stab_demangle_type (minfo, pp, ptype)
high = 0;
while (**pp != '\0' && **pp != '_')
{
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
{
stab_bad_demangle (orig);
return false;
@@ -4796,7 +4796,7 @@ stab_demangle_type (minfo, pp, ptype)
varargs = false;
++*pp;
- if (isdigit ((unsigned char) **pp))
+ if (ISDIGIT (**pp))
{
n = stab_demangle_count (pp);
if (strlen (*pp) < n)
@@ -5106,7 +5106,7 @@ stab_demangle_fund_type (minfo, pp, ptype)
case 'G':
++*pp;
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
{
stab_bad_demangle (orig);
return false;
diff --git a/binutils/strings.c b/binutils/strings.c
index 7326cae..c6cf10d 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -59,10 +59,10 @@
#include "bfd.h"
#include <stdio.h>
#include <getopt.h>
-#include <ctype.h>
#include <errno.h>
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
/* Some platforms need to put stdin into binary mode, to read
binary files. */
@@ -81,14 +81,7 @@
#endif
#endif
-/* Not all printable characters have ASCII codes (depending upon the
- LOCALE set) but on some older systems it is not safe to test isprint
- without first testing isascii... */
-#if defined isascii && !defined HAVE_LOCALE_H
-#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t'))
-#else
-#define isgraphic(c) (isprint (c) || (c) == '\t')
-#endif
+#define isgraphic(c) (ISPRINT (c) || (c) == '\t')
#ifndef errno
extern int errno;
@@ -153,7 +146,7 @@ main (argc, argv)
int exit_status = 0;
boolean files_given = false;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
diff --git a/binutils/sysdump.c b/binutils/sysdump.c
index 28fafea..874b9e5 100644
--- a/binutils/sysdump.c
+++ b/binutils/sysdump.c
@@ -26,9 +26,9 @@
#include "bfd.h"
#include "bucomm.h"
+#include "safe-ctype.h"
#include <stdio.h>
-#include <ctype.h>
#include <libiberty.h>
#include <getopt.h>
#include "sysroff.h"
@@ -260,7 +260,8 @@ pbarray (y)
printf ("%d (", y->len);
for (x = 0; x < y->len; x++)
{
- printf ("(%02x %c)", y->data[x], isprint (y->data[x]) ? y->data[x] : '.');
+ printf ("(%02x %c)", y->data[x],
+ ISPRINT (y->data[x]) ? y->data[x] : '.');
}
printf (")\n");
}
@@ -760,6 +761,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/windres.c b/binutils/windres.c
index d76f35e..f802706 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -1,5 +1,5 @@
/* windres.c -- a program to manipulate Windows resources
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -39,11 +39,11 @@
#include "getopt.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "windres.h"
#include <assert.h>
-#include <ctype.h>
#include <time.h>
/* used by resrc.c at least */
@@ -679,11 +679,11 @@ format_from_filename (filename, input)
return RES_FORMAT_RES;
/* If every character is printable or space, assume it's an RC file. */
- if ((isprint (b1) || isspace (b1))
- && (isprint (b2) || isspace (b2))
- && (isprint (b3) || isspace (b3))
- && (isprint (b4) || isspace (b4))
- && (isprint (b5) || isspace (b5)))
+ if ((ISPRINT (b1) || ISSPACE (b1))
+ && (ISPRINT (b2) || ISSPACE (b2))
+ && (ISPRINT (b3) || ISSPACE (b3))
+ && (ISPRINT (b4) || ISSPACE (b4))
+ && (ISPRINT (b5) || ISSPACE (b5)))
return RES_FORMAT_RC;
/* Otherwise, we give up. */
@@ -789,6 +789,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/winduni.c b/binutils/winduni.c
index d79f47a..deb6a94 100644
--- a/binutils/winduni.c
+++ b/binutils/winduni.c
@@ -1,5 +1,5 @@
/* winduni.c -- unicode support for the windres program.
- Copyright 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -30,8 +30,7 @@
#include "bfd.h"
#include "bucomm.h"
#include "winduni.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef _WIN32
#include <windows.h>
@@ -99,7 +98,7 @@ unicode_print (e, unicode, length)
{
if (ch == '\\')
fputs ("\\", e);
- else if (isprint (ch))
+ else if (ISPRINT (ch))
putc (ch, e);
else
{
diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c
index 0b29511..4f10e0d 100644
--- a/binutils/wrstabs.c
+++ b/binutils/wrstabs.c
@@ -1,5 +1,5 @@
/* wrstabs.c -- Output stabs debugging information
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
@@ -23,12 +23,12 @@
information. */
#include <stdio.h>
-#include <ctype.h>
#include <assert.h>
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "debug.h"
#include "budbg.h"
@@ -2172,7 +2172,7 @@ stab_variable (p, name, kind, val)
kindstr = "";
/* Make sure that this is a type reference or definition. */
- if (! isdigit ((unsigned char) *s))
+ if (! ISDIGIT (*s))
{
char *n;
long index;
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ce8567d..ba90aaf 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,232 @@
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * as.h: Don't include <ctype.h>.
+ * as.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * atof-generic.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (atof_generic): Use ISDIGIT instead of isdigit.
+ * config/m68k-parse.y: Include "safe-ctype.h".
+ (yylex): Use ISDIGIT/ISALNUM instead of isdigit/isalnum.
+ * config/obj-elf.c: Include "safe-ctype.h".
+ (obj_elf_vtable_inherit): Use ISSPACE instead of isspace.
+ * config/obj-vms.c: Include "safe-ctype.h".
+ (Write_VMS_MHD_Records): Use TOUPPER instead of islower/toupper.
+ (VMS_Case_Hack_Symbol): Use ISUPPER/ISLOWER/TOUPPER/TOLOWER
+ instead of isupper/islower/toupper/tolower.
+ * config/tc-a29k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (insert_sreg): Use TOUPPER instead of islower/toupper.
+ (machine_ip): Use ISALPHA/ISALNUM/ISUPPER/TOLOWER instead of
+ isalpha/isalnum/isupper/tolower.
+ (a29k_unrecognized_line, md_operand): Use ISDIGIT instead of
+ isdigit.
+ * config/tc-alpha.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_undefined_symbol, s_alpha_ent): Use ISDIGIT instead of isdigit.
+ * config/tc-arc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE/ISALNUM instead of isspace/isalnum.
+ (arc_extoper): Use TOLOWER instead of isupper/tolower.
+ * config/tc-arm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (arm_psr_parse): Use ISALPHA instead of isalpha.
+ (accum0_required_here): Use ISALNUM instead of isalnum.
+ (do_ldrd): Use ISSPACE instead of isspace.
+ (decode_shift): Use ISALPHA instead of isalpha.
+ (insert_reg): Use TOUPPER instead of islower/toupper.
+ (arm_reg_parse): Use ISALPHA instead of isalpha.
+ (arm_parse_reloc): Use ISALNUM/ISPUNCT/TOLOWER instead of
+ isalnum/ispunct/tolower.
+ * config/tc-avr.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_parse_option): Use TOLOWER instead of tolower.
+ (avr_operand): Use ISDIGIT/TOLOWER instead of isdigit/tolower.
+ * config/tc-cris.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (cris_process_instruction): Use ISLOWER instead of islower.
+ (get_gen_reg): Use ISALNUM/ISDIGIT instead of isalnum/isdigit.
+ (get_spec_reg): Use TOLOWER/ISALNUM instead of isupper/tolower/isalnum.
+ (get_flags): Use ISSPACE instead of isspace.
+ * config/tc-d10v.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (do_assemble): Use TOLOWER instead of tolower.
+ * config/tc-d30v.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (do_assemble): Use TOLOWER instead of tolower.
+ (d30v_start_line): Use ISSPACE instead of isspace.
+ * config/tc-fr30.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (fr30_is_colon_insn): Use TOLOWER instead of tolower.
+ * config/tc-h8300.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (skip_colonthing, get_operand): Use ISDIGIT instead of isdigit.
+ * config/tc-h8500.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (start_label): Use ISALPHA instead of isalpha.
+ * config/tc-hppa.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (pa_ip): Use ISUPPER/ISLOWER/TOLOWER instead of
+ isupper/islower/tolower.
+ (pa_parse_number): Use ISDIGIT instead of isdigit.
+ (pa_chk_field_selector): Use TOLOWER instead of tolower.
+ (pa_stringer): Use ISDIGIT instead of isdigit.
+ * config/tc-i370.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (register_name): Use ISALPHA instead of isalpha.
+ (i370_elf_suffix): Use ISALNUM/TOLOWER instead of
+ isalnum/islower/tolower.
+ (i370_addr_offset): Use ISDIGIT/ISALPHA instead of
+ isdigit/isalpha.
+ (i370_addr_cons): Use ISALPHA/ISXDIGIT instead of
+ isalpha/isxdigit.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-i386.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_begin): Use ISDIGIT/ISLOWER/ISUPPER/TOLOWER/ISALPHA
+ instead of isdigit/islower/isupper/tolower/isalpha.
+ (output_invalid): Use ISPRINT instead of isprint.
+ * config/tc-i860.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (i860_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit.
+ * config/tc-i960.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (get_args): Use ISALNUM instead of isalnum.
+ * config/tc-ia64.c: Include "safe-ctype.h".
+ (dot_pred_rel): Use TOUPPER/ISDIGIT instead of toupper/isdigit.
+ (ia64_unrecognized_line): Use ISDIGIT instead of isdigit.
+ (ia64_parse_name): Likewise.
+ * config/tc-m32r.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (assemble_two_insns): Use ISSPACE/ISALNUM/ISUPPER/TOLOWER
+ instead of isspace/isalnum/isupper/tolower.
+ * config/tc-m68hc11.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use TOLOWER/ISALNUM instead of tolower/isalnum.
+ * config/tc-m68k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mklower_table): Remove variable.
+ (mklower): Remove macro.
+ (insert_reg): Use TOUPPER instead of islower/toupper.
+ (md_begin): Remove initialization of mklower_table.
+ (s_reg): Use ISALNUM instead of isalnum.
+ (mri_assemble): Use ISUPPER/TOLOWER instead of isupper/tolower.
+ (parse_mri_condition): Use TOLOWER instead of isupper/tolower.
+ (build_mri_control_operand): Use TOLOWER instead of tolower.
+ (s_mri_else, s_mri_break, s_mri_next, s_mri_for): Likewise.
+ * config/tc-m88k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE instead of isspace.
+ (get_imm16): Use ISALNUM instead of isalnum.
+ (get_cnd): Use ISDIGIT/ISUPPER/TOLOWER instead of
+ isdigit/isupper/tolower.
+ (get_bf_offset_expression): Use ISALPHA/ISUPPER/TOLOWER
+ instead of isalpha/isupper/tolower.
+ (hexval): Use ISDIGIT/ISLOWER/ISUPPER instead of
+ isdigit/islower/isupper.
+ * config/tc-mcore.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mcore_s_section): Use ISSPACE instead of isspace.
+ (parse_reg): Use ISSPACE/TOLOWER/ISALNUM instead of
+ isspace/tolower/isalnum.
+ (parse_creg): Use ISSPACE/TOLOWER instead of isspace/tolower.
+ (parse_psrmod): Use TOLOWER instead of isascii/tolower.
+ (parse_exp, parse_mem, md_assemble): Use ISSPACE instead of
+ isspace.
+ * config/tc-mips.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mips_ip): Use ISSPACE/ISDIGIT instead of isspace/isdigit.
+ (mips16_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit.
+ (my_getSmallExpression): Use ISDIGIT/TOLOWER instead of
+ isdigit/tolower.
+ (tc_get_register): Likewise.
+ (get_number): Use ISDIGIT/ISXDIGIT instead of isdigit/isxdigit.
+ (s_mips_ent): Use ISDIGIT instead of isdigit.
+ * config/tc-mn10200.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-mn10300.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-ns32k.c: Don't include <ctype.h>.
+ * config/tc-pdp11.c: Include "safe-ctype.h".
+ (mklower): Remove function.
+ (parse_reg): Use TOLOWER instead of mklower.
+ * config/tc-pj.c: Include "safe-ctype.h".
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-ppc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (register_name): Use ISALPHA instead of isalpha.
+ (ppc_elf_suffix): Use ISALNUM/TOLOWER instead of
+ isalnum/islower/tolower.
+ (md_assemble): Use ISSPACE instead of isspace.
+ (ppc_canonicalize_symbol_name): Use ISLOWER/TOUPPER instead of
+ islower/toupper.
+ * config/tc-s390.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (register_name): Use ISALPHA instead of isalpha.
+ (s390_elf_suffix, s390_lit_suffix): Use ISALNUM instead of isalnum.
+ (md_gather_operands, md_assemble, s390_insn): Use ISSPACE instead of
+ isspace.
+ * config/tc-sh.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (sh_elf_suffix): Use ISALNUM/TOLOWER instead of
+ isalnum/islower/tolower.
+ (IDENT_CHAR): Use ISALNUM instead of isalnum.
+ (parse_reg): Use TOLOWER instead of tolower.
+ (find_cooked_opcode): Use TOLOWER instead of isupper/tolower.
+ * config/tc-sparc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (sparc_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit.
+ (parse_keyword_arg): Use ISALNUM instead of isalnum.
+ * config/tc-tahoe.c: Include "safe-ctype.h".
+ (tahoe_reg_parse): Use ISDIGIT instead of isdigit.
+ (tip_op): Use TOLOWER instead of isupper/tolower.
+ * config/tc-tic30.c: Include "safe-ctype.h".
+ (md_begin): Use ISLOWER/ISDIGIT/ISUPPER/TOLOWER/ISLOWER/
+ ISALPHA instead of islower/isdigit/isupper/tolower/islower/isalpha.
+ (tic30_operand): Use TOLOWER instead of tolower.
+ (tic30_find_parallel_insn): Likewise.
+ (output_invalid): Use ISPRINT instead of isprint.
+ * config/tc-tic54x.c: Include "safe-ctype.h".
+ (tic54x_asg, tic54x_eval): Use ISALPHA instead of isalpha.
+ (lookup_version): Use TOUPPER instead of toupper.
+ (tic54x_var): Use ISALPHA instead of isalpha.
+ (tic54x_mlib): Use ISSPACE instead of isspace.
+ (subsym_iscons): Use TOUPPER instead of toupper.
+ (get_operands): Use ISSPACE instead of isspace.
+ (is_type): Use TOUPPER/ISDIGIT instead of toupper/isdigit.
+ (encode_indirect, encode_operand): Use TOUPPER instead of toupper.
+ (next_line_shows_parallel): Use ISSPACE instead of isspace.
+ (subsym_get_arg, subsym_substitute): Use ISDIGIT instead of isdigit.
+ (tic54x_start_line_hook, md_assemble, tic54x_start_label): Use
+ ISSPACE instead of isspace.
+ * config/tc-tic80.c: Include "safe-ctype.h".
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-v850.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (system_register_name): Use ISDIGIT instead of isdigit.
+ (md_assemble): Use ISSPACE instead of isspace.
+ * config/tc-vax.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (vax_reg_parse): Use TOLOWER/ISDIGIT instead of
+ isupper/tolower/isdigit.
+ (vip_op): Use TOLOWER instead of isupper/tolower.
+ * config/tc-w65.c: Don't include <ctype.h>.
+ * config/tc-z8k.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (tohex): Use ISDIGIT/ISLOWER instead of isdigit/islower.
+ (whatreg): Use ISDIGIT instead of isdigit.
+ * ecoff.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ecoff_directive_ent, ecoff_stab): Use ISDIGIT instead of isdigit.
+ * expr.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (integer_constant): Use ISALNUM/TOUPPER instead of
+ isalnum/islower/toupper.
+ (operand): Use TOLOWER instead of isupper/tolower.
+ * gasp.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (sb_strtol, level_0, change_base, doinstr): Use ISDIGIT instead
+ of isdigit.
+ (process_assigns, whatcond): Use TOUPPER instead of toupper.
+ (chartype_init): Use ISALPHA/ISDIGIT instead of isalpha/isdigit.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * hash.c: Include "safe-ctype.h".
+ (main): Use TOLOWER instead of isupper/tolower.
+ * itbl-lex.l: Don't include <ctype.h>.
+ * listing.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (listing_newline): Use ISCNTRL instead of isascii/iscntrl. Don't
+ omit non-ASCII characters.
+ (debugging_pseudo): Use ISSPACE instead of isspace.
+ * macro.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (buffer_and_nest): Use ISALNUM instead of isalnum.
+ (get_token): Use ISALPHA/ISALNUM instead of isalpha/isalnum.
+ (define_macro): Use ISUPPER/TOLOWER instead of isupper/tolower.
+ (macro_expand_body): Use ISALNUM/ISDIGIT/ISUPPER/ISALPHA
+ instead of isalnum/isdigit/isupper/isalpha.
+ (check_macro): Use ISALPHA/ISALNUM/ISUPPER/TOLOWER instead
+ of isalpha/isalnum/isupper/tolower.
+ * read.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (read_a_source_file): Use ISUPPER/TOLOWER/ISDIGIT instead of
+ isupper/tolower/isdigit.
+ (s_mri_common): Use ISDIGIT instead of isdigit.
+ (s_mri_sect): Use ISDIGIT/TOUPPER instead of isdigit/toupper.
+ (s_float_space): Use ISALPHA instead of isalpha.
+ (ignore_rest_of_line): Use ISPRINT instead of isprint.
+ (float_cons): Use ISALPHA instead of isalpha.
+ (next_char_of_string): Use ISDIGIT/ISXDIGIT instead of
+ isdigit/isxdigit.
+ * symbols.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (save_symbol_name): Use ISLOWER/TOUPPER instead of
+ islower/toupper.
+ (symbol_find_base): Use TOUPPER instead of islower/toupper.
+ (decode_local_label_name): Use ISDIGIT instead of isdigit.
+
2001-09-18 Martin Schwidefsky <schwidefsky@de.ibm.com>
* tc-s390.c (s390_insn): Add code to cope with 6 byte O_constants
diff --git a/gas/as.c b/gas/as.c
index 0f6d4af..2ce2fb9 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -780,6 +780,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/gas/as.h b/gas/as.h
index 7da5ed2..ed82574 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -73,7 +73,6 @@ extern void *alloca ();
/* System include files first... */
#include <stdio.h>
-#include <ctype.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
diff --git a/gas/atof-generic.c b/gas/atof-generic.c
index 2d7a32b..c5d10d4 100644
--- a/gas/atof-generic.c
+++ b/gas/atof-generic.c
@@ -1,5 +1,5 @@
/* atof_generic.c - turn a string of digits into a Flonum
- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+ Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -19,10 +19,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include <string.h>
#include "as.h"
+#include "safe-ctype.h"
#ifndef FALSE
#define FALSE (0)
@@ -171,7 +171,7 @@ atof_generic (address_of_string_pointer,
&& (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
if (seen_significant_digit || c > '0')
{
@@ -200,7 +200,7 @@ atof_generic (address_of_string_pointer,
{
unsigned int zeros = 0; /* Length of current string of zeros */
- for (p++; (c = *p) && isdigit ((unsigned char) c); p++)
+ for (p++; (c = *p) && ISDIGIT (c); p++)
{
if (c == '0')
{
@@ -221,7 +221,7 @@ atof_generic (address_of_string_pointer,
&& (!c || !strchr (string_of_decimal_exponent_marks, c)));
p++)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
/* This may be retracted below. */
number_of_digits_after_decimal++;
@@ -275,7 +275,7 @@ atof_generic (address_of_string_pointer,
for (; (c); c = *++p)
{
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
decimal_exponent = decimal_exponent * 10 + c - '0';
/*
@@ -400,7 +400,7 @@ atof_generic (address_of_string_pointer,
for (p = first_digit, count = number_of_digits_to_use; count; p++, --count)
{
c = *p;
- if (isdigit ((unsigned char) c))
+ if (ISDIGIT (c))
{
/*
* Multiply by 10. Assume can never overflow.
diff --git a/gas/config/m68k-parse.y b/gas/config/m68k-parse.y
index e24110f..15c6236 100644
--- a/gas/config/m68k-parse.y
+++ b/gas/config/m68k-parse.y
@@ -1,5 +1,5 @@
/* m68k.y -- bison grammar for m68k operand parsing
- Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support
This file is part of GAS, the GNU Assembler.
@@ -29,6 +29,7 @@
#include "as.h"
#include "tc-m68k.h"
#include "m68k-parse.h"
+#include "safe-ctype.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
etc), as well as gratuitiously global symbol names If other parser
@@ -743,9 +744,9 @@ yylex ()
/* In MRI mode, this can be the start of an octal number. */
if (flag_mri)
{
- if (isdigit (str[1])
+ if (ISDIGIT (str[1])
|| ((str[1] == '+' || str[1] == '-')
- && isdigit (str[2])))
+ && ISDIGIT (str[2])))
break;
}
/* Fall through. */
@@ -929,7 +930,7 @@ yylex ()
{
if (parens == 0
&& s > str
- && (s[-1] == ')' || isalnum ((unsigned char) s[-1])))
+ && (s[-1] == ')' || ISALNUM (s[-1])))
break;
++parens;
}
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 7ab0d57..b84a4b0 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -21,6 +21,7 @@
#define OBJ_HEADER "obj-elf.h"
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
@@ -1236,7 +1237,7 @@ obj_elf_vtable_inherit (ignore)
if (input_line_pointer[0] == '0'
&& (input_line_pointer[1] == '\0'
- || isspace ((unsigned char) input_line_pointer[1])))
+ || ISSPACE (input_line_pointer[1])))
{
psym = section_symbol (absolute_section);
++input_line_pointer;
diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c
index 969b96e..cd36a38 100644
--- a/gas/config/obj-vms.c
+++ b/gas/config/obj-vms.c
@@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "as.h"
#include "config.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
@@ -3071,7 +3072,7 @@ Write_VMS_MHD_Records ()
cp++;
continue;
}
- *cp1++ = islower (*cp) ? toupper (*cp++) : *cp++;
+ *cp1++ = TOUPPER (*cp++);
}
*cp1 = '\0';
@@ -3254,20 +3255,20 @@ VMS_Case_Hack_Symbol (In, Out)
switch (vms_name_mapping)
{
case 0:
- if (isupper (*In)) {
+ if (ISUPPER (*In)) {
*Out++ = *In++;
Case_Hack_Bits |= 1;
} else {
- *Out++ = islower (*In) ? toupper (*In++) : *In++;
+ *Out++ = TOUPPER (*In++);
}
break;
case 3: *Out++ = *In++;
break;
case 2:
- if (islower (*In)) {
+ if (ISLOWER (*In)) {
*Out++ = *In++;
} else {
- *Out++ = isupper (*In) ? tolower (*In++) : *In++;
+ *Out++ = TOLOWER (*In++);
}
break;
}
@@ -3298,7 +3299,7 @@ VMS_Case_Hack_Symbol (In, Out)
* and ensure that they are lowercase
*/
for (i = 0; (In[i] != 0) && (i < 8); i++)
- if (isupper (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case)
+ if (ISUPPER (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case)
break;
if (In[i] == 0)
@@ -3313,11 +3314,11 @@ VMS_Case_Hack_Symbol (In, Out)
i = 8;
while ((--i >= 0) && (*In))
switch (vms_name_mapping){
- case 0: *Out++ = islower (*In) ? toupper (*In++) : *In++;
+ case 0: *Out++ = TOUPPER (*In++);
break;
case 3: *Out++ = *In++;
break;
- case 2: *Out++ = isupper (*In) ? tolower (*In++) : *In++;
+ case 2: *Out++ = TOLOWER (*In++);
break;
}
}
diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c
index d4d4c43..14c0d82 100644
--- a/gas/config/tc-a29k.c
+++ b/gas/config/tc-a29k.c
@@ -1,5 +1,5 @@
/* tc-a29k.c -- Assemble for the AMD 29000.
- Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000
+ Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -23,8 +23,8 @@
to convert it to new machines' assemblers as desired. There was too
much bloody rewriting required before. There still probably is. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/a29k.h"
@@ -188,7 +188,7 @@ insert_sreg (regname, regnum)
symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum,
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum,
@@ -397,10 +397,9 @@ machine_ip (str)
/* Must handle `div0' opcode. */
s = str;
- if (isalpha (*s))
- for (; isalnum (*s); ++s)
- if (isupper (*s))
- *s = tolower (*s);
+ if (ISALPHA (*s))
+ for (; ISALNUM (*s); ++s)
+ *s = TOLOWER (*s);
switch (*s)
{
@@ -1067,13 +1066,13 @@ a29k_unrecognized_line (c)
char *s;
if (c != '$'
- || ! isdigit ((unsigned char) input_line_pointer[0]))
+ || ! ISDIGIT (input_line_pointer[0]))
return 0;
s = input_line_pointer;
lab = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
lab = lab * 10 + *s - '0';
++s;
@@ -1176,7 +1175,7 @@ md_operand (expressionP)
expressionP->X_op = O_constant;
}
else if (input_line_pointer[0] == '$'
- && isdigit ((unsigned char) input_line_pointer[1]))
+ && ISDIGIT (input_line_pointer[1]))
{
long lab;
char *name;
@@ -1238,7 +1237,7 @@ md_operand (expressionP)
return;
}
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
fieldnum = *s - '0';
++s;
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 7a8c04c..0c87d40 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -62,7 +62,7 @@
#include "dwarf2dbg.h"
#endif
-#include <ctype.h>
+#include "safe-ctype.h"
/* Local types */
@@ -1299,7 +1299,7 @@ md_undefined_symbol (name)
/* FALLTHRU */
case 'r':
- if (!isdigit (*++name))
+ if (!ISDIGIT (*++name))
break;
/* FALLTHRU */
@@ -1307,7 +1307,7 @@ md_undefined_symbol (name)
case '5': case '6': case '7': case '8': case '9':
if (name[1] == '\0')
num = name[0] - '0';
- else if (name[0] != '0' && isdigit (name[1]) && name[2] == '\0')
+ else if (name[0] != '0' && ISDIGIT (name[1]) && name[2] == '\0')
{
num = (name[0] - '0') * 10 + name[1] - '0';
if (num >= 32)
@@ -4214,7 +4214,7 @@ s_alpha_ent (dummy)
input_line_pointer++;
SKIP_WHITESPACE ();
}
- if (isdigit (*input_line_pointer) || *input_line_pointer == '-')
+ if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
(void) get_absolute_expression ();
}
demand_empty_rest_of_line ();
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 285cdf6..cedd2b4 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -21,9 +21,9 @@
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "libiberty.h"
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/arc.h"
#include "../opcodes/arc-ext.h"
@@ -393,7 +393,7 @@ md_assemble (str)
}
/* Skip leading white space. */
- while (isspace (*str))
+ while (ISSPACE (*str))
str++;
/* The instructions are stored in lists hashed by the first letter (though
@@ -544,7 +544,7 @@ md_assemble (str)
}
/* Pick the suffix out and look it up via the hash table. */
- for (t = s; *t && isalnum (*t); ++t)
+ for (t = s; *t && ISALNUM (*t); ++t)
continue;
c = *t;
*t = '\0';
@@ -736,7 +736,7 @@ md_assemble (str)
insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (!is_end_of_line[(unsigned char) *str])
@@ -913,8 +913,7 @@ arc_extoper (opertype)
p = name;
while (*p)
{
- if (isupper (*p))
- *p = tolower (*p);
+ *p = TOLOWER (*p);
p++;
}
@@ -1703,7 +1702,7 @@ md_operand (expressionP)
while (ext_oper)
{
l = strlen (ext_oper->operand.name);
- if (!strncmp (p, ext_oper->operand.name, l) && !isalnum (*(p + l)))
+ if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l)))
{
input_line_pointer += l + 1;
expressionP->X_op = O_register;
@@ -1715,7 +1714,7 @@ md_operand (expressionP)
for (i = 0; i < arc_reg_names_count; i++)
{
l = strlen (arc_reg_names[i].name);
- if (!strncmp (p, arc_reg_names[i].name, l) && !isalnum (*(p + l)))
+ if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l)))
{
input_line_pointer += l + 1;
expressionP->X_op = O_register;
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index da8ffc0..ab4f291 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -21,10 +21,10 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include <string.h>
#define NO_RELOC 0
#include "as.h"
+#include "safe-ctype.h"
/* Need TARGET_CPU. */
#include "config.h"
@@ -1864,7 +1864,7 @@ arm_psr_parse (ccp)
{
c = *p++;
}
- while (isalpha (c) || c == '_');
+ while (ISALPHA (c) || c == '_');
/* Terminate the word. */
*--p = 0;
@@ -2517,7 +2517,7 @@ accum0_required_here (str)
*str = p; /* Advance caller's string pointer too. */
c = *p++;
- while (isalnum (c))
+ while (ISALNUM (c))
c = *p++;
*--p = 0; /* Aap nul into input buffer at non-alnum. */
@@ -3513,7 +3513,7 @@ do_ldrd (str, flags)
static char buff[128];
--str;
- while (isspace (*str))
+ while (ISSPACE (*str))
--str;
str -= 4;
@@ -3710,7 +3710,7 @@ decode_shift (str, unrestrict)
skip_whitespace (* str);
- for (p = * str; isalpha (* p); p ++)
+ for (p = * str; ISALPHA (* p); p ++)
;
if (p == * str)
@@ -6407,7 +6407,7 @@ insert_reg (entry)
strcpy (buf + i, reg_table[entry].name);
for (i = 0; buf[i]; i++)
- buf2[i] = islower (buf[i]) ? toupper (buf[i]) : buf[i];
+ buf2[i] = TOUPPER (buf[i]);
buf2[i] = '\0';
@@ -6775,11 +6775,11 @@ arm_reg_parse (ccp)
p++, start++;
#endif
#endif
- if (!isalpha (*p) || !is_name_beginner (*p))
+ if (!ISALPHA (*p) || !is_name_beginner (*p))
return FAIL;
c = *p++;
- while (isalpha (c) || isdigit (c) || c == '_')
+ while (ISALPHA (c) || ISDIGIT (c) || c == '_')
c = *p++;
*--p = 0;
@@ -8724,9 +8724,9 @@ arm_parse_reloc ()
};
for (i = 0, ip = input_line_pointer;
- i < sizeof (id) && (isalnum (*ip) || ispunct (*ip));
+ i < sizeof (id) && (ISALNUM (*ip) || ISPUNCT (*ip));
i++, ip++)
- id[i] = tolower (*ip);
+ id[i] = TOLOWER (*ip);
for (i = 0; reloc_map[i].str; i++)
if (strncmp (id, reloc_map[i].str, reloc_map[i].len) == 0)
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index 78954e1..aebab8d 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -1,6 +1,6 @@
/* tc-avr.c -- Assembler code for the ATMEL AVR
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of GAS, the GNU Assembler.
@@ -21,8 +21,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
struct avr_opcodes_s
@@ -298,7 +298,7 @@ md_parse_option (c, arg)
char *arg1 = arg;
do
- *t = tolower (*arg1++);
+ *t = TOLOWER (*arg1++);
while (*t++);
}
@@ -555,12 +555,12 @@ avr_operand (opcode, where, op, line)
str = extract_word (str, r_name, sizeof (r_name));
op_mask = 0xff;
- if (isdigit (r_name[1]))
+ if (ISDIGIT (r_name[1]))
{
if (r_name[2] == '\0')
op_mask = r_name[1] - '0';
else if (r_name[1] != '0'
- && isdigit (r_name[2])
+ && ISDIGIT (r_name[2])
&& r_name[3] == '\0')
op_mask = (r_name[1] - '0') * 10 + r_name[2] - '0';
}
@@ -613,7 +613,7 @@ avr_operand (opcode, where, op, line)
str = skip_space (str + 1);
op_mask = 0x1002;
}
- c = tolower (*str);
+ c = TOLOWER (*str);
if (c == 'x')
op_mask |= 0x100c;
else if (c == 'y')
@@ -656,7 +656,7 @@ avr_operand (opcode, where, op, line)
case 'b':
{
- char c = tolower (*str++);
+ char c = TOLOWER (*str++);
if (c == 'y')
op_mask |= 0x8;
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index a83cf8a..0ca98f5 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -23,8 +23,8 @@
MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/cris.h"
#include "dwarf2dbg.h"
@@ -925,7 +925,7 @@ cris_process_instruction (insn_text, out_insnp, prefixp)
/* Find the end of the opcode mnemonic. We assume (true in 2.9.1)
that the caller has translated the opcode to lower-case, up to the
first non-letter. */
- for (operands = insn_text; islower (*operands); ++operands)
+ for (operands = insn_text; ISLOWER (*operands); ++operands)
;
/* Terminate the opcode after letters, but save the character there if
@@ -1586,7 +1586,7 @@ get_gen_reg (cPP, regnop)
(*cPP)++;
if ((**cPP == 'C' || **cPP == 'c')
- && ! isalnum ((*cPP)[1]))
+ && ! ISALNUM ((*cPP)[1]))
{
/* It's "PC": consume the "c" and we're done. */
(*cPP)++;
@@ -1600,13 +1600,13 @@ get_gen_reg (cPP, regnop)
/* Hopefully r[0-9] or r1[0-5]. Consume 'R' or 'r'. */
(*cPP)++;
- if (isdigit (**cPP))
+ if (ISDIGIT (**cPP))
{
/* It's r[0-9]. Consume and check the next digit. */
*regnop = **cPP - '0';
(*cPP)++;
- if (! isalnum (**cPP))
+ if (! ISALNUM (**cPP))
{
/* No more digits, we're done. */
return 1;
@@ -1688,8 +1688,7 @@ get_spec_reg (cPP, sregpp)
s1 = name_begin;
s2 = sregp->name;
- while (*s2 != '\0'
- && (isupper (*s1) ? tolower (*s1) == *s2 : *s1 == *s2))
+ while (*s2 != '\0' && TOLOWER (*s1) == *s2)
{
s1++;
s2++;
@@ -1698,7 +1697,7 @@ get_spec_reg (cPP, sregpp)
/* For a match, we must have consumed the name in the table, and we
must be outside what could be part of a name. Assume here that a
test for alphanumerics is sufficient for a name test. */
- if (*s2 == 0 && ! isalnum (*s1))
+ if (*s2 == 0 && ! ISALNUM (*s1))
{
/* We have a match. Update the pointer and be done. */
*cPP = s1;
@@ -2321,7 +2320,7 @@ get_flags (cPP, flagsp)
whitespace. Anything else, and we consider it a failure. */
if (**cPP != ','
&& **cPP != 0
- && ! isspace (**cPP))
+ && ! ISSPACE (**cPP))
return 0;
else
return 1;
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index 28ac040..248e62a 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/d10v.h"
#include "elf/ppc.h"
@@ -1185,7 +1185,7 @@ do_assemble (str, opcode)
&& !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
name[nlen] = 0;
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index b61ce5f..5316b09 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -1,5 +1,5 @@
/* tc-d30v.c -- Assembler code for the Mitsubishi D30V
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -19,8 +19,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/d30v.h"
@@ -1454,7 +1454,7 @@ do_assemble (str, opcode, shortp, is_parallel)
&& !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
@@ -2045,7 +2045,7 @@ d30v_start_line ()
{
char *c = input_line_pointer;
- while (isspace (*c))
+ while (ISSPACE (*c))
c++;
if (*c == '.')
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c
index 98f5729..26768fe 100644
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -19,8 +19,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/fr30-desc.h"
@@ -614,7 +614,7 @@ fr30_is_colon_insn (start)
continue;
while (len --)
- if (tolower (start [len]) != insn [len])
+ if (TOLOWER (start [len]) != insn [len])
break;
if (len == -1)
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 05c49dc..13be3462 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -28,7 +28,7 @@
#define DEFINE_TABLE
#define h8_opcodes ops
#include "opcode/h8300.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef OBJ_ELF
#include "elf/h8.h"
@@ -347,7 +347,7 @@ skip_colonthing (ptr, exp, mode)
{
*mode |= L_16;
}
- while (isdigit (*ptr))
+ while (ISDIGIT (*ptr))
ptr++;
}
}
@@ -418,8 +418,8 @@ get_operand (ptr, op, dst, direction)
/* Gross. Gross. ldm and stm have a format not easily handled
by get_operand. We deal with it explicitly here. */
- if (src[0] == 'e' && src[1] == 'r' && isdigit (src[2])
- && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && isdigit (src[6]))
+ if (src[0] == 'e' && src[1] == 'r' && ISDIGIT (src[2])
+ && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && ISDIGIT (src[6]))
{
int low, high;
diff --git a/gas/config/tc-h8500.c b/gas/config/tc-h8500.c
index a13c942..7cffd83 100644
--- a/gas/config/tc-h8500.c
+++ b/gas/config/tc-h8500.c
@@ -28,7 +28,7 @@
#define DEFINE_TABLE
#define ASSEMBLER_TABLE
#include "opcodes/h8500-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
const char comment_chars[] = "!";
const char line_separator_chars[] = ";";
@@ -1589,10 +1589,10 @@ start_label (ptr)
char *ptr;
{
/* Check for :s.w */
- if (isalpha (ptr[1]) && ptr[2] == '.')
+ if (ISALPHA (ptr[1]) && ptr[2] == '.')
return 0;
/* Check for :s */
- if (isalpha (ptr[1]) && !isalpha (ptr[2]))
+ if (ISALPHA (ptr[1]) && !ISALPHA (ptr[2]))
return 0;
return 1;
}
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index cb9b9fb..2339890 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -23,9 +23,9 @@
at the University of Utah. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "bfd/libhppa.h"
@@ -1571,11 +1571,12 @@ pa_ip (str)
/* Convert everything up to the first whitespace character into lower
case. */
for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++)
- if (isupper (*s))
- *s = tolower (*s);
+ *s = TOLOWER (*s);
/* Skip to something interesting. */
- for (s = str; isupper (*s) || islower (*s) || (*s >= '0' && *s <= '3'); ++s)
+ for (s = str;
+ ISUPPER (*s) || ISLOWER (*s) || (*s >= '0' && *s <= '3');
+ ++s)
;
switch (*s)
@@ -4687,7 +4688,7 @@ pa_parse_number (s, is_float)
pa_number = -1;
have_prefix = 0;
num = 0;
- if (!strict && isdigit (*p))
+ if (!strict && ISDIGIT (*p))
{
/* Looks like a number. */
@@ -4695,10 +4696,10 @@ pa_parse_number (s, is_float)
{
/* The number is specified in hex. */
p += 2;
- while (isdigit (*p) || ((*p >= 'a') && (*p <= 'f'))
+ while (ISDIGIT (*p) || ((*p >= 'a') && (*p <= 'f'))
|| ((*p >= 'A') && (*p <= 'F')))
{
- if (isdigit (*p))
+ if (ISDIGIT (*p))
num = num * 16 + *p - '0';
else if (*p >= 'a' && *p <= 'f')
num = num * 16 + *p - 'a' + 10;
@@ -4710,7 +4711,7 @@ pa_parse_number (s, is_float)
else
{
/* The number is specified in decimal. */
- while (isdigit (*p))
+ while (ISDIGIT (*p))
{
num = num * 10 + *p - '0';
++p;
@@ -4762,7 +4763,7 @@ pa_parse_number (s, is_float)
num = 2;
p++;
}
- else if (!isdigit (*p))
+ else if (!ISDIGIT (*p))
{
if (print_errors)
as_bad (_("Undefined register: '%s'."), name);
@@ -4772,7 +4773,7 @@ pa_parse_number (s, is_float)
{
do
num = num * 10 + *p++ - '0';
- while (isdigit (*p));
+ while (ISDIGIT (*p));
}
}
else
@@ -5124,16 +5125,16 @@ pa_chk_field_selector (str)
*str = *str + 1;
if ((*str)[1] == '\'' || (*str)[1] == '%')
- name[0] = tolower ((*str)[0]),
+ name[0] = TOLOWER ((*str)[0]),
name[1] = 0;
else if ((*str)[2] == '\'' || (*str)[2] == '%')
- name[0] = tolower ((*str)[0]),
- name[1] = tolower ((*str)[1]),
+ name[0] = TOLOWER ((*str)[0]),
+ name[1] = TOLOWER ((*str)[1]),
name[2] = 0;
else if ((*str)[3] == '\'' || (*str)[3] == '%')
- name[0] = tolower ((*str)[0]),
- name[1] = tolower ((*str)[1]),
- name[2] = tolower ((*str)[2]),
+ name[0] = TOLOWER ((*str)[0]),
+ name[1] = TOLOWER ((*str)[1]),
+ name[2] = TOLOWER ((*str)[2]),
name[3] = 0;
else
return e_fsel;
@@ -8196,11 +8197,11 @@ pa_stringer (append_zero)
s++;
for (num_digit = 0, number = 0, dg = *s;
num_digit < 2
- && (isdigit (dg) || (dg >= 'a' && dg <= 'f')
+ && (ISDIGIT (dg) || (dg >= 'a' && dg <= 'f')
|| (dg >= 'A' && dg <= 'F'));
num_digit++)
{
- if (isdigit (dg))
+ if (ISDIGIT (dg))
number = number * 16 + dg - '0';
else if (dg >= 'a' && dg <= 'f')
number = number * 16 + dg - 'a' + 10;
diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c
index 75a5792..9ea4c3a 100644
--- a/gas/config/tc-i370.c
+++ b/gas/config/tc-i370.c
@@ -29,8 +29,8 @@
*/
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "c=ctype.h"
#include "subsegs.h"
#include "struc-symbol.h"
@@ -334,7 +334,7 @@ register_name (expressionP)
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
else if (!reg_names_p)
@@ -345,7 +345,7 @@ register_name (expressionP)
/* If it's a number, treat it as a number. If it's alpha, look to
see if it's in the register table. */
- if (!isalpha (name[0]))
+ if (!ISALPHA (name[0]))
{
reg_number = get_single_number ();
}
@@ -702,10 +702,10 @@ i370_elf_suffix (str_p, exp_p)
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
- *str2++ = (islower (ch)) ? ch : tolower (ch);
+ *str2++ = TOLOWER (ch);
}
*str2 = '\0';
@@ -1489,11 +1489,11 @@ i370_addr_offset (expressionS *exx)
lab = input_line_pointer;
while (*lab && (',' != *lab) && ('(' != *lab))
{
- if (isdigit (*lab))
+ if (ISDIGIT (*lab))
{
all_digits = 1;
}
- else if (isalpha (*lab))
+ else if (ISALPHA (*lab))
{
if (!all_digits)
{
@@ -1562,7 +1562,7 @@ i370_addr_cons (expressionS *exp)
name = input_line_pointer;
sym_name = input_line_pointer;
/* Find the spelling of the operand */
- if (name[0] == '=' && isalpha (name[1]))
+ if (name[0] == '=' && ISALPHA (name[1]))
{
name = ++input_line_pointer;
}
@@ -1652,7 +1652,7 @@ i370_addr_cons (expressionS *exp)
save = input_line_pointer;
while (*save)
{
- if (isxdigit (*save))
+ if (ISXDIGIT (*save))
hex_len++;
save++;
}
@@ -1979,7 +1979,7 @@ md_assemble (str)
#endif
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -2004,7 +2004,7 @@ md_assemble (str)
insn = opcode->opcode;
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
/* I370 operands are either expressions or address constants.
@@ -2289,7 +2289,7 @@ md_assemble (str)
++str;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 739ed58..749d7c4 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -26,9 +26,8 @@
Bugs & suggestions are completely welcome. This is free software.
Please help us make it better. */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
#include "opcode/i386.h"
@@ -891,27 +890,27 @@ md_begin ()
for (c = 0; c < 256; c++)
{
- if (isdigit (c))
+ if (ISDIGIT (c))
{
digit_chars[c] = c;
mnemonic_chars[c] = c;
register_chars[c] = c;
operand_chars[c] = c;
}
- else if (islower (c))
+ else if (ISLOWER (c))
{
mnemonic_chars[c] = c;
register_chars[c] = c;
operand_chars[c] = c;
}
- else if (isupper (c))
+ else if (ISUPPER (c))
{
- mnemonic_chars[c] = tolower (c);
+ mnemonic_chars[c] = TOLOWER (c);
register_chars[c] = mnemonic_chars[c];
operand_chars[c] = c;
}
- if (isalpha (c) || isdigit (c))
+ if (ISALPHA (c) || ISDIGIT (c))
identifier_chars[c] = c;
else if (c >= 128)
{
@@ -4461,7 +4460,7 @@ static char *
output_invalid (c)
int c;
{
- if (isprint (c))
+ if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c);
else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c
index 5a48115..5f29b20 100644
--- a/gas/config/tc-i860.c
+++ b/gas/config/tc-i860.c
@@ -1,5 +1,5 @@
/* tc-i860.c -- Assembler for the Intel i860 architecture.
- Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+ Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Brought back from the dead and completely reworked
@@ -21,10 +21,10 @@
with GAS; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/i860.h"
#include "elf/i860.h"
@@ -409,7 +409,7 @@ i860_process_insn (str)
opcode = 0;
#endif
- for (s = str; islower (*s) || *s == '.' || *s == '3'
+ for (s = str; ISLOWER (*s) || *s == '.' || *s == '3'
|| *s == '2' || *s == '1'; ++s)
;
@@ -485,9 +485,9 @@ i860_process_insn (str)
/* Must be at least one digit. */
case '#':
- if (isdigit (*s++))
+ if (ISDIGIT (*s++))
{
- while (isdigit (*s))
+ while (ISDIGIT (*s))
++s;
continue;
}
@@ -528,11 +528,11 @@ i860_process_insn (str)
/* Any register r0..r31. */
case 'r':
s++;
- if (!isdigit (c = *s++))
+ if (!ISDIGIT (c = *s++))
{
goto error;
}
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
goto error;
@@ -575,10 +575,10 @@ i860_process_insn (str)
else
s++;
- if (*s++ == 'f' && isdigit (*s))
+ if (*s++ == 'f' && ISDIGIT (*s))
{
mask = *s++;
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32)
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index 66ec025..279c214 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -64,10 +64,10 @@
a relocation directive. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "opcode/i960.h"
@@ -1389,8 +1389,8 @@ get_args (p, args)
{
if (*p == ' '
- && (! isalnum ((unsigned char) p[1])
- || ! isalnum ((unsigned char) p[-1])))
+ && (! ISALNUM (p[1])
+ || ! ISALNUM (p[-1])))
{
p++;
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index c7b0ec9..6930d6f 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -43,6 +43,7 @@
*/
#include "as.h"
+#include "safe-ctype.h"
#include "dwarf2dbg.h"
#include "subsegs.h"
@@ -4514,7 +4515,7 @@ dot_pred_rel (type)
valueT bit = 1;
int regno;
- if (toupper (*input_line_pointer) != 'P'
+ if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0
|| regno > 63)
{
@@ -4522,7 +4523,7 @@ dot_pred_rel (type)
ignore_rest_of_line ();
return;
}
- while (isdigit (*input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
++input_line_pointer;
if (p1 == -1)
p1 = regno;
@@ -4539,7 +4540,7 @@ dot_pred_rel (type)
valueT stop = 1;
++input_line_pointer;
- if (toupper (*input_line_pointer) != 'P'
+ if (TOUPPER (*input_line_pointer) != 'P'
|| (regno = atoi (++input_line_pointer)) < 0
|| regno > 63)
{
@@ -4547,7 +4548,7 @@ dot_pred_rel (type)
ignore_rest_of_line ();
return;
}
- while (isdigit (*input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
++input_line_pointer;
stop <<= regno;
if (bit >= stop)
@@ -6779,10 +6780,10 @@ ia64_unrecognized_line (ch)
c = get_symbol_end ();
}
else if (LOCAL_LABELS_FB
- && isdigit ((unsigned char) *input_line_pointer))
+ && ISDIGIT (*input_line_pointer))
{
temp = 0;
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
temp = (temp * 10) + *input_line_pointer++ - '0';
fb_label_instance_inc (temp);
s = fb_label_name (temp, 0);
@@ -6955,7 +6956,7 @@ ia64_parse_name (name, e)
switch (name[0])
{
case 'i':
- if (name[1] == 'n' && isdigit (name[2]))
+ if (name[1] == 'n' && ISDIGIT (name[2]))
{
dr = &md.in;
name += 2;
@@ -6963,7 +6964,7 @@ ia64_parse_name (name, e)
break;
case 'l':
- if (name[1] == 'o' && name[2] == 'c' && isdigit (name[3]))
+ if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3]))
{
dr = &md.loc;
name += 3;
@@ -6971,7 +6972,7 @@ ia64_parse_name (name, e)
break;
case 'o':
- if (name[1] == 'u' && name[2] == 't' && isdigit (name[3]))
+ if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3]))
{
dr = &md.out;
name += 3;
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index af53e6e..6ee3a2e 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/m32r-desc.h"
@@ -819,15 +819,14 @@ assemble_two_insns (str, str2, parallel_p)
{
char *s2 = str;
- while (isspace (*s2++))
+ while (ISSPACE (*s2++))
continue;
--s2;
- while (isalnum (*s2))
+ while (ISALNUM (*s2))
{
- if (isupper ((unsigned char) *s2))
- *s2 = tolower (*s2);
+ *s2 = TOLOWER (*s2);
s2++;
}
}
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index 2c2b80c..7ac37c2 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/m68hc11.h"
#include "dwarf2dbg.h"
@@ -2234,7 +2234,7 @@ md_assemble (str)
*op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
- name[nlen] = tolower (op_start[nlen]);
+ name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
}
name[nlen] = 0;
@@ -2276,14 +2276,14 @@ md_assemble (str)
&& (*op_end &&
(is_end_of_line[op_end[1]]
|| op_end[1] == ' ' || op_end[1] == '\t'
- || !isalnum (op_end[1])))
+ || !ISALNUM (op_end[1])))
&& (*op_end == 'a' || *op_end == 'b'
|| *op_end == 'A' || *op_end == 'B'
|| *op_end == 'd' || *op_end == 'D'
|| *op_end == 'x' || *op_end == 'X'
|| *op_end == 'y' || *op_end == 'Y'))
{
- name[nlen++] = tolower (*op_end++);
+ name[nlen++] = TOLOWER (*op_end++);
name[nlen] = 0;
opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash,
name);
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 9f6b500..c04eb6e 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -20,8 +20,8 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
@@ -648,8 +648,6 @@ CONST pseudo_typeS mote_pseudo_table[] =
extern char *input_line_pointer;
-static char mklower_table[256];
-#define mklower(c) (mklower_table[(unsigned char) (c)])
static char notend_table[256];
static char alt_notend_table[256];
#define notend(s) \
@@ -3311,7 +3309,7 @@ insert_reg (regname, regnum)
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, reg_section, regnum,
@@ -3880,9 +3878,6 @@ md_begin ()
}
}
- for (i = 0; i < (int) sizeof (mklower_table); i++)
- mklower_table[i] = (isupper (c = (char) i)) ? tolower (c) : c;
-
for (i = 0; i < (int) sizeof (notend_table); i++)
{
notend_table[i] = 0;
@@ -5370,7 +5365,7 @@ s_reg (ignore)
SKIP_WHITESPACE ();
s = input_line_pointer;
- while (isalnum ((unsigned char) *input_line_pointer)
+ while (ISALNUM (*input_line_pointer)
#ifdef REGISTER_PREFIX
|| *input_line_pointer == REGISTER_PREFIX
#endif
@@ -5582,10 +5577,7 @@ mri_assemble (str)
/* md_assemble expects the opcode to be in lower case. */
for (s = str; *s != ' ' && *s != '\0'; s++)
- {
- if (isupper ((unsigned char) *s))
- *s = tolower ((unsigned char) *s);
- }
+ *s = TOLOWER (*s);
md_assemble (str);
}
@@ -5667,10 +5659,8 @@ parse_mri_condition (pcc)
++input_line_pointer;
SKIP_WHITESPACE ();
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
+ c1 = TOLOWER (c1);
+ c2 = TOLOWER (c2);
*pcc = (c1 << 8) | c2;
@@ -5912,7 +5902,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
*s++ = 'm';
*s++ = 'p';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, leftstart, leftstop - leftstart);
s += leftstop - leftstart;
@@ -5930,7 +5920,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
*s++ = cc >> 8;
*s++ = cc & 0xff;
if (extent != '\0')
- *s++ = tolower (extent);
+ *s++ = TOLOWER (extent);
*s++ = ' ';
strcpy (s, truelab);
mri_assemble (buf);
@@ -6180,7 +6170,7 @@ s_mri_else (qual)
mri_control_stack->else_seen = 1;
buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom));
- q[0] = tolower (qual);
+ q[0] = TOLOWER (qual);
q[1] = '\0';
sprintf (buf, "bra%s %s", q, mri_control_stack->bottom);
mri_assemble (buf);
@@ -6253,7 +6243,7 @@ s_mri_break (extent)
}
buf = (char *) xmalloc (20 + strlen (n->bottom));
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->bottom);
mri_assemble (buf);
@@ -6292,7 +6282,7 @@ s_mri_next (extent)
}
buf = (char *) xmalloc (20 + strlen (n->next));
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
sprintf (buf, "bra%s %s", ex, n->next);
mri_assemble (buf);
@@ -6476,7 +6466,7 @@ s_mri_for (qual)
*s++ = 'v';
*s++ = 'e';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, initstart, initstop - initstart);
s += initstop - initstart;
@@ -6494,7 +6484,7 @@ s_mri_for (qual)
*s++ = 'm';
*s++ = 'p';
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, endstart, endstop - endstart);
s += endstop - endstart;
@@ -6505,7 +6495,7 @@ s_mri_for (qual)
mri_assemble (buf);
/* bcc bottom */
- ex[0] = tolower (extent);
+ ex[0] = TOLOWER (extent);
ex[1] = '\0';
if (up)
sprintf (buf, "blt%s %s", ex, n->bottom);
@@ -6521,7 +6511,7 @@ s_mri_for (qual)
strcpy (s, "sub");
s += 3;
if (qual != '\0')
- *s++ = tolower (qual);
+ *s++ = TOLOWER (qual);
*s++ = ' ';
memcpy (s, bystart, bystop - bystart);
s += bystop - bystart;
diff --git a/gas/config/tc-m88k.c b/gas/config/tc-m88k.c
index c12142e..bd3ddba 100644
--- a/gas/config/tc-m88k.c
+++ b/gas/config/tc-m88k.c
@@ -2,7 +2,7 @@
Contributed by Devon Bowen of Buffalo University
and Torbjorn Granlund of the Swedish Institute of Computer Science.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -22,8 +22,8 @@ along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "m88k-opcode.h"
@@ -239,7 +239,7 @@ md_assemble (op)
assert (op);
/* Skip over instruction to find parameters. */
- for (param = op; *param != 0 && !isspace (*param); param++)
+ for (param = op; *param != 0 && !ISSPACE (*param); param++)
;
c = *param;
*param++ = '\0';
@@ -517,17 +517,17 @@ get_imm16 (param, insn)
unsigned int val;
char *save_ptr;
- if (!strncmp (param, "hi16", 4) && !isalnum (param[4]))
+ if (!strncmp (param, "hi16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_HI16;
param += 4;
}
- else if (!strncmp (param, "lo16", 4) && !isalnum (param[4]))
+ else if (!strncmp (param, "lo16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_LO16;
param += 4;
}
- else if (!strncmp (param, "iw16", 4) && !isalnum (param[4]))
+ else if (!strncmp (param, "iw16", 4) && !ISALNUM (param[4]))
{
reloc = RELOC_IW16;
param += 4;
@@ -630,7 +630,7 @@ get_cnd (param, valp)
{
unsigned int val;
- if (isdigit (*param))
+ if (ISDIGIT (*param))
{
param = getval (param, &val);
@@ -642,11 +642,8 @@ get_cnd (param, valp)
}
else
{
- if (isupper (*param))
- *param = tolower (*param);
-
- if (isupper (param[1]))
- param[1] = tolower (param[1]);
+ param[0] = TOLOWER (param[0]);
+ param[1] = TOLOWER (param[1]);
param = match_name (param, cndmsk, valp);
@@ -690,12 +687,10 @@ get_bf_offset_expression (param, offsetp)
{
unsigned offset;
- if (isalpha (param[0]))
+ if (ISALPHA (param[0]))
{
- if (isupper (param[0]))
- param[0] = tolower (param[0]);
- if (isupper (param[1]))
- param[1] = tolower (param[1]);
+ param[0] = TOLOWER (param[0]);
+ param[1] = TOLOWER (param[1]);
param = match_name (param, cmpslot, offsetp);
@@ -888,9 +883,9 @@ get_o6 (param, valp)
}
#define hexval(z) \
- (isdigit (z) ? (z) - '0' : \
- islower (z) ? (z) - 'a' + 10 : \
- isupper (z) ? (z) - 'A' + 10 : -1)
+ (ISDIGIT (z) ? (z) - '0' : \
+ ISLOWER (z) ? (z) - 'a' + 10 : \
+ ISUPPER (z) ? (z) - 'A' + 10 : -1)
static char *
getval (param, valp)
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 0af3dc1..7a8a5f4 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -24,7 +24,7 @@
#include "subsegs.h"
#define DEFINE_TABLE
#include "../opcodes/mcore-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include <string.h>
#ifdef OBJ_ELF
@@ -390,11 +390,11 @@ mcore_s_section (ignore)
pool. */
char * ilp = input_line_pointer;
- while (*ilp != 0 && isspace(*ilp))
+ while (*ilp != 0 && ISSPACE (*ilp))
++ ilp;
if (strncmp (ilp, ".line", 5) == 0
- && (isspace (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
+ && (ISSPACE (ilp[5]) || *ilp == '\n' || *ilp == '\r'))
;
else
dump_literals (0);
@@ -480,10 +480,10 @@ parse_reg (s, reg)
unsigned * reg;
{
/* Strip leading whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
- if (tolower (s[0]) == 'r')
+ if (TOLOWER (s[0]) == 'r')
{
if (s[1] == '1' && s[2] >= '0' && s[2] <= '5')
{
@@ -497,9 +497,9 @@ parse_reg (s, reg)
return s + 2;
}
}
- else if ( tolower (s[0]) == 's'
- && tolower (s[1]) == 'p'
- && ! isalnum (s[2]))
+ else if ( TOLOWER (s[0]) == 's'
+ && TOLOWER (s[1]) == 'p'
+ && ! ISALNUM (s[2]))
{
* reg = 0;
return s + 2;
@@ -540,10 +540,10 @@ parse_creg (s, reg)
int i;
/* Strip leading whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++s;
- if ((tolower (s[0]) == 'c' && tolower (s[1]) == 'r'))
+ if ((TOLOWER (s[0]) == 'c' && TOLOWER (s[1]) == 'r'))
{
if (s[2] == '3' && s[3] >= '0' && s[3] <= '1')
{
@@ -580,7 +580,7 @@ parse_creg (s, reg)
length = strlen (cregs[i].name);
for (j = 0; j < length; j++)
- buf[j] = tolower (s[j]);
+ buf[j] = TOLOWER (s[j]);
if (strncmp (cregs[i].name, buf, length) == 0)
{
@@ -615,7 +615,7 @@ parse_psrmod (s, reg)
};
for (i = 0; i < 2; i++)
- buf[i] = isascii (s[i]) ? tolower (s[i]) : 0;
+ buf[i] = TOLOWER (s[i]);
for (i = sizeof (psrmods) / sizeof (psrmods[0]); i--;)
{
@@ -643,7 +643,7 @@ parse_exp (s, e)
char * new;
/* Skip whitespace. */
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
save = input_line_pointer;
@@ -903,14 +903,14 @@ parse_mem (s, reg, off, siz)
* off = 0;
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == '(')
{
s = parse_reg (s + 1, reg);
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == ',')
@@ -936,7 +936,7 @@ parse_mem (s, reg, off, siz)
}
}
- while (isspace (* s))
+ while (ISSPACE (* s))
++ s;
if (* s == ')')
@@ -969,7 +969,7 @@ md_assemble (str)
char name[20];
/* Drop leading whitespace. */
- while (isspace (* str))
+ while (ISSPACE (* str))
str ++;
/* Find the op code end. */
@@ -1068,7 +1068,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (*op_end == ',')
@@ -1092,7 +1092,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1110,7 +1110,7 @@ md_assemble (str)
op_end = parse_reg (op_end + 1, & reg);
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',') /* xtrb- r1,rx */
@@ -1130,7 +1130,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1150,7 +1150,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1169,7 +1169,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1188,7 +1188,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1217,7 +1217,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1244,7 +1244,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1283,7 +1283,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1316,7 +1316,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1335,7 +1335,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1354,7 +1354,7 @@ md_assemble (str)
inst |= reg << 8;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1390,7 +1390,7 @@ md_assemble (str)
inst |= (reg << 8);
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1421,7 +1421,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '-')
@@ -1432,7 +1432,7 @@ md_assemble (str)
as_bad (_("ending register must be r15"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
}
@@ -1441,7 +1441,7 @@ md_assemble (str)
op_end ++;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '(')
@@ -1470,7 +1470,7 @@ md_assemble (str)
as_fatal (_("first register must be r4"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '-')
@@ -1481,7 +1481,7 @@ md_assemble (str)
as_fatal (_("last register must be r7"));
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1489,7 +1489,7 @@ md_assemble (str)
op_end ++;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == '(')
@@ -1502,7 +1502,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ')')
@@ -1535,7 +1535,7 @@ md_assemble (str)
inst |= reg << 4;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1595,7 +1595,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1617,7 +1617,7 @@ md_assemble (str)
inst |= reg << 4;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1638,7 +1638,7 @@ md_assemble (str)
inst |= reg;
/* Skip whitespace. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
++ op_end;
if (* op_end == ',')
@@ -1690,7 +1690,7 @@ md_assemble (str)
}
/* Drop whitespace after all the operands have been parsed. */
- while (isspace (* op_end))
+ while (ISSPACE (* op_end))
op_end ++;
/* Give warning message if the insn has more operands than required. */
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 92cac7e..8babf77 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -26,8 +26,7 @@
#include "as.h"
#include "config.h"
#include "subsegs.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef USE_STDARG
#include <stdarg.h>
@@ -6946,13 +6945,13 @@ mips_ip (str, ip)
/* If the instruction contains a '.', we first try to match an instruction
including the '.'. Then we try again without the '.'. */
insn = NULL;
- for (s = str; *s != '\0' && !isspace ((unsigned char) *s); ++s)
+ for (s = str; *s != '\0' && !ISSPACE (*s); ++s)
continue;
/* If we stopped on whitespace, then replace the whitespace with null for
the call to hash_find. Save the character we replaced just in case we
have to re-parse the instruction. */
- if (isspace ((unsigned char) *s))
+ if (ISSPACE (*s))
{
save_c = *s;
*s++ = '\0';
@@ -6970,7 +6969,9 @@ mips_ip (str, ip)
*(--s) = save_c;
/* Scan up to the first '.' or whitespace. */
- for (s = str; *s != '\0' && *s != '.' && !isspace ((unsigned char) *s); ++s)
+ for (s = str;
+ *s != '\0' && *s != '.' && !ISSPACE (*s);
+ ++s)
continue;
/* If we did not find a '.', then we can quit now. */
@@ -7234,7 +7235,7 @@ mips_ip (str, ip)
if (s[0] == '$')
{
- if (isdigit ((unsigned char) s[1]))
+ if (ISDIGIT (s[1]))
{
++s;
regno = 0;
@@ -7244,7 +7245,7 @@ mips_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
as_bad (_("Invalid register number (%d)"), regno);
}
@@ -7397,7 +7398,8 @@ mips_ip (str, ip)
case 'V':
case 'W':
s_reset = s;
- if (s[0] == '$' && s[1] == 'f' && isdigit ((unsigned char) s[2]))
+ if (s[0] == '$' && s[1] == 'f'
+ && ISDIGIT (s[2]))
{
s += 2;
regno = 0;
@@ -7407,7 +7409,7 @@ mips_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
as_bad (_("Invalid float register number (%d)"), regno);
@@ -7860,7 +7862,7 @@ mips_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 7)
as_bad (_("invalid condition code register $fcc%d"), regno);
if (*args == 'N')
@@ -7872,7 +7874,7 @@ mips_ip (str, ip)
case 'H':
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
s += 2;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
c = 0;
do
@@ -7881,7 +7883,7 @@ mips_ip (str, ip)
c += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
}
else
c = 8; /* Invalid sel value. */
@@ -7938,7 +7940,7 @@ mips16_ip (str, ip)
mips16_small = false;
mips16_ext = false;
- for (s = str; islower ((unsigned char) *s); ++s)
+ for (s = str; ISLOWER (*s); ++s)
;
switch (*s)
{
@@ -8071,7 +8073,7 @@ mips16_ip (str, ip)
if (s[0] != '$')
break;
s_reset = s;
- if (isdigit ((unsigned char) s[1]))
+ if (ISDIGIT (s[1]))
{
++s;
regno = 0;
@@ -8081,7 +8083,7 @@ mips16_ip (str, ip)
regno += *s - '0';
++s;
}
- while (isdigit ((unsigned char) *s));
+ while (ISDIGIT (*s));
if (regno > 31)
{
as_bad (_("invalid register number (%d)"), regno);
@@ -8352,7 +8354,7 @@ mips16_ip (str, ip)
++s;
}
reg1 = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
reg1 *= 10;
reg1 += *s - '0';
@@ -8379,7 +8381,7 @@ mips16_ip (str, ip)
}
}
reg2 = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
reg2 *= 10;
reg2 += *s - '0';
@@ -8641,41 +8643,41 @@ my_getSmallExpression (ep, str)
if (*str == '(')
c = S_EX_NONE;
else if (str[0] == '%'
- && tolower(str[1]) == 'l'
- && tolower(str[2]) == 'o'
+ && TOLOWER (str[1]) == 'l'
+ && TOLOWER (str[2]) == 'o'
&& str[3] == '(')
{
c = S_EX_LO;
str += sizeof ("%lo(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
&& str[3] == '(')
{
c = S_EX_HI;
str += sizeof ("%hi(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
- && tolower(str[3]) == 'g'
- && tolower(str[4]) == 'h'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 'r'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
+ && TOLOWER (str[3]) == 'g'
+ && TOLOWER (str[4]) == 'h'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 'r'
&& str[7] == '(')
{
c = S_EX_HIGHER;
str += sizeof ("%higher(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'h'
- && tolower(str[2]) == 'i'
- && tolower(str[3]) == 'g'
- && tolower(str[4]) == 'h'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 's'
- && tolower(str[7]) == 't'
+ && TOLOWER (str[1]) == 'h'
+ && TOLOWER (str[2]) == 'i'
+ && TOLOWER (str[3]) == 'g'
+ && TOLOWER (str[4]) == 'h'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 's'
+ && TOLOWER (str[7]) == 't'
&& str[8] == '(')
{
c = S_EX_HIGHEST;
@@ -8684,21 +8686,21 @@ my_getSmallExpression (ep, str)
/* currently unsupported */
#if 0
else if (str[0] == '%'
- && tolower(str[1]) == 'g'
- && tolower(str[2]) == 'p'
- && tolower(str[3]) == '_'
- && tolower(str[4]) == 'r'
- && tolower(str[5]) == 'e'
- && tolower(str[6]) == 'l'
+ && TOLOWER (str[1]) == 'g'
+ && TOLOWER (str[2]) == 'p'
+ && TOLOWER (str[3]) == '_'
+ && TOLOWER (str[4]) == 'r'
+ && TOLOWER (str[5]) == 'e'
+ && TOLOWER (str[6]) == 'l'
&& str[7] == '(')
{
c = S_EX_GPREL;
str += sizeof ("%gp_rel(") - 2;
}
else if (str[0] == '%'
- && tolower(str[1]) == 'n'
- && tolower(str[2]) == 'e'
- && tolower(str[3]) == 'g'
+ && TOLOWER (str[1]) == 'n'
+ && TOLOWER (str[2]) == 'e'
+ && TOLOWER (str[3]) == 'g'
&& str[4] == '(')
{
c = S_EX_NEG;
@@ -8721,9 +8723,9 @@ my_getSmallExpression (ep, str)
;
if (sp - 4 >= str && sp[-1] == ')')
{
- if (isdigit ((unsigned char) sp[-2]))
+ if (ISDIGIT (sp[-2]))
{
- for (sp -= 3; sp >= str && isdigit ((unsigned char) *sp); sp--)
+ for (sp -= 3; sp >= str && ISDIGIT (*sp); sp--)
;
if (*sp == '$' && sp > str && sp[-1] == '(')
{
@@ -10777,7 +10779,7 @@ tc_get_register (frame)
as_warn (_("expected `$'"));
reg = 0;
}
- else if (isdigit ((unsigned char) *input_line_pointer))
+ else if (ISDIGIT (*input_line_pointer))
{
reg = get_absolute_expression ();
if (reg < 0 || reg >= 32)
@@ -11796,14 +11798,14 @@ get_number ()
++input_line_pointer;
negative = 1;
}
- if (!isdigit ((unsigned char) *input_line_pointer))
+ if (!ISDIGIT (*input_line_pointer))
as_bad (_("Expected simple number."));
if (input_line_pointer[0] == '0')
{
if (input_line_pointer[1] == 'x')
{
input_line_pointer += 2;
- while (isxdigit ((unsigned char) *input_line_pointer))
+ while (ISXDIGIT (*input_line_pointer))
{
val <<= 4;
val |= hex_value (*input_line_pointer++);
@@ -11813,7 +11815,7 @@ get_number ()
else
{
++input_line_pointer;
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
val <<= 3;
val |= *input_line_pointer++ - '0';
@@ -11821,14 +11823,14 @@ get_number ()
return negative ? -val : val;
}
}
- if (!isdigit ((unsigned char) *input_line_pointer))
+ if (!ISDIGIT (*input_line_pointer))
{
printf (_(" *input_line_pointer == '%c' 0x%02x\n"),
*input_line_pointer, *input_line_pointer);
as_warn (_("Invalid number"));
return -1;
}
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
val *= 10;
val += *input_line_pointer++ - '0';
@@ -11951,7 +11953,7 @@ s_mips_ent (aent)
if (*input_line_pointer == ',')
input_line_pointer++;
SKIP_WHITESPACE ();
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-')
number = get_number ();
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index a6a46af..1ccc8e0 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/mn10200.h"
@@ -781,7 +781,7 @@ md_assemble (str)
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && !isspace (*s); s++)
+ for (s = str; *s != '\0' && !ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -795,7 +795,7 @@ md_assemble (str)
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
input_line_pointer = str;
@@ -1029,7 +1029,7 @@ keep_going:
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 725f4f2..6782240 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/mn10300.h"
#include "dwarf2dbg.h"
@@ -917,7 +917,7 @@ md_assemble (str)
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && !isspace (*s); s++)
+ for (s = str; *s != '\0' && !ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -931,7 +931,7 @@ md_assemble (str)
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
input_line_pointer = str;
@@ -1445,7 +1445,7 @@ keep_going:
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index ca6cb8f..3aa890d 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -23,7 +23,6 @@
/*#define SHOW_NUM 1*//* Uncomment for debugging. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
#include "opcode/ns32k.h"
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index 3af7dc8..a38a0ea 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -26,6 +26,7 @@
*/
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/pdp11.h"
static int set_option PARAMS ((char *arg));
@@ -252,19 +253,11 @@ find_whitespace (char *str)
return str;
}
-static char
-mklower (char c)
-{
- if (isupper (c))
- return tolower (c);
- return c;
-}
-
static char *
parse_reg (char *str, struct pdp11_code *operand)
{
str = skip_whitespace (str);
- if (mklower (*str) == 'r')
+ if (TOLOWER (*str) == 'r')
{
str++;
switch (*str)
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index fbd0eb6..7d5b835 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -1,6 +1,6 @@
/*-
tc-pj.c -- Assemble code for Pico Java
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -22,6 +22,7 @@
/* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/pj.h"
extern const pj_opc_info_t pj_opc_info[512];
@@ -312,7 +313,7 @@ md_assemble (str)
pending_reloc = 0;
}
- while (isspace (*op_end))
+ while (ISSPACE (*op_end))
op_end++;
if (*op_end != 0)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index f06bb58..945e6dc 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -21,8 +21,8 @@
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/ppc.h"
@@ -618,10 +618,10 @@ register_name (expressionP)
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
- else if (!reg_names_p || !isalpha (name[0]))
+ else if (!reg_names_p || !ISALPHA (name[0]))
return false;
c = get_symbol_end ();
@@ -1383,10 +1383,10 @@ ppc_elf_suffix (str_p, exp_p)
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
- *str2++ = (islower (ch)) ? ch : tolower (ch);
+ *str2++ = TOLOWER (ch);
}
*str2 = '\0';
@@ -1820,7 +1820,7 @@ md_assemble (str)
#endif
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -1843,7 +1843,7 @@ md_assemble (str)
insn = opcode->opcode;
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
/* PowerPC operands are just expressions. The only real issue is
@@ -2266,7 +2266,7 @@ md_assemble (str)
++str;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
@@ -4267,8 +4267,7 @@ ppc_canonicalize_symbol_name (name)
}
for (s++; *s != '\0' && *s != brac; s++)
- if (islower (*s))
- *s = toupper (*s);
+ *s = TOUPPER (*s);
if (*s == '\0' || s[1] != '\0')
as_bad (_("bad symbol suffix"));
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 6b93796..a84750b 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -20,8 +20,8 @@
02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "struc-symbol.h"
@@ -263,7 +263,7 @@ register_name (expressionP)
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
else
return false;
@@ -633,7 +633,7 @@ s390_elf_suffix (str_p, exp_p)
return ELF_SUFFIX_NONE;
ident = str;
- while (isalnum (*str))
+ while (ISALNUM (*str))
str++;
len = str - ident;
@@ -782,7 +782,7 @@ s390_lit_suffix (str_p, exp_p, suffix)
/* We look for a suffix of the form "@lit1", "@lit2", "@lit4" or "@lit8". */
ident = str;
- while (isalnum (*str))
+ while (ISALNUM (*str))
str++;
len = str - ident;
if (len != 4 || strncasecmp (ident, "lit", 3) != 0 ||
@@ -1006,7 +1006,7 @@ md_gather_operands (str, insn, opcode)
char *f;
int fc, i;
- while (isspace(*str)) str++;
+ while (ISSPACE (*str)) str++;
parentheses = 0;
skip_optional = 0;
@@ -1193,7 +1193,7 @@ md_gather_operands (str, insn, opcode)
}
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
@@ -1267,7 +1267,7 @@ md_assemble (str)
char *s;
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
@@ -1336,7 +1336,7 @@ s390_insn (ignore)
/* Get the opcode format. */
s = input_line_pointer;
- while (*s != '\0' && *s != ',' && ! isspace (*s))
+ while (*s != '\0' && *s != ',' && ! ISSPACE (*s))
s++;
if (*s != ',')
as_bad (_("Invalid .insn format\n"));
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 9308959..b574e68 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -27,7 +27,7 @@
#include "subsegs.h"
#define DEFINE_TABLE
#include "opcodes/sh-opc.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "struc-symbol.h"
#ifdef OBJ_ELF
@@ -282,11 +282,9 @@ sh_elf_suffix (str_p, exp_p, new_exp_p)
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
- {
- *str2++ = (islower (ch)) ? ch : tolower (ch);
- }
+ *str2++ = TOLOWER (ch);
*str2 = '\0';
len = str2 - ident;
@@ -479,7 +477,7 @@ static int reg_x, reg_y;
static int reg_efg;
static int reg_b;
-#define IDENT_CHAR(c) (isalnum (c) || (c) == '_')
+#define IDENT_CHAR(c) (ISALNUM (c) || (c) == '_')
/* Try to parse a reg name. Return the number of chars consumed. */
@@ -489,8 +487,8 @@ parse_reg (src, mode, reg)
int *mode;
int *reg;
{
- char l0 = tolower (src[0]);
- char l1 = l0 ? tolower (src[1]) : 0;
+ char l0 = TOLOWER (src[0]);
+ char l1 = l0 ? TOLOWER (src[1]) : 0;
/* We use ! IDENT_CHAR for the next character after the register name, to
make sure that we won't accidentally recognize a symbol name such as
@@ -545,7 +543,7 @@ parse_reg (src, mode, reg)
*reg = A_A0_NUM;
return 2;
}
- if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = DSP_REG_N;
*reg = A_A0G_NUM;
@@ -560,7 +558,7 @@ parse_reg (src, mode, reg)
*reg = A_A1_NUM;
return 2;
}
- if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
+ if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = DSP_REG_N;
*reg = A_A1G_NUM;
@@ -641,34 +639,34 @@ parse_reg (src, mode, reg)
if (l0 == 's'
&& l1 == 's'
- && tolower (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
+ && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SSR;
return 3;
}
- if (l0 == 's' && l1 == 'p' && tolower (src[2]) == 'c'
+ if (l0 == 's' && l1 == 'p' && TOLOWER (src[2]) == 'c'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SPC;
return 3;
}
- if (l0 == 's' && l1 == 'g' && tolower (src[2]) == 'r'
+ if (l0 == 's' && l1 == 'g' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_SGR;
return 3;
}
- if (l0 == 'd' && l1 == 's' && tolower (src[2]) == 'r'
+ if (l0 == 'd' && l1 == 's' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_DSR;
return 3;
}
- if (l0 == 'd' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'd' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_DBR;
@@ -700,34 +698,34 @@ parse_reg (src, mode, reg)
*mode = A_PC;
return 2;
}
- if (l0 == 'g' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'g' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_GBR;
return 3;
}
- if (l0 == 'v' && l1 == 'b' && tolower (src[2]) == 'r'
+ if (l0 == 'v' && l1 == 'b' && TOLOWER (src[2]) == 'r'
&& ! IDENT_CHAR ((unsigned char) src[3]))
{
*mode = A_VBR;
return 3;
}
- if (l0 == 'm' && l1 == 'a' && tolower (src[2]) == 'c'
+ if (l0 == 'm' && l1 == 'a' && TOLOWER (src[2]) == 'c'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
- if (tolower (src[3]) == 'l')
+ if (TOLOWER (src[3]) == 'l')
{
*mode = A_MACL;
return 4;
}
- if (tolower (src[3]) == 'h')
+ if (TOLOWER (src[3]) == 'h')
{
*mode = A_MACH;
return 4;
}
}
- if (l0 == 'm' && l1 == 'o' && tolower (src[2]) == 'd'
+ if (l0 == 'm' && l1 == 'o' && TOLOWER (src[2]) == 'd'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
*mode = A_MOD;
@@ -809,25 +807,25 @@ parse_reg (src, mode, reg)
return 3;
}
}
- if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 'u'
- && tolower (src[3]) == 'l'
+ if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 'u'
+ && TOLOWER (src[3]) == 'l'
&& ! IDENT_CHAR ((unsigned char) src[4]))
{
*mode = FPUL_N;
return 4;
}
- if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 's'
- && tolower (src[3]) == 'c'
- && tolower (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
+ if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 's'
+ && TOLOWER (src[3]) == 'c'
+ && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5]))
{
*mode = FPSCR_N;
return 5;
}
- if (l0 == 'x' && l1 == 'm' && tolower (src[2]) == 't'
- && tolower (src[3]) == 'r'
- && tolower (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
+ if (l0 == 'x' && l1 == 'm' && TOLOWER (src[2]) == 't'
+ && TOLOWER (src[3]) == 'r'
+ && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5]))
{
*mode = XMTRX_M4;
return 5;
@@ -1637,9 +1635,9 @@ find_cooked_opcode (str_p)
/* The machine independent code will convert CMP/EQ into cmp/EQ
because it thinks the '/' is the end of the symbol. Moreover,
all but the first sub-insn is a parallel processing insn won't
- be capitailzed. Instead of hacking up the machine independent
+ be capitalized. Instead of hacking up the machine independent
code, we just deal with it here. */
- c = isupper (c) ? tolower (c) : c;
+ c = TOLOWER (c);
name[nlen] = c;
nlen++;
}
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 33ea071..692a7fa 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -20,9 +20,9 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/sparc.h"
@@ -1385,11 +1385,11 @@ sparc_ip (str, pinsn)
int special_case = SPECIAL_CASE_NONE;
s = str;
- if (islower ((unsigned char) *s))
+ if (ISLOWER (*s))
{
do
++s;
- while (islower ((unsigned char) *s) || isdigit ((unsigned char) *s));
+ while (ISLOWER (*s) || ISDIGIT (*s));
}
switch (*s)
@@ -1617,11 +1617,11 @@ sparc_ip (str, pinsn)
{
s += 4;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
long num = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
num = num * 10 + *s - '0';
++s;
@@ -1825,9 +1825,9 @@ sparc_ip (str, pinsn)
break;
case '#': /* Must be at least one digit. */
- if (isdigit ((unsigned char) *s++))
+ if (ISDIGIT (*s++))
{
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
++s;
}
@@ -1846,10 +1846,10 @@ sparc_ip (str, pinsn)
case 'b': /* Next operand is a coprocessor register. */
case 'c':
case 'D':
- if (*s++ == '%' && *s++ == 'c' && isdigit ((unsigned char) *s))
+ if (*s++ == '%' && *s++ == 'c' && ISDIGIT (*s))
{
mask = *s++;
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32)
@@ -1942,7 +1942,7 @@ sparc_ip (str, pinsn)
goto error;
case 'r': /* any register */
- if (!isdigit ((unsigned char) (c = *s++)))
+ if (!ISDIGIT ((c = *s++)))
{
goto error;
}
@@ -1957,7 +1957,7 @@ sparc_ip (str, pinsn)
case '7':
case '8':
case '9':
- if (isdigit ((unsigned char) *s))
+ if (ISDIGIT (*s))
{
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
{
@@ -2022,9 +2022,9 @@ sparc_ip (str, pinsn)
if (*s++ == '%'
&& ((format = *s) == 'f')
- && isdigit ((unsigned char) *++s))
+ && ISDIGIT (*++s))
{
- for (mask = 0; isdigit ((unsigned char) *s); ++s)
+ for (mask = 0; ISDIGIT (*s); ++s)
{
mask = 10 * mask + (*s - '0');
} /* read the number */
@@ -2240,7 +2240,7 @@ sparc_ip (str, pinsn)
for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++)
;
- if (s1 != s && isdigit ((unsigned char) s1[-1]))
+ if (s1 != s && ISDIGIT (s1[-1]))
{
if (s1[-2] == '%' && s1[-3] == '+')
s1 -= 3;
@@ -2663,7 +2663,7 @@ parse_keyword_arg (lookup_fn, input_pointerP, valueP)
p = *input_pointerP;
for (q = p + (*p == '#' || *p == '%');
- isalnum ((unsigned char) *q) || *q == '_';
+ ISALNUM (*q) || *q == '_';
++q)
continue;
c = *q;
diff --git a/gas/config/tc-tahoe.c b/gas/config/tc-tahoe.c
index f4f781a..895c426 100644
--- a/gas/config/tc-tahoe.c
+++ b/gas/config/tc-tahoe.c
@@ -1,6 +1,6 @@
/* This file is tc-tahoe.c
- Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000
+ Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -20,6 +20,7 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
/* This bit glommed from tahoe-inst.h. */
@@ -885,11 +886,11 @@ tahoe_reg_parse (start)
R or r, and then a number. */
case 'R':
case 'r':
- if (isdigit (*regpoint))
+ if (ISDIGIT (*regpoint))
{
/* Got the first digit. */
regnum = *regpoint++ - '0';
- if ((regnum == 1) && isdigit (*regpoint))
+ if ((regnum == 1) && ISDIGIT (*regpoint))
{
/* Its a two digit number. */
regnum = 10 + (*regpoint++ - '0');
@@ -1064,7 +1065,7 @@ tip_op (optex, topP)
as_warn (_("Casting a branch displacement is bad form, and is ignored."));
else
{
- c = (isupper (*point) ? tolower (*point) : *point);
+ c = TOLOWER (*point);
call_width = ((c == 'b') ? 1 :
((c == 'w') ? 2 : 4));
}
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 2190a85..21f2ad9 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -1,5 +1,5 @@
/* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of GAS, the GNU Assembler.
@@ -25,6 +25,7 @@
Please help us make it better. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/tic30.h"
/* Put here all non-digit non-letter charcters that may occur in an
@@ -188,25 +189,25 @@ md_begin ()
for (c = 0; c < 256; c++)
{
- if (islower (c) || isdigit (c))
+ if (ISLOWER (c) || ISDIGIT (c))
{
opcode_chars[c] = c;
register_chars[c] = c;
}
- else if (isupper (c))
+ else if (ISUPPER (c))
{
- opcode_chars[c] = tolower (c);
+ opcode_chars[c] = TOLOWER (c);
register_chars[c] = opcode_chars[c];
}
else if (c == ')' || c == '(')
{
register_chars[c] = c;
}
- if (isupper (c) || islower (c) || isdigit (c))
+ if (ISUPPER (c) || ISLOWER (c) || ISDIGIT (c))
operand_chars[c] = c;
- if (isdigit (c) || c == '-')
+ if (ISDIGIT (c) || c == '-')
digit_chars[c] = c;
- if (isalpha (c) || c == '_' || c == '.' || isdigit (c))
+ if (ISALPHA (c) || c == '_' || c == '.' || ISDIGIT (c))
identifier_chars[c] = c;
if (c == ' ' || c == '\t')
space_chars[c] = c;
@@ -1267,7 +1268,7 @@ tic30_operand (token)
ind_buffer[0] = *token;
for (count = 1; count < strlen (token); count++)
{ /* Strip operand */
- ind_buffer[buffer_posn] = tolower (*(token + count));
+ ind_buffer[buffer_posn] = TOLOWER (*(token + count));
if ((*(token + count - 1) == 'a' || *(token + count - 1) == 'A') &&
(*(token + count) == 'r' || *(token + count) == 'R'))
{
@@ -1486,12 +1487,12 @@ tic30_find_parallel_insn (current_line, next_line)
{
if (is_opcode_char (c) && search_status == NONE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
search_status = START_OPCODE;
}
else if (is_opcode_char (c) && search_status == START_OPCODE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
}
else if (!is_opcode_char (c) && search_status == START_OPCODE)
{
@@ -1868,7 +1869,7 @@ char *
output_invalid (c)
char c;
{
- if (isprint (c))
+ if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c);
else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index f0b1007..3c59a8a 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -45,6 +45,7 @@
#include <limits.h>
#include <errno.h>
#include "as.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "macro.h"
#include "subsegs.h"
@@ -355,7 +356,7 @@ tic54x_asg (x)
name = ++input_line_pointer;
c = get_symbol_end (); /* Get terminator. */
- if (!isalpha (*name))
+ if (!ISALPHA (*name))
{
as_bad ("symbols assigned with .asg must begin with a letter");
ignore_rest_of_line ();
@@ -420,7 +421,7 @@ tic54x_eval (x)
name = strcpy (tmp, name);
*input_line_pointer = c;
- if (!isalpha (*name))
+ if (!ISALPHA (*name))
{
as_bad (_("symbols assigned with .eval must begin with a letter"));
ignore_rest_of_line ();
@@ -1464,8 +1465,8 @@ lookup_version (ver)
|| ver[2] == '5' || ver[2] == '8' || ver[2] == '9'))
version = ver[2] - '0';
else if (strlen (ver) == 5
- && toupper (ver[3]) == 'L'
- && toupper (ver[4]) == 'P'
+ && TOUPPER (ver[3]) == 'L'
+ && TOUPPER (ver[4]) == 'P'
&& (ver[2] == '5' || ver[2] == '6'))
version = ver[2] - '0' + 10;
}
@@ -2272,7 +2273,7 @@ tic54x_var (ignore)
}
do
{
- if (!isalpha (*input_line_pointer))
+ if (!ISALPHA (*input_line_pointer))
{
as_bad (_("Substitution symbols must begin with a letter"));
ignore_rest_of_line ();
@@ -2325,7 +2326,7 @@ tic54x_mlib (ignore)
SKIP_WHITESPACE ();
len = 0;
while (!is_end_of_line[(int) *input_line_pointer]
- && !isspace (*input_line_pointer))
+ && !ISSPACE (*input_line_pointer))
{
obstack_1grow (&notes, *input_line_pointer);
++input_line_pointer;
@@ -2739,7 +2740,7 @@ subsym_iscons (a, ignore)
{
int len = strlen (a);
- switch (toupper (a[len - 1]))
+ switch (TOUPPER (a[len - 1]))
{
case 'B':
return 1;
@@ -2755,7 +2756,7 @@ subsym_iscons (a, ignore)
/* No suffix; either octal, hex, or decimal. */
if (*a == '0' && len > 1)
{
- if (toupper (a[1]) == 'X')
+ if (TOUPPER (a[1]) == 'X')
return 3;
return 2;
}
@@ -3294,7 +3295,7 @@ get_operands (operands, line)
{
int paren_not_balanced = 0;
char *op_start, *op_end;
- while (*lptr && isspace (*lptr))
+ while (*lptr && ISSPACE (*lptr))
++lptr;
op_start = lptr;
while (paren_not_balanced || *lptr != ',')
@@ -3324,7 +3325,7 @@ get_operands (operands, line)
/* Trim trailing spaces; while the preprocessor gets rid of most,
there are weird usage patterns that can introduce them
(i.e. using strings for macro args). */
- while (len > 0 && isspace (operands[numexp].buf[len - 1]))
+ while (len > 0 && ISSPACE (operands[numexp].buf[len - 1]))
operands[numexp].buf[--len] = 0;
lptr = op_end;
++numexp;
@@ -3348,7 +3349,7 @@ get_operands (operands, line)
}
}
- while (*lptr && isspace (*lptr++))
+ while (*lptr && ISSPACE (*lptr++))
;
if (!is_end_of_line[(int) *lptr])
{
@@ -3501,12 +3502,12 @@ is_type (operand, type)
case OP_DST:
return is_accumulator (operand);
case OP_B:
- return is_accumulator (operand) && toupper (operand->buf[0]) == 'B';
+ return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'B';
case OP_A:
- return is_accumulator (operand) && toupper (operand->buf[0]) == 'A';
+ return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'A';
case OP_ARX:
return strncasecmp ("ar", operand->buf, 2) == 0
- && isdigit (operand->buf[2]);
+ && ISDIGIT (operand->buf[2]);
case OP_SBIT:
return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
case OP_CC:
@@ -3736,7 +3737,7 @@ encode_indirect (insn, operand)
if (insn->is_lkaddr)
{
/* lk addresses always go in the second insn word. */
- mod = ((toupper (operand->buf[1]) == 'A') ? 12 :
+ mod = ((TOUPPER (operand->buf[1]) == 'A') ? 12 :
(operand->buf[1] == '(') ? 15 :
(strchr (operand->buf, '%') != NULL) ? 14 : 13);
arf = ((mod == 12) ? operand->buf[3] - '0' :
@@ -3761,7 +3762,7 @@ encode_indirect (insn, operand)
}
else
{
- arf = (toupper (operand->buf[1]) == 'A' ?
+ arf = (TOUPPER (operand->buf[1]) == 'A' ?
operand->buf[3] : operand->buf[4]) - '0';
if (operand->buf[1] == '+')
@@ -3782,9 +3783,9 @@ encode_indirect (insn, operand)
else
mod = (operand->buf[4] == '-' ? 8 : 10);/* *ARx+% / *ARx-% */
}
- else if (toupper (operand->buf[6]) == 'B')
+ else if (TOUPPER (operand->buf[6]) == 'B')
mod = (operand->buf[4] == '-' ? 4 : 7); /* ARx+0B / *ARx-0B */
- else if (toupper (operand->buf[6]) == '%')
+ else if (TOUPPER (operand->buf[6]) == '%')
mod = (operand->buf[4] == '-' ? 9 : 11); /* ARx+0% / *ARx - 0% */
else
{
@@ -4002,7 +4003,7 @@ encode_operand (insn, type, operand)
/* 16-bit immediate value. */
return encode_dmad (insn, operand, 0);
case OP_SRC:
- if (toupper (*operand->buf) == 'B')
+ if (TOUPPER (*operand->buf) == 'B')
{
insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9);
if (insn->using_default_dst)
@@ -4011,7 +4012,7 @@ encode_operand (insn, type, operand)
return 1;
case OP_RND:
/* Make sure this agrees with with the OP_DST operand. */
- if (!((toupper (operand->buf[0]) == 'B') ^
+ if (!((TOUPPER (operand->buf[0]) == 'B') ^
((insn->opcode[0].word & (1 << 8)) != 0)))
{
as_bad (_("Destination accumulator for each part of this parallel "
@@ -4021,7 +4022,7 @@ encode_operand (insn, type, operand)
return 1;
case OP_SRC1:
case OP_DST:
- if (toupper (operand->buf[0]) == 'B')
+ if (TOUPPER (operand->buf[0]) == 'B')
insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 8);
return 1;
case OP_Xmem:
@@ -4418,7 +4419,7 @@ next_line_shows_parallel (next_line)
char *next_line;
{
/* Look for the second half. */
- while (isspace (*next_line))
+ while (ISSPACE (*next_line))
++next_line;
return (next_line[0] == PARALLEL_SEPARATOR
@@ -4505,11 +4506,11 @@ subsym_get_arg (char *line, char *terminators, char **str, int nosub)
char *ptr = line;
char *endp;
int is_string = *line == '"';
- int is_char = isdigit (*line);
+ int is_char = ISDIGIT (*line);
if (is_char)
{
- while (isdigit (*ptr))
+ while (ISDIGIT (*ptr))
++ptr;
endp = ptr;
*str = xmalloc (ptr - line + 1);
@@ -4728,7 +4729,7 @@ subsym_substitute (char *line, int forced)
/* Check for local labels; replace them with the appropriate
substitution. */
- if ((*name == '$' && isdigit (name[1]) && name[2] == '\0')
+ if ((*name == '$' && ISDIGIT (name[1]) && name[2] == '\0')
|| name[strlen (name) - 1] == '?')
{
/* Use an existing identifier for that label if, available, or
@@ -4821,7 +4822,7 @@ subsym_substitute (char *line, int forced)
}
/* Character constants are converted to numerics
by the preprocessor. */
- arg_type[1] = (isdigit (*ptr)) ? 2 : (*ptr == '"');
+ arg_type[1] = (ISDIGIT (*ptr)) ? 2 : (*ptr == '"');
ptr = subsym_get_arg (ptr, ")", &arg2, ismember);
}
/* Args checking. */
@@ -5026,7 +5027,7 @@ tic54x_start_line_hook ()
comment = replacement + strlen (replacement) - 1;
/* Trim trailing whitespace. */
- while (isspace (*comment))
+ while (ISSPACE (*comment))
{
comment[0] = endc;
comment[1] = 0;
@@ -5034,7 +5035,7 @@ tic54x_start_line_hook ()
}
/* Compact leading whitespace. */
- while (isspace (tmp[0]) && isspace (tmp[1]))
+ while (ISSPACE (tmp[0]) && ISSPACE (tmp[1]))
++tmp;
input_line_pointer = endp;
@@ -5135,7 +5136,7 @@ md_assemble (line)
otherwise let the assembler pick up the next line for us. */
if (tmp != NULL)
{
- while (isspace (tmp[2]))
+ while (ISSPACE (tmp[2]))
++tmp;
md_assemble (tmp + 2);
}
@@ -5673,18 +5674,18 @@ tic54x_start_label (c, rest)
if (is_end_of_line[(int) c])
return 1;
- if (isspace (c))
- while (isspace (c = *++rest))
+ if (ISSPACE (c))
+ while (ISSPACE (c = *++rest))
;
if (c == '.')
{
/* Don't let colon () define a label for any of these... */
- return (strncasecmp (rest, ".tag", 4) != 0 || !isspace (rest[4]))
- && (strncasecmp (rest, ".struct", 7) != 0 || !isspace (rest[7]))
- && (strncasecmp (rest, ".union", 6) != 0 || !isspace (rest[6]))
- && (strncasecmp (rest, ".macro", 6) != 0 || !isspace (rest[6]))
- && (strncasecmp (rest, ".set", 4) != 0 || !isspace (rest[4]))
- && (strncasecmp (rest, ".equ", 4) != 0 || !isspace (rest[4]));
+ return (strncasecmp (rest, ".tag", 4) != 0 || !ISSPACE (rest[4]))
+ && (strncasecmp (rest, ".struct", 7) != 0 || !ISSPACE (rest[7]))
+ && (strncasecmp (rest, ".union", 6) != 0 || !ISSPACE (rest[6]))
+ && (strncasecmp (rest, ".macro", 6) != 0 || !ISSPACE (rest[6]))
+ && (strncasecmp (rest, ".set", 4) != 0 || !ISSPACE (rest[4]))
+ && (strncasecmp (rest, ".equ", 4) != 0 || !ISSPACE (rest[4]));
}
return 1;
diff --git a/gas/config/tc-tic80.c b/gas/config/tc-tic80.c
index 244e16b..585865f 100644
--- a/gas/config/tc-tic80.c
+++ b/gas/config/tc-tic80.c
@@ -1,5 +1,5 @@
/* tc-tic80.c -- Assemble for the TI TMS320C80 (MV)
- Copyright 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -19,6 +19,7 @@
02111-1307, USA. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/tic80.h"
#define internal_error(what) \
@@ -784,12 +785,12 @@ md_assemble (str)
assert (str);
/* Drop any leading whitespace. */
- while (isspace (*str))
+ while (ISSPACE (*str))
str++;
/* Isolate the mnemonic from the rest of the string by finding the first
whitespace character and zapping it to a null byte. */
- for (scan = str; *scan != '\000' && !isspace (*scan); scan++)
+ for (scan = str; *scan != '\000' && !ISSPACE (*scan); scan++)
;
if (*scan != '\000')
@@ -803,7 +804,7 @@ md_assemble (str)
}
str = scan;
- while (isspace (*scan))
+ while (ISSPACE (*scan))
scan++;
input_line_save = input_line_pointer;
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index ce676cd..46104a4 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/v850.h"
#include "dwarf2dbg.h"
@@ -858,7 +858,7 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
/* Reset input_line pointer. */
input_line_pointer = start;
- if (isdigit (*input_line_pointer))
+ if (ISDIGIT (*input_line_pointer))
{
reg_number = strtol (input_line_pointer, &input_line_pointer, 10);
@@ -1711,7 +1711,7 @@ md_assemble (str)
strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
continue;
if (*s != '\0')
@@ -1728,7 +1728,7 @@ md_assemble (str)
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
start_of_operands = str;
@@ -2141,7 +2141,7 @@ md_assemble (str)
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index bf6558c..8400b5d 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -1965,7 +1965,7 @@ main ()
*
*/
-#include <ctype.h>
+#include "safe-ctype.h"
#define AP (12)
#define FP (13)
#define SP (14)
@@ -1979,14 +1979,12 @@ vax_reg_parse (c1, c2, c3) /* 3 chars of register name */
retval = -1;
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
- if (isdigit (c2) && c1 == 'r')
+ c1 = TOLOWER (c1);
+ c2 = TOLOWER (c2);
+ if (ISDIGIT (c2) && c1 == 'r')
{
retval = c2 - '0';
- if (isdigit (c3))
+ if (ISDIGIT (c3))
{
retval = retval * 10 + c3 - '0';
retval = (retval > 15) ? -1 : retval;
@@ -2332,8 +2330,7 @@ vip_op (optext, vopP)
char c;
c = *p;
- if (isupper (c))
- c = tolower (c);
+ c = TOLOWER (c);
if (DISPLENP (p[1]) && strchr ("bilws", len = c))
p += 2; /* skip (letter) '^' */
else /* no (letter) '^' seen */
diff --git a/gas/config/tc-w65.c b/gas/config/tc-w65.c
index 24247ae..dda8859 100644
--- a/gas/config/tc-w65.c
+++ b/gas/config/tc-w65.c
@@ -26,7 +26,6 @@
#include "subsegs.h"
#define DEFINE_TABLE
#include "../opcodes/w65-opc.h"
-#include <ctype.h>
const char comment_chars[] = "!";
CONST char line_separator_chars[] = ";";
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index d8bbb8b..924ce9c 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1,5 +1,5 @@
/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -28,7 +28,7 @@
#include "as.h"
#include "bfd.h"
-#include <ctype.h>
+#include "safe-ctype.h"
const char comment_chars[] = "!";
const char line_comment_chars[] = "#";
@@ -70,9 +70,9 @@ int
tohex (c)
int c;
{
- if (isdigit (c))
+ if (ISDIGIT (c))
return c - '0';
- if (islower (c))
+ if (ISLOWER (c))
return c - 'a' + 10;
return c - 'A' + 10;
}
@@ -221,7 +221,7 @@ whatreg (reg, src)
int *reg;
char *src;
{
- if (isdigit (src[1]))
+ if (ISDIGIT (src[1]))
{
*reg = (src[0] - '0') * 10 + src[1] - '0';
return src + 2;
diff --git a/gas/ecoff.c b/gas/ecoff.c
index cbcdd9f..ed11921 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -37,7 +37,7 @@
#include "coff/symconst.h"
#include "aout/stab_gnu.h"
-#include <ctype.h>
+#include "safe-ctype.h"
/* Why isn't this in coff/sym.h? */
#define ST_RFDESCAPE 0xfff
@@ -3101,7 +3101,7 @@ ecoff_directive_ent (ignore)
++input_line_pointer;
SKIP_WHITESPACE ();
}
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-')
(void) get_absolute_expression ();
@@ -3546,7 +3546,7 @@ ecoff_stab (sec, what, string, type, other, desc)
listing_source_file (string);
#endif
- if (isdigit ((unsigned char) *input_line_pointer)
+ if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-'
|| *input_line_pointer == '+')
{
diff --git a/gas/expr.c b/gas/expr.c
index 4f7f225..499f9a3 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -25,11 +25,11 @@
(It also gives smaller files to re-compile.)
Here, "operand"s are of expressions, not instructions. */
-#include <ctype.h>
#include <string.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
static void floating_constant PARAMS ((expressionS * expressionP));
@@ -331,9 +331,7 @@ integer_constant (radix, expressionP)
/* In MRI mode, the number may have a suffix indicating the
radix. For that matter, it might actually be a floating
point constant. */
- for (suffix = input_line_pointer;
- isalnum ((unsigned char) *suffix);
- suffix++)
+ for (suffix = input_line_pointer; ISALNUM (*suffix); suffix++)
{
if (*suffix == 'e' || *suffix == 'E')
flt = 1;
@@ -347,8 +345,7 @@ integer_constant (radix, expressionP)
else
{
c = *--suffix;
- if (islower ((unsigned char) c))
- c = toupper (c);
+ c = TOUPPER (c);
if (c == 'B')
radix = 2;
else if (c == 'D')
@@ -862,8 +859,7 @@ operand (expressionP)
{
input_line_pointer++;
floating_constant (expressionP);
- expressionP->X_add_number =
- - (isupper ((unsigned char) c) ? tolower (c) : c);
+ expressionP->X_add_number = - TOLOWER (c);
}
else
{
@@ -985,8 +981,7 @@ operand (expressionP)
case 'G':
input_line_pointer++;
floating_constant (expressionP);
- expressionP->X_add_number =
- - (isupper ((unsigned char) c) ? tolower (c) : c);
+ expressionP->X_add_number = - TOLOWER (c);
break;
case '$':
diff --git a/gas/gasp.c b/gas/gasp.c
index ad33a46..4022408 100644
--- a/gas/gasp.c
+++ b/gas/gasp.c
@@ -1,5 +1,5 @@
/* gasp.c - Gnu assembler preprocessor main program.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
@@ -51,7 +51,6 @@ suitable for gas to consume.
#include <stdio.h>
#include <string.h>
#include <getopt.h>
-#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -63,6 +62,7 @@ extern char *malloc ();
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "macro.h"
#include "asintl.h"
@@ -539,7 +539,7 @@ sb_strtol (idx, string, base, ptr)
{
int ch = string->ptr[idx];
int dig = 0;
- if (isdigit (ch))
+ if (ISDIGIT (ch))
dig = ch - '0';
else if (ch >= 'a' && ch <= 'f')
dig = ch - 'a' + 10;
@@ -574,7 +574,7 @@ level_0 (idx, string, lhs)
lhs->value = 0;
- if (isdigit ((unsigned char) string->ptr[idx]))
+ if (ISDIGIT (string->ptr[idx]))
{
idx = sb_strtol (idx, string, 10, &lhs->value);
}
@@ -1132,7 +1132,7 @@ change_base (idx, in, out)
idx++;
}
}
- else if (isdigit ((unsigned char) in->ptr[idx]))
+ else if (ISDIGIT (in->ptr[idx]))
{
int value;
/* All numbers must start with a digit, let's chew it and
@@ -1676,7 +1676,7 @@ doinstr (idx, in, out)
idx = sb_skip_comma (idx, in);
idx = get_and_process (idx, in, &search);
idx = sb_skip_comma (idx, in);
- if (isdigit ((unsigned char) in->ptr[idx]))
+ if (ISDIGIT (in->ptr[idx]))
{
idx = exp_get_abs (_(".instr needs absolute expresson.\n"), idx, in, &start);
}
@@ -1776,26 +1776,26 @@ process_assigns (idx, in, buf)
}
else if (idx + 3 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'L'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'E'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'N')
+ && TOUPPER (in->ptr[idx + 1]) == 'L'
+ && TOUPPER (in->ptr[idx + 2]) == 'E'
+ && TOUPPER (in->ptr[idx + 3]) == 'N')
idx = dolen (idx + 4, in, buf);
else if (idx + 6 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'I'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'N'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 4]) == 'T'
- && toupper ((unsigned char) in->ptr[idx + 5]) == 'R')
+ && TOUPPER (in->ptr[idx + 1]) == 'I'
+ && TOUPPER (in->ptr[idx + 2]) == 'N'
+ && TOUPPER (in->ptr[idx + 3]) == 'S'
+ && TOUPPER (in->ptr[idx + 4]) == 'T'
+ && TOUPPER (in->ptr[idx + 5]) == 'R')
idx = doinstr (idx + 6, in, buf);
else if (idx + 7 < in->len
&& in->ptr[idx] == '.'
- && toupper ((unsigned char) in->ptr[idx + 1]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 2]) == 'U'
- && toupper ((unsigned char) in->ptr[idx + 3]) == 'B'
- && toupper ((unsigned char) in->ptr[idx + 4]) == 'S'
- && toupper ((unsigned char) in->ptr[idx + 5]) == 'T'
- && toupper ((unsigned char) in->ptr[idx + 6]) == 'R')
+ && TOUPPER (in->ptr[idx + 1]) == 'S'
+ && TOUPPER (in->ptr[idx + 2]) == 'U'
+ && TOUPPER (in->ptr[idx + 3]) == 'B'
+ && TOUPPER (in->ptr[idx + 4]) == 'S'
+ && TOUPPER (in->ptr[idx + 5]) == 'T'
+ && TOUPPER (in->ptr[idx + 6]) == 'R')
idx = dosubstr (idx + 7, in, buf);
else if (ISFIRSTCHAR (in->ptr[idx]))
{
@@ -2130,8 +2130,8 @@ whatcond (idx, in, val)
char a, b;
p = in->ptr + idx;
- a = toupper ((unsigned char) p[0]);
- b = toupper ((unsigned char) p[1]);
+ a = TOUPPER (p[0]);
+ b = TOUPPER (p[1]);
if (a == 'E' && b == 'Q')
cond = EQ;
else if (a == 'N' && b == 'E')
@@ -2980,13 +2980,13 @@ chartype_init ()
int x;
for (x = 0; x < 256; x++)
{
- if (isalpha (x) || x == '_' || x == '$')
+ if (ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= FIRSTBIT;
if (mri && x == '.')
chartype[x] |= FIRSTBIT;
- if (isdigit (x) || isalpha (x) || x == '_' || x == '$')
+ if (ISDIGIT (x) || ISALPHA (x) || x == '_' || x == '$')
chartype[x] |= NEXTBIT;
if (x == ' ' || x == '\t' || x == ',' || x == '"' || x == ';'
@@ -3552,6 +3552,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/gas/hash.c b/gas/hash.c
index ab28396..e993136 100644
--- a/gas/hash.c
+++ b/gas/hash.c
@@ -1,6 +1,6 @@
/* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -30,6 +30,7 @@
structure. */
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
/* The default number of entries to use when creating a hash table. */
@@ -458,8 +459,7 @@ main ()
printf ("hash_test command: ");
gets (answer);
command = answer[0];
- if (isupper (command))
- command = tolower (command); /* Ecch! */
+ command = TOLOWER (command); /* Ecch! */
switch (command)
{
case '#':
diff --git a/gas/itbl-lex.l b/gas/itbl-lex.l
index 4ac0946..ed0be64 100644
--- a/gas/itbl-lex.l
+++ b/gas/itbl-lex.l
@@ -1,5 +1,5 @@
/* itbl-lex.l
- Copyright 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
#include "itbl-parse.h"
#ifdef DEBUG
diff --git a/gas/listing.c b/gas/listing.c
index 7aeb3fc..f8847d9 100644
--- a/gas/listing.c
+++ b/gas/listing.c
@@ -91,10 +91,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
on a line
*/
-#include <ctype.h>
-
#include "as.h"
#include <obstack.h>
+#include "safe-ctype.h"
#include "input-file.h"
#include "subsegs.h"
@@ -370,7 +369,7 @@ listing_newline (ps)
unsigned char c = *src++;
/* Omit control characters in the listing. */
- if (isascii (c) && ! iscntrl (c))
+ if (!ISCNTRL (c))
*dest++ = c;
}
@@ -908,7 +907,7 @@ debugging_pseudo (list, line)
was_debug = in_debug;
in_debug = 0;
- while (isspace ((unsigned char) *line))
+ while (ISSPACE (*line))
line++;
if (*line != '.')
diff --git a/gas/macro.c b/gas/macro.c
index e78855b..3e03c5d 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -1,5 +1,5 @@
/* macro.c - macro support for gas and gasp
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
@@ -51,11 +51,11 @@ extern void *alloca ();
#else
#include <strings.h>
#endif
-#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sb.h"
#include "hash.h"
#include "macro.h"
@@ -183,7 +183,7 @@ buffer_and_nest (from, to, ptr, get_line)
/* Skip over a label. */
while (i < ptr->len
- && (isalnum ((unsigned char) ptr->ptr[i])
+ && (ISALNUM (ptr->ptr[i])
|| ptr->ptr[i] == '_'
|| ptr->ptr[i] == '$'))
i++;
@@ -206,11 +206,11 @@ buffer_and_nest (from, to, ptr, get_line)
i++;
if (strncasecmp (ptr->ptr + i, from, from_len) == 0
&& (ptr->len == (i + from_len)
- || ! isalnum (ptr->ptr[i + from_len])))
+ || ! ISALNUM (ptr->ptr[i + from_len])))
depth++;
if (strncasecmp (ptr->ptr + i, to, to_len) == 0
&& (ptr->len == (i + to_len)
- || ! isalnum (ptr->ptr[i + to_len])))
+ || ! ISALNUM (ptr->ptr[i + to_len])))
{
depth--;
if (depth == 0)
@@ -241,13 +241,13 @@ get_token (idx, in, name)
sb *name;
{
if (idx < in->len
- && (isalpha ((unsigned char) in->ptr[idx])
+ && (ISALPHA (in->ptr[idx])
|| in->ptr[idx] == '_'
|| in->ptr[idx] == '$'))
{
sb_add_char (name, in->ptr[idx++]);
while (idx < in->len
- && (isalnum ((unsigned char) in->ptr[idx])
+ && (ISALNUM (in->ptr[idx])
|| in->ptr[idx] == '_'
|| in->ptr[idx] == '$'))
{
@@ -567,8 +567,7 @@ define_macro (idx, in, label, get_line, namep)
/* And stick it in the macro hash table. */
for (idx = 0; idx < name.len; idx++)
- if (isupper ((unsigned char) name.ptr[idx]))
- name.ptr[idx] = tolower (name.ptr[idx]);
+ name.ptr[idx] = TOLOWER (name.ptr[idx]);
namestr = sb_terminate (&name);
hash_jam (macro_hash, namestr, (PTR) macro);
@@ -726,15 +725,14 @@ macro_expand_body (in, out, formals, formal_hash, comment_char, locals)
sb_add_char (out, '&');
src++;
}
- else if (macro_mri
- && isalnum ((unsigned char) in->ptr[src]))
+ else if (macro_mri && ISALNUM (in->ptr[src]))
{
int ind;
formal_entry *f;
- if (isdigit ((unsigned char) in->ptr[src]))
+ if (ISDIGIT (in->ptr[src]))
ind = in->ptr[src] - '0';
- else if (isupper ((unsigned char) in->ptr[src]))
+ else if (ISUPPER (in->ptr[src]))
ind = in->ptr[src] - 'A' + 10;
else
ind = in->ptr[src] - 'a' + 10;
@@ -758,7 +756,7 @@ macro_expand_body (in, out, formals, formal_hash, comment_char, locals)
}
}
else if ((macro_alternate || macro_mri)
- && (isalpha ((unsigned char) in->ptr[src])
+ && (ISALPHA (in->ptr[src])
|| in->ptr[src] == '_'
|| in->ptr[src] == '$')
&& (! inquote
@@ -1107,14 +1105,14 @@ check_macro (line, expand, comment_char, error, info)
macro_entry *macro;
sb line_sb;
- if (! isalpha ((unsigned char) *line)
+ if (! ISALPHA (*line)
&& *line != '_'
&& *line != '$'
&& (! macro_mri || *line != '.'))
return 0;
s = line + 1;
- while (isalnum ((unsigned char) *s)
+ while (ISALNUM (*s)
|| *s == '_'
|| *s == '$')
++s;
@@ -1123,8 +1121,7 @@ check_macro (line, expand, comment_char, error, info)
memcpy (copy, line, s - line);
copy[s - line] = '\0';
for (cs = copy; *cs != '\0'; cs++)
- if (isupper ((unsigned char) *cs))
- *cs = tolower (*cs);
+ *cs = TOLOWER (*cs);
macro = (macro_entry *) hash_find (macro_hash, copy);
diff --git a/gas/read.c b/gas/read.c
index 17bd456..80389b7 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -35,10 +35,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Routines that read assembler source text to build spagetti in memory.
Another group of these functions is in the expr.c module. */
-/* For isdigit (). */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "sb.h"
#include "macro.h"
@@ -739,8 +737,7 @@ read_a_source_file (name)
while (*s2)
{
- if (isupper ((unsigned char) *s2))
- *s2 = tolower (*s2);
+ *s2 = TOLOWER (*s2);
s2++;
}
}
@@ -907,8 +904,7 @@ read_a_source_file (name)
if (is_end_of_line[(unsigned char) c])
continue;
- if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
- && isdigit ((unsigned char) c))
+ if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
{
/* local label ("4:") */
char *backup = input_line_pointer;
@@ -918,7 +914,7 @@ read_a_source_file (name)
temp = c - '0';
/* Read the whole number. */
- while (isdigit ((unsigned char) *input_line_pointer))
+ while (ISDIGIT (*input_line_pointer))
{
temp = (temp * 10) + *input_line_pointer - '0';
++input_line_pointer;
@@ -1453,7 +1449,7 @@ s_mri_common (small)
SKIP_WHITESPACE ();
name = input_line_pointer;
- if (!isdigit ((unsigned char) *name))
+ if (!ISDIGIT (*name))
c = get_symbol_end ();
else
{
@@ -1461,7 +1457,7 @@ s_mri_common (small)
{
++input_line_pointer;
}
- while (isdigit ((unsigned char) *input_line_pointer));
+ while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer;
*input_line_pointer = '\0';
@@ -2488,7 +2484,7 @@ s_mri_sect (type)
SKIP_WHITESPACE ();
name = input_line_pointer;
- if (!isdigit ((unsigned char) *name))
+ if (!ISDIGIT (*name))
c = get_symbol_end ();
else
{
@@ -2496,7 +2492,7 @@ s_mri_sect (type)
{
++input_line_pointer;
}
- while (isdigit ((unsigned char) *input_line_pointer));
+ while (ISDIGIT (*input_line_pointer));
c = *input_line_pointer;
*input_line_pointer = '\0';
@@ -2521,7 +2517,7 @@ s_mri_sect (type)
if (*input_line_pointer == ',')
{
c = *++input_line_pointer;
- c = toupper ((unsigned char) c);
+ c = TOUPPER (c);
if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
*type = c;
else
@@ -3044,7 +3040,7 @@ s_float_space (float_type)
/* Skip any 0{letter} that may be present. Don't even check if the
* letter is legal. */
if (input_line_pointer[0] == '0'
- && isalpha ((unsigned char) input_line_pointer[1]))
+ && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating point
@@ -3141,7 +3137,7 @@ ignore_rest_of_line ()
/* For suspect lines: gives warning. */
if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
- if (isprint ((unsigned char) *input_line_pointer))
+ if (ISPRINT (*input_line_pointer))
as_warn (_("rest of line ignored; first ignored character is `%c'"),
*input_line_pointer);
else
@@ -4130,7 +4126,7 @@ float_cons (float_type)
has no use for such information. Lusers beware: you get
diagnostics if your input is ill-conditioned. */
if (input_line_pointer[0] == '0'
- && isalpha ((unsigned char) input_line_pointer[1]))
+ && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2;
/* Accept :xxxx, where the x's are hex digits, for a floating
@@ -4668,7 +4664,7 @@ next_char_of_string ()
int i;
for (i = 0, number = 0;
- isdigit (c) && i < 3;
+ ISDIGIT (c) && i < 3;
c = *input_line_pointer++, i++)
{
number = number * 8 + c - '0';
@@ -4686,11 +4682,11 @@ next_char_of_string ()
number = 0;
c = *input_line_pointer++;
- while (isxdigit (c))
+ while (ISXDIGIT (c))
{
- if (isdigit (c))
+ if (ISDIGIT (c))
number = number * 16 + c - '0';
- else if (isupper (c))
+ else if (ISUPPER (c))
number = number * 16 + c - 'A' + 10;
else
number = number * 16 + c - 'a' + 10;
diff --git a/gas/symbols.c b/gas/symbols.c
index 201b03e..5dd3040 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -22,10 +22,9 @@
/* #define DEBUG_SYMS / * to debug symbol list maintenance. */
-#include <ctype.h>
-
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h" /* For "symbols.h" */
#include "subsegs.h"
@@ -124,11 +123,10 @@ save_symbol_name (name)
if (! symbols_case_sensitive)
{
- unsigned char *s;
+ char *s;
- for (s = (unsigned char *) ret; *s != '\0'; s++)
- if (islower (*s))
- *s = toupper (*s);
+ for (s = ret; *s != '\0'; s++)
+ *s = TOUPPER (*s);
}
return ret;
@@ -630,9 +628,7 @@ symbol_find_base (name, strip_underscore)
while ((c = *orig++) != '\0')
{
- if (islower (c))
- c = toupper (c);
- *copy++ = c;
+ *copy++ = TOUPPER (c);
}
*copy = '\0';
}
@@ -1584,7 +1580,7 @@ decode_local_label_name (s)
if (s[index] != 'L')
return s;
- for (label_number = 0, p = s + index + 1; isdigit ((unsigned char) *p); ++p)
+ for (label_number = 0, p = s + index + 1; ISDIGIT (*p); ++p)
label_number = (10 * label_number) + *p - '0';
if (*p == DOLLAR_LABEL_CHAR)
@@ -1594,7 +1590,7 @@ decode_local_label_name (s)
else
return s;
- for (instance_number = 0, p++; isdigit ((unsigned char) *p); ++p)
+ for (instance_number = 0, p++; ISDIGIT (*p); ++p)
instance_number = (10 * instance_number) + *p - '0';
message_format = _("\"%d\" (instance number %d of a %s label)");
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index dc98398..5b8b0b7 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,9 @@
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * gprof.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * sym_ids.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_spec): Use ISDIGIT instead of isdigit.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* sparc.c (sparc_find_call): Warning fix.
diff --git a/gprof/gprof.c b/gprof/gprof.c
index 2ed37a3..4a1fd50 100644
--- a/gprof/gprof.c
+++ b/gprof/gprof.c
@@ -173,6 +173,9 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/gprof/sym_ids.c b/gprof/sym_ids.c
index f98ccbf..bf6ffcd 100644
--- a/gprof/sym_ids.c
+++ b/gprof/sym_ids.c
@@ -19,9 +19,8 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ctype.h>
-
#include "libiberty.h"
+#include "safe-ctype.h"
#include "cg_arcs.h"
#include "sym_ids.h"
@@ -123,7 +122,7 @@ DEFUN (parse_spec, (spec, sym), char *spec AND Sym * sym)
if (strlen (spec))
{
- if (isdigit ((unsigned char) spec[0]))
+ if (ISDIGIT (spec[0]))
sym->line_num = atoi (spec);
else
sym->name = spec;
@@ -139,7 +138,7 @@ DEFUN (parse_spec, (spec, sym), char *spec AND Sym * sym)
if (!sym->file)
sym->file = &non_existent_file;
}
- else if (isdigit ((unsigned char) *spec))
+ else if (ISDIGIT (*spec))
{
sym->line_num = atoi (spec);
}
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8211fe6..d857495 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,44 @@
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * deffilep.y: Include "safe-ctype.h" instead of <ctype.h>.
+ (def_file_add_directive): Use ISSPACE instead of isspace.
+ (def_lex): Use ISDIGIT/ISXDIGIT/ISALPHA/ISALNUM instead of
+ isdigit/isxdigit/isalpha/isalnum.
+ * emultempl/aix.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld${EMULATION_NAME}_read_file): Use ISSPACE instead of isspace.
+ * emultempl/elf32.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld${EMULATION_NAME}_place_orphan): Use ISALNUM instead of
+ isalnum.
+ * emultempl/gld960c.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld960_set_output_arch): Use ISUPPER/TOLOWER instead of
+ isupper/tolower.
+ * emultempl/sunos.em: Include "safe-ctype.h" instead of <ctype.h>.
+ (gld${EMULATION_NAME}_search_dir): Use ISDIGIT instead of isdigit.
+ * ldctor.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ctor_prio): Use ISDIGIT instead of isdigit.
+ * ldfile.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ldfile_open_file_search): Use ISALPHA instead of isalpha.
+ (ldfile_add_arch): Use ISUPPER/TOLOWER instead of
+ isupper/tolower.
+ * ldlang.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (stricpy): Use TOLOWER instead of isupper/tolower.
+ (lang_leave_overlay_section): Use ISALNUM instead of isalnum.
+ * ldlex.l: Include "safe-ctype.h" instead of <ctype.h>.
+ (lex_warn_invalid): Use ISPRINT instead of isprint.
+ * ldmain.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ (add_keepsyms_file): Use ISSPACE instead of isspace.
+ * lexsup.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (is_num, parse_args): Use ISDIGIT instead of isdigit.
+ * mpw-elfmips.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (gldelf32ebmip_place_orphan): Use ISALNUM instead of isalnum.
+ * mpw-eppcmac.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (gldppcmacos_read_file): Use ISSPACE instead of isspace.
+ * pe-dll.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (quoteput): Use ISSPACE instead of isspace.
+ (pe_dll_generate_implib, pe_process_import_defs): Use ISALNUM
+ instead of isalnum.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* deffilep.y (def_stash_module): Constify "name" param.
diff --git a/ld/deffilep.y b/ld/deffilep.y
index 2121da0..51d17f8 100644
--- a/ld/deffilep.y
+++ b/ld/deffilep.y
@@ -20,8 +20,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "sysdep.h"
#include "ld.h"
@@ -572,10 +572,10 @@ def_file_add_directive (my_def, param, len)
while (param < pend)
{
- while (param < pend && isspace (*param))
+ while (param < pend && ISSPACE (*param))
param++;
for (tend = param + 1;
- tend < pend && !(isspace (tend[-1]) && *tend == '-');
+ tend < pend && !(ISSPACE (tend[-1]) && *tend == '-');
tend++);
for (i = 0; diropts[i].param; i++)
@@ -949,10 +949,10 @@ def_lex ()
/* must be something else */
saw_newline = 0;
- if (isdigit (c))
+ if (ISDIGIT (c))
{
bufptr = 0;
- while (c != EOF && (isxdigit (c) || (c == 'x')))
+ while (c != EOF && (ISXDIGIT (c) || (c == 'x')))
{
put_buf (c);
c = def_getc ();
@@ -966,10 +966,10 @@ def_lex ()
return NUMBER;
}
- if (isalpha (c) || strchr ("$:-_?", c))
+ if (ISALPHA (c) || strchr ("$:-_?", c))
{
bufptr = 0;
- while (c != EOF && (isalnum (c) || strchr ("$:-_?/@", c)))
+ while (c != EOF && (ISALNUM (c) || strchr ("$:-_?/@", c)))
{
put_buf (c);
c = def_getc ();
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 775a678..eb01b66 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -36,12 +36,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "getopt.h"
#include "obstack.h"
#include "bfdlink.h"
-#include <ctype.h>
-
#include "ld.h"
#include "ldmain.h"
#include "ldmisc.h"
@@ -950,7 +949,7 @@ gld${EMULATION_NAME}_read_file (filename, import)
++lineno;
s = (char *) obstack_base (o);
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0'
|| *s == '*'
@@ -965,7 +964,7 @@ gld${EMULATION_NAME}_read_file (filename, import)
if (*s == '#' && s[1] == '!')
{
s += 2;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0')
{
@@ -986,7 +985,8 @@ gld${EMULATION_NAME}_read_file (filename, import)
keep = true;
imppath = s;
file = NULL;
- while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0')
+ while (! ISSPACE (*s)
+ && *s != '(' && *s != '\0')
{
if (*s == '/')
file = s + 1;
@@ -1006,7 +1006,7 @@ gld${EMULATION_NAME}_read_file (filename, import)
}
cs = *s;
*s = '\0';
- while (isspace ((unsigned char) cs))
+ while (ISSPACE (cs))
{
++s;
cs = *s;
@@ -1042,7 +1042,7 @@ gld${EMULATION_NAME}_read_file (filename, import)
syscall_flag = 0;
address = (bfd_vma) -1;
- while (! isspace ((unsigned char) *s) && *s != '\0')
+ while (! ISSPACE (*s) && *s != '\0')
++s;
if (*s != '\0')
{
@@ -1050,16 +1050,16 @@ gld${EMULATION_NAME}_read_file (filename, import)
*s++ = '\0';
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
se = s;
- while (! isspace ((unsigned char) *se) && *se != '\0')
+ while (! ISSPACE (*se) && *se != '\0')
++se;
if (*se != '\0')
{
*se++ = '\0';
- while (isspace ((unsigned char) *se))
+ while (ISSPACE (*se))
++se;
if (*se != '\0')
einfo ("%s%d: warning: syntax error in import/export file\n",
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 0e5cd99..f2011ce 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -38,8 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#include "bfdlink.h"
@@ -1194,7 +1193,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
/* If the name of the section is representable in C, then create
symbols to mark the start and the end of the section. */
for (ps = outsecname; *ps != '\0'; ps++)
- if (! isalnum ((unsigned char) *ps) && *ps != '_')
+ if (! ISALNUM (*ps) && *ps != '_')
break;
if (*ps == '\0')
{
diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em
index 46d6e87..2fdabe9 100644
--- a/ld/emultempl/gld960c.em
+++ b/ld/emultempl/gld960c.em
@@ -26,10 +26,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
*/
-#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "ld.h"
@@ -96,8 +96,7 @@ gld960_set_output_arch()
s = concat ("i960:", ldfile_output_machine_name, (char *) NULL);
for (s1 = s; *s1 != '\0'; s1++)
- if (isupper ((unsigned char) *s1))
- *s1 = tolower ((unsigned char) *s1);
+ *s1 = TOLOWER (*s1);
ldfile_set_output_arch (s);
free (s);
}
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index d2f62e9..17cd407 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -32,12 +32,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGET_IS_${EMULATION_NAME}
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "ld.h"
#include "ldmain.h"
@@ -311,13 +310,13 @@ gld${EMULATION_NAME}_search_dir (dirname, filename, found_static)
if (entry->d_name[6 + len] == '\0')
;
else if (entry->d_name[6 + len] == '.'
- && isdigit ((unsigned char) entry->d_name[7 + len]))
+ && ISDIGIT (entry->d_name[7 + len]))
;
else
continue;
for (s = entry->d_name + 6 + len; *s != '\0'; s++)
- if (*s != '.' && ! isdigit ((unsigned char) *s))
+ if (*s != '.' && ! ISDIGIT (*s))
break;
if (*s != '\0')
continue;
diff --git a/ld/ldctor.c b/ld/ldctor.c
index 1c8439b..9e79921 100644
--- a/ld/ldctor.c
+++ b/ld/ldctor.c
@@ -1,5 +1,5 @@
/* ldctor.c -- constructor support routines
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
By Steve Chamberlain <sac@cygnus.com>
@@ -23,8 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#include "ld.h"
#include "ldexp.h"
@@ -146,7 +145,7 @@ ctor_prio (name)
return -1;
if (name[1] != 'I' && name[1] != 'D')
return -1;
- if (! isdigit ((unsigned char) name[3]))
+ if (! ISDIGIT (name[3]))
return -1;
return atoi (name + 3);
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 001f71a..039a648 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
+#include "safe-ctype.h"
#include "ld.h"
#include "ldmisc.h"
#include "ldexp.h"
@@ -35,8 +36,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "ldemul.h"
#include "libiberty.h"
-#include <ctype.h>
-
const char *ldfile_input_filename;
boolean ldfile_assumed_script = false;
const char *ldfile_output_machine_name = "";
@@ -190,7 +189,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
else if (entry->filename[0] == '/' || entry->filename[0] == '.'
#if defined (__MSDOS__) || defined (_WIN32)
|| entry->filename[0] == '\\'
- || (isalpha (entry->filename[0])
+ || (ISALPHA (entry->filename[0])
&& entry->filename[1] == ':')
#endif
)
@@ -426,8 +425,7 @@ ldfile_add_arch (in_name)
new->next = (search_arch_type *) NULL;
while (*name)
{
- if (isupper ((unsigned char) *name))
- *name = tolower ((unsigned char) *name);
+ *name = TOLOWER (*name);
name++;
}
*search_arch_tail_ptr = new;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 30de02b..db420e8 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "bfdlink.h"
@@ -39,8 +40,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "fnmatch.h"
#include "demangle.h"
-#include <ctype.h>
-
/* FORWARDS */
static lang_statement_union_type *new_statement
PARAMS ((enum statement_enum, size_t, lang_statement_list_type *));
@@ -1618,12 +1617,7 @@ stricpy (dest, src)
char c;
while ((c = *src++) != 0)
- {
- if (isupper ((unsigned char) c))
- c = tolower (c);
-
- *dest++ = c;
- }
+ *dest++ = TOLOWER (c);
*dest = 0;
}
@@ -4786,7 +4780,7 @@ lang_leave_overlay_section (fill, phdrs)
clean = xmalloc (strlen (name) + 1);
s2 = clean;
for (s1 = name; *s1 != '\0'; s1++)
- if (isalnum ((unsigned char) *s1) || *s1 == '_')
+ if (ISALNUM (*s1) || *s1 == '_')
*s2++ = *s1;
*s2 = '\0';
diff --git a/ld/ldlex.l b/ld/ldlex.l
index eecb902..eebb950 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -1,6 +1,6 @@
%{
-/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -28,7 +28,6 @@ This was written by steve chamberlain
#include <ansidecl.h>
#include <stdio.h>
-#include <ctype.h>
#ifdef MPW
/* Prevent enum redefinition problems. */
@@ -37,6 +36,7 @@ This was written by steve chamberlain
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "ld.h"
#include "ldgram.h"
#include "ldmisc.h"
@@ -658,7 +658,7 @@ lex_warn_invalid (where, what)
einfo ("%F%s: file not recognized: %E\n", ldfile_input_filename);
}
- if (! isprint ((unsigned char) *what))
+ if (! ISPRINT (*what))
{
sprintf (buf, "\\%03o", (unsigned int) *what);
what = buf;
diff --git a/ld/ldmain.c b/ld/ldmain.c
index f9c5997..e31f276 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -1,5 +1,5 @@
/* Main program of GNU linker.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
@@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "bfd.h"
#include "sysdep.h"
#include <stdio.h>
-#include <ctype.h>
+#include "safe-ctype.h"
#include "libiberty.h"
#include "progress.h"
#include "bfdlink.h"
@@ -169,6 +169,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -721,14 +724,14 @@ add_keepsyms_file (filename)
c = getc (file);
while (c != EOF)
{
- while (isspace (c))
+ while (ISSPACE (c))
c = getc (file);
if (c != EOF)
{
size_t len = 0;
- while (! isspace (c) && c != EOF)
+ while (! ISSPACE (c) && c != EOF)
{
buf[len] = c;
++len;
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 5183b86..d544df5 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -25,7 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "libiberty.h"
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
+#include "safe-ctype.h"
#include "getopt.h"
#include "bfdlink.h"
#include "ld.h"
@@ -419,7 +419,7 @@ is_num (string, min, max, err)
for (; *string; ++string)
{
- if (! isdigit (*string))
+ if (! ISDIGIT (*string))
{
result = err;
break;
@@ -504,7 +504,7 @@ parse_args (argc, argv)
for (i = 1; i < argc; i++)
if (strcmp (argv[i], "-G") == 0
&& (i + 1 >= argc
- || ! isdigit ((unsigned char) argv[i + 1][0])))
+ || ! ISDIGIT (argv[i + 1][0])))
argv[i] = (char *) "--shared";
/* Because we permit long options to start with a single dash, and
diff --git a/ld/mpw-elfmips.c b/ld/mpw-elfmips.c
index 9a84e78..70ceecd 100644
--- a/ld/mpw-elfmips.c
+++ b/ld/mpw-elfmips.c
@@ -26,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#include "bfdlink.h"
@@ -667,7 +666,7 @@ gldelf32ebmip_place_orphan (file, s)
/* If the name of the section is representable in C, then create
symbols to mark the start and the end of the section. */
for (ps = secname; *ps != '\0'; ps++)
- if (! isalnum (*ps) && *ps != '_')
+ if (! ISALNUM (*ps) && *ps != '_')
break;
if (*ps == '\0' && config.build_constructors)
{
diff --git a/ld/mpw-eppcmac.c b/ld/mpw-eppcmac.c
index 0062ff3..1278097 100644
--- a/ld/mpw-eppcmac.c
+++ b/ld/mpw-eppcmac.c
@@ -1,7 +1,7 @@
/* This file is is generated by a shell script. DO NOT EDIT! */
/* AIX emulation code for ppcmacos
- Copyright 1991, 1993, 1995, 1996, 1997, 2000
+ Copyright 1991, 1993, 1995, 1996, 1997, 2000, 2001
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
@@ -27,11 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "getopt.h"
#include "bfdlink.h"
-#include <ctype.h>
-
#include "ld.h"
#include "ldmain.h"
#include "ldmisc.h"
@@ -708,7 +707,7 @@ gldppcmacos_read_file (filename, import)
++lineno;
s = (char *) obstack_base (o);
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0'
|| *s == '*'
@@ -722,7 +721,7 @@ gldppcmacos_read_file (filename, import)
if (*s == '#' && s[1] == '!')
{
s += 2;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s == '\0')
{
@@ -743,7 +742,7 @@ gldppcmacos_read_file (filename, import)
keep = true;
imppath = s;
file = NULL;
- while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0')
+ while (! ISSPACE (*s) && *s != '(' && *s != '\0')
{
if (*s == '/')
file = s + 1;
@@ -763,7 +762,7 @@ gldppcmacos_read_file (filename, import)
}
cs = *s;
*s = '\0';
- while (isspace ((unsigned char) cs))
+ while (ISSPACE (cs))
{
++s;
cs = *s;
@@ -797,7 +796,7 @@ gldppcmacos_read_file (filename, import)
syscall = false;
address = (bfd_vma) -1;
- while (! isspace ((unsigned char) *s) && *s != '\0')
+ while (! ISSPACE (*s) && *s != '\0')
++s;
if (*s != '\0')
{
@@ -805,16 +804,16 @@ gldppcmacos_read_file (filename, import)
*s++ = '\0';
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
se = s;
- while (! isspace ((unsigned char) *se) && *se != '\0')
+ while (! ISSPACE (*se) && *se != '\0')
++se;
if (*se != '\0')
{
*se++ = '\0';
- while (isspace ((unsigned char) *se))
+ while (ISSPACE (*se))
++se;
if (*se != '\0')
einfo (_("%s%d: warning: syntax error in import/export file\n"),
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index b943cbb..ae72eaa 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -23,9 +23,9 @@
#include "sysdep.h"
#include "bfdlink.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include <time.h>
-#include <ctype.h>
#include "ld.h"
#include "ldexp.h"
@@ -1254,7 +1254,7 @@ quoteput (s, f, needs_quotes)
if (*cp == '\''
|| *cp == '"'
|| *cp == '\\'
- || isspace ((unsigned char) *cp)
+ || ISSPACE (*cp)
|| *cp == ','
|| *cp == ';')
needs_quotes = 1;
@@ -2088,7 +2088,7 @@ pe_dll_generate_implib (def, impfilename)
dll_filename = (def->name) ? def->name : dll_name;
dll_symname = xstrdup (dll_filename);
for (i = 0; dll_symname[i]; i++)
- if (!isalnum ((unsigned char) dll_symname[i]))
+ if (!ISALNUM (dll_symname[i]))
dll_symname[i] = '_';
unlink (impfilename);
@@ -2185,7 +2185,7 @@ pe_process_import_defs (output_bfd, link_info)
dll_filename = module->name;
dll_symname = xstrdup (module->name);
for (i = 0; dll_symname[i]; i++)
- if (!isalnum (dll_symname[i]))
+ if (!ISALNUM (dll_symname[i]))
dll_symname[i] = '_';
do_this_dll = 0;
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 2f85bfd..17cc563 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,32 @@
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * cgen-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (cgen_parse_keyword): Use ISALNUM instead of isalnum.
+ * cgen-opc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (cgen_keyword_lookup_name): Use ISALPHA/TOLOWER instead of
+ isalpha/tolower.
+ (cgen_keyword_add): Use ISALNUM instead of isalnum.
+ (hash_keyword_name): Use TOLOWER instead of tolower.
+ * fr30-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_insn_normal): Use TOLOWER/ISSPACE instead of
+ tolower/isspace.
+ (fr30_cgen_assemble_insn): Use ISSPACE instead of isspace.
+ * fr30-desc.c: Don't include <ctype.h>.
+ * fr30-ibld.c: Likewise.
+ * ia64-gen.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (load_insn_classes, parse_resource_users, load_depfile): Use
+ ISSPACE instead of isspace.
+ * m32r-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_insn_normal): Use TOLOWER/ISSPACE instead of
+ tolower/isspace.
+ (m32r_cgen_assemble_insn): Use ISSPACE instead of isspace.
+ * m32r-desc.c: Don't include <ctype.h>.
+ * m32r-ibld.c: Likewise.
+ * openrisc-asm.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_insn_normal): Use TOLOWER/ISSPACE instead of
+ tolower/isspace.
+ (openrisc_cgen_assemble_insn): Use ISSPACE instead of isspace.
+
2001-09-18 Martin Schwidefsky <schwidefsky@de.ibm.com>
* Makefile.am: Add rules and dependencies to create the s/390 opcode
diff --git a/opcodes/cgen-asm.c b/opcodes/cgen-asm.c
index 7bb29ca..dba0c37 100644
--- a/opcodes/cgen-asm.c
+++ b/opcodes/cgen-asm.c
@@ -1,6 +1,6 @@
/* CGEN generic assembler support code.
- Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
@@ -20,9 +20,9 @@
#include "sysdep.h"
#include <stdio.h>
-#include <ctype.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "opcode/cgen.h"
@@ -221,8 +221,7 @@ cgen_parse_keyword (cd, strp, keyword_table, valuep)
/* Allow letters, digits, and any special characters. */
while (((p - start) < (int) sizeof (buf))
&& *p
- && (isalnum ((unsigned char) *p)
- || strchr (keyword_table->nonalpha_chars, *p)))
+ && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p)))
++p;
if (p - start >= (int) sizeof (buf))
diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c
index 9dfc16e..06544ca 100644
--- a/opcodes/cgen-opc.c
+++ b/opcodes/cgen-opc.c
@@ -20,10 +20,10 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "opcode/cgen.h"
@@ -69,9 +69,7 @@ cgen_keyword_lookup_name (kt, name)
while (*p
&& (*p == *n
- || (isalpha ((unsigned char) *p)
- && (tolower ((unsigned char) *p)
- == tolower ((unsigned char) *n)))))
+ || (ISALPHA (*p) && (TOLOWER (*p) == TOLOWER (*n)))))
++n, ++p;
if (!*p && !*n)
@@ -135,7 +133,7 @@ cgen_keyword_add (kt, ke)
kt->null_entry = ke;
for (i = 1; i < strlen (ke->name); i++)
- if (! isalnum ((unsigned char) ke->name[i])
+ if (! ISALNUM (ke->name[i])
&& ! strchr (kt->nonalpha_chars, ke->name[i]))
{
size_t idx = strlen (kt->nonalpha_chars);
@@ -232,7 +230,7 @@ hash_keyword_name (kt, name, case_sensitive_p)
hash = (hash * 97) + (unsigned char) *name;
else
for (hash = 0; *name; ++name)
- hash = (hash * 97) + (unsigned char) tolower (*name);
+ hash = (hash * 97) + (unsigned char) TOLOWER (*name);
return hash % kt->hash_table_size;
}
diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c
index 9ad3f2c..df9d216 100644
--- a/opcodes/fr30-asm.c
+++ b/opcodes/fr30-asm.c
@@ -26,9 +26,9 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "fr30-desc.h"
@@ -461,14 +461,14 @@ parse_insn_normal (cd, insn, strp, fields)
GAS's input scrubber will ensure mnemonics are lowercase, but we may
not be called from GAS. */
p = CGEN_INSN_MNEMONIC (insn);
- while (*p && tolower (*p) == tolower (*str))
+ while (*p && TOLOWER (*p) == TOLOWER (*str))
++p, ++str;
if (* p)
return _("unrecognized instruction");
#ifndef CGEN_MNEMONIC_OPERANDS
- if (* str && !isspace (* str))
+ if (* str && !ISSPACE (* str))
return _("unrecognized instruction");
#endif
@@ -497,7 +497,7 @@ parse_insn_normal (cd, insn, strp, fields)
first char after the mnemonic part is a space. */
/* FIXME: We also take inappropriate advantage of the fact that
GAS's input scrubber will remove extraneous blanks. */
- if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
+ if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
if (CGEN_SYNTAX_CHAR(* syn) == ' ')
@@ -544,7 +544,7 @@ parse_insn_normal (cd, insn, strp, fields)
blanks now. IE: We needn't try again with a longer version of
the insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
if (* str != '\0')
@@ -593,7 +593,7 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg)
int recognized_mnemonic = 0;
/* Skip leading white space. */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
/* The instructions are stored in hashed lists.
diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c
index b2a205f..0eb6755 100644
--- a/opcodes/fr30-desc.c
+++ b/opcodes/fr30-desc.c
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "ansidecl.h"
diff --git a/opcodes/fr30-ibld.c b/opcodes/fr30-ibld.c
index 90ad6ef..95fc5d0 100644
--- a/opcodes/fr30-ibld.c
+++ b/opcodes/fr30-ibld.c
@@ -25,7 +25,6 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
#include "dis-asm.h"
diff --git a/opcodes/ia64-gen.c b/opcodes/ia64-gen.c
index 4b4b197..6443c7c 100644
--- a/opcodes/ia64-gen.c
+++ b/opcodes/ia64-gen.c
@@ -1,5 +1,5 @@
/* ia64-gen.c -- Generate a shrunk set of opcode tables
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Bob Manson, Cygnus Solutions, <manson@cygnus.com>
This file is part of GDB, GAS, and the GNU binutils.
@@ -35,10 +35,10 @@
*/
#include <stdio.h>
-#include <ctype.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sysdep.h"
#include "ia64-opc.h"
#include "ia64-opc-a.c"
@@ -543,7 +543,7 @@ load_insn_classes()
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
- while (isspace(buf[strlen(buf)-1]))
+ while (ISSPACE (buf[strlen(buf)-1]))
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
@@ -571,7 +571,7 @@ load_insn_classes()
char *subname;
int sub;
- while (*tmp && isspace(*tmp))
+ while (*tmp && ISSPACE (*tmp))
{
++tmp;
if (tmp == buf + sizeof(buf))
@@ -633,7 +633,7 @@ parse_resource_users(ref, usersp, nusersp, notesp)
int create = 0;
char *name;
- while (isspace(*tmp))
+ while (ISSPACE (*tmp))
++tmp;
name = tmp;
while (*tmp && *tmp != ',')
@@ -754,7 +754,7 @@ load_depfile (const char *filename, enum ia64_dependency_mode mode)
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
- while (isspace(buf[strlen(buf)-1]))
+ while (ISSPACE (buf[strlen(buf)-1]))
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
@@ -762,21 +762,21 @@ load_depfile (const char *filename, enum ia64_dependency_mode mode)
++tmp;
*tmp++ = '\0';
- while (isspace (*tmp))
+ while (ISSPACE (*tmp))
++tmp;
regp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
- while (isspace (*tmp))
+ while (ISSPACE (*tmp))
++tmp;
chkp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
- while (isspace (*tmp))
+ while (ISSPACE (*tmp))
++tmp;
semantics = parse_semantics (tmp);
extra = semantics == IA64_DVS_OTHER ? xstrdup (tmp) : NULL;
diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c
index 0e69a80..4141e4f 100644
--- a/opcodes/m32r-asm.c
+++ b/opcodes/m32r-asm.c
@@ -26,9 +26,9 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "m32r-desc.h"
@@ -469,14 +469,14 @@ parse_insn_normal (cd, insn, strp, fields)
GAS's input scrubber will ensure mnemonics are lowercase, but we may
not be called from GAS. */
p = CGEN_INSN_MNEMONIC (insn);
- while (*p && tolower (*p) == tolower (*str))
+ while (*p && TOLOWER (*p) == TOLOWER (*str))
++p, ++str;
if (* p)
return _("unrecognized instruction");
#ifndef CGEN_MNEMONIC_OPERANDS
- if (* str && !isspace (* str))
+ if (* str && !ISSPACE (* str))
return _("unrecognized instruction");
#endif
@@ -505,7 +505,7 @@ parse_insn_normal (cd, insn, strp, fields)
first char after the mnemonic part is a space. */
/* FIXME: We also take inappropriate advantage of the fact that
GAS's input scrubber will remove extraneous blanks. */
- if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
+ if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
if (CGEN_SYNTAX_CHAR(* syn) == ' ')
@@ -552,7 +552,7 @@ parse_insn_normal (cd, insn, strp, fields)
blanks now. IE: We needn't try again with a longer version of
the insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
if (* str != '\0')
@@ -601,7 +601,7 @@ m32r_cgen_assemble_insn (cd, str, fields, buf, errmsg)
int recognized_mnemonic = 0;
/* Skip leading white space. */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
/* The instructions are stored in hashed lists.
diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c
index d07c657..8db9bfa 100644
--- a/opcodes/m32r-desc.c
+++ b/opcodes/m32r-desc.c
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "ansidecl.h"
diff --git a/opcodes/m32r-ibld.c b/opcodes/m32r-ibld.c
index 447f014..befebe9 100644
--- a/opcodes/m32r-ibld.c
+++ b/opcodes/m32r-ibld.c
@@ -25,7 +25,6 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
#include "dis-asm.h"
diff --git a/opcodes/openrisc-asm.c b/opcodes/openrisc-asm.c
index a8ed30b..5dc75a8 100644
--- a/opcodes/openrisc-asm.c
+++ b/opcodes/openrisc-asm.c
@@ -26,9 +26,9 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
Keep that in mind. */
#include "sysdep.h"
-#include <ctype.h>
#include <stdio.h>
#include "ansidecl.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "openrisc-desc.h"
@@ -393,14 +393,14 @@ parse_insn_normal (cd, insn, strp, fields)
GAS's input scrubber will ensure mnemonics are lowercase, but we may
not be called from GAS. */
p = CGEN_INSN_MNEMONIC (insn);
- while (*p && tolower (*p) == tolower (*str))
+ while (*p && TOLOWER (*p) == TOLOWER (*str))
++p, ++str;
if (* p)
return _("unrecognized instruction");
#ifndef CGEN_MNEMONIC_OPERANDS
- if (* str && !isspace (* str))
+ if (* str && !ISSPACE (* str))
return _("unrecognized instruction");
#endif
@@ -429,7 +429,7 @@ parse_insn_normal (cd, insn, strp, fields)
first char after the mnemonic part is a space. */
/* FIXME: We also take inappropriate advantage of the fact that
GAS's input scrubber will remove extraneous blanks. */
- if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
+ if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
if (CGEN_SYNTAX_CHAR(* syn) == ' ')
@@ -476,7 +476,7 @@ parse_insn_normal (cd, insn, strp, fields)
blanks now. IE: We needn't try again with a longer version of
the insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
if (* str != '\0')
@@ -525,7 +525,7 @@ openrisc_cgen_assemble_insn (cd, str, fields, buf, errmsg)
int recognized_mnemonic = 0;
/* Skip leading white space. */
- while (isspace (* str))
+ while (ISSPACE (* str))
++ str;
/* The instructions are stored in hashed lists.