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)
@ -164,8 +193,8 @@ Wed Dec 6 21:03:41 2000 J"orn Rennecke <amylaar@redhat.com>
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>
@ -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>
@ -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>
@ -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>
@ -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

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,8 +1525,8 @@ 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);

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,8 +48,8 @@ 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>
@ -189,8 +202,8 @@ Sun Oct 1 11:43:44 2000 Mark Mitchell <mark@codesourcery.com>
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;

View File

@ -1,3 +1,7 @@
2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
* jvgenmain.c: Use ISPRINT not isascii.
2000-12-06 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (end_artificial_method_body): Fixed typo.
@ -981,7 +985,7 @@ Sun Aug 6 00:47:24 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
target interface.
2000-07-27 Tom Tromey <tromey@cygnus.com>
Anthony Green <green@cygnus.com>
Anthony Green <green@cygnus.com>
Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c (make_class_data): Create vtable for abstract classes.
@ -1043,7 +1047,7 @@ Sun Aug 6 00:47:24 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
2000-07-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (simple_name:): Reject `$' in type names.
* parse.y (simple_name:): Reject `$' in type names.
(resolve_type_during_patch): Use `type' as a second
argument to resolve_no_layout. Fixes gcj/257.
@ -1168,9 +1172,9 @@ Sun Aug 6 00:47:24 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
2000-07-02 Bryce McKinlay <bryce@albatross.co.nz>
* gjavah.c (HANDLE_METHOD): Call print_method_info with a NULL stream
argument on the first pass for CNI as well as JNI.
(print_method_info): Set up method name on the first pass only.
* gjavah.c (HANDLE_METHOD): Call print_method_info with a NULL stream
argument on the first pass for CNI as well as JNI.
(print_method_info): Set up method name on the first pass only.
2000-07-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -1441,11 +1445,11 @@ Thu Apr 27 17:25:33 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-04-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (maybe_yank_clinit): New function.
(maybe_generate_pre_expand_clinit): Always link <clinit> at the
end of the list of methods belonging to a class.
(java_complete_expand_method): Check whether <clinit> is really
necessary and expand it accordingly.
* parse.y (maybe_yank_clinit): New function.
(maybe_generate_pre_expand_clinit): Always link <clinit> at the
end of the list of methods belonging to a class.
(java_complete_expand_method): Check whether <clinit> is really
necessary and expand it accordingly.
2000-04-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -1613,8 +1617,8 @@ Mon Apr 24 14:59:36 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-04-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (source_start_java_method): Deleted unecessary code.
(patch_method_invocation): Fixed comment.
* parse.y (source_start_java_method): Deleted unecessary code.
(patch_method_invocation): Fixed comment.
2000-04-24 Robert Lipe <robertlipe@usa.net>
@ -1952,8 +1956,8 @@ Tue Mar 14 17:15:41 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-02-14 Andrew Haley <aph@cygnus.com>
* check-init.c (check_init): Add new cases for unary and binary
tree nodes.
* check-init.c (check_init): Add new cases for unary and binary
tree nodes.
2000-03-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -2018,7 +2022,7 @@ Mon Mar 13 11:36:51 2000 Hans Boehm <boehm@acm.org>
* parse.y (patch_string): Call force_evaluation_order on the
completed string concatenation tree.
* expr.c (force_evaluation_order): Call force_evaluation_order on
function's arguments too.
function's arguments too.
Mon Mar 6 18:07:07 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
@ -2332,22 +2336,22 @@ Thu Feb 10 12:52:09 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-02-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c (layout_class): Set and test CLASS_BEING_LAIDOUT.
Generate error message if circularity is detected. New static
local `list'.
* java-tree.h (CLASS_BEING_LAIDOUT): New flag usage, new macro. *
* jcf-write.c (generate_bytecode_insns): Very simply handle
SAVE_EXPR.
* parse.y (java_check_circular_reference): Use
`cyclic_inheritance_report' during report, if necessary.
(java_complete_lhs): fixed comment with `THROW_EXPR:' case. Avoid
walking NEW_ARRAY_INIT twice.
* class.c (layout_class): Set and test CLASS_BEING_LAIDOUT.
Generate error message if circularity is detected. New static
local `list'.
* java-tree.h (CLASS_BEING_LAIDOUT): New flag usage, new macro. *
* jcf-write.c (generate_bytecode_insns): Very simply handle
SAVE_EXPR.
* parse.y (java_check_circular_reference): Use
`cyclic_inheritance_report' during report, if necessary.
(java_complete_lhs): fixed comment with `THROW_EXPR:' case. Avoid
walking NEW_ARRAY_INIT twice.
2000-02-09 Tom Tromey <tromey@cygnus.com>
* parse.y (check_class_interface_creation): Allow inner classes to
be `private' or `protected', check modifiers' consistency. Prevent
block local classes from bearing any modifiers.
* parse.y (check_class_interface_creation): Allow inner classes to
be `private' or `protected', check modifiers' consistency. Prevent
block local classes from bearing any modifiers.
2000-02-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
@ -2364,27 +2368,27 @@ Thu Feb 10 12:52:09 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-02-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-write.c (generate_classfile): Don't consider
pre-initialization with reference value (use <clinit> instead.)
* parse.y (java_fix_constructors): No generated constructor for
interfaces.
(build_outer_field_access): Removed debug message.
(outer_field_expanded_access_p): Adapted to bytecode generation.
(build_outer_field_access_method): Use fix_method_argument_names.
(build_outer_method_access_method): Fixed indentation. Added
comment. Handle access method generation for static and also void
methods.
(build_access_to_thisn): Inserted debug message.
(maybe_build_thisn_access_method): Use fix_method_argument_names.
(resolve_qualified_expression_name): Fixed comment.
(not_accessible_p): Adapted to bytecode generation. Added comment.
(patch_method_invocation): Added comment.
(maybe_use_access_method): Fixed leading comment. Handle static
methods.
(java_complete_lhs): Don't shortcut handling of initialized upon
declaration String type static fields when generating bytecode.
(patch_unaryop): Handle outer field access when generating
bytecode.
* jcf-write.c (generate_classfile): Don't consider
pre-initialization with reference value (use <clinit> instead.)
* parse.y (java_fix_constructors): No generated constructor for
interfaces.
(build_outer_field_access): Removed debug message.
(outer_field_expanded_access_p): Adapted to bytecode generation.
(build_outer_field_access_method): Use fix_method_argument_names.
(build_outer_method_access_method): Fixed indentation. Added
comment. Handle access method generation for static and also void
methods.
(build_access_to_thisn): Inserted debug message.
(maybe_build_thisn_access_method): Use fix_method_argument_names.
(resolve_qualified_expression_name): Fixed comment.
(not_accessible_p): Adapted to bytecode generation. Added comment.
(patch_method_invocation): Added comment.
(maybe_use_access_method): Fixed leading comment. Handle static
methods.
(java_complete_lhs): Don't shortcut handling of initialized upon
declaration String type static fields when generating bytecode.
(patch_unaryop): Handle outer field access when generating
bytecode.
Thu Feb 3 20:23:19 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -2400,31 +2404,31 @@ Thu Feb 3 20:23:19 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-01-25 Andrew Haley <aph@cygnus.com>
* java-except.h (struct eh_range): Add `expanded' field.
(maybe_start_try): Add end_pc arg.
(maybe_end_try): Ditto.
* java-except.h (struct eh_range): Add `expanded' field.
(maybe_start_try): Add end_pc arg.
(maybe_end_try): Ditto.
* java-tree.h (force_poplevels): new function.
* expr.c (expand_byte_code): Don't call maybe_start_try or
maybe_end_try.
* except.c (add_handler): Reset expanded.
(expand_start_java_handler): Set expanded.
(check_start_handlers): Don't expand a start handler that's
already been expanded.
(maybe_start_try): Add end_pc arg. Only expand a handler which
ends after end_pc.
* expr.c (expand_byte_code): Don't call maybe_start_try or
maybe_end_try.
* except.c (add_handler): Reset expanded.
(expand_start_java_handler): Set expanded.
(check_start_handlers): Don't expand a start handler that's
already been expanded.
(maybe_start_try): Add end_pc arg. Only expand a handler which
ends after end_pc.
(expand_end_java_handler): call force_poplevels.
(force_poplevels): new function.
* decl.c (binding_level): Add start_pc of binding level.
(maybe_pushlevels): Call maybe_start_try when pushing binding
levels.
(maybe_poplevels): Call maybe_end_try when popping binding levels.
(LARGEST_PC): Define.
(clear_binding_level): Use LARGEST_PC.
* decl.c (binding_level): Add start_pc of binding level.
(maybe_pushlevels): Call maybe_start_try when pushing binding
levels.
(maybe_poplevels): Call maybe_end_try when popping binding levels.
(LARGEST_PC): Define.
(clear_binding_level): Use LARGEST_PC.
* java-tree.h (DEBUG_JAVA_BINDING_LEVELS): new define.
* decl.c (DEBUG_JAVA_BINDING_LEVELS): new define.
(binding_depth, is_class_level, current_pc): new variables.
(struct binding_level): ditto.
(struct binding_level): ditto.
(indent): new function.
(push_jvm_slot): add debugging info.
(maybe_pushlevels): ditto.
@ -2671,9 +2675,9 @@ Fri Jan 28 20:10:57 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-01-27 Andrew Haley <aph@cygnus.com>
* jcf-write.c (emit_goto): RESERVE 3 bytes for insn.
(emit_if): Ditto.
(emit_jsr): Ditto.
* jcf-write.c (emit_goto): RESERVE 3 bytes for insn.
(emit_if): Ditto.
(emit_jsr): Ditto.
2000-01-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
@ -3062,7 +3066,7 @@ Thu Jan 6 00:54:10 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-write.c (generate_bytecode_conditional): Fixed indentation in
method invocation and typo in conditional expression.
(generate_bytecode_insns): COND_EXPR can be part of a binop. Issue
(generate_bytecode_insns): COND_EXPR can be part of a binop. Issue
the appropriate NOTE_POP.
* parse.y (patch_binop): Shift value mask to feature the right
type.
@ -3197,12 +3201,12 @@ Tue Dec 14 14:20:16 1999 Per Bothner <per@bothner.com>
1999-12-15 Anthony Green <green@cygnus.com>
* check-init.c (check_init): Take into account both types of
`throw's when checking for uninitialized variables.
`throw's when checking for uninitialized variables.
Fri Dec 10 21:53:45 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (java_complete_lhs): Force convertion of array
dimensions to int_type_node, that's what runtime's ABI expects.
* parse.y (java_complete_lhs): Force convertion of array
dimensions to int_type_node, that's what runtime's ABI expects.
Fri Dec 10 16:13:48 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -3220,12 +3224,12 @@ Fri Dec 10 16:13:48 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Wed Dec 8 15:33:26 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* expr.c (java_lang_expand_expr): Switch to permanent obstack
before calling expand_eh_region_start and expand_start_all_catch.
* except.c (expand_start_java_handler): Switch to permanent
obstack before calling expand_eh_region_start.
(expand_end_java_handler): Switch to permanent obstack before
calling expand_start_all_catch.
* expr.c (java_lang_expand_expr): Switch to permanent obstack
before calling expand_eh_region_start and expand_start_all_catch.
* except.c (expand_start_java_handler): Switch to permanent
obstack before calling expand_eh_region_start.
(expand_end_java_handler): Switch to permanent obstack before
calling expand_start_all_catch.
1999-12-5 Anthony Green <green@cygnus.com>
@ -3236,24 +3240,24 @@ Wed Dec 8 15:33:26 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Wed Dec 1 04:25:06 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* except.c (expand_end_java_handler): Call
expand_resume_after_catch and end_catch_handler.
* except.c (expand_end_java_handler): Call
expand_resume_after_catch and end_catch_handler.
Tue Nov 30 12:36:15 1999 Anthony Green <green@cygnus.com>
* verify.c (verify_jvm_instructions): Create new return label
chain if non existant (don't rely on the verified state of the jsr
target.)
* verify.c (verify_jvm_instructions): Create new return label
chain if non existant (don't rely on the verified state of the jsr
target.)
Tue Nov 30 12:28:34 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-write.c (generate_bytecode_insns): Fixed indentation for
COMPOUND_EXPR and FIX_TRUNC_EXPR cases.
* jcf-write.c (generate_bytecode_insns): Fixed indentation for
COMPOUND_EXPR and FIX_TRUNC_EXPR cases.
* parse.y (patch_assignment): Removed bogus final class test on
lhs when checking on whether to emit an ArrayStoreException runtime
check.
* expr.c (expand_java_arraystore): Likewise.
* parse.y (patch_assignment): Removed bogus final class test on
lhs when checking on whether to emit an ArrayStoreException runtime
check.
* expr.c (expand_java_arraystore): Likewise.
1999-11-28 Anthony Green <green@cygnus.com>
@ -3262,9 +3266,9 @@ Tue Nov 30 12:28:34 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Wed Nov 24 17:33:26 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-parse.c (saw_java_source): Global variable removed.
(read_class): Don't use `saw_java_source'. Added extra braces.
(yyparse): Code setting `saw_java_source' removed.
* jcf-parse.c (saw_java_source): Global variable removed.
(read_class): Don't use `saw_java_source'. Added extra braces.
(yyparse): Code setting `saw_java_source' removed.
1999-11-24 Mark Mitchell <mark@codesourcery.com>
@ -3272,8 +3276,8 @@ Wed Nov 24 17:33:26 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Tue Nov 23 17:29:40 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* verify.c (merge_type_state): Non verified subroutines being
considered more than once to trigger passive type merge.
* verify.c (merge_type_state): Non verified subroutines being
considered more than once to trigger passive type merge.
Tue Nov 23 10:55:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -3306,7 +3310,7 @@ Wed Nov 17 21:09:28 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Thu Nov 11 01:57:14 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (lookup_method_invoke): Use lang_printable_name to
* parse.y (lookup_method_invoke): Use lang_printable_name to
reliably build the type name during error report. Fixes PR gcj/97.
1999-11-09 Tom Tromey <tromey@cygnus.com>
@ -3749,24 +3753,24 @@ Wed Aug 18 13:17:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Tue Aug 17 22:51:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (java_refold): Added prototype.
* parse.y (java_refold): Added prototype.
Tue Aug 17 21:48:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (BINOP_COMPOUND_CANDIDATES): New macro.
(java_stabilize_reference): Removed unnecessary `else'.
(java_complete_lhs): Set flag to remember boolean. Call
java_refold. Added comments.
(java_decl_equiv): New function.
(binop_compound_p): Likewise.
(java_refold): Likewise.
(patch_unaryop): Striped static field access assigned to decl and
op. Changed promotion scheme for ++/-- operators.
(search_loop): New function.
(labeled_block_contains_loop_p): Likewise.
(patch_loop_statement): Call labeled_block_contains_loop_p. Added
comment.
(patch_bc_statement): Call search_loop. Fixed comment.
* parse.y (BINOP_COMPOUND_CANDIDATES): New macro.
(java_stabilize_reference): Removed unnecessary `else'.
(java_complete_lhs): Set flag to remember boolean. Call
java_refold. Added comments.
(java_decl_equiv): New function.
(binop_compound_p): Likewise.
(java_refold): Likewise.
(patch_unaryop): Striped static field access assigned to decl and
op. Changed promotion scheme for ++/-- operators.
(search_loop): New function.
(labeled_block_contains_loop_p): Likewise.
(patch_loop_statement): Call labeled_block_contains_loop_p. Added
comment.
(patch_bc_statement): Call search_loop. Fixed comment.
1999-08-14 Anthony Green <green@cygnus.com>
@ -3863,11 +3867,11 @@ Tue Aug 10 00:28:31 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
1999-08-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* lang.c (java_dummy_print): Constify a char*.
(lang_print_error): Likewise.
(lang_init): Remove redundant prototype for `print_error_function'.
(lang_init_source): Likewise.
(lang_identify): Constify a char*.
* lang.c (java_dummy_print): Constify a char*.
(lang_print_error): Likewise.
(lang_init): Remove redundant prototype for `print_error_function'.
(lang_init_source): Likewise.
(lang_identify): Constify a char*.
1999-08-09 Tom Tromey <tromey@cygnus.com>
@ -4003,29 +4007,29 @@ Thu Jul 22 12:41:12 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
1999-07-15 Andrew Haley <aph@cygnus.com>
* lang.c (flag_use_divide_subroutine): New variable.
* typeck.c: (convert_ieee_real_to_integer): Bounds check
fp-to-integer conversion.
(convert): Call convert_ieee_real_to_integer when flag_fast_math
is not set.
* lang.c (flag_use_divide_subroutine): New variable.
* typeck.c: (convert_ieee_real_to_integer): Bounds check
fp-to-integer conversion.
(convert): Call convert_ieee_real_to_integer when flag_fast_math
is not set.
* expr.c (build_java_soft_divmod): New function.
(build_java_binop): Call build_java_soft_divmod if
flag_use_divide_subroutine is set.
* decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
soft_lrem_node: new builtin functions.
(init_decl_processing) Initialize the new builtins.
* java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
soft_lrem_node: new builtin functions.
(build_java_soft_divmod): New function.
* parse.y: Call build_java_soft_divmod if
flag_use_divide_subroutine is set.
* parse.c: Rebuilt.
* expr.c (build_java_soft_divmod): New function.
(build_java_binop): Call build_java_soft_divmod if
flag_use_divide_subroutine is set.
* decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
soft_lrem_node: new builtin functions.
(init_decl_processing) Initialize the new builtins.
* java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
soft_lrem_node: new builtin functions.
(build_java_soft_divmod): New function.
* parse.y: Call build_java_soft_divmod if
flag_use_divide_subroutine is set.
* parse.c: Rebuilt.
* jvspec.c (lang_specific_driver): Always allow an extra arg (for
a --specs= arg) even if not linking.
* lang-options.h (DEFINE_LANG_NAME ("Java")): Add
-fuse-divide-subroutine
* jvspec.c (lang_specific_driver): Always allow an extra arg (for
a --specs= arg) even if not linking.
* lang-options.h (DEFINE_LANG_NAME ("Java")): Add
-fuse-divide-subroutine
Tue Jul 20 13:20:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4037,8 +4041,8 @@ Tue Jul 20 13:20:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
1999-07-14 Andrew Haley <aph@cygnus.com>
* expr.c (expand_expr): Do not return the last statement in a
block as the block's value.
* expr.c (expand_expr): Do not return the last statement in a
block as the block's value.
Sat Jul 3 22:26:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4113,17 +4117,17 @@ Tue Jun 22 20:43:49 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
1999-06-21 Andrew Haley <aph@cygnus.com>
* except.c (find_handler_in_range): The upper limit for exception
ranges is exclusive, not inclusive: (start <= pc < end).
(link_handler): find child pointer which points to outer by
searching sibling list: previous code incorrectly assumed that
outer->outer->first_child must point to outer.
* verify.c (verify_jvm_instructions): FIXME added to code for
`athrow'.
(verify_jvm_instructions): Do not assume that the last block
processed in a subroutine is a block which ends with a `ret'
instruction. With some control flows it is possible that the last
block ends with an `athrow'.
* except.c (find_handler_in_range): The upper limit for exception
ranges is exclusive, not inclusive: (start <= pc < end).
(link_handler): find child pointer which points to outer by
searching sibling list: previous code incorrectly assumed that
outer->outer->first_child must point to outer.
* verify.c (verify_jvm_instructions): FIXME added to code for
`athrow'.
(verify_jvm_instructions): Do not assume that the last block
processed in a subroutine is a block which ends with a `ret'
instruction. With some control flows it is possible that the last
block ends with an `athrow'.
Mon Jun 14 13:13:39 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4183,8 +4187,8 @@ Wed Jun 2 10:35:13 1999 Anthony Green <green@cygnus.com>
Fri May 28 18:22:45 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (lookup_field_wrapper): Unified returned value to NULL
or the searched field decl.
* parse.y (lookup_field_wrapper): Unified returned value to NULL
or the searched field decl.
Fri May 28 11:34:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4212,8 +4216,8 @@ Wed May 26 15:33:06 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Tue May 25 15:06:13 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (patch_assignment): Save the rhs before using it as an
argument to _Jv_CheckArrayStore.
* parse.y (patch_assignment): Save the rhs before using it as an
argument to _Jv_CheckArrayStore.
Tue May 25 11:23:59 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4221,9 +4225,9 @@ Tue May 25 11:23:59 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Mon May 24 13:26:00 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* lex.c (java_lex): Accepts `+' or `-' after the beginning of a
floating point litteral only when the exponent indicator has been
parsed.
* lex.c (java_lex): Accepts `+' or `-' after the beginning of a
floating point litteral only when the exponent indicator has been
parsed.
Sat May 22 13:54:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4335,9 +4339,9 @@ Thu May 13 13:23:38 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
1999-05-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gjavah.c (print_include): Cast the result of `strlen' to int
when comparing against a signed value.
(add_namelet): Likewise.
* gjavah.c (print_include): Cast the result of `strlen' to int
when comparing against a signed value.
(add_namelet): Likewise.
1999-05-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
@ -4356,10 +4360,10 @@ Thu May 13 13:23:38 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
1999-05-11 Andrew Haley <aph@cygnus.com>
* parse.y (source_end_java_method): If the current method contains
any exception handlers, force asynchronous_exceptions: this is
necessary because signal handlers in libjava may throw exceptions.
* decl.c (end_java_method): Ditto.
* parse.y (source_end_java_method): If the current method contains
any exception handlers, force asynchronous_exceptions: this is
necessary because signal handlers in libjava may throw exceptions.
* decl.c (end_java_method): Ditto.
1999-05-11 Tom Tromey <tromey@cygnus.com>
@ -4564,8 +4568,8 @@ Tue Apr 6 23:15:52 1999 Jeffrey A Law (law@cygnus.com)
Tue Apr 6 15:15:51 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (patch_assignment): Added ArrayStoreException runtime
check.
* parse.y (patch_assignment): Added ArrayStoreException runtime
check.
1999-04-06 Per Bothner <bothner@cygnus.com>
@ -4593,26 +4597,26 @@ Mon Apr 5 16:06:09 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Mon Apr 5 15:43:51 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* class.c (add_method_1): Cast the argument of `bzero' to PTR.
* class.c (add_method_1): Cast the argument of `bzero' to PTR.
* decl.c (copy_lang_decl): Likewise for `bcopy'.
* decl.c (copy_lang_decl): Likewise for `bcopy'.
* jcf-depend.c: Include "config.h", not <config.h>.
* jcf-depend.c: Include "config.h", not <config.h>.
* jcf-parse.c (jcf_figure_file_type): Cast the arguments of
* jcf-parse.c (jcf_figure_file_type): Cast the arguments of
`bcopy' to PTR.
* jcf-path.c: Include "config.h", not <config.h>.
* jcf-path.c: Include "config.h", not <config.h>.
* lex.c: Don't include various system header files.
* lex.c: Don't include various system header files.
(java_init_lex): Cast the argument of `bzero' to PTR
* parse-scan.y (java_push_parser_context): Likewise.
* parse-scan.y (java_push_parser_context): Likewise.
* parse.y (java_push_parser_context): Likewise.
* parse.y (java_push_parser_context): Likewise.
(patch_bc_statement): Match format specifier to variable argument.
* xref.c: Don't include <stdio.h>.
* xref.c: Don't include <stdio.h>.
Mon Apr 5 11:24:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4634,10 +4638,10 @@ Mon Apr 5 11:24:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Wed Mar 31 11:00:32 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (keyword.h): Generate using gperf language 'C', not
'KR-C', so gperf uses the `const' keyword on strings.
* Makefile.in (keyword.h): Generate using gperf language 'C', not
'KR-C', so gperf uses the `const' keyword on strings.
* keyword.gperf (java_keyword): Const-ify a char*.
* keyword.gperf (java_keyword): Const-ify a char*.
Tue Mar 30 11:31:53 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -4981,7 +4985,7 @@ Fri Mar 12 19:42:55 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
1999-03-12 Andrew Haley <aph@cygnus.com>
* jcf-path.c (add_entry): alloca len+2 rather than len+1 bytes;
we'll need a directory separator and a null character.
we'll need a directory separator and a null character.
Wed Mar 10 23:20:11 1999 Per Bothner <bothner@cygnus.com>
@ -5219,15 +5223,15 @@ Wed Feb 3 12:38:43 1999 Per Bothner <bothner@cygnus.com>
1999-02-17 Andrew Haley <aph@cygnus.com>
* class.c (build_utf8_ref): Back out broken patch which was
intended to to output signatures using '.' as a separator.
intended to to output signatures using '.' as a separator.
* class.c (make_class_data): Output signatures using '.' as a
separator, rather than '/'.
(mangled_classname): Likewise.
(make_field_value): Likewise.
(make_method_value): Likewise.
* constants.c (alloc_class_constant): Likewise.
* expr.c (build_invokeinterface): Likewise.
* class.c (make_class_data): Output signatures using '.' as a
separator, rather than '/'.
(mangled_classname): Likewise.
(make_field_value): Likewise.
(make_method_value): Likewise.
* constants.c (alloc_class_constant): Likewise.
* expr.c (build_invokeinterface): Likewise.
Thu Feb 11 21:25:51 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -5269,11 +5273,11 @@ Tue Feb 9 19:31:09 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Mon Feb 8 11:50:50 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.h: DECL_P renamed JDECL_P.
* parse.y: DECL_P replaced by JDECL_P.
(build_array_from_name): Always use pointer's type.
(patch_bc_statement): Extra code to search continue target in a
for loop. Fixed comments. Continue target is current loop when
unlabeled.
* parse.y: DECL_P replaced by JDECL_P.
(build_array_from_name): Always use pointer's type.
(patch_bc_statement): Extra code to search continue target in a
for loop. Fixed comments. Continue target is current loop when
unlabeled.
1999-02-05 Andrew Haley <aph@cygnus.com>
@ -5290,8 +5294,8 @@ Mon Feb 8 11:50:50 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Wed Feb 3 22:50:17 1999 Marc Espie <Marc.Espie@liafa.jussieu.fr>
* Make-lang.in ($(GCJ)(exeext)): Remove choose-temp.o, pexecute.o and
mkstemp.o. Get them from libiberty now.
* Make-lang.in ($(GCJ)(exeext)): Remove choose-temp.o, pexecute.o and
mkstemp.o. Get them from libiberty now.
Tue Feb 2 19:49:12 1999 Jeffrey A Law (law@cygnus.com)
@ -5403,10 +5407,10 @@ Wed Jan 27 10:19:29 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Mon Jan 25 17:39:19 1999 Andrew Haley <aph@cygnus.com>
* except.c, java-except.h (expand_resume_after_catch): new
function.
* expr.c (java_lang_expand_expr): call expand_resume_after_catch
to branch back to main flow of control after a catch block.
* except.c, java-except.h (expand_resume_after_catch): new
function.
* expr.c (java_lang_expand_expr): call expand_resume_after_catch
to branch back to main flow of control after a catch block.
Sat Jan 23 23:02:43 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
@ -5547,7 +5551,7 @@ Sun Jan 17 21:55:42 1999 Jeffrey A Law (law@cygnus.com)
* Makefile.in (zextract.o): Add dependencies.
* Makefile.in: Do not put ^Ls at the start of a line.
* Makefile.in: Do not put ^Ls at the start of a line.
Fri Jan 15 20:16:20 1999 Per Bothner <bothner@cygnus.com>
@ -5667,7 +5671,7 @@ Wed Jan 6 16:20:06 1999 Per Bothner <bothner@cygnus.com>
Tue Jan 5 22:15:40 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Make-lang.in ($(GCJ).o): Depend on prefix.h.
* Make-lang.in ($(GCJ).o): Depend on prefix.h.
Tue Dec 22 11:25:19 1998 Per Bothner <bothner@cygnus.com>
@ -8803,42 +8807,42 @@ Mon Jun 1 09:58:36 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
Wed May 27 10:30:31 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
* java-tree.h (COMPOUND_ASSIGN_P, INITIALIZED_P): New macros.
* lex.c (java_lex): Use BUILD_OPERATOR and BUILD_OPERATOR2 to
build operator node and return tokens.
* lex.h (BUILD_OPERATOR, BUILD_OPERATOR2): New macros.
* lex.c (java_lex): Use BUILD_OPERATOR and BUILD_OPERATOR2 to
build operator node and return tokens.
* lex.h (BUILD_OPERATOR, BUILD_OPERATOR2): New macros.
* parse.h (java_complete_tree): Changed returned type in prototype.
(build_method_invocation, build_assignment, patch_assignment,
patch_binop): New static function declarations.
(JFLOAT_TYPE_P, JNUMERIC_TYPE_P, JPRIMITIVE_TYPE_P, JSTRING_P,
(JFLOAT_TYPE_P, JNUMERIC_TYPE_P, JPRIMITIVE_TYPE_P, JSTRING_P,
BUILD_EXPR_WFL): New macros.
* parse.y (enum tree_code binop_lookup[]): New static for token to
TREE_CODE lookup.
(%union): Parser union has new sub-structure `operator'.
(ASSIGN_TK, MULT_ASSIGN_TK, DIV_ASSIGN_TK, REM_ASSIGN_TK,
PLUS_ASSIGN_TK, MINUS_ASSIGN_TK, LS_ASSIGN_TK, SRS_ASSIGN_TK,
ZRS_ASSIGN_TK, AND_ASSIGN_TK, XOR_ASSIGN_TK, OR_ASSIGN_TK,
ASSIGN_ANY_TK): Tokens tagged `operator'.
(ASSIGN_TK, MULT_ASSIGN_TK, DIV_ASSIGN_TK, REM_ASSIGN_TK,
PLUS_ASSIGN_TK, MINUS_ASSIGN_TK, LS_ASSIGN_TK, SRS_ASSIGN_TK,
ZRS_ASSIGN_TK, AND_ASSIGN_TK, XOR_ASSIGN_TK, OR_ASSIGN_TK,
ASSIGN_ANY_TK): Tokens tagged `operator'.
(EQ_TK, GTE_TK, ZRS_TK, SRS_TK, GT_TK, LTE_TK, LS_TK, BOOL_AND_TK,
AND_TK, BOOL_OR_TK, OR_TK, INCR_TK, PLUS_TK, DECR_TK, MINUS_TK,
MULT_TK, DIV_TK, XOR_TK, REM_TK, NEQ_TK, NEG_TK, REL_QM_TK,
REL_CL_TK, NOT_TK, LT_TK): Tokens tagged `operator'.
(assignment_operator:): Rule tagged `operator'.
(assignment_operator:): Rule tagged `operator'.
(expression_statement:): Re-installed default rule.
(method_invocation:): Sub rules call build_method_invocation.
(method_invocation:): Sub rules call build_method_invocation.
(postfix_expression:): Don't attempt to resolve name here. Just
return an ID.
(multiplicative_expression:): Sub-rules build corresponding binop
expression node.
(additive_expression:, shift_expression:, and_expression:,
exclusive_or_expression:, inclusive_or_expression:): Likewise.
(assignment:): Sub rule invoke build_assignment.
(assignment_operator:): Default rules on sub rules.
(assignment:): Sub rule invoke build_assignment.
(assignment_operator:): Default rules on sub rules.
(force_error): Added documentation on this variable.
(declare_local_variables): Build initialization calling
build_assignment.
(expand_start_java_method): Removed unused rtx declaration. Mark
(declare_local_variables): Build initialization calling
build_assignment.
(expand_start_java_method): Removed unused rtx declaration. Mark
arguments as already initialized.
(java_method_add_stmt): Type of built COMPOUND_EXPR set to NULL.
(java_method_add_stmt): Type of built COMPOUND_EXPR set to NULL.
(java_complete_expand_methods): Don't process next method if
completion of the previous one triggered errors.
(java_complete_expand_method): Call source_end_java_method if no

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.

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)