safe-ctype.h: New file.

include:
	* safe-ctype.h: New file.
libiberty:
	* safe-ctype.c: New file.
	* Makefile.in (CFILES): Add safe-ctype.c.
	(REQUIRED_OFILES): Add safe-ctype.o.

	* argv.c: Define ISBLANK and use it, not isspace.
	* basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c,
	strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h.  Use
	uppercase ctype macros.  Don't test ISUPPER(c)/ISLOWER(c)
	before calling TOLOWER(c)/TOUPPER(c).
gcc:
	* Makefile.in (HOST_RTL): Add safe-ctype.o.
	(safe-ctype.o): New rule.
	* system.h: Include safe-ctype.h, not ctype.h.  No need to
	wrap ctype macros.

	* cpphash.h: Zap IStable and related macros.  Define is_* in
	terms of safe-ctype.h macros.
	* cppinit.c: Delete the IStable and all related code.

	* tradcpp.c: Delete is_idchar, is_idstart, is_hor_space, and
	is_space arrays.  Delete initialize_char_syntax.  Change all
	references to the above arrays to use macros instead.
	* tradcpp.h: Define is_idchar, is_idstart, is_space, and
	is_nvspace in terms of safe_ctype.h's macros.
	* tradcif.y: is_idchar, is_idstart are macros not arrays.

	* config/i370/i370.c, config/winnt/dirent.c,
	config/winnt/fixinc-nt.c, config/winnt/ld.c:
	Use uppercase ctype macros.  If we included ctype.h,
	include safe-ctype.h instead.

	* fixinc/fixfixes.c: Use uppercase ctype macros.  Don't test
	ISLOWER(c) before calling TOUPPER(c).
	* fixinc/fixincl.c (extract_quoted_files): Simplify out some gunk.
	* fixinc/gnu-regex.c: Include safe-ctype.h, not ctype.h.  No need to
	wrap ctype macros.  Don't test ISUPPER(x) before calling TOLOWER(x).
gcc/ch:
	* lex.c: Don't bother checking whether ISUPPER(c) before
	calling TOLOWER(c).  Don't bother checking whether isascii(c)
	before testing ISSPACE(c); ISSPACE(c) includes '\n'.
gcc/f:
	* Make-lang.in: Link f/fini with safe-ctype.o.
	* bad.c: Don't test ISUPPER(c) || ISLOWER(c) before calling TOUPPER(c).
	* com.c: Use TOUPPER, not ffesrc_toupper.
	* fini.c: Don't test ISALPHA(c) before calling TOUPPER(c)/TOLOWER(c).
	* intrin.c: Don't test IN_CTYPE_DOMAIN(c).
	* src.c: Delete ffesrc_toupper_ and ffesrc_tolower_ and their
	initializing code; use TOUPPER and TOLOWER instead of
	ffesrc_toupper and ffesrc_tolower.
	* src.h: Don't declare ffesrc_toupper_ or ffesrc_tolower_.
	Don't define ffesrc_toupper or ffesrc_tolower.
gcc/java:
	* jvgenmain.c: Use ISPRINT not isascii.

From-SVN: r38124
This commit is contained in:
Zack Weinberg 2000-12-08 03:00:26 +00:00
parent f3588f1aad
commit f6bbde28c4
40 changed files with 1639 additions and 1572 deletions

View File

@ -1,3 +1,32 @@
2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
* Makefile.in (HOST_RTL): Add safe-ctype.o.
(safe-ctype.o): New rule.
* system.h: Include safe-ctype.h, not ctype.h. No need to
wrap ctype macros.
* cpphash.h: Zap IStable and related macros. Define is_* in
terms of safe-ctype.h macros.
* cppinit.c: Delete the IStable and all related code.
* tradcpp.c: Delete is_idchar, is_idstart, is_hor_space, and
is_space arrays. Delete initialize_char_syntax. Change all
references to the above arrays to use macros instead.
* tradcpp.h: Define is_idchar, is_idstart, is_space, and
is_nvspace in terms of safe_ctype.h's macros.
* tradcif.y: is_idchar, is_idstart are macros not arrays.
* config/i370/i370.c, config/winnt/dirent.c,
config/winnt/fixinc-nt.c, config/winnt/ld.c:
Use uppercase ctype macros. If we included ctype.h,
include safe-ctype.h instead.
* fixinc/fixfixes.c: Use uppercase ctype macros. Don't test
ISLOWER(c) before calling TOUPPER(c).
* fixinc/fixincl.c (extract_quoted_files): Simplify out some gunk.
* fixinc/gnu-regex.c: Include safe-ctype.h, not ctype.h. No need to
wrap ctype macros. Don't test ISUPPER(x) before calling TOLOWER(x).
2000-12-07 DJ Delorie <dj@redhat.com>
* c-decl.c (grokdeclarator): preserve previous alignments when
@ -5,27 +34,27 @@
2000-12-07 Neil Booth <neilb@earthling.net>
* cppfiles.c (struct include_file): Move from cpphash.h.
(_cpp_never_reread): New function.
(open_file, read_include_file): Use it.
(stack_include_file): Set the buffer's sysp according to the
path in which the file was found.
(find_include_file): Don't set sysp.
(cpp_make_system_header, actual_directory): Update.
(_cpp_execute_include): Do #include_next lookup handling here,
not in cpplib.c. Use _cpp_never_reread.
* cpphash.h (struct_include_file): Remove.
(struct cpp_buffer): New member sysp.
(CPP_IN_SYSTEM_HEADER, _cpp_execute_include): Update.
(_cpp_never_reread): New.
* cpplib.c (read_line_number): Rename read_flag. Rework slightly.
(end_directive): Clear line_extension flag.
(_cpp_handle_directive): Set line_extension flag for #number.
(do_include_next): Handle path lookup in _cpp_execute_include.
(do_line): Cleanup to use read_flag. Don't allow flags in #line.
(_cpp_do_file_change): Update.
(do_pragma_once): Use cpp_never_reread. Clean up.
* cpplib.h (struct lexer_state): New member line_extension.
* cppfiles.c (struct include_file): Move from cpphash.h.
(_cpp_never_reread): New function.
(open_file, read_include_file): Use it.
(stack_include_file): Set the buffer's sysp according to the
path in which the file was found.
(find_include_file): Don't set sysp.
(cpp_make_system_header, actual_directory): Update.
(_cpp_execute_include): Do #include_next lookup handling here,
not in cpplib.c. Use _cpp_never_reread.
* cpphash.h (struct_include_file): Remove.
(struct cpp_buffer): New member sysp.
(CPP_IN_SYSTEM_HEADER, _cpp_execute_include): Update.
(_cpp_never_reread): New.
* cpplib.c (read_line_number): Rename read_flag. Rework slightly.
(end_directive): Clear line_extension flag.
(_cpp_handle_directive): Set line_extension flag for #number.
(do_include_next): Handle path lookup in _cpp_execute_include.
(do_line): Cleanup to use read_flag. Don't allow flags in #line.
(_cpp_do_file_change): Update.
(do_pragma_once): Use cpp_never_reread. Clean up.
* cpplib.h (struct lexer_state): New member line_extension.
2000-12-07 Richard Henderson <rth@redhat.com>
@ -39,14 +68,14 @@
2000-12-07 Neil Booth <neilb@earthling.net>
* c-common.c (parse_in): Make a cpp_reader *.
* cppfiles.c (_cpp_fake_include): Remove.
* cpphash.h: Similarly.
* cpplib.c (do_line): Don't call _cpp_fake_include. A valid
#line always creates a callback; FC_RENAME if there are no
#line flags.
* fix-header.c (read_scan_file): cpp_push_buffer cannot fail.
The first EOF must be our get_char buffer.
* c-common.c (parse_in): Make a cpp_reader *.
* cppfiles.c (_cpp_fake_include): Remove.
* cpphash.h: Similarly.
* cpplib.c (do_line): Don't call _cpp_fake_include. A valid
#line always creates a callback; FC_RENAME if there are no
#line flags.
* fix-header.c (read_scan_file): cpp_push_buffer cannot fail.
The first EOF must be our get_char buffer.
2000-12-07 Joseph S. Myers <jsm28@cam.ac.uk>
@ -91,17 +120,17 @@
2000-12-06 Joel Sherrill <joel@OARcorp.com>
* config.gcc (a29k*-*-rtems*, arm*-*-rtems*, c4x-*-rtems*,
h8300-*-rtems*, hppa1.1-*-rtems, *mips*-*-rtems*): New targets.
* config.gcc (*-rtems*): Add support for gthr-rtems.h.
* gthr-rtems.h, config/a29k/rtems.h, config/arm/rtems-elf.h,
config/h8300/rtems.h, config/mips/rtems.h: New files.
* config.gcc (a29k*-*-rtems*, arm*-*-rtems*, c4x-*-rtems*,
h8300-*-rtems*, hppa1.1-*-rtems, *mips*-*-rtems*): New targets.
* config.gcc (*-rtems*): Add support for gthr-rtems.h.
* gthr-rtems.h, config/a29k/rtems.h, config/arm/rtems-elf.h,
config/h8300/rtems.h, config/mips/rtems.h: New files.
2000-12-06 Mark Kettenis <kettenis@gnu.org>
* config.gcc: Reorganize handling of *-*-gnu*, to share target
specific make details with Linux. Update comments to clarify
the distinction between GNU/Linux and GNU/Hurd.
the distinction between GNU/Linux and GNU/Hurd.
Wed Dec 6 19:22:02 2000 Jeffrey A Law (law@cygnus.com)
@ -163,9 +192,9 @@ Wed Dec 6 21:03:41 2000 J"orn Rennecke <amylaar@redhat.com>
* final.c (final_addr_vec_align): Fix clipping to BIGGEST_ALIGNMENT.
2000-12-06 Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
* cpplex.c (skip_escaped_newlines): Don't warn for spaces between
backslash and newline, when inside a comment.
* cpplex.c (skip_escaped_newlines): Don't warn for spaces between
backslash and newline, when inside a comment.
2000-12-06 Joseph S. Myers <jsm28@cam.ac.uk>
@ -200,16 +229,16 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-05 Neil Booth <neilb@earthling.net>
* cppfiles.c (stack_include_file): Push zero-length buffers
in case of failure. Return void, as we don't fail any more.
(read_include_file): Check for files we shouldn't re-read.
Don't return an error code; errors are implied by marking the
file NEVER_REREAD.
(_cpp_execute_include): Move the recursion and in-macro checks
here. Update for stack_include_file not failing.
* cpplib.c (cpp_push_buffer): Always succeed, since
_cpp_execute_include performs the recursion check. Tidy up.
* cpplib.h (cpp_push_buffer): Update prototype.
* cppfiles.c (stack_include_file): Push zero-length buffers
in case of failure. Return void, as we don't fail any more.
(read_include_file): Check for files we shouldn't re-read.
Don't return an error code; errors are implied by marking the
file NEVER_REREAD.
(_cpp_execute_include): Move the recursion and in-macro checks
here. Update for stack_include_file not failing.
* cpplib.c (cpp_push_buffer): Always succeed, since
_cpp_execute_include performs the recursion check. Tidy up.
* cpplib.h (cpp_push_buffer): Update prototype.
2000-12-05 Alexandre Oliva <aoliva@redhat.com>
@ -276,7 +305,7 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
* config/arm/arm.c (arm_override_options): Test 'insn_flags' not
'tune_flags' for XScale nature.
Remove spurious test of HARD_FLOAT and XScale flags.
Remove spurious test of HARD_FLOAT and XScale flags.
* config/arm/arm.md (umulsidi3adddi): Restore "=&r" register
contraint, accidentally changed during XScale contribution.
@ -294,13 +323,13 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-04 Neil Booth <neilb@earthling.net>
* tradcif.y: Move lexptr to top of file. Add rule to handle
assertions in conditional expressions.
* tradcpp.c (parse_answer): Assertions do not need to go to
end of line in conditional directives.
(parse_assertion): Get first character of identifiers correct.
(test_assertion): New function.
* tradcpp.h (test_assertion): New prototype.
* tradcif.y: Move lexptr to top of file. Add rule to handle
assertions in conditional expressions.
* tradcpp.c (parse_answer): Assertions do not need to go to
end of line in conditional directives.
(parse_assertion): Get first character of identifiers correct.
(test_assertion): New function.
* tradcpp.h (test_assertion): New prototype.
2000-12-01 Rodney Brown <RodneyBrown@mynd.com>
@ -339,19 +368,19 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-04 Neil Booth <neilb@earthling.net>
* cppinternals.texi: New file.
* cppinternals.texi: New file.
2000-12-04 Neil Booth <neilb@earthling.net>
* cppfiles.c (cpp_make_system_header): Take 2 booleans,
and operate on current buffer.
(cpp_read_file): Rename _cpp_read_file.
* cpplib.c (do_line, do_pragma_system_header): Update calls to
cpp_make_system_header.
* fix-header.c: Similarly.
* cpphash.h (_cpp_read_file): Move from...
* cpplib.h: ... here.
* cppinit.c (do_includes, cpp_start_read): Update appropriately.
* cppfiles.c (cpp_make_system_header): Take 2 booleans,
and operate on current buffer.
(cpp_read_file): Rename _cpp_read_file.
* cpplib.c (do_line, do_pragma_system_header): Update calls to
cpp_make_system_header.
* fix-header.c: Similarly.
* cpphash.h (_cpp_read_file): Move from...
* cpplib.h: ... here.
* cppinit.c (do_includes, cpp_start_read): Update appropriately.
2000-12-03 Kaveh R. Ghazi <ghazi@teal.rutgers.edu>
@ -466,9 +495,9 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-03 Laurynas Biveinis <lauras@softhome.net>
Bruce Korb <bkorb@gnu.org>
* Makefile.in: pass $(build_canonical) to mkfixinc.sh.
* fixinc/mkfixinc.sh: accept build system name as an argument.
Use it for choosing the fix build method. Use the target for
* Makefile.in: pass $(build_canonical) to mkfixinc.sh.
* fixinc/mkfixinc.sh: accept build system name as an argument.
Use it for choosing the fix build method. Use the target for
selecting special fix rules.
2000-12-03 Bernd Schmidt <bernds@redhat.co.uk>
@ -553,11 +582,11 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-03 Neil Booth <neilb@earthling.net>
* cppmacro.c (funlike_invocation_p): Re-disable macros enabled
by contexts drops AFTER argument pre-expansion, so that they
remain enabled during argument pre-expansion.
(_cpp_pop_context): Unconditionally re-enable a macro when
dropping a context level.
* cppmacro.c (funlike_invocation_p): Re-disable macros enabled
by contexts drops AFTER argument pre-expansion, so that they
remain enabled during argument pre-expansion.
(_cpp_pop_context): Unconditionally re-enable a macro when
dropping a context level.
2000-12-03 Manfred Hollstein <manfredh@redhat.com>
@ -579,7 +608,7 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
* c-common.c (c_common_nodes_and_builtins): Declare builtin
strcat, strncat, strspn and strcspn.
(string_ftype_string_cstring): Renamed from `string_ftype_ptr_ptr'.
(string_ftype_string_cstring): Renamed from `string_ftype_ptr_ptr'.
* extend.texi (strcat, strcspn, strncat, strspn): Document new
builtins.
@ -608,16 +637,16 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
(do_ifndef): Likewise.
2000-12-02 Daniel Berlin <dberlin@redhat.com>
Bruce Korb <bkorb@gnu.org>
Bruce Korb <bkorb@gnu.org>
* fixinc/*: global substitute /__MSDOS__/SEPARATE_FIX_PROC/
* fixinc/mkfixinc.sh: prepare to use Makefile.BEOS for *-*-beos*
* fixinc/Makefile.DOS: define SEPARATE_FIX_PROC for build
* fixinc/fixfix.c(wrap_fix): avoid wrapping files that
use the "__need_" hackery. It breaks them.
* fixinc/fixincl.c(process - SEPARATE_FIX_PROC):
Sometimes on DOS and BeOS the temp output file cannot be opened.
Skip the file noisily. Ought to be fixed instead.
* fixinc/*: global substitute /__MSDOS__/SEPARATE_FIX_PROC/
* fixinc/mkfixinc.sh: prepare to use Makefile.BEOS for *-*-beos*
* fixinc/Makefile.DOS: define SEPARATE_FIX_PROC for build
* fixinc/fixfix.c(wrap_fix): avoid wrapping files that
use the "__need_" hackery. It breaks them.
* fixinc/fixincl.c(process - SEPARATE_FIX_PROC):
Sometimes on DOS and BeOS the temp output file cannot be opened.
Skip the file noisily. Ought to be fixed instead.
2000-12-02 Bruce Korb <bkorb@gnu.org>
@ -673,10 +702,10 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-02 Neil Booth <neilb@earthling.net>
* tradcpp.c (struct answer, parse_assertion, parse_answer,
canonicalize_text, find_answer): New.
(do_assert, do_unassert): Provide appropriate function bodies.
(union hashval): New member answers.
* tradcpp.c (struct answer, parse_assertion, parse_answer,
canonicalize_text, find_answer): New.
(do_assert, do_unassert): Provide appropriate function bodies.
(union hashval): New member answers.
2000-11-23 Marek Michalkiewicz <marekm@linux.org.pl>
@ -703,7 +732,7 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-02 Neil Booth <neilb@earthling.net>
* cppexp.c (parse_number): Update diagnostic test.
* cppexp.c (parse_number): Update diagnostic test.
2000-12-02 Bernd Schmidt <bernds@redhat.co.uk>
@ -720,7 +749,7 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
* install.texi (Installation): Remove obsolete description for
libstdc++ which is now an integral part of GCC.
2000-12-01 Jim Blandy <jimb@redhat.com>
* dbxout.c (dbxout_parms): Correctly describe parameters passed by
@ -794,19 +823,19 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
2000-12-01 Neil Booth <neilb@earthling.net>
* cppinit.c (initialize): Forgotten prototype.
* cpplex.c (_cpp_lex_token): Loop until not skipping.
Always clear PREV_WHITE upon meeting a new line.
* cpplib.c (end_directive): Set pfile->skipping after
skip_rest_of_line.
* cpplib.h (cpp_reader): Remove macro_pos.
* cppmacro.c (cpp_get_line): Don't do anything special inside
macros.
(parse_arg): Add PREV_WHITE if a token appears after new lines.
(funlike_invocation_p): Save and restore the output position
over a successful check for a '('.
(enter_macro_context): Delete uses of macro_pos.
(cpp_get_token): Don't use pfile->skipping.
* cppinit.c (initialize): Forgotten prototype.
* cpplex.c (_cpp_lex_token): Loop until not skipping.
Always clear PREV_WHITE upon meeting a new line.
* cpplib.c (end_directive): Set pfile->skipping after
skip_rest_of_line.
* cpplib.h (cpp_reader): Remove macro_pos.
* cppmacro.c (cpp_get_line): Don't do anything special inside
macros.
(parse_arg): Add PREV_WHITE if a token appears after new lines.
(funlike_invocation_p): Save and restore the output position
over a successful check for a '('.
(enter_macro_context): Delete uses of macro_pos.
(cpp_get_token): Don't use pfile->skipping.
2000-12-01 Phil Edwards <pme@sources.redhat.com>
@ -912,15 +941,15 @@ Tue Dec 5 20:09:14 2000 Jeffrey A Law (law@cygnus.com)
the tail recursion sequence.
2000-11-30 J. David Anglin <dave.anglin@nrc.ca>
Bruce Korb <bkorb@gnu.org>
Bruce Korb <bkorb@gnu.org>
* fixinc/inclhack.def(): prevent dual double definition protection
* fixinc/fixincl.x: regenerate
2000-11-29 Loren J. Rittle <ljrittle@acm.org>
* fixinc/Makefile.in (fixincl.x): Explicitly state the
location of the generated file.
* fixinc/Makefile.in (fixincl.x): Explicitly state the
location of the generated file.
2000-11-30 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
@ -949,12 +978,12 @@ Thu Nov 30 01:12:52 2000 Jeffrey A Law (law@cygnus.com)
2000-11-30 Neil Booth <neilb@earthling.net>
* objc/objc-act.c (lang_init, finish_file, maybe_objc_comptypes,
maybe_objc_check_decl, build_objc_string_object,
objc_declare_alias, objc_declare_class, build_message_expr,
build_protocol_expr, build_selector_expr, build_encode_expr,
get_class_ivars, start_class, start_protocol): Remove
redundant code, assuming doing_objc_thang is true.
* objc/objc-act.c (lang_init, finish_file, maybe_objc_comptypes,
maybe_objc_check_decl, build_objc_string_object,
objc_declare_alias, objc_declare_class, build_message_expr,
build_protocol_expr, build_selector_expr, build_encode_expr,
get_class_ivars, start_class, start_protocol): Remove
redundant code, assuming doing_objc_thang is true.
2000-11-29 John David Anglin <dave@hiauly1.hia.nrc.ca>
@ -1048,10 +1077,10 @@ Thu Nov 30 01:12:52 2000 Jeffrey A Law (law@cygnus.com)
2000-11-29 Neil Booth <neilb@earthling.net>
* c-decl.c (c_decode_option): Don't handle -lang-objc.
* objc/lang-options.h: Remove -lang-objc.
* objc/lang-specs.h: Don't pass -lang-objc to cc1obj.
* objc/objc-act.c (lang_init_options): Set c_language.
* c-decl.c (c_decode_option): Don't handle -lang-objc.
* objc/lang-options.h: Remove -lang-objc.
* objc/lang-specs.h: Don't pass -lang-objc to cc1obj.
* objc/objc-act.c (lang_init_options): Set c_language.
2000-11-29 Jakub Jelinek <jakub@redhat.com>
@ -1060,7 +1089,7 @@ Thu Nov 30 01:12:52 2000 Jeffrey A Law (law@cygnus.com)
2000-11-29 Neil Booth <neilb@earthling.net>
* c-pragma.c (init_pragma): Update for parse_in type change.
* c-pragma.c (init_pragma): Update for parse_in type change.
2000-11-29 Laurynas Biveinis <lauras@softhome.net>
@ -1129,8 +1158,8 @@ Wed Nov 29 00:08:23 2000 J"orn Rennecke <amylaar@redhat.com>
2000-11-28 Neil Booth <neilb@earthling.net>
* c-common.h: Remove flag_digraphs.
* c-decl.c: Remove flag_digraphs.
(c_decode_option): Don't set it.
* c-decl.c: Remove flag_digraphs.
(c_decode_option): Don't set it.
* c-lex.c (init_c_lex): Don't do anything for digraphs.
2000-11-28 Richard Henderson <rth@redhat.com>
@ -1246,7 +1275,7 @@ Tue Nov 28 09:53:50 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2000-11-27 Neil Booth <neilb@earthling.net>
* cppinit.c (cpp_reader_init): Remove handling of warn_paste
* cppinit.c (cpp_reader_init): Remove handling of warn_paste
command line options.
(cpp_handle_option): Similarly.
* cpplib.h (struct cpp_options): Remove warn_paste.
@ -1300,7 +1329,7 @@ Mon Nov 27 17:22:56 MET 2000 Jan Hubicka <jh@suse.cz>
* arm.md (arm_adddi3, adddi_sesidi_di, adddi_zesidi_di, arm_addsi3,
arm_subsi3_insn, anddi_zesidi_di, arm_andsi3_insn, anddi_notdi_di,
anddi_notzesidi_di, anddi_notsesidi_di, arm_iorsi3,
anddi_notzesidi_di, anddi_notsesidi_di, arm_iorsi3,
one_cmpldi2): Merge with splitters to create define_insn_and_split
patterns. Remove redundant splits.
(peephole2 for add:SI of invalid immediate): New.
@ -1427,7 +1456,7 @@ Mon Nov 27 17:22:56 MET 2000 Jan Hubicka <jh@suse.cz>
* cpplib.h (struct cpp_reader): Remove lang_asm.
(struct cpp_options): Remove c89. New members lang,
extended_numbers.
* cppexp.c (parse_number): Use them.
* cppexp.c (parse_number): Use them.
* cpphash.h (VALID_SIGN): Use them.
* cppinit.c (set_lang, cpp_start_read): Update.
* cpplex.c (parse_string, _cpp_lex_token): Update.
@ -1600,7 +1629,7 @@ Sun Nov 26 10:02:37 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2000-11-24 Nick Clifton <nickc@redhat.com>
* config.gcc (v850-*-*): Define c_target_objs and
cxx_target_objs.
cxx_target_objs.
* config/v850/t-v850: Define how to build v850-c.o
@ -1632,7 +1661,7 @@ Sun Nov 26 10:02:37 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* config.gcc (extra_objs): Remove duplicate description.
(c_target_objs): New variable. Contains target specific
object files for the gcc C compiler only.
(cxx_target_objs): New variable. Contains target specific
(cxx_target_objs): New variable. Contains target specific
object files for the gxx C++ compiler only.
* configure.in (c_target_objs): Substitute in the makefile.
@ -1681,7 +1710,7 @@ Fri Nov 24 22:37:41 2000 Denis Chertykov <denisc@overta.ru>
* config/avr/avr.c (out_tsthi,out_tstsi): Test simplification bug
fixed.
(machine_dependent_reorg): Wrong optimization based on
NOTICE_UPDATE_CC removed.
NOTICE_UPDATE_CC removed.
Fri Nov 24 19:48:09 2000 J"orn Rennecke <amylaar@redhat.com>
@ -1824,7 +1853,7 @@ Thu Nov 23 01:01:32 2000 J"orn Rennecke <amylaar@redhat.com>
* cpplex.c (trigraph_ok): Ensure we don't warn twice.
* cpplib.h (struct cpp_buffer): New member last_Wtrigraphs.
2000-11-22 Richard Henderson <rth@redhat.com>
* haifa-sched.c (sched_analyze_1): Don't special-case calls
@ -1832,11 +1861,11 @@ Thu Nov 23 01:01:32 2000 J"orn Rennecke <amylaar@redhat.com>
(sched_analyze_2): Likewise.
(sched_analyze): Zap reg_last_uses and reg_last_sets after calls.
2000-11-22 Chris Demetriou <cgd@sibyte.com>
2000-11-22 Chris Demetriou <cgd@sibyte.com>
Neil Booth <neilb@earthling.net>
* gcc.c (validate_switches): Validate multiple switches named
in '|' (or) expressions in specs.
in '|' (or) expressions in specs.
(handle_braces): If more than 1 alternative in a '|' spec
matches, call do_spec1 just once.
@ -1846,7 +1875,7 @@ Thu Nov 23 01:01:32 2000 J"orn Rennecke <amylaar@redhat.com>
(TARGET_OPTIONS): Ditto.
(OPTIMIZATION_OPTIONS): Temporarily turn off -frename-registers if
-O3.
Wed Nov 22 06:40:56 2000 Jeffrey A Law (law@cygnus.com)
* pa.c (hppa_encode_label): Account for addition of encoding
@ -1924,7 +1953,7 @@ Wed Nov 22 00:52:55 2000 J"orn Rennecke <amylaar@redhat.com>
TARGET_CPU_strongarm110 and TARGET_SPU_strongarm1100.
* config.gcc: Accept --with-cpu=arm9 and --with-cpu=arm9tdmi.
2000-11-21 Richard Henderson <rth@redhat.com>
* c-common.c (c_unsafe_for_reeval): New function.
@ -1955,7 +1984,7 @@ Wed Nov 22 00:52:55 2000 J"orn Rennecke <amylaar@redhat.com>
(all insn patterns): Use itanium_class, not type attributes.
Occasionally split alternatives as necessary.
(attr type): Compute from new attr itanium_class.
2000-11-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* tradcpp.c (output_line_command): Mark system headers as such in
@ -2102,7 +2131,7 @@ Wed Nov 22 00:52:55 2000 J"orn Rennecke <amylaar@redhat.com>
* ssa.c (ssa_rename_from_hash_function): Avoid needlessly casting
away const-ness.
* tradcpp.c (rescan, do_line, macroexpand, macarg): Use
ISALNUM/ISDIGIT/ISPRINT, not isalnum/isdigit/isprint.
ISALNUM/ISDIGIT/ISPRINT, not isalnum/isdigit/isprint.
* varasm.c (const_str_htab_hash, const_str_htab_eq,
compare_constant_1, record_constant_1): Constify.
@ -2180,7 +2209,7 @@ Wed Nov 22 00:52:55 2000 J"orn Rennecke <amylaar@redhat.com>
2000-11-17 Jim Wilson <wilson@redhat.com>
* config/ia64/ia64.c (emit_insn_group_barriers, case CALL_INSN):
* config/ia64/ia64.c (emit_insn_group_barriers, case CALL_INSN):
Don't clear need_barrier is next_insn is a CALL_INSN, or has
instruction type B or UNKNOWN.

View File

@ -627,7 +627,7 @@ HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
$(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) $(HOST_CLIB)
HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o \
$(HOST_PREFIX)ggc-none.o gensupport.o hashtab.o
$(HOST_PREFIX)ggc-none.o gensupport.o hashtab.o safe-ctype.o
HOST_PRINT = $(HOST_PREFIX)print-rtl.o
HOST_ERRORS = $(HOST_PREFIX)errors.o
@ -1672,6 +1672,11 @@ hashtab.o: $(srcdir)/../libiberty/hashtab.c $(GCONFIG_H)
$(LN_S) $(srcdir)/../libiberty/hashtab.c hashtab.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) hashtab.c
safe-ctype.o: $(srcdir)/../libiberty/safe-ctype.c $(GCONFIG_H)
rm -f safe-ctype.c
$(LN_S) $(srcdir)/../libiberty/safe-ctype.c safe-ctype.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) safe-ctype.c
genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)

File diff suppressed because it is too large Load Diff

View File

@ -889,8 +889,7 @@ maybe_downcase (str)
return;
while (*str)
{
if (ISUPPER ((unsigned char) *str))
*str = TOLOWER (*str);
*str = TOLOWER (*str);
str++;
}
}
@ -1526,9 +1525,9 @@ handle_generic_pragma (buffer)
* buff ++ = c;
c = getc (finput);
}
while (c != EOF && isascii (c) && ! ISSPACE (c) && c != '\n'
&& buff < buffer + 128); /* XXX shared knowledge about size of buffer. */
while (c != EOF && ! ISSPACE (c) && buff < buffer + 128);
/* XXX shared knowledge about size of buffer. */
ungetc (c, finput);
* -- buff = 0;

View File

@ -906,11 +906,11 @@ mvs_need_alias (realname)
return 1;
if (strchr (realname, '_') != 0)
return 1;
if (isupper (realname[0]))
if (ISUPPER (realname[0]))
{
for (i = 1; i < j; i++)
{
if (islower (realname[i]))
if (ISLOWER (realname[i]))
return 1;
}
}
@ -918,7 +918,7 @@ mvs_need_alias (realname)
{
for (i = 1; i < j; i++)
{
if (isupper (realname[i]))
if (ISUPPER (realname[i]))
return 1;
}
}
@ -951,9 +951,9 @@ mvs_get_alias (realname, aliasname)
c1 = realname[0];
c2 = realname[1];
if (islower (c1)) c1 = toupper (c1);
if (ISLOWER (c1)) c1 = TOUPPER (c1);
else if (c1 == '_') c1 = 'A';
if (islower (c2)) c2 = toupper (c2);
if (ISLOWER (c2)) c2 = TOUPPER (c2);
else if (c2 == '_' || c2 == '\0') c2 = '#';
sprintf (aliasname, "%c%c%06d", c1, c2, mvs_hash_alias (realname));
@ -998,9 +998,9 @@ mvs_check_alias (realname, aliasname)
c1 = realname[0];
c2 = realname[1];
if (islower (c1)) c1 = toupper (c1);
if (ISLOWER (c1)) c1 = TOUPPER (c1);
else if (c1 == '_') c1 = 'A';
if (islower (c2)) c2 = toupper (c2);
if (ISLOWER (c2)) c2 = TOUPPER (c2);
else if (c2 == '_' || c2 == '\0') c2 = '#';
sprintf (aliasname, "%c%c%06d", c1, c2, mvs_hash_alias (realname));

View File

@ -23,7 +23,7 @@
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <safe-ctype.h>
#include <errno.h>
#include <dirent.h>
@ -332,8 +332,8 @@ IsHPFSFileSystem (directory)
unsigned int nDrive;
char szCurDir [MAX_PATH];
if (isalpha (directory[0]) && (directory[1] == ':'))
nDrive = toupper (directory[0]) - '@';
if (ISALPHA (directory[0]) && (directory[1] == ':'))
nDrive = TOUPPER (directory[0]) - '@';
else
{

View File

@ -64,7 +64,7 @@ newname (olddirname)
char *newname = strdup (olddirname);
if ((strlen (newname) >= 2)
&& (isalpha (newname[0]) && newname[1] == ':'))
&& (ISALPHA (newname[0]) && newname[1] == ':'))
newname [1] = '-';
else if ((strlen (newname) >= 1)
&& (newname [0] == '/' || newname [0] == '\\'))

View File

@ -86,7 +86,7 @@ locate_file (file_name, path_val)
/* Handle absolute pathnames */
if (file_name [0] == '/' || file_name [0] == DIR_SEPARATOR
|| isalpha (file_name [0]) && file_name [1] == ':')
|| ISALPHA (file_name [0]) && file_name [1] == ':')
{
strncpy (buf, file_name, sizeof buf);
buf[sizeof buf - 1] = '\0';

View File

@ -135,39 +135,30 @@ struct cpp_buffer
unsigned char sysp;
};
/* Character classes.
/* Character classes. Based on the more primitive macros in safe-ctype.h.
If the definition of `numchar' looks odd to you, please look up the
definition of a pp-number in the C standard [section 6.4.8 of C99].
In the unlikely event that characters other than \r and \n enter
the set is_vspace, the macro handle_newline() in cpplex.c must be
updated. */
#define ISidnum 0x01 /* a-zA-Z0-9_ */
#define ISidstart 0x02 /* _a-zA-Z */
#define ISnumstart 0x04 /* 0-9 */
#define IShspace 0x08 /* ' ' \t */
#define ISvspace 0x10 /* \r \n */
#define ISspace 0x20 /* ' ' \t \r \n \f \v \0 */
#define _dollar_ok(x) ((x) == '$' && CPP_OPTION (pfile, dollars_in_ident))
#define is_idchar(x) ((_cpp_IStable[x] & ISidnum) || _dollar_ok(x))
#define is_idstart(x) ((_cpp_IStable[x] & ISidstart) || _dollar_ok(x))
#define is_numchar(x) (_cpp_IStable[x] & ISidnum)
#define is_numstart(x) (_cpp_IStable[x] & ISnumstart)
#define is_hspace(x) (_cpp_IStable[x] & IShspace)
#define is_vspace(x) (_cpp_IStable[x] & ISvspace)
#define is_nvspace(x) ((_cpp_IStable[x] & (ISspace | ISvspace)) == ISspace)
#define is_space(x) (_cpp_IStable[x] & ISspace)
#define is_idchar(x) (ISIDNUM(x) || _dollar_ok(x))
#define is_numchar(x) ISIDNUM(x)
#define is_idstart(x) (ISIDST(x) || _dollar_ok(x))
#define is_numstart(x) ISDIGIT(x)
#define is_hspace(x) ISBLANK(x)
#define is_vspace(x) IS_VSPACE(x)
#define is_nvspace(x) IS_NVSPACE(x)
#define is_space(x) IS_SPACE_OR_NUL(x)
/* These tables are constant if they can be initialized at compile time,
/* This table is constant if it can be initialized at compile time,
which is the case if cpp was compiled with GCC >=2.7, or another
compiler that supports C99. */
#if HAVE_DESIGNATED_INITIALIZERS
extern const unsigned char _cpp_IStable[UCHAR_MAX + 1];
extern const unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
#else
extern unsigned char _cpp_IStable[UCHAR_MAX + 1];
extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
#endif

View File

@ -125,9 +125,6 @@ enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
runtime. */
#if HAVE_DESIGNATED_INITIALIZERS
#define init_IStable() /* Nothing. */
#define ISTABLE __extension__ const U_CHAR _cpp_IStable[UCHAR_MAX + 1] = {
#define init_trigraph_map() /* Nothing. */
#define TRIGRAPH_MAP \
__extension__ const U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = {
@ -137,10 +134,6 @@ __extension__ const U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = {
#else
#define ISTABLE unsigned char _cpp_IStable[UCHAR_MAX + 1] = { 0 }; \
static void init_IStable PARAMS ((void)) { \
unsigned char *x = _cpp_IStable;
#define TRIGRAPH_MAP U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = { 0 }; \
static void init_trigraph_map PARAMS ((void)) { \
unsigned char *x = _cpp_trigraph_map;
@ -150,45 +143,13 @@ __extension__ const U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = {
#endif
#define A(x) s(x, ISidnum|ISidstart)
#define N(x) s(x, ISidnum|ISnumstart)
#define H(x) s(x, IShspace|ISspace)
#define V(x) s(x, ISvspace|ISspace)
#define S(x) s(x, ISspace)
ISTABLE
A('_')
A('a') A('b') A('c') A('d') A('e') A('f') A('g') A('h') A('i')
A('j') A('k') A('l') A('m') A('n') A('o') A('p') A('q') A('r')
A('s') A('t') A('u') A('v') A('w') A('x') A('y') A('z')
A('A') A('B') A('C') A('D') A('E') A('F') A('G') A('H') A('I')
A('J') A('K') A('L') A('M') A('N') A('O') A('P') A('Q') A('R')
A('S') A('T') A('U') A('V') A('W') A('X') A('Y') A('Z')
N('1') N('2') N('3') N('4') N('5') N('6') N('7') N('8') N('9') N('0')
H(' ') H('\t')
V('\n') V('\r')
S('\0') S('\v') S('\f')
END
TRIGRAPH_MAP
s('=', '#') s(')', ']') s('!', '|')
s('(', '[') s('\'', '^') s('>', '}')
s('/', '\\') s('<', '{') s('-', '~')
END
#undef A
#undef N
#undef H
#undef V
#undef S
#undef s
#undef ISTABLE
#undef END
#undef TRIGRAPH_MAP
@ -507,11 +468,9 @@ initialize ()
qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp);
#endif
/* Set up the trigraph map and the IStable. These don't need to do
anything if we were compiled with a compiler that supports C99
designated initializers. */
/* Set up the trigraph map. This doesn't need to do anything if we were
compiled with a compiler that supports C99 designated initializers. */
init_trigraph_map ();
init_IStable ();
initialized = 1;
}

View File

@ -1,3 +1,16 @@
2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
* Make-lang.in: Link f/fini with safe-ctype.o.
* bad.c: Don't test ISUPPER(c) || ISLOWER(c) before calling TOUPPER(c).
* com.c: Use TOUPPER, not ffesrc_toupper.
* fini.c: Don't test ISALPHA(c) before calling TOUPPER(c)/TOLOWER(c).
* intrin.c: Don't test IN_CTYPE_DOMAIN(c).
* src.c: Delete ffesrc_toupper_ and ffesrc_tolower_ and their
initializing code; use TOUPPER and TOLOWER instead of
ffesrc_toupper and ffesrc_tolower.
* src.h: Don't declare ffesrc_toupper_ or ffesrc_tolower_.
Don't define ffesrc_toupper or ffesrc_tolower.
2000-11-28 Richard Henderson <rth@redhat.com>
* com.c (ffecom_member_phase2_): Set TREE_USED on the debugging decl.
@ -35,11 +48,11 @@ Thu Nov 23 02:18:57 2000 J"orn Rennecke <amylaar@redhat.com>
Sun Nov 19 17:29:22 2000 Matthias Klose <doko@marvin.itso-berlin.de>
* g77.texi (Floating-point precision): Adjust example
to work with glibc (>= 2.1).
* g77.texi (Floating-point precision): Adjust example
to work with glibc (>= 2.1).
Sat Nov 18 13:54:49 2000 Matthias Klose <doko@cs.tu-berlin.de>
Sat Nov 18 13:54:49 2000 Matthias Klose <doko@cs.tu-berlin.de>
* g77.texi (Floating-point Exception Handling): Adjust
example to work with glibc (>= 2.1).
@ -149,7 +162,7 @@ Thu Oct 12 22:28:51 2000 Mark Mitchell <mark@codesourcery.com>
(ffeste_R842): Likewise.
(ffeste_R843): Likewise.
(ffeste_R1001): Likewise.
2000-10-05 Richard Henderson <rth@cygnus.com>
* com.c (finish_function): Don't init can_reach_end.
@ -188,9 +201,9 @@ Sun Oct 1 11:43:44 2000 Mark Mitchell <mark@codesourcery.com>
* intrin.def: Adjust DEFIMP definition of LOG10, (float) MOD.
2000-08-21 Nix <nix@esperi.demon.co.uk>
* lang-specs.h: Do not process -o or run the assembler if
-fsyntax-only. Use %j instead of /dev/null.
* lang-specs.h: Do not process -o or run the assembler if
-fsyntax-only. Use %j instead of /dev/null.
2000-08-21 Jakub Jelinek <jakub@redhat.com>
@ -210,7 +223,7 @@ Sun Oct 1 11:43:44 2000 Mark Mitchell <mark@codesourcery.com>
* news.texi: Ditto.
2000-08-11 G. Helffrich <george@gly.bris.ac.uk>
Toon Moene <toon@moene.indiv.nluug.nl>
Toon Moene <toon@moene.indiv.nluug.nl>
* com.c (ffecom_transform_equiv_): Make EQUIVALENCEs addressable
so that debug info can be attached to their storage.

View File

@ -137,9 +137,9 @@ f/str-op.h f/str-op.j: f/fini$(build_exeext) f/str-op.fin
f/str-ot.h f/str-ot.j: f/fini$(build_exeext) f/str-ot.fin
./f/fini$(build_exeext) $(srcdir)/f/str-ot.fin f/str-ot.j f/str-ot.h
f/fini$(build_exeext): f/fini.o f/proj-h.o
f/fini$(build_exeext): f/fini.o f/proj-h.o safe-ctype.o
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o f/fini$(build_exeext) \
f/fini.o f/proj-h.o
f/fini.o f/proj-h.o safe-ctype.o
f/fini.o:
$(HOST_CC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \

View File

@ -457,7 +457,7 @@ ffebad_finish ()
if (ffebad_places_ == 0)
{
/* Didn't output "warning:" string, capitalize it for message. */
if ((s[0] != '\0') && ISALPHA (s[0]) && ISLOWER (s[0]))
if (s[0] != '\0')
{
char c;

View File

@ -1840,7 +1840,7 @@ ffecom_build_f2c_string_ (int i, const char *s)
tmp = &space[0];
for (p = s, q = tmp; *p != '\0'; ++p, ++q)
*q = ffesrc_toupper (*p);
*q = TOUPPER (*p);
*q = '\0';
t = build_string (i, tmp);

View File

@ -381,15 +381,9 @@ main (int argc, char **argv)
for (i = 0; i < newname->namelen; ++i)
{
cc = buf[i];
if (ISALPHA (cc))
{
newname->name_uc[i] = TOUPPER (cc);
newname->name_lc[i] = TOLOWER (cc);
newname->name_ic[i] = cc;
}
else
newname->name_uc[i] = newname->name_lc[i] = newname->name_ic[i]
= cc;
newname->name_uc[i] = TOUPPER (cc);
newname->name_lc[i] = TOLOWER (cc);
newname->name_ic[i] = cc;
}
newname->name_uc[i] = newname->name_lc[i] = newname->name_ic[i] = '\0';

View File

@ -1581,10 +1581,6 @@ ffeintrin_init_0 ()
p3 = ffeintrin_names_[i].name_ic;
for (; *p1 != '\0' && *p2 != '\0' && *p3 != '\0'; ++p1, ++p2, ++p3)
{
if (! IN_CTYPE_DOMAIN (*p1)
|| ! IN_CTYPE_DOMAIN (*p2)
|| ! IN_CTYPE_DOMAIN (*p3))
break;
if ((ISDIGIT (*p1) || (*p1 == '_')) && (*p1 == *p2) && (*p1 == *p3))
continue;
if (! ISUPPER ((unsigned char)*p1) || ! ISLOWER ((unsigned char)*p2)

View File

@ -32,16 +32,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "src.h"
#include "top.h"
/* This array does a toupper (), but any valid char type is valid as an
index and returns identity if not a lower-case character. */
char ffesrc_toupper_[256];
/* This array does a tolower (), but any valid char type is valid as an
index and returns identity if not an upper-case character. */
char ffesrc_tolower_[256];
/* This array is set up so that, given a source-mapped character, the result
of indexing into this array will match an upper-cased character depending
on the source-mapped character's case and the established ffe_case_match()
@ -113,18 +103,10 @@ ffesrc_init_1 ()
ffesrc_char_match_noninit_[i] = i;
ffesrc_char_source_[i] = i;
ffesrc_char_internal_init_[i] = i;
ffesrc_toupper_[i] = i;
ffesrc_tolower_[i] = i;
ffesrc_bad_symbol_init_[i] = FFEBAD;
ffesrc_bad_symbol_noninit_[i] = FFEBAD;
}
for (i = 'A'; i <= 'Z'; ++i)
ffesrc_tolower_[i] = TOLOWER (i);
for (i = 'a'; i <= 'z'; ++i)
ffesrc_toupper_[i] = TOUPPER (i);
ffesrc_check_symbol_ = (ffe_case_symbol () != FFE_caseNONE);
ffesrc_ok_match_init_upper_ = (ffe_case_match () != FFE_caseLOWER);
@ -230,8 +212,8 @@ ffesrc_strcmp_1ns2i (ffeCase mcase, const char *var, int len,
for (; len > 0; --len, ++var, ++str_ic)
{
c = ffesrc_char_source (*var); /* Transform source. */
c = ffesrc_toupper (c); /* Upcase source. */
d = ffesrc_toupper (*str_ic); /* Upcase InitialCaps char. */
c = TOUPPER (c); /* Upcase source. */
d = TOUPPER (*str_ic); /* Upcase InitialCaps char. */
if (c != d)
{
if ((d != '\0') && (c < d))
@ -246,7 +228,7 @@ ffesrc_strcmp_1ns2i (ffeCase mcase, const char *var, int len,
for (; len > 0; --len, ++var, ++str_ic)
{
c = ffesrc_char_source (*var); /* Transform source. */
d = ffesrc_toupper (*str_ic); /* Transform InitialCaps char. */
d = TOUPPER (*str_ic); /* Transform InitialCaps char. */
if (c != d)
{
if ((d != '\0') && (c < d))
@ -261,7 +243,7 @@ ffesrc_strcmp_1ns2i (ffeCase mcase, const char *var, int len,
for (; len > 0; --len, ++var, ++str_ic)
{
c = ffesrc_char_source (*var); /* Transform source. */
d = ffesrc_tolower (*str_ic); /* Transform InitialCaps char. */
d = TOLOWER (*str_ic); /* Transform InitialCaps char. */
if (c != d)
{
if ((d != '\0') && (c < d))
@ -279,14 +261,14 @@ ffesrc_strcmp_1ns2i (ffeCase mcase, const char *var, int len,
d = *str_ic; /* No transform of InitialCaps char. */
if (c != d)
{
c = ffesrc_toupper (c);
d = ffesrc_toupper (d);
c = TOUPPER (c);
d = TOUPPER (d);
while ((len > 0) && (c == d))
{ /* Skip past equivalent (case-ins) chars. */
--len, ++var, ++str_ic;
if (len > 0)
c = ffesrc_toupper (*var);
d = ffesrc_toupper (*str_ic);
c = TOUPPER (*var);
d = TOUPPER (*str_ic);
}
if ((d != '\0') && (c < d))
return -1;
@ -323,7 +305,7 @@ ffesrc_strcmp_2c (ffeCase mcase, const char *var, const char *str_uc,
case FFE_caseNONE:
for (; *var != '\0'; ++var, ++str_uc)
{
c = ffesrc_toupper (*var); /* Upcase source. */
c = TOUPPER (*var); /* Upcase source. */
if (c != *str_uc)
{
if ((*str_uc != '\0') && (c < *str_uc))
@ -349,11 +331,11 @@ ffesrc_strcmp_2c (ffeCase mcase, const char *var, const char *str_uc,
{
if (*var != *str_ic)
{
c = ffesrc_toupper (*var);
c = TOUPPER (*var);
while ((c != '\0') && (c == *str_uc))
{ /* Skip past equivalent (case-ins) chars. */
++var, ++str_uc;
c = ffesrc_toupper (*var);
c = TOUPPER (*var);
}
if ((*str_uc != '\0') && (c < *str_uc))
return -1;
@ -393,7 +375,7 @@ ffesrc_strncmp_2c (ffeCase mcase, const char *var, const char *str_uc,
case FFE_caseNONE:
for (; len > 0; ++var, ++str_uc, --len)
{
c = ffesrc_toupper (*var); /* Upcase source. */
c = TOUPPER (*var); /* Upcase source. */
if (c != *str_uc)
{
if (c < *str_uc)
@ -417,12 +399,12 @@ ffesrc_strncmp_2c (ffeCase mcase, const char *var, const char *str_uc,
{
if (*var != *str_ic)
{
c = ffesrc_toupper (*var);
c = TOUPPER (*var);
while ((len > 0) && (c == *str_uc))
{ /* Skip past equivalent (case-ins) chars. */
--len, ++var, ++str_uc;
if (len > 0)
c = ffesrc_toupper (*var);
c = TOUPPER (*var);
}
if ((len > 0) && (c < *str_uc))
return -1;

View File

@ -33,8 +33,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "bad.h"
#include "top.h"
extern char ffesrc_toupper_[256];
extern char ffesrc_tolower_[256];
extern char ffesrc_char_match_init_[256];
extern char ffesrc_char_match_noninit_[256];
extern char ffesrc_char_source_[256];
@ -136,8 +134,6 @@ int ffesrc_strncmp_2c (ffeCase mcase, const char *var, const char *str_uc,
#define ffesrc_terminate_2()
#define ffesrc_terminate_3()
#define ffesrc_terminate_4()
#define ffesrc_toupper(c) (ffesrc_toupper_[(unsigned int) (c)])
#define ffesrc_tolower(c) (ffesrc_tolower_[(unsigned int) (c)])
/* End of #include file. */

View File

@ -156,7 +156,7 @@ emit_gnu_type ( text, rm )
char* pD = z_TYPE;
while (ps < pe)
*(pD++) = toupper( *(pd++) = *(ps++) );
*(pD++) = TOUPPER( *(pd++) = *(ps++) );
*pD = *pd = NUL;
}
@ -612,20 +612,16 @@ FIX_PROC_HEAD( wrap_fix )
"wrap-fix" );
for (;;) {
char ch = *(pz_src++);
char ch = *pz_src++;
if (ISLOWER (ch))
*(pz_dst++) = TOUPPER ( ch );
else if (ISALNUM ( ch ))
*(pz_dst++) = ch;
else if (ch == NUL) {
*(pz_dst++) = ch;
if (ch == NUL) {
*pz_dst++ = ch;
break;
} else if (! ISALNUM (ch)) {
*pz_dst++ = '_';
} else {
*pz_dst++ = TOUPPER (ch);
}
else
*(pz_dst++) = '_';
if (++len >= sizeof( z_fixname )) {
void* p = xmalloc( len + strlen( pz_src ) + 1 );

View File

@ -771,14 +771,8 @@ extract_quoted_files (pz_data, pz_fixed_file, p_re_match)
pz_incl_quot += p_re_match->rm_so;
/* Skip forward to the included file name */
while (ISSPACE (*pz_incl_quot))
while (*pz_incl_quot != '"')
pz_incl_quot++;
/* ISSPACE() may evaluate its argument more than once! */
while (++pz_incl_quot, ISSPACE (*pz_incl_quot))
;
pz_incl_quot += sizeof ("include") - 1;
while (*pz_incl_quot++ != '"')
;
if (quoted_file_exists (pz_src_dir, pz_fixed_file, pz_incl_quot))
{

View File

@ -198,50 +198,10 @@ init_syntax_once ()
/* GCC LOCAL: call it gnu-regex.h, not regex.h, to avoid name conflicts */
#include "gnu-regex.h"
/* isalpha etc. are used for the character classes. */
#include <ctype.h>
/* Jim Meyering writes:
"... Some ctype macros are valid only for character codes that
isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
using /bin/cc or gcc but without giving an ansi option). So, all
ctype uses should be through macros like ISPRINT... If
STDC_HEADERS is defined, then autoconf has verified that the ctype
macros don't need to be guarded with references to isascii. ...
Defining isascii to 1 should let any compiler worth its salt
eliminate the && through constant folding."
Solaris defines some of these symbols so we must undefine them first. */
#undef ISASCII
#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
# define ISASCII(c) 1
#else
# define ISASCII(c) isascii(c)
#endif
#ifdef isblank
# define ISBLANK(c) (ISASCII (c) && isblank (c))
#else
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
#else
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#endif
#undef ISPRINT
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define ISALNUM(c) (ISASCII (c) && isalnum (c))
#define ISALPHA(c) (ISASCII (c) && isalpha (c))
#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
#define ISLOWER(c) (ISASCII (c) && islower (c))
#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
#define ISSPACE(c) (ISASCII (c) && isspace (c))
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
/* ISALPHA etc. are used for the character classes. */
/* GCC LOCAL: use libiberty's safe-ctype.h, don't bother defining
wrapper macros ourselves. */
#include <safe-ctype.h>
#ifndef NULL
# define NULL (void *)0
@ -5613,7 +5573,7 @@ regcomp (preg, pattern, cflags)
/* Map uppercase characters to corresponding lowercase ones. */
for (i = 0; i < CHAR_SET_SIZE; i++)
preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
preg->translate[i] = TOLOWER (i);
}
else
preg->translate = NULL;

File diff suppressed because it is too large Load Diff

View File

@ -144,7 +144,7 @@ main (int argc, const char **argv)
fprintf (stream, " \"");
for (p = &argv[i][2]; *p; ++p)
{
if (! isascii (*p))
if (! ISPRINT (*p))
fprintf (stream, "\\%o", *p);
else if (*p == '\\' || *p == '"')
fprintf (stream, "\\%c", *p);

View File

@ -75,91 +75,12 @@ extern int fputs_unlocked PARAMS ((const char *, FILE *));
# endif
#endif
#include <ctype.h>
/* There are an extraordinary number of issues with <ctype.h>.
The last straw is that it varies with the locale. Use libiberty's
replacement instead. */
#include <safe-ctype.h>
/* Jim Meyering writes:
"... Some ctype macros are valid only for character codes that
isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
using /bin/cc or gcc but without giving an ansi option). So, all
ctype uses should be through macros like ISPRINT... If
STDC_HEADERS is defined, then autoconf has verified that the ctype
macros don't need to be guarded with references to isascii. ...
Defining isascii to 1 should let any compiler worth its salt
eliminate the && through constant folding."
Bruno Haible adds:
"... Furthermore, isupper(c) etc. have an undefined result if c is
outside the range -1 <= c <= 255. One is tempted to write isupper(c)
with c being of type `char', but this is wrong if c is an 8-bit
character >= 128 which gets sign-extended to a negative value.
The macro ISUPPER protects against this as well." */
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) || defined(HOST_EBCDIC)
# define IN_CTYPE_DOMAIN(c) 1
#else
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
/* The ctype functions are often implemented as macros which do
lookups in arrays using the parameter as the offset. If the ctype
function parameter is a char, then gcc will (appropriately) warn
that a "subscript has type char". Using a (signed) char as a subscript
is bad because you may get negative offsets and thus it is not 8-bit
safe. The CTYPE_CONV macro ensures that the parameter is cast to an
unsigned char when a char is passed in. When an int is passed in, the
parameter is left alone so we don't lose EOF.
*/
#define CTYPE_CONV(CH) \
(sizeof(CH) == sizeof(unsigned char) ? (int)(unsigned char)(CH) : (int)(CH))
/* WARNING! The argument to the ctype replacement macros below is
evaluated more than once so it must not have side effects! */
#ifdef isblank
# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (CTYPE_CONV(c)))
#else
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (CTYPE_CONV(c)))
#else
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (CTYPE_CONV(c)) && !isspace (CTYPE_CONV(c)))
#endif
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (CTYPE_CONV(c)))
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (CTYPE_CONV(c)))
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (CTYPE_CONV(c)))
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (CTYPE_CONV(c)))
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (CTYPE_CONV(c)))
#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (CTYPE_CONV(c)))
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (CTYPE_CONV(c)))
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (CTYPE_CONV(c)))
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (CTYPE_CONV(c)))
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (CTYPE_CONV(c)))
#if STDC_HEADERS
# define TOLOWER(c) (tolower (CTYPE_CONV(c)))
# define TOUPPER(c) (toupper (CTYPE_CONV(c)))
#else
# define TOLOWER(c) (ISUPPER (c) ? tolower (CTYPE_CONV(c)) : (c))
# define TOUPPER(c) (ISLOWER (c) ? toupper (CTYPE_CONV(c)) : (c))
#endif
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
it's important to use the locale's definition of `digit' even when the
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
/* Define a default escape character; its different for EBCDIC. */
/* Define a default escape character; it's different for EBCDIC. */
#ifndef TARGET_ESC
#define TARGET_ESC 033
#endif

View File

@ -402,13 +402,13 @@ yylex ()
if (c >= '0' && c <= '9') {
/* It's a number */
for (namelen = 0;
c = tokstart[namelen], is_idchar[c] || c == '.';
c = tokstart[namelen], is_idchar (c) || c == '.';
namelen++)
;
return parse_number (namelen);
}
if (!is_idstart[c]) {
if (!is_idstart (c)) {
yyerror ("Invalid token in expression");
return ERROR;
}
@ -416,7 +416,7 @@ yylex ()
/* It is a name. See how long it is. */
for (namelen = 0;
is_idchar[(int)(unsigned char)tokstart[namelen]];
is_idchar (tokstart[namelen]);
namelen++)
;

View File

@ -376,7 +376,6 @@ static void output_line_command PARAMS ((FILE_BUF *, FILE_BUF *,
static int eval_if_expression PARAMS ((const U_CHAR *, int));
static void initialize_char_syntax PARAMS ((void));
static void initialize_builtins PARAMS ((void));
static void run_directive PARAMS ((const char *, size_t,
enum node_type));
@ -424,17 +423,8 @@ struct directive directive_table[] = {
{ -1, 0, "", T_UNUSED},
};
/* table to tell if char can be part of a C identifier. */
U_CHAR is_idchar[256];
/* table to tell if char can be first char of a c identifier. */
U_CHAR is_idstart[256];
/* table to tell if c is horizontal space. */
U_CHAR is_hor_space[256];
/* table to tell if c is horizontal or vertical space. */
U_CHAR is_space[256];
#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[*p]) p++; } while (0)
#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*p]) p++; } while (0)
#define SKIP_WHITE_SPACE(p) do { while (is_nvspace(*p)) p++; } while (0)
#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space(*p)) p++; } while (0)
int errors = 0; /* Error counter for exit code */
@ -522,9 +512,6 @@ main (argc, argv)
in_fname = NULL;
out_fname = NULL;
/* Initialize is_idchar to allow $. */
initialize_char_syntax ();
no_line_commands = 0;
dump_macros = 0;
no_output = 0;
@ -726,11 +713,7 @@ main (argc, argv)
if (user_label_prefix == 0)
user_label_prefix = USER_LABEL_PREFIX;
/* Initialize is_idchar. */
initialize_char_syntax ();
/* Install __LINE__, etc. Must follow initialize_char_syntax
and option processing. */
/* Install __LINE__, etc. Must follow option processing. */
initialize_builtins ();
/* Do defines specified with -D and undefines specified with -U. */
@ -1052,14 +1035,14 @@ name_newline_fix (bp)
/* What follows the backslash-newlines is not embarrassing. */
if (count == 0 || !is_idchar[*p])
if (count == 0 || !is_idchar (*p))
return;
/* Copy all potentially embarrassing characters
that follow the backslash-newline pairs
down to where the pairs originally started. */
while (is_idchar[*p])
while (is_idchar (*p))
*bp++ = *p++;
/* Now write the same number of pairs after the embarrassing chars. */
@ -1463,7 +1446,7 @@ do { ip = &instack[indepth]; \
/* If expanding a macro arg, keep the newline -. */
*obp++ = '-';
}
} else if (is_space[*ibp]) {
} else if (is_space (*ibp)) {
/* Newline Space does not prevent expansion of preceding token
so expand the preceding token and then come back. */
if (ident_length > 0)
@ -1514,7 +1497,7 @@ do { ip = &instack[indepth]; \
ibp--;
/* If we have an identifier that ends here, process it now, so
we get the right error for recursion. */
if (ident_length && ! is_idchar[*instack[indepth - 1].bufp]) {
if (ident_length && ! is_idchar (*instack[indepth - 1].bufp)) {
redo_char = 1;
goto randomchar;
}
@ -1642,7 +1625,7 @@ randomchar:
*obp++ = '/';
}
}
else if (is_space[*ibp]) {
else if (is_space (*ibp)) {
*obp++ = *ibp++;
if (ibp[-1] == '\n') {
if (ip->macro == 0) {
@ -1837,7 +1820,7 @@ handle_directive (ip, op)
bp = ip->bufp;
/* Skip whitespace and \-newline. */
while (1) {
if (is_hor_space[*bp])
if (is_nvspace (*bp))
bp++;
else if (*bp == '/' && (newline_fix (bp + 1), bp[1]) == '*') {
ip->bufp = bp;
@ -1854,12 +1837,12 @@ handle_directive (ip, op)
cp = bp;
while (1) {
if (is_idchar[*cp])
if (is_idchar (*cp))
cp++;
else {
if (*cp == '\\' && cp[1] == '\n')
name_newline_fix (cp);
if (is_idchar[*cp])
if (is_idchar (*cp))
cp++;
else break;
}
@ -1996,11 +1979,11 @@ handle_directive (ip, op)
if (*xp == '\n') {
xp++;
cp--;
if (cp != buf && is_space[cp[-1]]) {
while (cp != buf && is_space[cp[-1]]) cp--;
if (cp != buf && is_space (cp[-1])) {
while (cp != buf && is_space(cp[-1])) cp--;
cp++;
SKIP_WHITE_SPACE (xp);
} else if (is_space[*xp]) {
} else if (is_space (*xp)) {
*cp++ = *xp++;
SKIP_WHITE_SPACE (xp);
}
@ -2172,11 +2155,11 @@ special_symbol (hp, op)
SKIP_WHITE_SPACE (ip->bufp);
}
if (!is_idstart[*ip->bufp])
if (!is_idstart (*ip->bufp))
goto oops;
if (lookup (ip->bufp, -1, -1))
buf = " 1 ";
while (is_idchar[*ip->bufp])
while (is_idchar (*ip->bufp))
++ip->bufp;
SKIP_WHITE_SPACE (ip->bufp);
if (paren) {
@ -2235,7 +2218,7 @@ get_filename:
SKIP_WHITE_SPACE (fbeg);
/* Discard trailing whitespace so we can easily see
if we have parsed all the significant chars we were given. */
while (limit != fbeg && is_hor_space[limit[-1]]) limit--;
while (limit != fbeg && is_nvspace (limit[-1])) limit--;
switch (*fbeg++) {
case '\"':
@ -2514,17 +2497,17 @@ do_define (buf, limit, op)
bp = buf;
while (is_hor_space[*bp])
while (is_nvspace (*bp))
bp++;
symname = bp; /* remember where it starts */
while (is_idchar[*bp] && bp < limit) {
while (is_idchar (*bp) && bp < limit) {
bp++;
}
sym_length = bp - symname;
if (sym_length == 0)
error ("invalid macro name");
else if (!is_idstart[*symname]) {
else if (!is_idstart (*symname)) {
U_CHAR *msg; /* what pain... */
msg = (U_CHAR *) alloca (sym_length + 1);
memcpy (msg, symname, sym_length);
@ -2556,11 +2539,11 @@ do_define (buf, limit, op)
temp->argno = argno++;
arg_ptrs = temp;
if (!is_idstart[*bp])
if (!is_idstart (*bp))
warning ("parameter name starts with a digit in #define");
/* Find the end of the arg name. */
while (is_idchar[*bp]) {
while (is_idchar (*bp)) {
bp++;
}
temp->length = bp - temp->name;
@ -2581,7 +2564,7 @@ do_define (buf, limit, op)
}
++bp; /* skip paren */
while (is_hor_space[*bp]) /* and leading whitespace */
while (is_nvspace (*bp)) /* and leading whitespace */
++bp;
/* now everything from bp before limit is the definition. */
defn = collect_expansion (bp, limit, argno, arg_ptrs);
@ -2608,7 +2591,7 @@ do_define (buf, limit, op)
}
} else {
/* simple expansion or empty definition; skip leading whitespace */
while (is_hor_space[*bp])
while (is_nvspace (*bp))
++bp;
/* now everything from bp before limit is the definition. */
defn = collect_expansion (bp, limit, -1, 0);
@ -2689,17 +2672,17 @@ comp_def_part (first, beg1, len1, beg2, len2, last)
register const U_CHAR *end1 = beg1 + len1;
register const U_CHAR *end2 = beg2 + len2;
if (first) {
while (beg1 != end1 && is_space[*beg1]) beg1++;
while (beg2 != end2 && is_space[*beg2]) beg2++;
while (beg1 != end1 && is_space (*beg1)) beg1++;
while (beg2 != end2 && is_space (*beg2)) beg2++;
}
if (last) {
while (beg1 != end1 && is_space[end1[-1]]) end1--;
while (beg2 != end2 && is_space[end2[-1]]) end2--;
while (beg1 != end1 && is_space (end1[-1])) end1--;
while (beg2 != end2 && is_space (end2[-1])) end2--;
}
while (beg1 != end1 && beg2 != end2) {
if (is_space[*beg1] && is_space[*beg2]) {
while (beg1 != end1 && is_space[*beg1]) beg1++;
while (beg2 != end2 && is_space[*beg2]) beg2++;
if (is_space (*beg1) && is_space (*beg2)) {
while (beg1 != end1 && is_space (*beg1)) beg1++;
while (beg2 != end2 && is_space (*beg2)) beg2++;
} else if (*beg1 == *beg2) {
beg1++; beg2++;
} else break;
@ -2756,8 +2739,8 @@ collect_expansion (buf, end, nargs, arglist)
/* Find end of leading whitespace. */
limit = end;
p = buf;
while (p < limit && is_space[limit[-1]]) limit--;
while (p < limit && is_space[*p]) p++;
while (p < limit && is_space (limit[-1])) limit--;
while (p < limit && is_space (*p)) p++;
/* Allocate space for the text in the macro definition.
Leading and trailing whitespace chars need 2 bytes each.
@ -2776,7 +2759,7 @@ collect_expansion (buf, end, nargs, arglist)
p = buf;
/* Convert leading whitespace to Newline-markers. */
while (p < limit && is_space[*p]) {
while (p < limit && is_space (*p)) {
*exp_p++ = '\n';
*exp_p++ = *p++;
}
@ -2826,15 +2809,15 @@ collect_expansion (buf, end, nargs, arglist)
break;
}
if (is_idchar[c] && nargs > 0) {
if (is_idchar (c) && nargs > 0) {
U_CHAR *id_beg = p - 1;
int id_len;
--exp_p;
while (p != limit && is_idchar[*p]) p++;
while (p != limit && is_idchar (*p)) p++;
id_len = p - id_beg;
if (is_idstart[c]) {
if (is_idstart (c)) {
register struct arglist *arg;
for (arg = arglist; arg != NULL; arg = arg->next) {
@ -2887,7 +2870,7 @@ collect_expansion (buf, end, nargs, arglist)
if (limit < end) {
/* Convert trailing whitespace to Newline-markers. */
while (limit < end && is_space[*limit]) {
while (limit < end && is_space (*limit)) {
*exp_p++ = '\n';
*exp_p++ = *limit++;
}
@ -2941,7 +2924,7 @@ do_line (buf, limit, op)
bp++;
#if 0 /* #line 10"foo.c" is supposed to be allowed. */
if (*bp && !is_space[*bp]) {
if (*bp && !is_space (*bp)) {
error ("invalid format #line command");
return;
}
@ -3030,7 +3013,7 @@ do_undef (buf, limit, op)
SKIP_WHITE_SPACE (buf);
if (! strncmp ((const char *)buf, "defined", 7) && ! is_idchar[buf[7]])
if (! strncmp ((const char *)buf, "defined", 7) && ! is_idchar (buf[7]))
warning ("undefining `defined'");
while ((hp = lookup (buf, -1, -1)) != NULL) {
@ -3121,11 +3104,11 @@ parse_assertion (buf, limit, answerp, type)
unsigned int len;
bp = symname;
if (bp < climit && is_idstart[*bp])
if (bp < climit && is_idstart (*bp))
{
do
bp++;
while (bp < climit && is_idchar[*bp]);
while (bp < climit && is_idchar (*bp));
}
len = bp - symname;
@ -3177,9 +3160,9 @@ test_assertion (pbuf)
/* Yuk. We update pbuf to point after the assertion test.
First, move past the identifier. */
if (is_space[*buf])
if (is_space (*buf))
buf++;
while (is_idchar[*buf])
while (is_idchar (*buf))
buf++;
/* If we have an answer, we need to move past the parentheses. */
if (answer)
@ -3292,11 +3275,11 @@ canonicalize_text (buf, limit, climit)
for (dest = result; buf < limit;)
{
if (! is_space[*buf])
if (! is_space (*buf))
*dest++ = *buf++;
else
{
while (++buf < limit && is_space [*buf])
while (++buf < limit && is_space (*buf))
;
if (dest != result && buf != limit)
*dest++ = ' ';
@ -3411,10 +3394,10 @@ do_xifdef (buf, limit, type)
/* Discard leading and trailing whitespace. */
SKIP_WHITE_SPACE (buf);
while (limit != buf && is_hor_space[limit[-1]]) limit--;
while (limit != buf && is_nvspace (limit[-1])) limit--;
/* Find the end of the identifier at the beginning. */
for (end = buf; is_idchar[*end]; end++);
for (end = buf; is_idchar (*end); end++);
if (end == buf)
skip = (type == T_IFDEF);
@ -3521,7 +3504,7 @@ skip_if_group (ip, any)
If not, this # is not special. */
bp = beg_of_line;
while (1) {
if (is_hor_space[*bp])
if (is_nvspace (*bp))
bp++;
else if (*bp == '\\' && bp[1] == '\n')
bp += 2;
@ -3545,7 +3528,7 @@ skip_if_group (ip, any)
/* Skip whitespace and \-newline. */
while (1) {
if (is_hor_space[*bp])
if (is_nvspace (*bp))
bp++;
else if (*bp == '\\' && bp[1] == '\n')
bp += 2;
@ -3565,12 +3548,12 @@ skip_if_group (ip, any)
symbol-constituents so that we end up with a contiguous name. */
while (1) {
if (is_idchar[*bp])
if (is_idchar (*bp))
bp++;
else {
if (*bp == '\\' && bp[1] == '\n')
name_newline_fix (bp);
if (is_idchar[*bp])
if (is_idchar (*bp))
bp++;
else break;
}
@ -3579,7 +3562,7 @@ skip_if_group (ip, any)
for (kt = directive_table; kt->length >= 0; kt++) {
IF_STACK_FRAME *temp;
if (strncmp ((const char *)cp, kt->name, kt->length) == 0
&& !is_idchar[cp[kt->length]]) {
&& !is_idchar (cp[kt->length])) {
/* If we are asked to return on next directive,
do so now. */
@ -3926,7 +3909,7 @@ macroexpand (hp, op)
if (i == 1) {
register const U_CHAR *bp = args[0].raw;
register const U_CHAR *lim = bp + args[0].raw_length;
while (bp != lim && is_space[*bp]) bp++;
while (bp != lim && is_space (*bp)) bp++;
if (bp == lim)
i = 0;
}
@ -3994,10 +3977,10 @@ macroexpand (hp, op)
int c;
i = 0;
while (i < arglen
&& (c = arg->raw[i], is_space[c]))
&& (c = arg->raw[i], is_space (c)))
i++;
while (i < arglen
&& (c = arg->raw[arglen - 1], is_space[c]))
&& (c = arg->raw[arglen - 1], is_space (c)))
arglen--;
for (; i < arglen; i++) {
c = arg->raw[i];
@ -4012,13 +3995,13 @@ macroexpand (hp, op)
/* Internal sequences of whitespace are replaced by one space
except within an string or char token. */
if (! in_string
&& (c == '\n' ? arg->raw[i+1] == '\n' : is_space[c])) {
&& (c == '\n' ? arg->raw[i+1] == '\n' : is_space (c))) {
while (1) {
/* Note that Newline Space does occur within whitespace
sequences; consider it part of the sequence. */
if (c == '\n' && is_space[arg->raw[i+1]])
if (c == '\n' && is_space (arg->raw[i+1]))
i += 2;
else if (c != '\n' && is_space[c])
else if (c != '\n' && is_space (c))
i++;
else break;
c = arg->raw[i];
@ -4054,8 +4037,8 @@ macroexpand (hp, op)
const U_CHAR *l1 = p1 + arg->raw_length;
if (ap->raw_before) {
while (p1 != l1 && is_space[*p1]) p1++;
while (p1 != l1 && is_idchar[*p1])
while (p1 != l1 && is_space (*p1)) p1++;
while (p1 != l1 && is_idchar (*p1))
xbuf[totlen++] = *p1++;
/* Delete any no-reexpansion marker that follows
an identifier at the beginning of the argument
@ -4067,7 +4050,7 @@ macroexpand (hp, op)
/* Arg is concatenated after: delete trailing whitespace,
whitespace markers, and no-reexpansion markers. */
while (p1 != l1) {
if (is_space[l1[-1]]) l1--;
if (is_space (l1[-1])) l1--;
else if (l1[-1] == '-') {
const U_CHAR *p2 = l1 - 1;
/* If a `-' is preceded by an odd number of newlines then it
@ -4681,7 +4664,7 @@ install (name, len, type, hash)
if (len < 0) {
p = name;
while (is_idchar[*p])
while (is_idchar (*p))
p++;
len = p - name;
}
@ -4725,7 +4708,7 @@ lookup (name, len, hash)
register HASHNODE *bucket;
if (len < 0) {
for (bp = name; is_idchar[*bp]; bp++) ;
for (bp = name; is_idchar (*bp); bp++) ;
len = bp - name;
}
@ -4896,44 +4879,6 @@ dump_arg_n (defn, argnum)
p++;
}
}
/* Initialize syntactic classifications of characters. */
static void
initialize_char_syntax ()
{
register int i;
/*
* Set up is_idchar and is_idstart tables. These should be
* faster than saying (is_alpha (c) || c == '_'), etc.
* Must do set up these things before calling any routines tthat
* refer to them.
*/
for (i = 'a'; i <= 'z'; i++) {
is_idchar[i - 'a' + 'A'] = 1;
is_idchar[i] = 1;
is_idstart[i - 'a' + 'A'] = 1;
is_idstart[i] = 1;
}
for (i = '0'; i <= '9'; i++)
is_idchar[i] = 1;
is_idchar['_'] = 1;
is_idstart['_'] = 1;
/* horizontal space table */
is_hor_space[' '] = 1;
is_hor_space['\t'] = 1;
is_hor_space['\v'] = 1;
is_hor_space['\f'] = 1;
is_hor_space['\r'] = 1;
is_space[' '] = 1;
is_space['\t'] = 1;
is_space['\v'] = 1;
is_space['\f'] = 1;
is_space['\n'] = 1;
is_space['\r'] = 1;
}
/* Initialize the built-in macros. */
#define DSC(x) U x, sizeof x - 1

View File

@ -36,7 +36,9 @@ extern struct hashnode *lookup PARAMS ((const unsigned char *, int, int));
extern int parse_c_expression PARAMS ((const char *)); /* in tradcif.y */
extern int test_assertion PARAMS ((unsigned char **));
/* some external tables of character types */
extern unsigned char is_idstart[], is_idchar[];
#define is_idchar(x) ISIDNUM(x)
#define is_idstart(x) ISIDST(x)
#define is_space(x) ISSPACE(x)
#define is_nvspace(x) IS_NVSPACE(x)
#endif /* ! _TRADCPP_H_ */

View File

@ -1,3 +1,7 @@
2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
* safe-ctype.h: New file.
2000-12-06 Rodney Brown <RodneyBrown@mynd.com>
* getopt.h obstack.h: Standarize copyright statement.

105
include/safe-ctype.h Normal file
View File

@ -0,0 +1,105 @@
/* <ctype.h> replacement macros.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Zack Weinberg <zackw@stanford.edu>.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This is a compatible replacement of the standard C library's <ctype.h>
with the following properties:
- Implements all isxxx() macros required by C99.
- Also implements some character classes useful when
parsing C-like languages.
- Does not change behavior depending on the current locale.
- Behaves properly for all values in the range of a signed or
unsigned char.
To avoid conflicts, this header defines the isxxx functions in upper
case, e.g. ISALPHA not isalpha. */
#ifndef SAFE_CTYPE_H
#define SAFE_CTYPE_H
#ifdef isalpha
#error "safe-ctype.h and ctype.h may not be used simultaneously"
#else
/* Categories. */
enum {
/* In C99 */
_sch_isblank = 0x0001, /* space \t */
_sch_iscntrl = 0x0002, /* nonprinting characters */
_sch_isdigit = 0x0004, /* 0-9 */
_sch_islower = 0x0008, /* a-z */
_sch_isprint = 0x0010, /* any printing character including ' ' */
_sch_ispunct = 0x0020, /* all punctuation */
_sch_isspace = 0x0040, /* space \t \n \r \f \v */
_sch_isupper = 0x0080, /* A-Z */
_sch_isxdigit = 0x0100, /* 0-9A-Fa-f */
/* Extra categories useful to cpplib. */
_sch_isidst = 0x0200, /* A-Za-z_ */
_sch_isvsp = 0x0400, /* \n \r */
_sch_isnvsp = 0x0800, /* space \t \f \v \0 */
/* Combinations of the above. */
_sch_isalpha = _sch_isupper|_sch_islower, /* A-Za-z */
_sch_isalnum = _sch_isalpha|_sch_isdigit, /* A-Za-z0-9 */
_sch_isidnum = _sch_isidst|_sch_isdigit, /* A-Za-z0-9_ */
_sch_isgraph = _sch_isalnum|_sch_ispunct, /* isprint and not space */
_sch_iscppsp = _sch_isvsp|_sch_isnvsp /* isspace + \0 */
};
/* This code fundamentally assumes that a byte is 8 bits. Test this
at compile time. */
extern int a_byte_isnt_eight_bits[(unsigned char)256 == 0 ? 1 : -1];
/* Character classification. */
extern const unsigned short _sch_istable[256];
#define _sch_test(c, bit) (_sch_istable[(int)(unsigned char)(c)] & (bit))
#define ISALPHA(c) _sch_test(c, _sch_isalpha)
#define ISALNUM(c) _sch_test(c, _sch_isalnum)
#define ISBLANK(c) _sch_test(c, _sch_isblank)
#define ISCNTRL(c) _sch_test(c, _sch_iscntrl)
#define ISDIGIT(c) _sch_test(c, _sch_isdigit)
#define ISGRAPH(c) _sch_test(c, _sch_isgraph)
#define ISLOWER(c) _sch_test(c, _sch_islower)
#define ISPRINT(c) _sch_test(c, _sch_isprint)
#define ISPUNCT(c) _sch_test(c, _sch_ispunct)
#define ISSPACE(c) _sch_test(c, _sch_isspace)
#define ISUPPER(c) _sch_test(c, _sch_isupper)
#define ISXDIGIT(c) _sch_test(c, _sch_isxdigit)
#define ISIDNUM(c) _sch_test(c, _sch_isidnum)
#define ISIDST(c) _sch_test(c, _sch_isidst)
#define IS_VSPACE(c) _sch_test(c, _sch_isvsp)
#define IS_NVSPACE(c) _sch_test(c, _sch_isnvsp)
#define IS_SPACE_OR_NUL(c) _sch_test(c, _sch_iscppsp)
/* Character transformation. */
extern const unsigned char _sch_toupper[256];
extern const unsigned char _sch_tolower[256];
#define TOUPPER(c) _sch_toupper[(int)(unsigned char)(c)]
#define TOLOWER(c) _sch_tolower[(int)(unsigned char)(c)]
#endif /* no ctype.h */
#endif /* SAFE_CTYPE_H */

View File

@ -1,3 +1,15 @@
2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
* safe-ctype.c: New file.
* Makefile.in (CFILES): Add safe-ctype.c.
(REQUIRED_OFILES): Add safe-ctype.o.
* argv.c: Define ISBLANK and use it, not isspace.
* basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c,
strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use
uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c)
before calling TOLOWER(c)/TOUPPER(c).
2000-12-07 Mike Stump <mrs@wrs.com>
* Makefile.in (distclean): When cleaning, remove testsuite.
@ -13,7 +25,7 @@
* cplus-dem.c: Likewise.
(current_demangling_style): Now auto_demangling.
(cplus_demangle): Try v3 demangling if AUTO_DEMANGLING.
(main): Use standard symbol chars for auto_demangling.
(main): Use standard symbol chars for auto_demangling.
2000-11-26 Mark Mitchell <mark@codesourcery.com>

View File

@ -128,22 +128,22 @@ CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \
bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c \
cp-demangle.c dyn-string.c fdmatch.c fnmatch.c getcwd.c \
getpwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
floatformat.c hashtab.c hex.c index.c insque.c md5.c memchr.c memcmp.c\
memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c \
floatformat.c hashtab.c hex.c index.c insque.c md5.c memchr.c \
memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c \
partition.c pexecute.c putenv.c random.c rename.c rindex.c setenv.c \
sigsetmask.c sort.c spaces.c splay-tree.c strcasecmp.c strncasecmp.c \
strchr.c strdup.c strerror.c strncmp.c strrchr.c strsignal.c strstr.c \
strtod.c strtol.c strtoul.c tmpnam.c vasprintf.c vfork.c vfprintf.c \
vprintf.c vsprintf.c waitpid.c xatexit.c xexit.c xmalloc.c \
xmemdup.c xstrdup.c xstrerror.c
sigsetmask.c safe-ctype.c sort.c spaces.c splay-tree.c strcasecmp.c \
strncasecmp.c strchr.c strdup.c strerror.c strncmp.c strrchr.c \
strsignal.c strstr.c strtod.c strtol.c strtoul.c tmpnam.c vasprintf.c \
vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c xatexit.c xexit.c \
xmalloc.c xmemdup.c xstrdup.c xstrerror.c
# These are always included in the library.
REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o cp-demangle.o \
dyn-string.o fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o \
REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o cp-demangle.o \
dyn-string.o fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o \
getruntime.o hashtab.o hex.o floatformat.o md5.o objalloc.o obstack.o \
partition.o pexecute.o sort.o spaces.o splay-tree.o strerror.o \
strsignal.o xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o \
xstrerror.o
partition.o pexecute.o safe-ctype.o sort.o spaces.o splay-tree.o \
strerror.o strsignal.o xatexit.o xexit.o xmalloc.o xmemdup.o \
xstrdup.o xstrerror.o
$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
rm -f $(TARGETLIB)

View File

@ -25,10 +25,7 @@ Boston, MA 02111-1307, USA. */
#include "ansidecl.h"
#include "libiberty.h"
#ifdef isspace
#undef isspace
#endif
#define isspace(ch) ((ch) == ' ' || (ch) == '\t')
#define ISBLANK(ch) ((ch) == ' ' || (ch) == '\t')
/* Routines imported from standard C runtime libraries. */
@ -227,7 +224,7 @@ char *input;
do
{
/* Pick off argv[argc] */
while (isspace (*input))
while (ISBLANK (*input))
{
input++;
}
@ -260,7 +257,7 @@ char *input;
arg = copybuf;
while (*input != EOS)
{
if (isspace (*input) && !squote && !dquote && !bsquote)
if (ISBLANK (*input) && !squote && !dquote && !bsquote)
{
break;
}
@ -326,7 +323,7 @@ char *input;
argc++;
argv[argc] = NULL;
while (isspace (*input))
while (ISBLANK (*input))
{
input++;
}

View File

@ -20,7 +20,7 @@ BUGS
#include "ansidecl.h"
#include "libiberty.h"
#include <ctype.h>
#include "safe-ctype.h"
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
@ -50,7 +50,7 @@ basename (name)
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */
if (isalpha (name[0]) && name[1] == ':')
if (ISALPHA (name[0]) && name[1] == ':')
name += 2;
#endif

View File

@ -34,7 +34,8 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#endif
#include <ctype.h>
#include "safe-ctype.h"
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
@ -544,10 +545,10 @@ consume_count (type)
{
int count = 0;
if (! isdigit ((unsigned char)**type))
if (! ISDIGIT ((unsigned char)**type))
return -1;
while (isdigit ((unsigned char)**type))
while (ISDIGIT ((unsigned char)**type))
{
count *= 10;
@ -558,7 +559,7 @@ consume_count (type)
ten. */
if ((count % 10) != 0)
{
while (isdigit ((unsigned char) **type))
while (ISDIGIT ((unsigned char) **type))
(*type)++;
return -1;
}
@ -584,7 +585,7 @@ consume_count_with_underscores (mangled)
if (**mangled == '_')
{
(*mangled)++;
if (!isdigit ((unsigned char)**mangled))
if (!ISDIGIT ((unsigned char)**mangled))
return -1;
idx = consume_count (mangled);
@ -716,8 +717,8 @@ cplus_demangle_opname (opname, result, options)
}
}
else if (opname[0] == '_' && opname[1] == '_'
&& islower((unsigned char)opname[2])
&& islower((unsigned char)opname[3]))
&& ISLOWER((unsigned char)opname[2])
&& ISLOWER((unsigned char)opname[3]))
{
if (opname[4] == '\0')
{
@ -1003,8 +1004,8 @@ ada_demangle (mangled, option)
sizeof (char));
demangled = demangling_buffer;
if (isdigit ((unsigned char) mangled[len0 - 1])) {
for (i = len0 - 2; i >= 0 && isdigit ((unsigned char) mangled[i]); i -= 1)
if (ISDIGIT ((unsigned char) mangled[len0 - 1])) {
for (i = len0 - 2; i >= 0 && ISDIGIT ((unsigned char) mangled[i]); i -= 1)
;
if (i > 1 && mangled[i] == '_' && mangled[i - 1] == '_')
{
@ -1018,7 +1019,7 @@ ada_demangle (mangled, option)
}
}
for (i = 0, j = 0; i < len0 && ! isalpha ((unsigned char)mangled[i]);
for (i = 0, j = 0; i < len0 && ! ISALPHA ((unsigned char)mangled[i]);
i += 1, j += 1)
demangled[j] = mangled[i];
@ -1042,7 +1043,7 @@ ada_demangle (mangled, option)
demangled[j] = '\000';
for (i = 0; demangled[i] != '\0'; i += 1)
if (isupper ((unsigned char)demangled[i]) || demangled[i] == ' ')
if (ISUPPER ((unsigned char)demangled[i]) || demangled[i] == ' ')
goto Suppress;
if (! changed)
@ -1532,7 +1533,7 @@ demangle_signature (work, mangled, declp)
if (HP_DEMANGLING)
{
(*mangled)++;
while (**mangled && isdigit ((unsigned char)**mangled))
while (**mangled && ISDIGIT ((unsigned char)**mangled))
(*mangled)++;
}
else
@ -1865,7 +1866,7 @@ demangle_real_value (work, mangled, s)
string_appendn (s, "-", 1);
(*mangled)++;
}
while (isdigit ((unsigned char)**mangled))
while (ISDIGIT ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
@ -1874,7 +1875,7 @@ demangle_real_value (work, mangled, s)
{
string_appendn (s, ".", 1);
(*mangled)++;
while (isdigit ((unsigned char)**mangled))
while (ISDIGIT ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
@ -1884,7 +1885,7 @@ demangle_real_value (work, mangled, s)
{
string_appendn (s, "e", 1);
(*mangled)++;
while (isdigit ((unsigned char)**mangled))
while (ISDIGIT ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
@ -2735,20 +2736,20 @@ demangle_prefix (work, mangled, declp)
}
else if (work -> static_type)
{
if (!isdigit ((unsigned char)scan[0]) && (scan[0] != 't'))
if (!ISDIGIT ((unsigned char)scan[0]) && (scan[0] != 't'))
{
success = 0;
}
}
else if ((scan == *mangled)
&& (isdigit ((unsigned char)scan[2]) || (scan[2] == 'Q')
&& (ISDIGIT ((unsigned char)scan[2]) || (scan[2] == 'Q')
|| (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H')))
{
/* The ARM says nothing about the mangling of local variables.
But cfront mangles local variables by prepending __<nesting_level>
to them. As an extension to ARM demangling we handle this case. */
if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING)
&& isdigit ((unsigned char)scan[2]))
&& ISDIGIT ((unsigned char)scan[2]))
{
*mangled = scan + 2;
consume_count (mangled);
@ -2785,7 +2786,7 @@ demangle_prefix (work, mangled, declp)
/* EDG template? */
demangle_arm_hp_template (work, mangled, strlen (*mangled), declp);
}
else if ((scan == *mangled) && !isdigit ((unsigned char)scan[2])
else if ((scan == *mangled) && !ISDIGIT ((unsigned char)scan[2])
&& (scan[2] != 't'))
{
/* Mangled name starts with "__". Skip over any leading '_' characters,
@ -2907,7 +2908,7 @@ gnu_special (work, mangled, declp)
1);
break;
default:
if (isdigit((unsigned char)*mangled[0]))
if (ISDIGIT((unsigned char)*mangled[0]))
{
n = consume_count(mangled);
/* We may be seeing a too-large size, or else a
@ -3434,13 +3435,13 @@ get_count (type, count)
const char *p;
int n;
if (!isdigit ((unsigned char)**type))
if (!ISDIGIT ((unsigned char)**type))
return (0);
else
{
*count = **type - '0';
(*type)++;
if (isdigit ((unsigned char)**type))
if (ISDIGIT ((unsigned char)**type))
{
p = *type;
n = *count;
@ -3450,7 +3451,7 @@ get_count (type, count)
n += *p - '0';
p++;
}
while (isdigit ((unsigned char)*p));
while (ISDIGIT ((unsigned char)*p));
if (*p == '_')
{
*type = p + 1;
@ -3580,7 +3581,7 @@ do_type (work, mangled, result)
if (**mangled != 'Q')
string_prepend (&decl, SCOPE_STRING (work));
if (isdigit ((unsigned char)**mangled))
if (ISDIGIT ((unsigned char)**mangled))
{
n = consume_count (mangled);
if (n == -1
@ -3900,7 +3901,7 @@ demangle_fund_type (work, mangled, result)
break;
case 'G':
(*mangled)++;
if (!isdigit ((unsigned char)**mangled))
if (!ISDIGIT ((unsigned char)**mangled))
{
success = 0;
break;
@ -4012,12 +4013,12 @@ do_hpacc_template_const_value (work, mangled, result)
}
/* We have to be looking at an integer now */
if (!(isdigit ((unsigned char)**mangled)))
if (!(ISDIGIT ((unsigned char)**mangled)))
return 0;
/* We only deal with integral values for template
parameters -- so it's OK to look only for digits */
while (isdigit ((unsigned char)**mangled))
while (ISDIGIT ((unsigned char)**mangled))
{
char_str[0] = **mangled;
string_append (result, char_str);
@ -4096,10 +4097,10 @@ snarf_numeric_literal (args, arg)
else if (**args == '+')
(*args)++;
if (!isdigit ((unsigned char)**args))
if (!ISDIGIT ((unsigned char)**args))
return 0;
while (isdigit ((unsigned char)**args))
while (ISDIGIT ((unsigned char)**args))
{
char_str[0] = **args;
string_append (arg, char_str);
@ -4663,8 +4664,8 @@ demangle_function_name (work, mangled, declp, scan)
}
}
else if (declp->b[0] == '_' && declp->b[1] == '_'
&& islower((unsigned char)declp->b[2])
&& islower((unsigned char)declp->b[3]))
&& ISLOWER((unsigned char)declp->b[2])
&& ISLOWER((unsigned char)declp->b[3]))
{
if (declp->b[4] == '\0')
{
@ -5125,7 +5126,7 @@ main (argc, argv)
int i = 0;
c = getchar ();
/* Try to read a label. */
while (c != EOF && (isalnum (c) || strchr (valid_symbols, c)))
while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c)))
{
if (i >= MBUF_SIZE-1)
break;

View File

@ -45,8 +45,7 @@ Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
#include <safe-ctype.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
@ -74,8 +73,7 @@ fnmatch (pattern, string, flags)
register const char *p = pattern, *n = string;
register unsigned char c;
/* Note that this evalutes C many times. */
#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
#define FOLD(c) ((flags & FNM_CASEFOLD) ? TOLOWER (c) : (c))
while ((c = *p++) != '\0')
{

View File

@ -41,12 +41,12 @@ extern int errno;
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#define ISSPACE (x) isspace(x)
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include "libiberty.h"
#include "safe-ctype.h"
/* stdin file number. */
#define STDIN_FILE_NO 0

162
libiberty/safe-ctype.c Normal file
View File

@ -0,0 +1,162 @@
/* <ctype.h> replacement macros.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Zack Weinberg <zackw@stanford.edu>.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This is a compatible replacement of the standard C library's <ctype.h>
with the following properties:
- Implements all isxxx() macros required by C99.
- Also implements some character classes useful when
parsing C-like languages.
- Does not change behavior depending on the current locale.
- Behaves properly for all values in the range of a signed or
unsigned char. */
#include <safe-ctype.h>
#include <stdio.h> /* for EOF */
/* Shorthand */
#define bl _sch_isblank
#define cn _sch_iscntrl
#define di _sch_isdigit
#define is _sch_isidst
#define lo _sch_islower
#define nv _sch_isnvsp
#define pn _sch_ispunct
#define pr _sch_isprint
#define sp _sch_isspace
#define up _sch_isupper
#define vs _sch_isvsp
#define xd _sch_isxdigit
/* Masks. */
#define L lo|is |pr /* lower case letter */
#define XL lo|is|xd|pr /* lowercase hex digit */
#define U up|is |pr /* upper case letter */
#define XU up|is|xd|pr /* uppercase hex digit */
#define D di |xd|pr /* decimal digit */
#define P pn |pr /* punctuation */
#define _ pn|is |pr /* underscore */
#define C cn /* control character */
#define Z nv |cn /* NUL */
#define M nv|sp |cn /* cursor movement: \f \v */
#define V vs|sp |cn /* vertical space: \r \n */
#define T nv|sp|bl|cn /* tab */
#define S nv|sp|bl|pr /* space */
/* Are we ASCII? */
#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
&& 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
&& EOF == -1
const unsigned short _sch_istable[256] =
{
Z, C, C, C, C, C, C, C, /* NUL SOH STX ETX EOT ENQ ACK BEL */
C, T, V, M, M, V, C, C, /* BS HT LF VT FF CR SO SI */
C, C, C, C, C, C, C, C, /* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */
C, C, C, C, C, C, C, C, /* CAN EM SUB ESC FS GS RS US */
S, P, P, P, P, P, P, P, /* SP ! " # $ % & ' */
P, P, P, P, P, P, P, P, /* ( ) * + , - . / */
D, D, D, D, D, D, D, D, /* 0 1 2 3 4 5 6 7 */
D, D, P, P, P, P, P, P, /* 8 9 : ; < = > ? */
P, XU, XU, XU, XU, XU, XU, U, /* @ A B C D E F G */
U, U, U, U, U, U, U, U, /* H I J K L M N O */
U, U, U, U, U, U, U, U, /* P Q R S T U V W */
U, U, U, P, P, P, P, _, /* X Y Z [ \ ] ^ _ */
P, XL, XL, XL, XL, XL, XL, L, /* ` a b c d e f g */
L, L, L, L, L, L, L, L, /* h i j k l m n o */
L, L, L, L, L, L, L, L, /* p q r s t u v w */
L, L, L, P, P, P, P, C, /* x y z { | } ~ DEL */
/* high half of unsigned char is locale-specific, so all tests are
false in "C" locale */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
const unsigned char _sch_tolower[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64,
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
91, 92, 93, 94, 95, 96,
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
123,124,125,126,127,
128,129,130,131, 132,133,134,135, 136,137,138,139, 140,141,142,143,
144,145,146,147, 148,149,150,151, 152,153,154,155, 156,157,158,159,
160,161,162,163, 164,165,166,167, 168,169,170,171, 172,173,174,175,
176,177,178,179, 180,181,182,183, 184,185,186,187, 188,189,190,191,
192,193,194,195, 196,197,198,199, 200,201,202,203, 204,205,206,207,
208,209,210,211, 212,213,214,215, 216,217,218,219, 220,221,222,223,
224,225,226,227, 228,229,230,231, 232,233,234,235, 236,237,238,239,
240,241,242,243, 244,245,246,247, 248,249,250,251, 252,253,254,255,
};
const unsigned char _sch_toupper[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64,
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
91, 92, 93, 94, 95, 96,
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
123,124,125,126,127,
128,129,130,131, 132,133,134,135, 136,137,138,139, 140,141,142,143,
144,145,146,147, 148,149,150,151, 152,153,154,155, 156,157,158,159,
160,161,162,163, 164,165,166,167, 168,169,170,171, 172,173,174,175,
176,177,178,179, 180,181,182,183, 184,185,186,187, 188,189,190,191,
192,193,194,195, 196,197,198,199, 200,201,202,203, 204,205,206,207,
208,209,210,211, 212,213,214,215, 216,217,218,219, 220,221,222,223,
224,225,226,227, 228,229,230,231, 232,233,234,235, 236,237,238,239,
240,241,242,243, 244,245,246,247, 248,249,250,251, 252,253,254,255,
};
#else
#error "Unsupported host character set"
#endif /* not ASCII */

View File

@ -22,7 +22,7 @@ the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
#include <ctype.h>
#include "safe-ctype.h"
extern double atof ();
@ -42,7 +42,7 @@ strtod (str, ptr)
p = str;
while (isspace (*p))
while (ISSPACE (*p))
++p;
if (*p == '+' || *p == '-')
@ -88,10 +88,10 @@ strtod (str, ptr)
}
/* digits, with 0 or 1 periods in it. */
if (isdigit (*p) || *p == '.')
if (ISDIGIT (*p) || *p == '.')
{
int got_dot = 0;
while (isdigit (*p) || (!got_dot && *p == '.'))
while (ISDIGIT (*p) || (!got_dot && *p == '.'))
{
if (*p == '.')
got_dot = 1;
@ -105,9 +105,9 @@ strtod (str, ptr)
i = 1;
if (p[i] == '+' || p[i] == '-')
++i;
if (isdigit (p[i]))
if (ISDIGIT (p[i]))
{
while (isdigit (p[i]))
while (ISDIGIT (p[i]))
++i;
*ptr = p + i;
return atof (str);

View File

@ -37,15 +37,11 @@
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <ctype.h>
#include <errno.h>
#ifdef NEED_DECLARATION_ERRNO
extern int errno;
#endif
#if 0
#include <stdlib.h>
#endif
#include "ansidecl.h"
#include "safe-ctype.h"
/* FIXME: It'd be nice to configure around these, but the include files are too
painful. These macros should at least be more portable than hardwired hex
@ -88,7 +84,7 @@ strtol(nptr, endptr, base)
*/
do {
c = *s++;
} while (isspace(c));
} while (ISSPACE(c));
if (c == '-') {
neg = 1;
c = *s++;
@ -124,10 +120,10 @@ strtol(nptr, endptr, base)
cutlim = cutoff % (unsigned long)base;
cutoff /= (unsigned long)base;
for (acc = 0, any = 0;; c = *s++) {
if (isdigit(c))
if (ISDIGIT(c))
c -= '0';
else if (isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else if (ISALPHA(c))
c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)

View File

@ -74,7 +74,7 @@ strtoul(nptr, endptr, base)
*/
do {
c = *s++;
} while (isspace(c));
} while (ISSPACE(c));
if (c == '-') {
neg = 1;
c = *s++;
@ -91,10 +91,10 @@ strtoul(nptr, endptr, base)
cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
for (acc = 0, any = 0;; c = *s++) {
if (isdigit(c))
if (ISDIGIT(c))
c -= '0';
else if (isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else if (ISALPHA(c))
c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)