Skip to content
Snippets Groups Projects
  1. Feb 20, 2008
    • Tom Tromey's avatar
      traditional.c (lex_identifier): Use CPP_HASHNODE. · 2bf41bf0
      Tom Tromey authored
      	* traditional.c (lex_identifier): Use CPP_HASHNODE.
      	* lex.c (lex_identifier): Use CPP_HASHNODE.
      	* include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Wrap in
      	do-while.
      	* identifiers.c (alloc_node): Change return type.
      	(_cpp_init_hashtable): Don't cast 'alloc_node'.
      	(proxy_assertion_broken): New declaration.
      	(cpp_forall_identifiers): Move comment.
      	* line-map.c (linemap_add): Comment fix.
      	(linemap_line_start): Indentation fix.
      
      From-SVN: r132467
      2bf41bf0
  2. Jun 29, 2005
  3. May 28, 2005
    • Gabriel Dos Reis's avatar
      configure.ac: Check declarations for asprintf and vasprintf. · c3f829c1
      Gabriel Dos Reis authored
      	* configure.ac: Check declarations for asprintf and vasprintf.
      	* config.in: Regenerate.
      	* configure: Likewise.
      
      	* charset.c (conversion_loop): Use XRESIZEVEC.
      	(convert_no_conversion): Likewise.
      	(convert_using_iconv): Likewise.
      	(init_iconv_desc): Cast return value of alloca.
      	(cpp_host_to_exec_charset): Use XNEWVEC.
      	(emit_numeric_escape): Use XRESIZEVEC.
      	(cpp_interpret_string): Use XNEWVEC.
      	(cpp_interpret_string): Use XRESIZEVEC.
      	(_cpp_interpret_identifier): Cast return value of alloca.
      	(_cpp_convert_input): Use XNEWVEC and XRESIZEVEC.
      	* directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC.
      	(parse_include): Use XNEWVEC.
      	(insert_pragma_entry): Rename local variable "new" to
      	"new_entry".
      	(save_registered_pragmas): Cast return value of xmemdup.
      	(destringize_and_run): Same for alloca.
      	(parse_assertion): Likewise.
      	(do_assert): Cast allocated storage to proper type.
      	(cpp_define): Likewise.
      	(_cpp_define_builtin): Likewise.
      	(cpp_undef): Likewise.
      	(handle_assertion): Likewise.
      	(cpp_push_buffer): Rename local variable "new" to "new_buffer".
      	* expr.c (CPP_UPLUS): Cast value to type cpp_ttype.
      	(CPP_UMINUS): Likewise.
      	(struct cpp_operator): Rename from struct operator.
      	(_cpp_expand_op_stack): Use XRESIZEVEC.
      	* files.c (pch_open_file): Use XNEWVEC.
      	(pch_open_file): Use XRESIZEVEC.
      	(read_file_guts): Use XNEWVEC and XRESIZEVEC.
      	(dir_name_of_file): Use XNEWVEC.
      	(make_cpp_file): Use XCNEW.
      	(make_cpp_dir): Likewise.
      	(allocate_file_hash_entries): USE XNEWVEC.
      	(cpp_included): Cast return value of htab_find_with_hash.
      	(append_file_to_dir): Use XNEWVEC.
      	(read_filename_string): Likewise. Use XRESIZEVEC too.
      	(read_name_map): Cast return value of alloca.  Use XRESIZEVEC.
      	(remap_filename): Use XNEWVEC.
      	(struct pchf_entry): Move definition out of struct pchf_data.
      	(_cpp_save_file_entries): Use XCNEWVAR.
      	(_cpp_read_file_entries): Use XNEWVAR.
      	* identifiers.c (alloc_node): Use XOBNEW.
      	* init.c (cpp_create_reader): Use XCNEW.
      	(cpp_init_builtins): Cast of b->value to enum builtin_type.
      	(read_original_directory): Cast return value of alloca.
      	* lex.c (add_line_note): Use XRESIZEVEC.
      	(warn_about_normalization): Use XNEWVEC.
      	(_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype).
      	(new_buff): Use XNEWVEC.
      	* line-map.c (linemap_add): Use XRESIZEVEC.
      	* macro.c (builtin_macro): Cast return value of alloca.
      	(paste_tokens): Likewise.
      	(expand_arg): Use XNEWVEC and XRESIZEVEC.
      	(_cpp_save_parameter): Use XRESIZEVEC.
      	(create_iso_definition): Cast allocated storage to proper type.
      	(_cpp_create_definition): Likewise.
      	(cpp_macro_definition): Use XRESIZEVEC.
      	* makedepend.c (add_clm): Use XNEW.
      	(add_dir): Likewise.
      	* mkdeps.c (munge): Use XNEWVEC.
      	(deps_init): Use XCNEW.
      	(deps_add_target): Use XRESIZEVEC.
      	(deps_add_default_target): Cast return value of alloca.
      	(deps_add_dep): Use XRESIZEVEC.
      	(deps_add_vpath): Likewise.  Use XNEWVEC too.
      	(deps_restore): Likewise.
      	* pch.c (save_idents): Use XNEW and XNEWVEC.
      	(cpp_save_state): Use XNEW.
      	(count_defs): Cast return value of htab_find.
      	(write_defs): Likewise.
      	(cpp_write_pch_deps): Use XNEWVEC.
      	(collect_ht_nodes): Use XRESIZEVEC.
      	(cpp_valid_state): Use XNEWVEC.
      	(save_macros): Use XRESIZEVEC.  Cast return value of xmemdup.
      	* symtab.c (ht_create): Use XCNEW.
      	(ht_lookup_with_hash): Cast return value of obstack_copy0.
      	(ht_expand): Use XCNEWVEC.
      	* system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus.
      	(bool): Do not define if __cplusplus.
      
      From-SVN: r100295
      c3f829c1
  4. May 24, 2004
    • Paolo Bonzini's avatar
      Makefile.def (host_modules): add libcpp. · 4f4e53dd
      Paolo Bonzini authored
      ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* Makefile.def (host_modules): add libcpp.
      	* Makefile.tpl: Add dependencies on and for libcpp.
      	* Makefile.in: Regenerate.
      	* configure.in: Add libcpp host module.
      	* configure: Regenerate.
      
      config/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* acx.m4 (ACX_HEADER_STDBOOL, ACX_HEADER_STRING):
      	From gcc.
      
      gcc/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	Move libcpp to the toplevel.
      	* Makefile.in: Remove references to libcpp files,
      	use CPPLIBS instead of libcpp.a.  Define SYMTAB_H
      	and change hashtable.h to that.
      	* aclocal.m4 (gcc_AC_HEADER_STDBOOL,
      	gcc_AC_HEADER_STRING, gcc_AC_C__BOOL): Remove.
      	* configure.ac (gcc_AC_C__BOOL, HAVE_UCHAR): Remove tests.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      	* c-ppoutput.c: Include ../libcpp/internal.h instead of cpphash.h.
      	* cppcharset.c: Removed.
      	* cpperror.c: Removed.
      	* cppexp.c: Removed.
      	* cppfiles.c: Removed.
      	* cpphash.c: Removed.
      	* cpphash.h: Removed.
      	* cppinit.c: Removed.
      	* cpplex.c: Removed.
      	* cpplib.c: Removed.
      	* cpplib.h: Removed.
      	* cppmacro.c: Removed.
      	* cpppch.c: Removed.
      	* cpptrad.c: Removed.
      	* cppucnid.h: Removed.
      	* cppucnid.pl: Removed.
      	* cppucnid.tab: Removed.
      	* hashtable.c: Removed.
      	* hashtable.h: Removed.
      	* line-map.c: Removed.
      	* line-map.h: Removed.
      	* mkdeps.c: Removed.
      	* mkdeps.h: Removed.
      	* stringpool.h: Include symtab.h instead of hashtable.h.
      	* tree.h: Include symtab.h instead of hashtable.h.
      	* system.h (O_NONBLOCK, O_NOCTTY): Do not define.
      
      gcc/cp/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* Make-lang.in: No need to specify $(LIBCPP).
      
      gcc/java/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* Make-lang.in: Link in $(LIBCPP) instead of mkdeps.o.
      
      libcpp/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	Moved libcpp from the gcc subdirectory to the toplevel.
      	* Makefile.am: New file.
      	* Makefile.in: Regenerate.
      	* configure.ac: New file.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      	* charset.c: Moved from gcc/cppcharset.c.  Add note about
      	brokenness of input charset detection.  Adjust for change
      	in name of cppucnid.h.
      	* errors.c: Moved from gcc/cpperror.c.  Do not include intl.h.
      	* expr.c: Moved from gcc/cppexp.c.
      	* files.c: Moved from gcc/cppfiles.c.  Do not include intl.h.
      	Remove #define of O_BINARY, it is in system.h.
      	* identifiers.c: Moved from gcc/cpphash.c.
      	* internal.h: Moved from gcc/cpphash.h.  Change header
      	guard name.  All other files adjusted to match name change.
      	* init.c: Moved from gcc/cppinit.c.
      	(init_library) [ENABLE_NLS]: Call bindtextdomain.
      	* lex.c: Moved from gcc/cpplex.c.
      	* directives.c: Moved from gcc/cpplib.c.
      	* macro.c: Moved from gcc/cppmacro.c.
      	* pch.c: Moved from gcc/cpppch.c.  Do not include intl.h.
      	* traditional.c: Moved from gcc/cpptrad.c.
      	* ucnid.h: Moved from gcc/cppucnid.h.  Change header
      	guard name.
      	* ucnid.pl: Moved from gcc/cppucnid.pl.
      	* ucnid.tab: Moved from gcc/cppucnid.tab.  Change header
      	guard name.
      	* symtab.c: Moved from gcc/hashtable.c.
      	* line-map.c: Moved from gcc.  Do not include intl.h.
      	* mkdeps.c: Moved from gcc.
      	* system.h: New file.
      
      libcpp/include/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* cpplib.h: Moved from gcc.  Change header guard name.
      	* line-map.h: Moved from gcc.  Change header guard name.
      	* mkdeps.h: Moved from gcc.  Change header guard name.
      	* symtab.h: Moved from gcc/hashtable.h.  Change header
      	guard name.
      
      libcpp/po/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* be.po: Extracted from gcc/po/be.po.
      	* ca.po: Extracted from gcc/po/ca.po.
      	* da.po: Extracted from gcc/po/da.po.
      	* de.po: Extracted from gcc/po/de.po.
      	* el.po: Extracted from gcc/po/el.po.
      	* es.po: Extracted from gcc/po/es.po.
      	* fr.po: Extracted from gcc/po/fr.po.
      	* ja.po: Extracted from gcc/po/ja.po.
      	* nl.po: Extracted from gcc/po/nl.po.
      	* sv.po: Extracted from gcc/po/sv.po.
      	* tr.po: Extracted from gcc/po/tr.po.
      
      From-SVN: r82199
      4f4e53dd
  5. Jul 19, 2003
    • Kaveh R. Ghazi's avatar
      alias.c [...]: Remove unnecessary casts. · 703ad42b
      Kaveh R. Ghazi authored
      	* alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.c
      	c-common.c c-decl.c c-incpath.c c-lex.c c-opts.c c-parse.in
      	c-pragma.c c-typeck.c calls.c cfg.c cfganal.c cfgloop.c cfgrtl.c
      	collect2.c combine.c conflict.c coverage.c cppexp.c cppfiles.c
      	cpphash.c cppinit.c cpplex.c cpplib.c cppmacro.c cppspec.c
      	cpptrad.c cse.c cselib.c dbxout.c defaults.h df.c dominance.c
      	dwarf2out.c dwarfout.c emit-rtl.c except.c expmed.c expr.c final.c
      	fix-header.c flow.c fold-const.c function.c gcc.c gccspec.c gcov.c
      	gcse.c genattr.c genattrtab.c genautomata.c genconditions.c
      	genemit.c genextract.c genoutput.c genrecog.c gensupport.c
      	ggc-page.c ggc-simple.c global.c graph.c haifa-sched.c hashtable.c
      	integrate.c jump.c langhooks.c lcm.c line-map.c local-alloc.c
      	loop.c mips-tdump.c mips-tfile.c mkdeps.c optabs.c params.c
      	postreload.c prefix.c print-tree.c protoize.c ra-build.c
      	ra-colorize.c ra-rewrite.c ra.c recog.c reg-stack.c regclass.c
      	regmove.c regrename.c reload.c reload1.c reorg.c resource.c
      	sbitmap.c sched-deps.c sched-rgn.c sched-vis.c sdbout.c
      	simplify-rtx.c ssa-ccp.c ssa.c stmt.c stor-layout.c timevar.c
      	tlink.c toplev.c tree-dump.c tree.c unroll.c unwind-dw2-fde.c
      	varasm.c varray.c vmsdbgout.c xcoffout.c: Remove unnecessary
      	casts.
      
      From-SVN: r69587
      703ad42b
  6. Jul 13, 2003
    • Zack Weinberg's avatar
      Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H). · 43839642
      Zack Weinberg authored
      	* 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
      43839642
  7. Jun 17, 2003
    • Zack Weinberg's avatar
      * cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.c · 6cf87ca4
      Zack Weinberg authored
      	* cppfiles.c, cpphash.c, cppinit.c, cpplex.c, cpplib.c
      	* cppmacro.c, cpppch.c, cpptrad.c, cppspec.c: Convert to
      	ISO C: new-style function declarations, no need for PARAMS,
      	no special punctuation on indirect function calls, use string
      	constant concatenation where convenient.
      
      From-SVN: r68070
      6cf87ca4
  8. Jun 16, 2003
    • Kaveh R. Ghazi's avatar
      decl.c, [...]: Don't use the PTR macro. · fad205ff
      Kaveh R. Ghazi authored
      cp:
      	* cp/decl.c, cp/pt.c, cp/search.c, cp/tree.c: Don't use the PTR
      	macro.
      
      gcc:
      	* bitmap.c, builtins.c, c-incpath.c, cgraph.c, config/frv/frv.c,
      	config/mips/mips.c, cppfiles.c, cpphash.c, cppinit.c, cpplib.c,
      	dwarf2out.c, dwarfout.c, except.c, expr.c, expr.h, fold-const.c,
      	function.c, gcc.c, genoutput.c, gensupport.c, global.c,
      	haifa-sched.c, hashtable.c, ifcvt.c, integrate.c, local-alloc.c,
      	loop.c, mips-tdump.c, mips-tfile.c, mkdeps.c, protoize.c,
      	read-rtl.c, recog.h, reload1.c, sbitmap.c, ssa-dce.c,
      	stringpool.c, tlink.c, tree.c, varasm.c, varray.c: Don't use
      	the PTR macro.
      
      From-SVN: r68043
      fad205ff
  9. Dec 16, 2002
  10. May 22, 2002
    • Kazu Hirata's avatar
      cpperror.c: Fix formatting. · df383483
      Kazu Hirata authored
      	* cpperror.c: Fix formatting.
      	* cppexp.c: Likewise.
      	* cppfiles.c: Likewise.
      	* cpphash.c: Likewise.
      	* cpphash.h: Likewise.
      	* cppinit.c: Likewise.
      	* cpplex.c: Likewise.
      	* cpplib.c: Likewise.
      	* cppmacro.c: Likewise.
      	* cppmain.c: Likewise.
      	* cppspec.c: Likewise.
      
      From-SVN: r53751
      df383483
  11. May 21, 2002
    • Zack Weinberg's avatar
      c-common.c (c_common_init): Set options->unsigned_char from flag_signed_char. · 2a1dc0d8
      Zack Weinberg authored
      	* c-common.c (c_common_init): Set options->unsigned_char from
      	flag_signed_char.
      	(cb_register_builtins): Define __STRICT_ANSI__ and
      	__CHAR_UNSIGNED__ here...
      	* cppinit.c (init_builtins): Not here.
      	(cpp_create_reader): unsigned_char option defaults to 0, not
      	!DEFAULT_SIGNED_CHAR.
      	(COMMAND_LINE_OPTIONS, cpp_handle_option): Lose -fsigned-char
      	and -funsigned-char.
      
      	* cpphash.h (struct spec_nodes): Kill n__STRICT_ANSI__.
      	* cpphash.c (_cpp_init_hashtable): Don't set it.
      	* cppmacro.c (builtin_macro) [BT_STDC]: Use the language setting
      	directly.  Clarify comment.
      
      From-SVN: r53703
      2a1dc0d8
  12. Feb 02, 2002
    • Neil Booth's avatar
      cpphash.h (struct spec_nodes): Remove n__CHAR_UNSIGNED__. · 0fef3fd0
      Neil Booth authored
      	* cpphash.h (struct spec_nodes): Remove n__CHAR_UNSIGNED__.
      	* cpphash.c (_cpp_init_hashtable): Similarly.
      	* cppinit.c (cpp_create_reader): Default the signed_char flag.
      	(init_builtins): Define __CHAR_UNSIGNED__ appropriately.
      	(COMMAND_LINE_OPTIONS): Recognise -f{un,}signed-char.
      	(cpp_handle_option): Handle the new options.
      	* cpplex.c (cpp_interpret_charconst): Use new flag.
      	* cpplib.h (struct cpp_options): New member signed_char.
      	* gcc.c (cpp_unique_options): Remove %c spec and documentation.
      	(cpp_options): Handle -fsigned-char and -funsigned-char.
      	(static_specs): Remove signed_char_spec.
      	(do_spec1): Don't handle %c.
      	* system.h: Poison SIGNED_CHAR_SPEC.
      	* tradcif.y (yylex): Use flag_signed_char.
      	* tradcpp.h (flag_signed_char): New.
      	* tradcpp.c (flag_signed_char): New.
      	(main): Handle new command-line options.
      	(initialize_builtins): Define __CHAR_UNSIGNED__ if appropriate.
      config:
      	* alpha/alpha.h (SIGNED_CHAR_SPEC): Remove.
      	* avr/avr.h: Remove old comments.
      	* i960/i960.h (CPP_SPEC): Pass -fsigned-char if -mic*.
      	(CC1_SPEC): Pass -fsigned-char if -mic*.
      	(SIGNED_CHAR_SPEC): Remove.
      doc:
      	* tm.texi (SIGNED_CHAR_SPEC): Remove documentation.
      testsuite:
      	* gcc.dg/cpp/uchar-1.c, uchar-2.c, uchar-3.c: New tests.
      
      From-SVN: r49444
      0fef3fd0
  13. Jan 03, 2002
    • Neil Booth's avatar
      cpperror.c: Update comments and copyright. · 5d8ebbd8
      Neil Booth authored
      	* cpperror.c: Update comments and copyright.
      	* cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
      	cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.
      
      From-SVN: r48522
      5d8ebbd8
  14. Nov 27, 2001
    • Neil Booth's avatar
      cpphash.c (_cpp_init_hashtable): Update. · 0abc6a6a
      Neil Booth authored
      	* cpphash.c (_cpp_init_hashtable): Update.
      	* cpphash.h (struct spec_nodes): Remove n_L.
      	* cpplex.c (_cpp_lex_direct): Check for prefix L separately.
      
      	* Makefile.in: Update, and add c-objc-common.o dependencies.
      	* c-lang.c: Remove unnecessary includes.
      	(c_init): Move bulk of code to c_objc_common_init, and call it.
      	(c_tree_printer, c_missing_noreturn_ok_p, c_disregard_inline_limits,
      	inline_forbidden_p, c_cannot_inline_tree_fn): Move to
      	c-objc-common.c.
      	* c-objc-common.c: New.  Mostly pulled from c-lang.c.
      	* c-tree.h (c_disregard_inline_limits, c_cannot_inline_fn,
      	c_objc_common_init, c_missing_noreturn_ok_p): New.
      	* toplev.c: Update comment.
      	* doc/passes.texi: Update.
      	* objc/ojbc-act.c (LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN,
      	LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS,
      	LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P): Override.
      	(objc_init): Update to use c_objc_common_init.
      
      From-SVN: r47388
      0abc6a6a
  15. Nov 15, 2001
    • Neil Booth's avatar
      c-common.c: Include c-lex.h. · f5e99456
      Neil Booth authored
      	* c-common.c: Include c-lex.h.
      	(c_common_lang_init): Change prototype.  Call init_c_lex and
      	init_pragma from here.
      	* c-common.h (c_common_lang_init): Change prototype.
      	* c-decl.c (init_decl_processing): Rename.  Call c_parse_init.
      	* c-lang.c (c_init): Change prototype.  Update.
      	(c_init_options): Update.
      	* c-lex.c (cpp_filename): Remove.
      	(init_c_lex): Update.  Read the main file, and get the original
      	file name.
      	(yyparse): Finish the command line options.
      	* c-parse.in (c_parse_init): Call init_reswords here.
      	(init_parse): Remove.
      	* c-tree.h (c_init_decl_processing): New.
      	* cpphash.c (_cpp_init_hashtable): After initializing the hash
      	table, populate it.
      	* cppinit.c (read_original_filename, cpp_finish_options): New.
      	(cpp_create_reader): New prototype. Defer hash table initialization.
      	(cpp_start_read): Rename cpp_read_main_file.  Initialize the
      	hash table.  Get the original filename.
      	* cpplib.h (cpp_create_reader): Update.
      	(cpp_start_read): Remove.
      	(cpp_read_main_file, cpp_finish_options): New.
      	* cppmain.c (main, do_preprocessing): Update.
      	* langhooks.h (struct langhooks): Update init prototype.
      	* toplev.c (general_init, parse_options_and_default_flags,
      	process_options, lang_indpendent_init, lang_dependent_init,
      	init_asm_output): New; perform the bulk of initialization.
      	(compile_file): Move most of initialization to above functions.
      	(debug_hooks): Initialize statically.
      	(set_Wunused): Relocate.
      	(toplev_main): Move most of initialization to other init functions.
      	Have a clear logic flow.
      	* tree.h (init_parse, init_decl_processing): Remove.
      ada:
      	* misc.c (gnat_init): Change prototype.  Include the
      	functionality of the old init_parse and init_decl_processing.
      	(gnat_init_decl_processing): New prototype.
      	(init_parse): Remove.
      	* utils.c (init_decl_processing): Rename gnat_init_decl_processing.
      cp:	* cp-tree.h (init_reswords, cxx_init_decl_processing): New.
      	(cxx_init): Update prototype.
      	* decl.c (init_decl_processing): Rename.  Move null node init
      	to its creation time.
      	* lex.c (cxx_init_options): Update.
      	(cxx_init): Combine with old init_parse; also call
      	cxx_init_decl_processing.
      f:	* com.c (ffecom_init_decl_processing): Renamed from
      	init_decl_processing.
      	(init_parse): Move contents to ffe_init.
      	(ffe_init): Update prototype.
      java:	* decl.c (init_decl_processing): Rename java_init_decl_processing.
      	* java-tree.h: New prototype.
      	* lang.c (java_init): Update prototype.  Combine with old init_parse.
      objc:	* objc-act.c (objc_init): Update prototype, combine with old
      	init_parse.
      	(objc_init_options): Update.
      
      From-SVN: r47046
      f5e99456
  16. Aug 11, 2001
    • Neil Booth's avatar
      cpphash.c (_cpp_destroy_hashtable): Use ht_destroy. · bef985f3
      Neil Booth authored
      	* cpphash.c (_cpp_destroy_hashtable): Use ht_destroy.
      	* cpphash.h (CPP_IN_SYSTEM_HEADER): Fix.
      	(struct cpp_pool): New member first.
      	* cppinit.c (append_include_chain): Plug memory leaks.
      	* cpplib.c (cpp_register_pragma, cpp_register_pragma_space):
      	Allocate pragma structures from the (aligned) macro pool to
      	avoid leaking memory.
      	* cpplex.c (_cpp_init_pool, _cpp_free_pool): Use pool->first
      	so we don't leak memory.
      	* hashtable.c (ht_destroy): New.
      	* hashtable.h (ht_destroy): New.
      
      From-SVN: r44794
      bef985f3
  17. May 30, 2001
  18. May 20, 2001
    • Neil Booth's avatar
      Makefile.in (OBJS, [...]): Update. · 2a967f3d
      Neil Booth authored
      	* Makefile.in (OBJS, LIBCPP_OBJS, LIBCPP_DEPS,
      	cpplib.o, cpphash.o, fix-header): Update.
      	(hashtable.o): New target.
      	* c-common.h: Include cpplib.h.  Define C_RID_CODE and
      	struct c_common_identifier here.
      	* c-lang.c (c_init_options): Update.  Call set_identifier_size.
      	* c-lex.c (c_lex): Update.
      	* c-pragma.h: Update.
      	* c-tree.h (struct lang_identifier): Contain c_common_identifier.
      	Delete rid_code.
      	(C_RID_CODE): Delete.
      	* cpphash.c: Rewrite to use hashtable.c.
      	* cpphash.h: Update include guards.
      	(struct cpp_reader): Remove hashtab.
      	hash_ob and buffer_ob are no longer pointers.  Add hash_table
      	and our_hashtable.
      	(HASHSTEP, _cpp_init_hashtable,	_cpp_lookup_with_hash): Delete.
      	(_cpp_cleanup_hashtable): Rename _cpp_destroy_hashtable.
      	(_cpp_cleanup_stacks): Rename _cpp_init_directives.
      	* cppinit.c (cpp_create_reader): Update.
      	* cpplex.c (cpp_ideq, parse_identifier, cpp_output_token): Update.
      	(cpp_interpret_charconst): Eliminate warning.
      	* cpplib.c (do_pragma, do_endif, push_conditional,
      	cpp_push_buffer, cpp_pop_buffer): Update.
      	(_cpp_init_stacks): Rename cpp_init_directives.
      	(_cpp_cleanup_stacks): Remove.
      	* cpplib.h: Update include guards.  Include tree-core.h and c-rid.h.
      	(cpp_hashnode, cpp_token, NODE_LEN, NODE_NAME,
      	 cpp_forall_identifiers, cpp_create_reader): Update.
      	(C_RID_CODE, cpp_make_node): New.
      	(c_common_identifier): New identifier node for C front ends.
      	* cppmain.c (main): Update.
      	* fix-header.c (read_scan_file): Update.
      	* flags.h (id_clash_len): Make unsigned.
      	* ggc.h (ggc_mark_nonnull_tree): New.
      	* hashtable.c: New.
      	* hashtable.h: New.
      	* stringpool.c: Update comments and copyright.  Update to use
      	hashtable.c.
      	* toplev.c (approx_sqrt): Move to hashtable.c.
      	(id_clash_len): Make unsigned.
      	* toplev.h (ident_hash): New.
      	* tree.c (gcc_obstack_init): Move to hashtable.c.
      	* tree.h: Include hashtable.h.
      	(IDENTIFIER_POINTER, IDENTIFIER_LENGTH): Update.
      	(GCC_IDENT_TO_HT_IDENT, HT_IDENT_TO_GCC_IDENT): New.
      	(struct tree_identifier): Update.
      	(make_identifier): New.
      cp:
      	* cp-tree.h (struct lang_identifier, C_RID_YYCODE): Update.
      	(C_RID_CODE): Remove.
      	* lex.c (cxx_init_options): Call set_identifier_size.  Update.
      	(init_parse): Don't do it here.
      objc:
      	* objc-act.c (objc_init_options): Call set_identifier_size. Update.
      
      From-SVN: r42334
      2a967f3d
  19. May 16, 2001
    • Neil Booth's avatar
      cppexp.c (lex): Use NODE_NAME and NODE_LEN. · a28c5035
      Neil Booth authored
      	* cppexp.c (lex): Use NODE_NAME and NODE_LEN.
      	* cpphash.c (_cpp_lookup_with_hash): Similarly.
      	* cpplex.c (cpp_ideq, parse_identifier, cpp_token_len,
      	cpp_spell_token, cpp_output_token): Similarly.
      	* cpplib.c (lex_macro_node, do_undef, do_pragma,
      	do_pragma_poison, parse_assertion, do_assert): Similarly.
      	* cppmacro.c (builtin_macro, parse_args, funlike_invocation_p,
      	save_parameter, _cpp_create_definition, check_trad_stringification,
      	cpp_macro_definition): Similarly.
      	* cppmain.c (cb_define, cb_undef, dump_macro): Similarly.
      	* c-lex.c (cb_undef, c_lex): Similarly.
      	* fix-header.c (recognized_function): Similarly.
      	* cpplib.h (NODE_LEN, NODE_NAME): New.
      	(cpp_hashnode): Rename length len.
      
      From-SVN: r42174
      a28c5035
  20. Jan 28, 2001
    • Neil Booth's avatar
      cpphash.c (_cpp_cleanup_hashtable, [...]): Don't set fe_value. · 26ec42ee
      Neil Booth authored
              * cpphash.c (_cpp_cleanup_hashtable, _cpp_lookup_with_hash)
              : Don't set fe_value.
              * cpplib.h (AVOID_LPASTE): New flag.
              (struct cpp_hashnode): Remove fe_value.
              * cpplex.c (cpp_avoid_paste): Don't paste '.' with a number.
              * cppmacro.c (builtin_macro): Don't set flags here.
              (replace_args): Set AVOID_LPASTE flag on first token of an
              argument, and the token following it.
              (cpp_get_token): Set AVOID_LPASTE flag on first token of a
              macro expansion, and on the token following it.  Do it for
              builtins too.
              * cppmain.c (scan_buffer): Avoid pasting only flagged tokens.
      
      From-SVN: r39318
      26ec42ee
  21. Nov 09, 2000
    • Neil Booth's avatar
      cpphash.c: Move cpp_defined here from cpplib.c. · a949941c
      Neil Booth authored
              * cpphash.c: Move cpp_defined here from cpplib.c.
              * cpplib.c: Update comments, move cpp_defined to cpphash.c.
              * cpplex.c (_cpp_lex_token): Don't leave the lexer at EOL.
              * cppmacro.c (cpp_get_token): Update comments, no need now
              to catch the CPP_EOF meaning EOL case.
      
      From-SVN: r37345
      a949941c
  22. Oct 29, 2000
    • Geoff Keating's avatar
      cpphash.c (cpp_forall_identifiers): Add context variable for callback routine. · 926c5678
      Geoff Keating authored
      	* cpphash.c (cpp_forall_identifiers): Add context variable
      	for callback routine.
      	* cppmain.c (dump_macro): Update to match cpp_forall_identifiers
      	change.
      	(main): Call cpp_forall_identifiers with null context.
      	* cpplib.h (cpp_forall_identifiers): Update prototype.
      
      	* cppmain.c: Make `parse_in' and `print' static.
      
      From-SVN: r37119
      926c5678
  23. Oct 28, 2000
    • Neil Booth's avatar
      New macro expander. · 93c80368
      Neil Booth authored
      2000-10-28  Neil Booth  <neilb@earthling.net>
      
      	New macro expander.
      
      	* cpplib.c (struct answer): New.
      	(struct if_stack): Use cpp_lexer_pos rather than line and col.
      	Rename cmacro mi_cmacro.
      	(struct directive, KANDR, STDC89, EXTENSION, COND, IF_COND, INCL,
      	IN_I): New directive and flags.
      	(skip_rest_of_line, check_eol, run_directive, glue_header_name,
      	parse_answer, parse_assertion, find_answer): New functions.
      	(parse_ifdef, detect_if_not_defined, validate_else): Remove.
      	(lex_macro_node): New function to replace parse_ifdef and
      	get_define_node.
      
      	(_cpp_handle_directive): New function, combines _cpp_check_directive
      	and _cpp_check_linemarker.
      
      	(do_define, do_undef, parse_include, do_include, do_import,
      	do_include_next, read_line_number, do_line, do_ident, do_pragma,
      	do_pragma_once, do_pragma_poison, do_pragma_dependency):
      	Update for new token getting interface.
      
      	(do_ifdef, do_ifndef, do_if, do_else, do_endif, push_conditional)
      	: Update for new multiple-include optimisation technique.
      	(do_elif): Don't forget to invalidate controlling macros.
      
      	(unwind_if_stack, cpp_defined, cpp_push_buffer, cpp_pop_buffer): Update.
      	(parse_assertion, parse_answer, find_answer, _cpp_test_assertion):
      	Functions to handle assertions with the new token interface.
      	(do_assert, do_unassert): Use them.
      
      	(cpp_define, _cpp_define_builtin, cpp_undef, cpp_assert, cpp_unassert):
      	Use run_directive.
      
      	(_cpp_init_stacks): Register directive names.  Don't register special
      	nodes.
      
      	* cpperror.c (print_containing_files, _cpp_begin_message): Update to
      	new position recording regime.
      	(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
      	cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
      	cpp_pedwarn_with_file_and_line): Update for _cpp_begin_message changes.
      	(cpp_type2name): Move to cpplex.c.
      
      	* cppexp.c (parse_charconst): spec_nodes is no longer a pointer.
      	(parse_defined): Update to handle new multiple include optimisation
      	method.  Remove poisoned identifier warning.
      	(parse_assertion, TYPE_NAME): Delete.
      	(lex): Update for multiple include optimisation, removal of
      	CPP_DEFINED, to use _cpp_test_assertion for assertions and
      	cpp_token_as_text.
      	(_cpp_parse_expr): Update for MI optimisation, and to use op_as_text.
      	(op_as_text): New function, to wrap cpp_token_as_text.
      
      	* cppfiles.c (stack_include_file, _cpp_pop_file_buffer):
      	Update for MI optimisation.
      	(_cpp_execute_include): Take a token rather than 3 arguments.  Fix
      	segfault on diagnostic.
      	(_cpp_compare_file_date): Take a token rather than 3 args.
      	(cpp_read_file): Work correctly for zero-length files.
      
      	* cpphash.c (_cpp_init_macros, _cpp_cleanup_macros): Rename
      	_cpp_init_hashtable and _cpp_cleanup_hashtable.
      	(cpp_lookup): Place identifiers at front of identifier pool
      	for _cpp_lookup_with_hash.
      	(_cpp_lookup_with_hash): Require identifiers to be at the front of
      	the identifier pool.  Commit the memory if not already in the
      	hash table.
      
      	* cppinit.c (cpp_reader_init): Move cpp_init_completed test to top.
      	Initialise various members of cpp_reader, memory pools, and the
      	special nodes.
      	(cpp_printer_init): Delete.
      	(cpp_cleanup): Update.
      	(struct builtin, builtin_array, initialize_builtins): Update for new
      	hashnode definition and builtin handling.
      	(cpp_start_read, cpp_finish): Don't take or initialise a
      	printer.  Update.
      
      	* cpplib.h (cpp_printer, cpp_toklist, CPP_DEFINED, BOL,
      	PASTED, VAR_ARGS, BEG_OF_FILE, IN_DIRECTIVE, KNOWN_DIRECTIVE,
      	T_VOID, T_SPECLINE, T_DATE, T_FILE, T_BASE_FILE, T_INCLUDE_LEVEL,
      	T_TIME, T_STDC, T_OPERATOR, T_POISON, T_MACRO, T_ASSERTION): Delete.
      	(struct cpp_pool, struct cpp_macro, struct cpp_lexer_pos,
      	struct cpp_lookahead, CPP_DHASH, enum mi_state, enum mi_ind,
      	NO_EXPAND, VARARGS_FIRST, struct cpp_token_with_pos,
      	struct toklist, struct cpp_context, struct specnodes,
      	TOKEN_LOOKAHEAD, TOKEN_BUFFSIZE, NODE_OPERATOR, NODE_POISONED,
      	NODE_BUILTIN, NODE_DIAGNOSTIC, NT_VOID, NT_MACRO, NT_ASSERTION,
      	enum builtin_type, cpp_can_paste): New.
      	(struct cpp_token): Delete line and col members.
      	(struct cpp_buffer): New member output_lineno.
      	(struct lexer_state): Delete indented, in_lex_line, seen_dot.
      	Add va_args_ok, poisoned_ok, prevent_expansion, parsing_args.
      	(struct cpp_reader): New members lexer_pos, macro_pos, directive_pos,
      	ident_pool, temp_string_pool, macro_pool, argument_pool, string_pool,
      	base_context, context, directive, mi_state, mi_if_not_defined,
      	mi_lexed, mi_cmacro, mi_ind_cmacro, la_read, la_write, la_unused,
      	mlstring_pos, macro_buffer, macro_buffer_len.
      	Delete members mls_line, mls_column, token_list, potential_control_macro,
      	temp_tokens, temp_cap, temp_alloced, temp_used, first_directive_token,
      	context_cap, cur_context, no_expand_level, paste_level, contexts, args,
      	save_parameter_spellings, need_newline, .
      	Change type of date, time and spec_nodes members.
      	Change prototypes for include and ident callbacks.
      	(struct cpp_hashnode): Change type of name.  Remove union members
      	expansion and code.  Add members macro, operator and builtin.
      
      	(cpp_token_len, cpp_token_as_text, cpp_spell_token, cpp_start_read,
      	cpp_finish, cpp_avoid_paste, cpp_get_token, cpp_get_line,
      	cpp_get_output_line, cpp_macro_definition, cpp_start_lookahead,
      	cpp_stop_lookahead): New prototypes.
      	(cpp_printer_init, cpp_dump_definition): Delete prototypes.
      
      	(U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr, ufputs):
      	Move from cpphash.h.
      
      	* cpphash.h (U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr,
      	ufputs): Move to cpplib.h.
      	(enum spell_type, struct token_spelling, _cpp_token_spellings, TOKEN_SPELL,
      	TOKEN_NAME, struct answer, FREE_ANSWER, KANDR, STDC89, EXTENSION,
      	COND, EXPAND, INCL, COMMENTS, IN_I, struct directive, directive_handler,
      	struct spec_nodes, _cpp_digraph_spellings, _cpp_free_temp_tokens,
      	_cpp_init_input_buffer, _cpp_grow_token_buffer, _cpp_init_toklist,
      	_cpp_clear_toklist, _cpp_expand_token_space, _cpp_expand_name_space,
      	_cpp_equiv_tokens, _cpp_equiv_toklists, _cpp_process_directive,
      	_cpp_run_directive, _cpp_get_line, _cpp_get_raw_token, _cpp_glue_header_name,
      	_cpp_can_paste, _cpp_check_directive, _cpp_check_linemarker,
      	_cpp_parse_assertion, _cpp_find_answer): Delete.
      	(VALID_SIGN, ALIGN, POOL_FRONT, POOL_LIMIT, POOL_BASE, POOL_SIZE,
      	POOL_USED, POOL_COMMIT, struct cpp_chunk, _cpp_lex_token, _cpp_init_pool,
      	_cpp_free_pool, _cpp_pool_reserve, _cpp_pool_alloc, _cpp_next_chunk,
      	_cpp_lock_pool, _cpp_unlock_pool, _cpp_test_assertion,
      	_cpp_handle_directive, DSC): New.
      	(struct include_file): New member defined.
      
      	(DO_NOT_REREAD, _cpp_begin_message, _cpp_execute_include,
      	_cpp_compare_file_date): Update.
      	(_cpp_pop_context, _cpp_get_token, _cpp_free_lookaheads, _cpp_push_token): New.
      	(_cpp_init_macros, _cpp_cleanup_macros): Rename to _cpp_init_hashtable,
      	_cpp_cleanup_hashtable.
      
      	* Makefile.in: Remove cppoutput.c.
      
      	* cppoutput.c: Delete
      
      	* fixheader.c (read_scan_file): Update for new cpp_get_token
      	prototype.
      	(recognized_function): New argument LINE.
      
      	* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
      	new cpp_get_token prototype.
      
      	* scan.h (recognized_function): Update prototype.
      
      	* po/POTFILES.in: Remove cppoutput.c.
      
      From-SVN: r37098
      93c80368
  24. Sep 18, 2000
    • Neil Booth's avatar
      cpphash.h (HASHSTEP): Take character rather than pointer to character. · 0d9f234d
      Neil Booth authored
      	* cpphash.h (HASHSTEP): Take character rather than pointer
      	to character.
      	(_cpp_check_directive, _cpp_check_linemarker): Update prototypes.
      
      	* cpphash.c (cpp_loookup): Update for new HASHSTEP.
      
      	* cpplex.c (auto_expand_name_space, trigraph_replace,
      	backslash_start, handle_newline, parse_name, INIT_TOKEN_STR,
      	IMMED_TOKEN, PREV_TOKEN_TYPE, PUSH_TOKEN, REVISE_TOKEN,
      	BACKUP_TOKEN, BACKUP_TRIGRAPH, MIGHT_BE_DIRECTIVE,
      	KNOWN_DIRECTIVE): Delete.
      
      	(handle_newline, check_long_token, skip_escaped_newlines,
      	unterminated): New functions.
      	(ACCEPT_CHAR, SAVE_STATE, RESTORE_STATE): New macros.
      
      	(parse_identifier): Was parse_name, new implementation.
      	(skip_line_comment, skip_block_comment, skip_whitespace,
      	parse_number, parse_string, trigraph_ok, save_comment,
      	adjust_column, _cpp_get_line): New implementations.
      
      	(lex_token): New function.  Lexes a token at a time, looking
      	forwards.  Contains most of the guts of the old lex_line.
      	(lex_line): New implementation, using lex_token to obtain
      	individual tokens.
      	(cpp_scan_buffer): Use the token's line, not the list's line.
      
      	* cpplib.c (_cpp_check_directive, _cpp_check_linemarker):
      	 New implementations.
      	(do_assert): Don't bother setting the answer's list's line.
      	(cpp_push_buffer): Initialise new pfile and read_ahead members
      	of struct cpp_buffer.
      
      	* cpplib.h (cppchar_t): New typedef.
      	(struct cpp_buffer): read_ahead, pfile and col_adjust are
      	new members.
      	(struct lexer_state): New structure that determines the state
      	and behaviour of the lexer.
      	(IN_DIRECTIVE, KNOWN_DIRECTIVE): New macros.
      	(struct cpp_reader): New member "state". Rename
      	multiline_string_line and multiline_string_column. Delete
      	col_adjust, in_lex_line members.
      	(CPP_BUF_COLUMN): Update.
      
      	* gcc.dg/cpp/cmdlne-C.c: Remove bogus warning test.
      
      From-SVN: r36509
      0d9f234d
  25. Jul 18, 2000
    • Zack Weinberg's avatar
      [multiple changes] · 711b8824
      Zack Weinberg authored
      2000-02-17  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* cpphash.c: Don't include hashtab.h.  Most macro-handling code
      	moved to cppmacro.c.
      	(hash_HASHNODE, eq_HASHNODE, _cpp_dump_macro_hash,
      	dump_hash_helper): Delete.
      	(expand_hash, higher_prime_number, _cpp_lookup_with_hash,
      	cpp_forall_identifiers): New. Implement specialized version of
      	Vlad's expandable hash table.
      	(cpp_lookup): Use new functions.
      	(_cpp_init_macros, _cpp_cleanup_macros): Adjust for new
      	implementation.
      	* cppmacro.c: New file.
      	* cppinit.c (dump_macros_helper): New.
      	(cpp_finish): Iterate over the identifier table directly.
      	* cpplex.c (parse_name): Calculate the hash of the identifier
      	while we scan it.  Use _cpp_lookup_with_hash when we can.
      
      	* cpphash.h: Update prototypes.
      	(xcnewvec, HASHSTEP): New helper macros.
      	* cpplib.h: Update prototypes.
      	* Makefile.in (LIBCPP_OBJS): Add cppmacro.o.
      	(cppmacro.o): New rule.
      	(cpphash.o): Update deps.
      
      	* cppmain.c: Do not set pfile->printer if no_output is on.
      
      2000-02-15  Neil Booth  <neilb@earthling.net>
      
      	* cpplib.c: Change all directive-handler functions to return
      	void, not int.
      	* cpphash.h: Update typedefs.
      
      From-SVN: r35113
      711b8824
  26. Jul 15, 2000
    • Zack Weinberg's avatar
      cpphash.c (save_expansion): Clear PREV_WHITE on tokens immediately following a paste operator. · 2c0accc9
      Zack Weinberg authored
      	* cpphash.c (save_expansion): Clear PREV_WHITE on tokens
      	immediately following a paste operator.
      	* cppinit.c (sort_options): New function (only for HOST_EBCDIC).
      	(cpp_reader_init): Call it, if HOST_EBCDIC.
      	(cpp_handle_options): Do not sort option list here.
      	(handle_option): Rename to cpp_handle_option and export.
      	* cpplex.c (cpp_scan_buffer_nooutput, cpp_scan_buffer): Use
      	_cpp_get_token directly.
      	(cpp_scan_line): Return 0 at EOF, 1 otherwise.
      	* cpplib.c (cpp_push_buffer): Don't set new->lineno to 1.
      	* cpplib.h: Prototype cpp_handle_option.  Update prototype of
      	cpp_scan_line.
      
      From-SVN: r35052
      2c0accc9
  27. Jul 13, 2000
    • Neil Booth's avatar
      cpphash.c (struct macro_info): Add new members. · b30892f9
      Neil Booth authored
      	* cpphash.c (struct macro_info): Add new members.
      	(_cpp_free_definition): Delete the macro directly.
      	(count_params): Return void, with first token of
      	expansion in struct macro_info on success.
      	(parse_define): Return int.  Hoist syntax checking from
      	save_macro_expansion.  Leave call to save_expansion to
      	_cpp_create_definition.
      	(alloc_macro): Needs just 2 arguments.
      	(free_macro): Delete.
      	(save_expansion): Don't perform syntax check.
      	(_cpp_create_definition): Call save_expansion.
      
      From-SVN: r35025
      b30892f9
    • Kaveh R. Ghazi's avatar
      * cpphash.c (macro_info): Don't use the `signed' keyword. · af0d1578
      Kaveh R. Ghazi authored
      From-SVN: r35023
      af0d1578
    • Zack Weinberg's avatar
      cppexp.c, [...]: Eradicate all traces of code dependent on traditional,... · f9a0e96c
      Zack Weinberg authored
      cppexp.c, [...]: Eradicate all traces of code dependent on traditional, lang_chill, or lang_fortran.
      
      	* cppexp.c, cpphash.c, cpphash.h, cppinit.c, cpplex.c,
      	cpplib.c, cpplib.h: Eradicate all traces of code dependent on
      	traditional, lang_chill, or lang_fortran.
      
      	* cppfiles.c: #undef strcmp to suppress warning about macros
      	used without arguments.
      	(_cpp_execute_include): Use f, not fname, in "No include path"
      	error.
      	(_cpp_pop_file_buffer): New function.
      	* cpplib.c: Don't include <sys/mman.h>.
      	(cpp_push_buffer): Set line_base and lineno in new buffer.
      	(cpp_pop_buffer): Use _cpp_pop_file_buffer.
      
      	* cpplex.c: Move all prototypes and structure declarations to the
      	top of the file.  Properly parenthesise some macro arguments.
      	(cpp_scan_line): New function.
      	(special_symbol [case T_INCLUDE_DEPTH]): Use pfile->include_depth,
      	don't need to walk up the stack counting.
      
      From-SVN: r35003
      f9a0e96c
  28. Jul 12, 2000
    • Zack Weinberg's avatar
      cppexp.c (LOGICAL): Delete macro. · 0080e892
      Zack Weinberg authored
      	* cppexp.c (LOGICAL): Delete macro.
      	(_cpp_parse_expr): Do not use UNARY for unary +.  Implement ||
      	and && directly.
      
      	* cpphash.c (HASHSIZE): Increase to 4096.
      	(struct hashdummy): Add hash field.
      	(eq_HASHNODE): Compare unreduced hashes, then lengths, then
      	the string values using memcmp.
      	(cpp_lookup): Set dummy.hash.
      
      From-SVN: r34994
      0080e892
    • Neil Booth's avatar
      cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c. · 2964d54f
      Neil Booth authored
      	* cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c.
      	* cpplex.c (TOKEN_SPELL) Move to cpphash.h.
      
      	* cpphash.c: (struct macro_info, alloc_macro, free_macro,
      	struct toklist_dummy): New.
      	(cpp_free_definition): Free macros with free_macro.
      	(count_params): Don't save paramter spellings.  Save macro
      	information in a struct macro_info.
      	(parse_define): Don't allocate a token list.
      	(save_expansion): Allocate the macro's token list, and
      	save parameter spellings if necessary.  Use TOKEN_SPELL.
      	(cpp_create_definition): Make list const.
      
      From-SVN: r34985
      2964d54f
  29. Jul 11, 2000
    • Zack Weinberg's avatar
      [multiple changes] · 417f3e3a
      Zack Weinberg authored
      2000-07-11  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* cpplex.c (parse_name): No longer inline (premature optimization).
      	(do_pop_context): Fold into pop_context.
      	(pop_context): Returns int.
      	(lex_next): Hoist test for end of directive into pop_context.
      	(push_macro_context): Returns int; takes just reader and token.
      	Hoist test for excessive nesting to caller.
      	(push_arg_context): Returns void; takes just reader and token.
      	Do not call stringify_arg or get_raw_token.
      	(get_raw_token): Convert tail recursion through	push_arg_context
      	to a loop at this level.  Call stringify_arg here if appropriate.
      	(maybe_paste_with_next): Convert tail recursion to a while loop.
      	Hoist test of paste_level to caller.
      
      	(stringify_arg): Push arg context at beginning.
      	(cpp_get_token): Split out core into _cpp_get_token.  Call
      	process_directive here.  Throw away CPP_PLACEMARKER tokens.
      	(_cpp_get_token): Convert tail recursion through
      	push_macro_context to a loop at this level.
      	(_cpp_glue_header_name, is_macro_disabled, stringify_arg,
      	_cpp_get_raw_token): Use _cpp_get_token.
      	(_cpp_skip_rest_of_line): Drop the context stack directly; do
      	not call pop_context.
      	(_cpp_run_directive): Call lex_next directly.
      
      	* cpphash.h: Prototype _cpp_get_token.
      	* cppexp.c (lex): Use it.
      	* cpphash.c (parse_define): Use it.
      	* cpplib.c (get_define_node, do_undef, parse_include,
      	read_line_number, do_line, do_ident, do_pragma, do_pragma_gcc,
      	do_pragma_implementation, do_pragma_poison, do_pragma_dependency,
      	parse_ifdef, validate_else): Use it.
      	(cpp_push_buffer): Tweak error message; abort if anyone tries
      	to push a buffer while macro expansions are stacked.
      
      2000-07-11  Donn Terry  <donnte@microsoft.com>
      
      	* cpplex.c (free_macro_args, save_token): Cast arg of free
      	and/or xrealloc to PTR.
      	(_cpp_init_input_buffer): Clear all fields of the base context.
      
      From-SVN: r34972
      417f3e3a
  30. Jul 08, 2000
    • Zack Weinberg's avatar
      cpplib.h (struct cpp_name): Now struct cpp_string. · bfb9dc7f
      Zack Weinberg authored
      	* cpplib.h (struct cpp_name): Now struct cpp_string.
      	(CPP_INT, CPP_FLOAT, CPP_NUMBER, CPP_COMMENT,
      	CPP_HEADER_NAME): Change to type S.
      	(struct cpp_token): Rename 'name' field to 'str'.  Add 'node'
      	field, a cpp_hashnode *.  All references to val.name updated
      	to use val.str or val.node as appropriate.
      	(struct cpp_reader): Add spec_nodes field.
      	(cpp_idcmp): Now cpp_ideq; takes a token * and a char *.
      
      	* cpphash.h (struct spec_nodes): New.
      	(enum spell_type): Reorder.  Only SPELL_STRING tokens use
      	val.str.  All references to 'spelling > SPELL_NONE' updated to
      	match.
      
      	(CPP_IN_SYSTEM_HEADER): Check pfile->buffer and
      	pfile->buffer->inc are not NULL before dereferencing them.
      
      	* cpplex.c (parse_name): Take a pointer to the current token,
      	plus current position and limit as args; return the new
      	position; don't copy the text of a name into the string
      	buffer, instead call cpp_lookup and store the node pointer.
      	If extending a token, copy out the text of the old into a
      	scratch buffer, append the new, look that up and store the new
      	node pointer.  Inline.
      	(maybe_paste_with_next): If the result of paste is a NAME,
      	then look up the pasted text and store its node pointer.
      	(lex_line): Adjust for new parse_name interface.
      	Check for L"str", L'str' using spec_nodes->n_L.
      	(spell_token): SPELL_IDENT tokens have their spelling in
      	val.node->name.  Handle SPELL_STRING tokens that don't have
      	string delimiters.
      	(_cpp_expand_name_space,
      	(can_paste): Check for L ## "str" using spec_nodes->n_L.
      	(cpp_get_token, special_symbol): No need to call cpp_lookup.
      	(cpp_idcmp): Now cpp_ideq; take a token * and a const char *;
      	return 1=equal 0=not, not a tristate.
      
      	* cpphash.c (var_args_str): Delete.
      	(find_param): Compare node fields directly.
      	(is__va_args__): Use CPP_PEDANTIC.  Just compare
      	token->val.node with spec_nodes->n__VA_ARGS__.
      	(dump_funlike_macro): Don't use var_args_str.
      
      	* cpplib.c (_cpp_check_directive): Just walk through
      	spec_nodes->dirs comparing pointers.
      	(get_define_node, do_pragma_poison, detect_if_not_defined,
      	parse_ifdef): The identifier has already been looked up.
      	(do_ifdef, do_ifndef): parse_ifdef won't return a poisoned
      	node.
      	(do_if): Only call detect_if_not_defined at beginning of file.
      	(_cpp_parse_assertion): Only copy string pointers for
      	SPELL_STRING tokens.
      	(pragma_dispatch): Take a node pointer and examine its name
      	field.
      	(_cpp_init_stacks): Also initialize the spec_nodes structure.
      
      	* cppinit.c (cpp_reader_init): Call _cpp_init_stacks after
      	_cpp_init_macros.
      	(cpp_cleanup): Free pfile->spec_nodes.  Call _cpp_cleanup_* in
      	reverse order from the corresponding _cpp_init_* routines.
      
      	* cppexp.c (parse_number, parse_charconst, parse_defined,
      	lex): Check val.node->type instead of calling cpp_defined.
      	Use spec_nodes entries where appropriate.
      
      	* fix-header.c, scan-decls.c: Update for interface changes.
      
      From-SVN: r34926
      bfb9dc7f
    • Neil Booth's avatar
      cpphash.c (is__va_args__): New function. · 563dd08a
      Neil Booth authored
      	* cpphash.c (is__va_args__): New function.
      	(count_params): Fix line reported in error messages.  Use
      	is__va_args__.  Don't return ')' on error.  Flag GNU style
      	rest args macro definitions.
      	(parse_define): Check macro name is not __VA_ARGS__.
      	(save_expansion): Check identifier in non-varargs-macro is
      	not __VA_ARGS__.  Don't flag GNU_VARARGS.
      	* cpplex.c (parse_args): Accept no argument iff GNU_REST_ARGS.
      	(maybe_paste_with_next): Use per-macro GNU_REST_ARGS rather
      	 than per-token GNU_VARARGS.
      	* cpplib.h (GNU_VARARGS): Remove.
      	(GNU_REST_ARGS): New.
      
      	* gcc.dg/cpp/macsyntx.c: New tests.
      
      From-SVN: r34919
      563dd08a
  31. Jul 05, 2000
    • Zack Weinberg's avatar
      cpplex.c: Don't include sys/mman.h. · c71f835b
      Zack Weinberg authored
      toplevel:
      	* cpplex.c: Don't include sys/mman.h.
      	(cpp_push_buffer, cpp_pop_buffer): Moved to cpplib.c.
      
      	* cpplib.c: Include sys/mman.h and obstack.h.
      	(cpp_push_buffer): Moved from cpplex.c; allocate buffers on an
      	obstack.
      	(cpp_pop_buffer): Moved from cpplex.c; free buffers from an obstack.
      	(_cpp_unwind_if_stack): Now static, unwind_if_stack.  Don't
      	bother freeing if stack entries (they will be freed with their buffer).
      	(do_endif): Free if stack entries from the buffer obstack.
      	(push_conditional): Allocate if stack entries from the buffer obstack.
      
      	(find_answer): Rename to _cpp_find_answer.
      	(do_assert, do_unassert): Update.
      
      	* cpphash.h: Update prototypes.
      	(xobnew): New convenience macro.
      	* cpplib.h (struct cpp_reader): Add hash_ob and buffer_ob fields.
      	Update comments.
      	(struct cpp_hashnode): Remove disabled field.
      
      	* cppinit.c: Don't include hashtab.h or splay-tree.h.
      	(report_missing_guard): Moved to cppfiles.c.
      	(cpp_reader_init): Call cpp_init_stacks, cpp_init_macros,
      	cpp_init_includes.
      	(cpp_cleanup): Call cpp_cleanup_stacks, cpp_cleanup_macros,
      	cpp_cleanup_includes.  Don't destroy hashtab or
      	all_include_files here.
      	(cpp_finish): Use _cpp_report_missing_guards.
      
      	* cppfiles.c (report_missing_guard): Moved from cppinit.c.
      	(_cpp_init_include_table): Rename _cpp_init_includes.
      	(_cpp_cleanup_includes, _cpp_report_missing_guards): New.
      
      	* cppexp.c (parse_assertion): Update for new name of
      	find_answer.
      
      	* Makefile.in (cpplib.o, cpphash.o, cppinit.o): Update deps.
      
      	* cpplib.c (do_ident): s/VSPACE/EOF/
      
      testsuite:
      	* gcc.dg/cpp/ident.c: New test.
      
      From-SVN: r34870
      c71f835b
  32. Jul 04, 2000
    • Zack Weinberg's avatar
      top level: · 041c3194
      Zack Weinberg authored
      2000-07-03  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* fix-header.c (struct partial_proto): Remove unnecessary fields.
      	(recognized_extern, recognized_function, read_scan_file):
      	Update for new scheme.
      	(check_protection): It's still a multiple include guard even
      	if it doesn't always trigger.
      	* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
      	new scheme.
      	* scan.h: Declare struct cpp_token.  Update prototypes.
      
      2000-07-03  Neil Booth  <neilb@earthling.net>
      	    Zack Weinberg  <zack@wolery.cumb.org>
      
      	Complete overhaul of the lexer and macro expander.
      
      	* cpphash.c (object_defn, funct_defn, push_macro_expansion,
      	arg, arglist, argdata, reflist, collect_objlike_expansion,
      	collect_funlike_expansion, collect_params,
      	warn_trad_stringify, trad_stringify, duplicate_arg_p, add_pat,
      	unsafe_chars, macarg, compare_defs, special_symbol,
      	scan_arguments, stringify, funlike_macroexpand,
      	_cpp_quote_string, monthnames): Delete.
      	(cpp_lookup, _cpp_free_definition, dump_funlike_macro,
      	_cpp_create_definition, _cpp_dump_definition,
      	dump_hash_helper): Adjust.
      	(find_param, count_params, parse_define, var_args_str,
      	check_macro_redefinition, save_expansion): New.
      
      	* cpplex.c (skip_block_comment, skip_line_comment, parse_name,
              parse_string, output_line_command, trigraph_replace,
              lex_line, cpp_push_buffer, cpp_pop_buffer, cpp_output_tokens,
              cpp_scan_buffer_nooutput, cpp_scan_buffer, cpp_free_toklist,
              cpp_idcmp, _cpp_get_directive_token, _cpp_init_input_buffer,
      	_cpp_skip_rest_of_line): Modify.
      
              (maybe_macroexpand, skip_comment, copy_comment, skip_string,
      	find_position, null_warning, bump_column, expand_name_space,
      	pedantic_whitespace, _cpp_output_list, _cpp_slice_toklist,
      	_cpp_squeeze_toklist, _cpp_scan_until, _cpp_skip_hspace,
      	_cpp_parse_name, _cpp_lex_token, cpp_get_non_space_token,
      	_cpp_prescan): Delete.
      
      	(dump_param_spelling, process_directive, lex_next,
              is_macro_disabled, stringify_arg, expand_context_stack,
              output_token, make_string_token, alloc_number_token,
              special_symbol, duplicate_token, maybe_paste_with_next,
              can_paste, prevent_macro_expansion, restore_macro_expansion,
              get_temp_token, release_temp_tokens, quote_string,
              token_names, token_spellings, _cpp_expand_name_space,
              _cpp_glue_header_name, _cpp_reserve_name_space,
              digraph_spellings, trigraph_ok, skip_whitespace, save_comment,
              placemarker_token, eof_token, cpp_context, macro_args,
              get_raw_token, parse_arg, parse_args, save_token,
              push_arg_context, push_macro_context, pop_context,
              do_pop_context, free_macro_args, _cpp_get_line,
              _cpp_run_directive): New.
      
      	* cpplib.c (validate_else, parse_include, push_conditional,
      	pass_thru_directive, read_line_number, parse_ifdef,
      	detect_if_not_defined, _cpp_check_directive, do_define,
      	do_undef, do_include, do_import, do_include_next, do_error,
      	do_warning, do_ident, do_pragma, pragma_dispatch, gcc_pragmas,
      	top_pragmas, do_pragma_gcc, do_pragma_implementation,
      	do_pragma_poison, do_pragma_system_header,
      	do_pragma_dependency, do_sccs, do_ifdef, do_ifndef, do_else,
      	dl_elif, do_endif, _cpp_unwind_if_stack, do_assert,
      	do_unassert, cpp_define, cpp_undef, cpp_assert, cpp_unassert,
      	cpp_defined): Update for new scheme.
      	(strtoul_for_line, get_define_node, dump_macro_name,
      	_cpp_check_linemarker, _cpp_parse_assertion): New.
      	(_cpp_handle_directive, do_pragma_default): Delete.
      
      	* cpphash.h (struct predicate): Now struct answer.
      	(enum spell_type, struct token_spelling, struct directive,
      	directive_handler): New.
      	Update prototypes.  Remove unused macros.
      	* cpplib.h: Update prototypes.  Remove unused macros,
      	structure definitions, and fields.
      
      	* cpperror.c (print_containing_files, v_message): Adjust.
      	* cppexp.c (parse_assertion, lex, parse_escape,
      	_cpp_parse_expr): Adjust.
      	* cppfiles.c (open_include_file, _cpp_execute_include,
      	_cpp_compare_file_date, cpp_read_file, read_include_file):
      	Adjust.
      	* cppinit.c (dump_special_to_buffer): Delete.
      	(append_include_chain, merge_include_chains, cpp_reader_init,
      	cpp_cleanup, initialize_builtins, builtin_array, cpp_start_read,
      	cpp_finish, handle_option, print_help): Adjust.
      	* cppmain.c (main): Adjust.
      
      testsuite:
      2000-07-03  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* testsuite/gcc.dg/cpp/19951025-1.c: Adjust regexps.
      	* testsuite/gcc.dg/cpp/19990703-1.c: Likewise.
      	* testsuite/gcc.dg/cpp/20000625-1.c: Likewise.
      	* testsuite/gcc.dg/cpp/20000625-2.c: Likewise.
      
      	* testsuite/gcc.dg/cpp/macro1.c,
      	testsuite/gcc.dg/cpp/paste1.c, testsuite/gcc.dg/cpp/paste2.c,
      	testsuite/gcc.dg/cpp/paste3.c, testsuite/gcc.dg/cpp/paste4.c,
      	testsuite/gcc.dg/cpp/strify1.c,
      	testsuite/gcc.dg/cpp/strify2.c: New tests.
      
      From-SVN: r34859
      041c3194
  33. Jun 21, 2000
    • Zack Weinberg's avatar
      cppfiles.c: Include splay-tree.h, not hashtab.h. · c31a6508
      Zack Weinberg authored
      	* cppfiles.c: Include splay-tree.h, not hashtab.h.
      	(redundant_include_p, make_IHASH, hash_IHASH, eq_IHASH): Delete.
      	(destroy_include_file_node): New.
      	(_cpp_init_include_hash): Rename _cpp_init_include_table.
      	Create a splay tree, not a hash table.
      	(open_include_file): Look up the path in the include table,
      	do the multiple include optimization here, etc.
      	(cpp_included): Walk the path.
      	(find_include_file): Just walk the path calling
      	open_include_file, or call it directly for an absolute path.
      	(_cpp_fake_ihash): Rename _cpp_fake_include and update for new
      	scheme.
      	(read_include_file): Update for new scheme.  Don't close the
      	file unless reading fails.
      	(_cpp_execute_include, cpp_read_file): Tweak for new scheme.
      
      	* cpphash.h (struct ihash, NEVER_REINCLUDE): Delete.
      	(struct include_file): New.
      	(NEVER_REREAD, DO_NOT_REREAD, CPP_IN_SYSTEM_HEADER): New
      	macros.
      	(CPP_PEDANTIC, CPP_WTRADITIONAL): Update.
      	Update prototypes.
      
      	* cppinit.c: Include splay-tree.h.
      	(cpp_reader_init, cpp_cleanup): Update.
      
      	* cpplib.h (struct cpp_buffer): Change ihash field to
      	'struct include_file *inc'.  Remove system_header_p.
      	(struct cpp_reader): Change all_include_files to a
      	struct splay_tree_s *.
      
      	* cpplex.c: Update all references to cpp_buffer->ihash and/or
      	cpp_buffer->system_header_p.
      	(cpp_pop_buffer): Close file here, only if DO_NOT_REREAD.
      
      From-SVN: r34636
      c31a6508
  34. May 28, 2000
    • Zack Weinberg's avatar
      cppfiles.c: Read files in, using mmap if possible, then prescan them separately. · f8f769ea
      Zack Weinberg authored
      	* cppfiles.c: Read files in, using mmap if possible, then
      	prescan them separately.
      	(read_file, read_with_read): New functions.
      	* cpplex.c: Don't define UCHAR_MAX.
      	(_cpp_read_and_prescan): Rename to _cpp_prescan.  Don't read
      	the file here.
      
      	* cppinit.c (handle_option): Automatically define __cplusplus,
      	__OBJC__, __ASEEMBLER__, _LANGUAGE_FORTRAN here when we see
      	the respective -lang switch.
      
      	* cpphash.h (enum node_type, struct hashnode, _cpp_lookup
      	prototype): Move to...
      	* cpplib.h: ... here.  Rename struct hashnode to struct
      	cpp_hashnode and give it a typedef.  Rename _cpp_lookup to
      	cpp_lookup.  Add 'fe_value' slot, a union tree_node *.
      
      From-SVN: r34228
      f8f769ea
  35. May 19, 2000
  36. May 18, 2000
    • Zack Weinberg's avatar
      cppexp.c (parse_assertion): New. · 15dad1d9
      Zack Weinberg authored
      	* cppexp.c (parse_assertion): New.
      	(lex): Call it for CPP_HASH.  Remove CPP_ASSERTION case.
      	(_cpp_parse_expr): Remove case '#'.  Don't set
      	parsing_if_directive.
      	* cpphash.c (collect_objlike_expansion,
      	collect_funlike_expansion, collect_params,
      	_cpp_create_definition): The list no longer has a trailing
      	VSPACE token.
      	* cpphash.h (enum node_type): Add T_ASSERTION.
      	(struct hashnode): Remove aschain, add pred.
      	(struct predicate): New.
      	Update prototypes.
      
      	* cpplex.c (expand_token_space): Handle both offset and
      	nonoffset lists.
      	(init_token_list, _cpp_free_token_list, _cpp_parse_assertion): Delete.
      	(_cpp_init_toklist, _cpp_clear_toklist, _cpp_free_toklist,
      	_cpp_slice_toklist, _cpp_squeeze_toklist, _cpp_equiv_tokens,
      	_cpp_equiv_toklists): New.
      	(_cpp_scan_line): Rename to _cpp_scan_until; add ability to
      	stop at any single-character token, not just newline.
      	(_cpp_lex_token): Remove special cases for #define and #if.
      	(cpp_get_token): Expect # as a separate token type.  Remove
      	DIRECTIVE case.
      	(_cpp_get_directive_token): Remove DIRECTIVE case.
      	(_cpp_lex_line, _cpp_lex_file, _cpp_init_input_buffer): Update.
      
      	* cpplib.c (_cpp_check_directive): Set dirno and
      	SYNTAX_INCLUDE bit of flags, not dir_handler and dir_flags.
      	(_cpp_handle_directive): Run # <number> through the same logic
      	as normal directives.
      	(do_define): Don't set parsing_define_directive.  Use
      	_cpp_scan_until.  The list does not have a VSPACE at the end.
      	(do_if): Save, clear, and restore only_seen_white around
      	_cpp_parse_expr.
      	(skip_if_group): s/CPP_DIRECTIVE/CPP_HASH/
      	(do_assert, do_unassert): Rewrite.
      
      	* cpplib.h (TTYPE_TABLE): Remove CPP_ASSERTION.
      	(LIST_OFFSET): New flag.
      	(struct cpp_toklist): Replace dir_handler and dir_flags with
      	dirno and flags.
      	(struct cpp_reader): Remove parsing_if_directive and
      	parsing_define_directive.
      
      From-SVN: r33984
      15dad1d9
Loading