Commit Graph

13 Commits

Author SHA1 Message Date
Gabriel Dos Reis c3f829c1a6 configure.ac: Check declarations for asprintf and vasprintf.
* 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
2005-05-28 15:52:48 +00:00
Jakub Jelinek cae064e798 re PR preprocessor/19475 (missing whitespace after macro name in C90 or C++)
PR preprocessor/19475
	* macro.c (create_iso_definition): For < ISO C99, don't
	pedwarn if there is no whitespace between macro name and its
	replacement, but the replacement starts with a basic character
	set character.

	* gcc.dg/cpp/macspace1.c: New test.
	* gcc.dg/cpp/macspace2.c: New test.

From-SVN: r97652
2005-04-05 22:07:06 +02:00
Geoffrey Keating 47e204910a Index: libcpp/ChangeLog
2005-03-12  Geoffrey Keating  <geoffk@apple.com>

	* directives.c (glue_header_name): Update call to cpp_spell_token.
	* internal.h (_cpp_interpret_identifier): New.
	* charset.c (_cpp_interpret_identifier): New.
	(_cpp_valid_ucn): Allow UCN version of '$'.
	* lex.c (lex_identifier): Add extra parameter to indicate if initial
	character was '$' or '\'.  Support identifiers with UCNs.
	(forms_identifier_p): Allow UCNs.
	(_cpp_lex_direct): Pass extra parameter to lex_identifier.
	(utf8_to_ucn): New.
	(cpp_spell_token): Add FORSTRING parameter.  Use it.
	(cpp_token_as_text): Update call to cpp_spell_token.
	(cpp_output_token): Write UCNs back out.
	(stringify_arg): Update call to cpp_spell_token.
	(paste_tokens): Likewise.
	(cpp_macro_definition): Likewise.
	* macro.c (stringify_arg): Likewise.
	(paste_tokens): Likewise.
	(cpp_macro_definition): Likewise.
	* include/cpplib.h: Add parameter to cpp_spell_token.

Index: gcc/ChangeLog
2005-03-12  Geoffrey Keating  <geoffk@apple.com>

	* c-lex.c (c_lex_with_flags): Add parameter to call to
	cpp_spell_token.

Index: gcc/testsuite/ChangeLog
2005-03-12  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/ucnid-1.c: New.
	* gcc.dg/ucnid-2.c: New.
	* gcc.dg/ucnid-3.c: New.
	* gcc.dg/ucnid-4.c: New.
	* gcc.dg/ucnid-5.c: New.
	* gcc.dg/ucnid-6.c: New.
	* gcc.dg/cpp/ucnid-1.c: New.
	* gcc.dg/cpp/ucnid-2.c: New.
	* gcc.dg/cpp/ucnid-3.c: New.
	* g++.dg/other/ucnid-1.C: New.

From-SVN: r96333
2005-03-12 10:44:06 +00:00
Jakub Jelinek 730967114b re PR preprocessor/20282 (gcc4 can not bootstrap itself anymore)
PR bootstrap/20282
	PR bootstrap/20305
	* macro.c (replace_args, cpp_get_token): Copy whole
	cpp_token_u instead of just cpp_string field from it.

From-SVN: r95887
2005-03-04 16:33:23 +01:00
Eric Christopher 6da55c0077 re PR preprocessor/19077 (Internal compiler error compiling MPlayer)
2005-02-15  Eric Christopher  <echristo@redhat.com>

	PR preprocessor/19077
	* macro.c (cpp_macro_definition): Move handling of whitespace
	to PREV_WHITE conditional. Remove overloading of len
	variable.

2005-02-15  Eric Christopher  <echristo@redhat.com>

	* gcc.dg/cpp/20050215-1.c: New file.

From-SVN: r95080
2005-02-15 23:18:04 +00:00
Kazu Hirata 31c3e63157 directives.c, [...]: Update copyright.
* directives.c, files.c, init.c, internal.h, macro.c, pch.c,
	traditional.c: Update copyright.

From-SVN: r95012
2005-02-14 14:43:56 +00:00
Paolo Bonzini be0f1e5478 re PR bootstrap/19818 (GCC 4.0 cannot bootstrap itself)
include:
2005-02-08  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/19818
	* ansidecl.h (PARAMS): Guard from redefinition.

libcpp:
2005-02-08  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/19818
	* configure.ac: Check for declaration of basename and getopt.
	* config.in: Regenerate.
	* configure: Regenerate.
	* internal.h (ustrcspn): New.
	* macro.c (create_iso_definition): Fix allocation of memory.
	(padding_token): Add cast to remove const-ness.
	* pch.c (cpp_read_state): Use ustrcspn.

From-SVN: r95003
2005-02-14 08:52:24 +00:00
Gabriel Dos Reis a2566ae98d internal.h: Update references to Cpp lib filenames.
* internal.h: Update references to Cpp lib filenames.
        * directives.c: Likewise.
        * init.c: Likewise.
        * macro.c: Likewise.
        * traditional.c: Likewise.

From-SVN: r92799
2005-01-02 01:32:21 +00:00
Zack Weinberg 21b11495d7 cpplib.h (TTYPE_TABLE): Remove CPP_ and SPELL_ prefixes throughout.
2004-09-09  Matt Austern  <austern@apple.com>
	    Zack Weinberg  <zack@codesourcery.com>

	* include/cpplib.h (TTYPE_TABLE): Remove CPP_ and SPELL_
	prefixes throughout.  Add entry for PRAGMA.  Remove
	unnecessary "= 0" from EQ.
	(enum cpp_ttype): Adjust OP and TK definitions to restore
	prefixes, via token-paste.
	(CPP_LAST_EQ, CPP_FIRST_DIGRAPH, CPP_LAST_PUNCTUATOR, CPP_LAST_CPP_OP):
	Change from #defines to additional cpp_ttype enumerators.
	(struct cpp_options): Add defer_pragmas.
	(cpp_handle_deferred_pragma): Prototype new interface.

	* internal.h (struct cpp_reader): Add directive_result.
	* directives.c (struct pragma_entry): Add is_internal field;
	give boolean fields type bool.
	(start_directive): Initialize pfile->directive_result.type.
	(_cpp_do__Pragma): Likewise.
	(run_directive): Do not crash if pfile->buffer->prev is NULL.
	(insert_pragma_entry): Add 'internal' argument; set new->is_internal
	from it.
	(register_pragma): New static function, bulk of former
	cpp_register_pragma here; add 'internal' argument, pass along
	to insert_pragma_entry.
	(cpp_register_pragma): Now a wrapper around register_pragma which
	always passes false for 'internal' argument.
	(_cpp_init_internal_pragmas): Call register_pragma directly, passing
	true for 'internal'.
	(do_pragma): If CPP_OPTION (pfile, defer_pragmas) and this isn't
	an internal pragma, save text till the end of the line as a CPP_PRAGMA
	token instead of executing the pragma.
	(cpp_handle_deferred_pragma): New interface.
	* lex.c (token_spellings): Adjust OP and TK definitions to
	match changes to cpplib.h.
	(_cpp_lex_token): Check for a directive-result token and
	return it if present.
	(cpp_token_val_index): Handle CPP_PRAGMA.
	* macro.c (cpp_builtin_macro_text): Correct comment.
	(builtin_macro): Handle directive-result tokens from _cpp_do__Pragma.

From-SVN: r87247
2004-09-09 19:16:56 +00:00
Bernardo Innocenti 72bb2c39ce internal.h (xnew, [...]): Remove.
* internal.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Remove.
	* directives.c: Use XNEW-family macros from libiberty.
	* lex.c: Likewise.
	* macro.c: Likewise.
	* cpplib.h (cpp_deps_style): Export enum with name.

From-SVN: r85121
2004-07-24 20:04:42 +02:00
Geoffrey Keating d8044160b7 Index: gcc/ChangeLog
2004-06-09  Geoffrey Keating  <geoffk@apple.com>

	* Makefile.in (CPPLIB_H): Put files in order of inclusion.
	(CPP_ID_DATA_H): New.
	(gtype-desc.o): Update dependencies.
	(GTFILES): Use CPP_ID_DATA_H.

Index: gcc/testsuite/ChangeLog
2004-06-09  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/pch/macro-4.c: New.
	* gcc.dg/pch/macro-4.hs: New.

Index: libcpp/ChangeLog
2004-06-09  Geoffrey Keating  <geoffk@apple.com>

	* traditional.c (push_replacement_text): Set macro->traditional.
	(save_replacement_text): Likewise.
	* pch.c (cpp_write_pch_state): Don't write list of defined macros.
	(struct save_macro_item): Delete.
	(struct save_macro_data): Use a character array not the previous
	structured format.
	(save_macros): Save macro as text not as internal structures.
	(cpp_prepare_state): Update for changes to save_macro_data.
	(cpp_read_state): Don't read macros defined in PCH.  Restore
	-D macros as text.
	* macro.c (create_iso_definition): Honour alloc_subobject.
	Clear traditional flag.
	(_cpp_create_definition): Honour alloc_subobject.
	* lex.c (cpp_token_val_index): New.
	* internal.h: Include cpp-id-data.h.
	(uchar): Move definition to cpp-id-data.h.
	(U): Likewise.
	(cpp_macro): Likewise.
	* directives.c (struct answer): Move to cpp-id-data.h.
	(do_assert): Honour alloc_subobject.

Index: libcpp/include/ChangeLog
2004-06-09  Geoffrey Keating  <geoffk@apple.com>

	* symtab.h (struct ht): Add field 'alloc_subobject'.
	* cpplib.h (struct cpp_string): Add GTY marker.
	(enum cpp_token_fld_kind): New.
	(struct cpp_token): Add GTY markers.
	(cpp_token_val_index): Prototype.
	(CPP_HASHNODE_VALUE_IDX): New.
	(struct cpp_hashnode): Don't skip fields of 'value' when marking.
	* cpp-id-data.h: New file.

From-SVN: r82851
2004-06-09 20:10:13 +00:00
Zack Weinberg c6e8380069 Makefile.am: Add makedepend.
libcpp:
	* Makefile.am: Add makedepend.
	* Makefile.in, aclocal.m4: Regenerate.
	* charset.c: Insert a space to avoid a warning.
	* directives.c: Include mkdeps.h.
	(_cpp_handle_directive): Reenable macro expander if appropriate.
	(undefine_macros): Inline body of _cpp_free_definition for speed.
	Do not call undef callback or _cpp_warn_if_unused_macro.
	(cpp_get_deps): New interface.
	* files.c (search_cache): Add pfile argument.  Check for file
	that would be found by "" or <> search here...
	(_cpp_find_file): ...not here.  Correct recorded start_dir of
	files found by directory-of-current-file search that would be
	found by "" or <> search.
	* init.c (cpp_add_dependency_target): Delete.
	* internal.h (struct lexer_state): Add discarding_output flag.
	* lex.c (lex_identifier): Compute hash function while scanning.
	* macro.c (cpp_scan_nooutput): Disable macro expansion outside
	directives.
	* makedepend.c: New file.
	* mkdeps.c (struct deps): Add vpath vector.
	(apply_vpath, deps_add_vpath): New function.
	(deps_free): Free vpath vector.
	(deps_add_dep, deps_add_target): Use apply_vpath.
	* symtab.c (calc_hash): Use HT_HASHSTEP and HT_FINISH.
	(ht_lookup_with_hash): New function.
	* cpplib.h, mkdeps.h: Update prototypes.
	* symtab.h: Update prototypes.
	(HT_HASHSTEP, HT_FINISH): New macros.

gcc:
	* Makefile.in (MKDEPS_H): New shorthand.
	(c-opts.o): Update dependencies.
	* c-opts.c: Include mkdeps.h.
	(handle_deferred_opts): Use cpp_get_deps and deps_add_target,
	not cpp_add_dependency_target.

From-SVN: r82654
2004-06-05 20:58:06 +00:00
Paolo Bonzini 4f4e53dd85 Makefile.def (host_modules): add libcpp.
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
2004-05-24 10:50:45 +00:00