From 438396422cf866b96ccdb10c32875e425b37c0ac Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sun, 13 Jul 2003 17:34:18 +0000 Subject: [PATCH] Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H). * Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H). (hashtable.o, line-map.o, mkdeps.o): Likewise, from dependency list. Move these all together down by cpplib. * cpplib.h: Don't refer to MAX_WCHAR_TYPE_SIZE when determining definition of CPPCHAR_SIGNED_T. * cppcharset.c, cpperror.c, cppexp.c, cppfiles.c, cpphash.c, cppinit.c * cpplex.c, cpplib.c, cppmacro.c, cpppch.c, cpptrad.c, hashtable.c * line-map.c, mkdeps.c: Don't include coretypes.h or tm.h. * cpphash.c (_cpp_init_hashtable): Don't use gcc_obstack_init. * cppinit.c (cpp_create_reader): Likewise. * cpphash.h (scan_out_logical_line): Rename _cpp_scan_out_logical_line. * cpptrad.c: Likewise. All callers changed. * cpplib.c: All callers changed. * c-ppoutput.c: Replace 'uchar' with 'unsigned char' throughout. * hashtable.h: Define GTY(x) to nothing here too. From-SVN: r69298 --- gcc/ChangeLog | 22 ++++++++++++++++++++++ gcc/Makefile.in | 10 ++++------ gcc/c-ppoutput.c | 4 ++-- gcc/cppcharset.c | 2 -- gcc/cpperror.c | 2 -- gcc/cppexp.c | 2 -- gcc/cppfiles.c | 2 -- gcc/cpphash.c | 7 ++++--- gcc/cpphash.h | 2 +- gcc/cppinit.c | 6 +++--- gcc/cpplex.c | 2 -- gcc/cpplib.c | 5 +---- gcc/cpplib.h | 20 ++++++++++---------- gcc/cppmacro.c | 2 -- gcc/cpppch.c | 1 - gcc/cpptrad.c | 10 ++++------ gcc/hashtable.c | 7 ++++--- gcc/hashtable.h | 1 + gcc/line-map.c | 2 -- gcc/mkdeps.c | 2 -- 20 files changed, 56 insertions(+), 55 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9cda02600a..d95408bf93a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2003-07-13 Zack Weinberg + + * Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H). + (hashtable.o, line-map.o, mkdeps.o): Likewise, from dependency + list. Move these all together down by cpplib. + + * cpplib.h: Don't refer to MAX_WCHAR_TYPE_SIZE when determining + definition of CPPCHAR_SIGNED_T. + + * cppcharset.c, cpperror.c, cppexp.c, cppfiles.c, cpphash.c, cppinit.c + * cpplex.c, cpplib.c, cppmacro.c, cpppch.c, cpptrad.c, hashtable.c + * line-map.c, mkdeps.c: Don't include coretypes.h or tm.h. + + * cpphash.c (_cpp_init_hashtable): Don't use gcc_obstack_init. + * cppinit.c (cpp_create_reader): Likewise. + + * cpphash.h (scan_out_logical_line): Rename _cpp_scan_out_logical_line. + * cpptrad.c: Likewise. All callers changed. + * cpplib.c: All callers changed. + * c-ppoutput.c: Replace 'uchar' with 'unsigned char' throughout. + * hashtable.h: Define GTY(x) to nothing here too. + 2003-07-13 Richard Kenner * stor-layout.c (compute_record_mode): Remove very obsolete test diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 3573a3eacee..ed2a23ae760 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1450,10 +1450,6 @@ ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TR stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(GGC_H) gt-stringpool.h -hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(OBSTACK_H) - -line-map.o: line-map.c line-map.h intl.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) - ggc-none.o: ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(GGC_H) $(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) @@ -2356,7 +2352,7 @@ LIBCPP_OBJS = cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o cpptrad.o \ hashtable.o line-map.o mkdeps.o cpppch.o LIBCPP_DEPS = $(CPPLIB_H) cpphash.h line-map.h hashtable.h intl.h \ - $(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) + $(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H) # Most of the other archives built/used by this makefile are for # targets. This one is strictly for the host. @@ -2383,7 +2379,9 @@ cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(PREPROCESSOR_DEFINES) \ -c $(srcdir)/cppdefault.c $(OUTPUT_OPTION) -mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) mkdeps.h +mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) mkdeps.h +hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H) +line-map.o: line-map.c line-map.h intl.h $(CONFIG_H) $(SYSTEM_H) # Note for the stamp targets, we run the program `true' instead of # having an empty command (nothing following the semicolon). diff --git a/gcc/c-ppoutput.c b/gcc/c-ppoutput.c index 333da30b2e9..c37435fbf39 100644 --- a/gcc/c-ppoutput.c +++ b/gcc/c-ppoutput.c @@ -42,7 +42,7 @@ static struct /* General output routines. */ static void scan_translation_unit (cpp_reader *); static void scan_translation_unit_trad (cpp_reader *); -static void account_for_newlines (const uchar *, size_t); +static void account_for_newlines (const unsigned char *, size_t); static int dump_macro (cpp_reader *, cpp_hashnode *, void *); static void print_line (const struct line_map *, unsigned int, @@ -174,7 +174,7 @@ scan_translation_unit (cpp_reader *pfile) /* Adjust print.line for newlines embedded in output. */ static void -account_for_newlines (const uchar *str, size_t len) +account_for_newlines (const unsigned char *str, size_t len) { while (len--) if (*str++ == '\n') diff --git a/gcc/cppcharset.c b/gcc/cppcharset.c index 0fc87f2ce24..b38eea01ad6 100644 --- a/gcc/cppcharset.c +++ b/gcc/cppcharset.c @@ -20,8 +20,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" #include "cppucnid.h" diff --git a/gcc/cpperror.c b/gcc/cpperror.c index cb681f00f24..ceb4b938bb5 100644 --- a/gcc/cpperror.c +++ b/gcc/cpperror.c @@ -25,8 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" #include "intl.h" diff --git a/gcc/cppexp.c b/gcc/cppexp.c index 16082efd5e2..b558b3e8b8a 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -20,8 +20,6 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 019b0059318..742e5f110ef 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -23,8 +23,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" #include -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" #include "intl.h" diff --git a/gcc/cpphash.c b/gcc/cpphash.c index 01cd0a41f26..8016189bc5d 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -25,8 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" @@ -57,7 +55,10 @@ _cpp_init_hashtable (cpp_reader *pfile, hash_table *table) pfile->our_hashtable = 1; table = ht_create (13); /* 8K (=2^13) entries. */ table->alloc_node = (hashnode (*) (hash_table *)) alloc_node; - gcc_obstack_init (&pfile->hash_ob); + + _obstack_begin (&pfile->hash_ob, 0, 0, + (void *(*) (long)) xmalloc, + (void (*) (void *)) free); } table->pfile = pfile; diff --git a/gcc/cpphash.h b/gcc/cpphash.h index 0e1bb3922ce..f814b9fd280 100644 --- a/gcc/cpphash.h +++ b/gcc/cpphash.h @@ -552,7 +552,7 @@ extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *, extern void _cpp_pop_buffer (cpp_reader *); /* In cpptrad.c. */ -extern bool scan_out_logical_line (cpp_reader *, cpp_macro *); +extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *); extern bool _cpp_read_logical_line_trad (cpp_reader *); extern void _cpp_overlay_buffer (cpp_reader *pfile, const uchar *, size_t); extern void _cpp_remove_overlay (cpp_reader *); diff --git a/gcc/cppinit.c b/gcc/cppinit.c index f12cf1cc347..0c107b77e98 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -21,8 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" #include "mkdeps.h" @@ -194,7 +192,9 @@ cpp_create_reader (enum c_lang lang, hash_table *table) _cpp_expand_op_stack (pfile); /* Initialize the buffer obstack. */ - gcc_obstack_init (&pfile->buffer_ob); + _obstack_begin (&pfile->buffer_ob, 0, 0, + (void *(*) (long)) xmalloc, + (void (*) (void *)) free); _cpp_init_includes (pfile); diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 463064546fd..a7f13e79eae 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -21,8 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" diff --git a/gcc/cpplib.c b/gcc/cpplib.c index bbd6d016e01..3169f363569 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -21,9 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" - #include "cpplib.h" #include "cpphash.h" #include "obstack.h" @@ -280,7 +277,7 @@ prepare_directive_trad (cpp_reader *pfile) || pfile->directive == &dtable[T_ELIF]); if (no_expand) pfile->state.prevent_expansion++; - scan_out_logical_line (pfile, NULL); + _cpp_scan_out_logical_line (pfile, NULL); if (no_expand) pfile->state.prevent_expansion--; pfile->state.skipping = was_skipping; diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 661bbe5467d..434e455331a 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -191,18 +191,18 @@ struct cpp_token /* A type wide enough to hold any multibyte source character. cpplib's character constant interpreter requires an unsigned type. - Also, a typedef for the signed equivalent. */ -#ifndef MAX_WCHAR_TYPE_SIZE -# define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE -#endif -#if CHAR_BIT * SIZEOF_INT >= MAX_WCHAR_TYPE_SIZE + Also, a typedef for the signed equivalent. + The width of this type is capped at 32 bits; there do exist targets + where wchar_t is 64 bits, but only in a non-default mode, and there + would be no meaningful interpretation for a wchar_t value greater + than 2^32 anyway -- the widest wide-character encoding around is + ISO 10646, which stops at 2^31. */ +#if CHAR_BIT * SIZEOF_INT >= 32 # define CPPCHAR_SIGNED_T int +#elif CHAR_BIT * SIZEOF_LONG >= 32 +# define CPPCHAR_SIGNED_T long #else -# if CHAR_BIT * SIZEOF_LONG >= MAX_WCHAR_TYPE_SIZE || !HAVE_LONG_LONG -# define CPPCHAR_SIGNED_T long -# else -# define CPPCHAR_SIGNED_T long long -# endif +# error "Cannot find a least-32-bit signed integer type" #endif typedef unsigned CPPCHAR_SIGNED_T cppchar_t; typedef CPPCHAR_SIGNED_T cppchar_signed_t; diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index 2b9c9b5f89b..87ad5927754 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -25,8 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" diff --git a/gcc/cpppch.c b/gcc/cpppch.c index 6b60c57eaac..bdb7d16cfa0 100644 --- a/gcc/cpppch.c +++ b/gcc/cpppch.c @@ -17,7 +17,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include "coretypes.h" #include "cpplib.h" #include "cpphash.h" #include "intl.h" diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c index 9b08e31138f..152bc0fd657 100644 --- a/gcc/cpptrad.c +++ b/gcc/cpptrad.c @@ -18,8 +18,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" @@ -305,7 +303,7 @@ _cpp_read_logical_line_trad (cpp_reader *pfile) if (pfile->buffer->need_line && !_cpp_get_fresh_line (pfile)) return false; } - while (!scan_out_logical_line (pfile, NULL) || pfile->state.skipping); + while (!_cpp_scan_out_logical_line (pfile, NULL) || pfile->state.skipping); return true; } @@ -343,7 +341,7 @@ save_argument (struct fun_macro *macro, size_t offset) MACRO, and we call save_replacement_text() every time we meet an argument. */ bool -scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro) +_cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro) { bool result = true; cpp_context *context; @@ -982,7 +980,7 @@ _cpp_create_trad_definition (cpp_reader *pfile, cpp_macro *macro) if (* CUR (context) == '(') { /* Setting macro to NULL indicates an error occurred, and - prevents unnecessary work in scan_out_logical_line. */ + prevents unnecessary work in _cpp_scan_out_logical_line. */ if (!scan_parameters (pfile, macro)) macro = NULL; else @@ -1000,7 +998,7 @@ _cpp_create_trad_definition (cpp_reader *pfile, cpp_macro *macro) CPP_OPTION (pfile, discard_comments_in_macro_exp)); pfile->state.prevent_expansion++; - scan_out_logical_line (pfile, macro); + _cpp_scan_out_logical_line (pfile, macro); pfile->state.prevent_expansion--; if (!macro) diff --git a/gcc/hashtable.c b/gcc/hashtable.c index 88b1a293456..fafa1000a03 100644 --- a/gcc/hashtable.c +++ b/gcc/hashtable.c @@ -21,8 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "hashtable.h" /* The code below is a specialization of Vladimir Makarov's expandable @@ -63,7 +61,10 @@ ht_create (unsigned int order) memset (table, 0, sizeof (hash_table)); /* Strings need no alignment. */ - gcc_obstack_init (&table->stack); + _obstack_begin (&table->stack, 0, 0, + (void *(*) (long)) xmalloc, + (void (*) (void *)) free); + obstack_alignment_mask (&table->stack) = 0; table->entries = (hashnode *) xcalloc (nslots, sizeof (hashnode)); diff --git a/gcc/hashtable.h b/gcc/hashtable.h index 47ec1cccd3b..b14ab18bfaf 100644 --- a/gcc/hashtable.h +++ b/gcc/hashtable.h @@ -19,6 +19,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define GCC_HASHTABLE_H #include "obstack.h" +#define GTY(x) /* nothing */ /* This is what each hash table entry points to. It may be embedded deeply within another object. */ diff --git a/gcc/line-map.c b/gcc/line-map.c index 8bbe863693b..1023b9132eb 100644 --- a/gcc/line-map.c +++ b/gcc/line-map.c @@ -22,8 +22,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "line-map.h" #include "intl.h" diff --git a/gcc/mkdeps.c b/gcc/mkdeps.c index 71aab3d9fc5..bb084a59d0a 100644 --- a/gcc/mkdeps.c +++ b/gcc/mkdeps.c @@ -22,8 +22,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "mkdeps.h" /* Keep this structure local to this file, so clients don't find it