diff options
-rw-r--r-- | bfd/ChangeLog | 45 | ||||
-rw-r--r-- | bfd/aoutx.h | 4 | ||||
-rw-r--r-- | bfd/archive.c | 4 | ||||
-rw-r--r-- | bfd/archures.c | 4 | ||||
-rw-r--r-- | bfd/bfd.c | 9 | ||||
-rw-r--r-- | bfd/binary.c | 5 | ||||
-rw-r--r-- | bfd/cpu-v850.c | 5 | ||||
-rw-r--r-- | bfd/hosts/alphavms.h | 3 | ||||
-rw-r--r-- | bfd/ieee.c | 15 | ||||
-rw-r--r-- | bfd/ihex.c | 5 | ||||
-rw-r--r-- | bfd/merge.c | 2 | ||||
-rw-r--r-- | bfd/oasys.c | 4 | ||||
-rw-r--r-- | bfd/pdp11.c | 4 | ||||
-rw-r--r-- | bfd/ppcboot.c | 5 | ||||
-rw-r--r-- | bfd/som.c | 12 | ||||
-rw-r--r-- | bfd/srec.c | 6 | ||||
-rw-r--r-- | bfd/stabs.c | 5 | ||||
-rw-r--r-- | bfd/syms.c | 10 | ||||
-rw-r--r-- | bfd/vms-gsd.c | 2 | ||||
-rw-r--r-- | bfd/vms-hdr.c | 6 | ||||
-rw-r--r-- | bfd/vms-tir.c | 2 | ||||
-rw-r--r-- | opcodes/ChangeLog | 29 | ||||
-rw-r--r-- | opcodes/cgen-asm.c | 7 | ||||
-rw-r--r-- | opcodes/cgen-opc.c | 10 | ||||
-rw-r--r-- | opcodes/fr30-asm.c | 12 | ||||
-rw-r--r-- | opcodes/fr30-desc.c | 1 | ||||
-rw-r--r-- | opcodes/fr30-ibld.c | 1 | ||||
-rw-r--r-- | opcodes/ia64-gen.c | 18 | ||||
-rw-r--r-- | opcodes/m32r-asm.c | 12 | ||||
-rw-r--r-- | opcodes/m32r-desc.c | 1 | ||||
-rw-r--r-- | opcodes/m32r-ibld.c | 1 | ||||
-rw-r--r-- | opcodes/openrisc-asm.c | 12 |
32 files changed, 153 insertions, 108 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8d65726d315..e2fb3659126 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 240348570d5..4c30e87cb18 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 1faf0c7285e..f158ae61f0a 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 1a7ecbf5e71..18925e3f574 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 067c021a5d5..8101814106f 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 4d2fe03d6d8..6ef626c78d6 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 359c2c42d01..88363620266 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 eee391a97fb..e77c21ff232 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 cb7dca56eba..42a3d403c04 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 83808ee8969..fbfe63c9209 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 150e9365f2d..2170e4e43e6 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 dcb2b7381ac..d8dc957c8e8 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 de12563433b..5c1d4d21efd 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 478d55a2342..cd196b89202 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 0ea13532546..de3db50e933 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 0987051e73a..54706acb8c5 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 ea7e486c147..f54d658a58b 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 9c8922b3cfd..b334c11c2e5 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 2ee015fff06..538c148cb20 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 c6278c1b074..fedfe75594a 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 fc9d23d385f..e4ce47fb5a8 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/opcodes/ChangeLog b/opcodes/ChangeLog index 2f85bfd7f40..17cc563c08d 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 7bb29ca9867..dba0c37d427 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 9dfc16e9e51..06544ca057d 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 9ad3f2c5be3..df9d216ea9b 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 b2a205fae58..0eb67557aa7 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 90ad6ef7882..95fc5d0c50b 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 4b4b1970f57..6443c7c4b25 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 0e69a80c5e9..4141e4f567f 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 d07c6574717..8db9bfa204f 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 447f0140c3a..befebe9416c 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 a8ed30b91f6..5dc75a8c04a 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. |