Commit Graph

28 Commits

Author SHA1 Message Date
Steve Ellcey b52dbbf865 re PR c++/28288 (ICE with min/max operator)
PR c++/28288
	PR c++/14556
	* operators.def: Remove <?, ?>, <?=, and >?= operators.
	* parser.c: Remove CPP_MIN, CPP_MAX, CPP_MIN_EQ, and CPP_MAX_EQ.
	(cp_parser_warn_min_max): Remove.
	* include/cpplib.h: Remove <?, >?, <?=, and >?= tokens.
	(CPP_LAST_EQ): Change.
	(CPP_LAST_PUNCTUATOR): Change.
	* expr.c (cpp_operator): Remove MIN and MAX.
	(reduce): Remove CPP_MIN and CPP_MAX.
	(num_binary_op): Ditto.
	* lex.c (_cpp_lex_direct): Ditto.
	(cpp_avoid_paste): Remove ? as legal symbol after > or <.

From-SVN: r116140
2006-08-14 23:13:54 +00:00
Grigory Zagorodnev be8ac3e243 cpp.texi (__TIMESTAMP__): Document.
2006-02-17  Grigory Zagorodnev <grigory_zagorodnev@linux.intel.com>

gcc/ChangeLog:
     * doc/cpp.texi (__TIMESTAMP__): Document.

libcpp/ChangeLog:
     * macro.c (_cpp_builtin_macro_text): Handle BT_TIMESTAMP.
     * files.c (_cpp_get_file_stat): New function.
     * include/cpplib.h (builtin_type): Add BT_TIMESTAMP.
     * init.c (builtin_array): Add support for __TIMESTAMP__/BT_TIMESTAMP.
     * internal.h (_cpp_get_file_stat): Prototype.
     (struct cpp_buffer): Add timestamp.

gcc/testsuite/ChangeLog:
     * gcc.dg/cpp/undef3.c: New test.
     * gcc.dg/cpp/trad/builtins2.c: New test.

From-SVN: r111232
2006-02-18 10:25:31 +01:00
Richard Henderson bc4071dd66 directives.c (struct pragma_entry): Add is_deferred.
libcpp/
	* directives.c (struct pragma_entry): Add is_deferred.  Add ident
	entry to value union.
	(end_directive): Don't eat the line if in_deferred_pragma.
	(run_directive): Remove pragma hacks.
	(insert_pragma_entry): Remove.
	(new_pragma_entry): New.
	(register_pragma_1): Split out of register_pragma.  Only handle
	the lookup tree and return the new entry.
	(cpp_register_pragma): Fill in the pragma entry here.
	(cpp_register_deferred_pragma): New.
	(register_pragma_internal): New.
	(_cpp_init_internal_pragmas): Use register_pragma_internal.
	(do_pragma): Allow pragma expansion after namespace.  For deferred
	pragmas, don't slurp the line into a string.
	(destringize_and_run): Save tokens for deferred pragmas.
	(cpp_handle_deferred_pragma): Remove.
	* macro.c (builtin_macro): Remove pragma token hack.
	(_cpp_push_token_context): Rename from push_token_context and export.
	* internal.h (struct lexer_state): Add pragma_allow_expansion.
	(_cpp_push_token_context): Declare.
	* lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return
	a token.  Update the line number correctly if so.
	(_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens.
	(cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas.
	* include/cpplib.h (PRAGMA_EOL): New.
	(CPP_TOKEN_FLD_PRAGMA): New.
	(struct cpp_token): Add val.pragma.
	(struct cpp_options): Remove defer_pragmas.
	(cpp_handle_deferred_pragma): Remove.
	(cpp_register_deferred_pragma): Declare.

gcc/
	* c-lex.c (c_lex_with_flags) <CPP_PRAGMA>: Smuggle pragma id
	via integer constant.
	(pragma_lex): Remove.
	* c-pch.c (c_common_pch_pragma): Accept the name as an argument,
	rather than parsing it.
	* c-pragma.c (handle_pragma_weak, handle_pragma_redefine_extname,
	handle_pragma_extern_prefix): Add %< %> quotes.
	(registered_pragmas): New.
	(c_register_pragma_1): New.
	(c_register_pragma): Use it.
	(c_register_pragma_with_expansion): Likewise.
	(c_invoke_pragma_handler): New.
	(init_pragma): Use cpp_register_deferred_pragma directly for
	pch_preprocess.
	* c-pragma.h (enum pragma_kind): New.
	(pragma_handler): New.
	(c_invoke_pragma_handler): Declare.
	* c-common.c (c_parse_error): Pretty print CPP_PRAGMA and
	CPP_PRAGMA_EOL.
	* c-common.h (c_common_pch_pragma): Update decl.
	* Makefile.in (c-parser.o): Update dependencies.
	(GTFILES): Add c-pragma.h.
	* c-parser.c (struct c_token): Add pragma_kind.
	(struct c_parser): Add in_pragma.
	(c_lex_one_token): Always initialize keyword and pragma_kind.
	Extract data for CPP_PRAGMA.
	(c_parser_peek_2nd_token): Deny CPP_PRAGMA_EOL.
	(c_parser_consume_token): Don't allow CPP_PRAGMA unless errors.
	Don't allow CPP_PRAGMA_EOL if in_pragma.
	(c_parser_consume_pragma): New.
	(c_parser_skip_until_found): Stop on CPP_PRAGMA_EOL.
	(c_parser_skip_to_end_of_parameter): Likewise.
	(c_parser_skip_to_end_of_block_or_statement): Likewise.
	(c_parser_skip_to_pragma_eol): New.
	(c_parser_external_declaration): Handle CPP_PRAGMA.
	(c_parser_compound_statement_nostart): Likewise.
	(c_parser_statement_after_labels): Likewise.
	(c_parser_pragma): New.
	(pragma_lex): Likewise.
	(c_parser_pragma_pch_preprocess): New.
	(c_parser_new): Merge into ...
	(c_parse_file): ... here.  Call c_parser_pragma_pch_preprocess.

gcc/cp/
	* lex.c (handle_pragma_java_exceptions): Fix whitespace.
	* parser.c (struct cp_token): Add pragma_kind.
	(eof_token): Update to match.
	(struct cp_lexer): Add in_pragma; rearrange next for better packing.
	(cp_parser_initial_pragma): New.
	(cp_lexer_new_main): Use it.  Don't bother clearing
	c_lex_return_raw_strings.
	(cp_lexer_get_preprocessor_token): Always initialize keyword
	and pragma_kind fields.  Handle CPP_PRAGMA.
	(cp_lexer_consume_token): Don't allow CPP_PRAGMA_EOL when 
	in_pragma is set.
	(cp_lexer_handle_pragma): Remove.  Update callers to cp_parser_pragma.
	(cp_lexer_print_token) <CPP_PRAGMA>: Don't print as a string.
	(cp_parser_skip_to_pragma_eol): New.
	(cp_parser_error): Use it.
	(cp_parser_skip_to_closing_parenthesis): Stop at CPP_PRAGMA_EOL;
	rearrange with switch statement.
	(cp_parser_skip_to_end_of_statement): Likewise.
	(cp_parser_skip_to_end_of_block_or_statement): Likewise.
	(cp_parser_skip_to_closing_brace): Likewise.
	(cp_parser_skip_until_found): Likewise.
	(cp_parser_statement): Add in_compound argument; update callers.
	Use it to decide how to handle pragma parsing.
	(cp_parser_labeled_statement): Add in_compound argument; pass
	it on to cp_parser_statement.
	(cp_parser_statement_seq_opt): Stop at CPP_PRAGMA_EOL.
	(cp_parser_declaration_seq_opt): Likewise.
	(cp_parser_parameter_declaration): Likewise.
	(cp_parser_member_specification_opt): Likewise.
	(cp_parser_function_definition_after_decl): Likewise.
	(cp_parser_cache_group): Handle CPP_PRAGMA/CPP_PRAGMA_EOL pairs.
	(cp_parser_pragma): New.
	(pragma_lex): New.

gcc/testsuite/
	* g++.dg/parse/pragma2.C: Update expected error lines.

From-SVN: r109336
2006-01-04 08:33:38 -08:00
Volker Reichelt ab84748af1 re PR c++/23333 (accepts invalid pure specifier)
2005-12-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c++/23333
	* include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure.

	* c-lex.c (c_lex_with_flags): Add PURE_ZERO to cpp_flags if
	number is a single digit '0'.

	* parser.c (cp_parser_pure_specifier): Check for PURE_ZERO to
	identify a single '0'.

	* g++.dg/parse/error25.C: Add more tests.

From-SVN: r108947
2005-12-22 12:01:44 +00:00
Jon Grimm ad6ed77efd cpplib.h (CPP_N_DFLOAT): New.
* include/cpplib.h (CPP_N_DFLOAT): New.
	* expr.c (interpret_float_suffix): Identify df, dd, and dl
	suffixes as decimal floating point constants.
	(cpp_classify_number): Disallow hexadecimal DFP constants.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>

From-SVN: r108133
2005-12-07 10:13:15 +11:00
Gerald Pfeifer ba0966205a cpplib.h (struct cpp_callbacks): Annotate error with ATTRIBUTE_FPTR_PRINTF(3,0) instead of ATTRIBUTE_PRINTF(3,0).
* include/cpplib.h (struct cpp_callbacks): Annotate error with
	ATTRIBUTE_FPTR_PRINTF(3,0) instead of ATTRIBUTE_PRINTF(3,0).

Co-Authored-By: Ian Lance Taylor <ian@airs.com>

From-SVN: r106891
2005-11-14 16:28:55 +00:00
Joseph Myers a63607ed43 cp-tree.h (cp_cpp_error), [...]): Take va_list* parameter.
gcc/cp:
	* cp-tree.h (cp_cpp_error), error.c (cp_cpp_error): Take va_list*
	parameter.

libcpp:
	* include/cpplib.h (struct cpp_callbacks): Make error take
	va_list* parameter.
	* errors.c (cpp_error): Update call to callback.

From-SVN: r106466
2005-11-04 01:16:32 +00:00
Joseph Myers 178b58b59e re PR c++/17964 (cpp error messages contain wrong line in C++)
gcc:
	PR c++/17964
	* diagnostic.c (diagnostic_set_info_translated): New function.
	(diagnostic_set_info): Use it.  Add comment.
	* diagnostic.h (diagnostic_set_info_translated): Declare.

gcc/cp:
	* error.c (cp_cpp_error): New function.
	* cp-tree.h (cp_cpp_error): Declare.
	* parser.c (cp_lexer_new_main): Set CPP option client_diagnostic
	and error callback after lexing.

gcc/testsuite:
	* g++.dg/cpp/string-1.C: New test.

libcpp:
	* include/cpplib.h (struct cpp_options): Add client_diagnostic.
	(struct cpp_callbacks): Add error.
	* errors.c (cpp_error): If client_diagnostic, use error callback.
	* charset.c (convert_escape): Don't use %03o in diagnostic.

From-SVN: r106454
2005-11-03 23:08:18 +00:00
Ian Lance Taylor cbc43ae091 re PR preprocessor/13726 (cpp -C -dI loses comments on same line as #include directives)
libcpp/
	PR preprocessor/13726
	* directives.c (check_eol_return_comments): New static function.
	(parse_include): Add buf parameter.  Change all callers.
	(do_include_common): If not discard comments, turn on
	save_comments.  Pass collected comments to include callback.
	* include/cpplib.h (struct cpp_callbacks): Add new parameter to
	include callback: cpp_token list.
gcc/
	PR preprocessor/13726
	* c-ppoutput.c (cb_include): Add comments parameter, and print out
	any comments passed in.
gcc/testsuite/
	PR preprocessor/13726
	* gcc.dg/cpp/cmdlne-dI-C.c: New test.
	* gcc.dg/cpp/cmdlne-dI-C.h: New file.

From-SVN: r104951
2005-10-04 18:06:19 +00:00
Joseph Myers af15a2fed7 c.opt (fextended-identifiers): New.
gcc:
	* c.opt (fextended-identifiers): New.
	* c-opts.c (c_common_handle_option): Handle
	-fextended-identifiers.
	* doc/cpp.texi: Update documentation of extended identifiers.
	* doc/cppopts.texi (-fextended-identifiers): Document.

gcc/testsuite:
	* g++.dg/cpp/ucnid-1.C, g++.dg/cpp/normalize-1.C,
	g++.dg/other/ucnid-1.C, gcc.dg/cpp/normalize-1.c,
	gcc.dg/cpp/normalize-2.c, gcc.dg/cpp/normalize-3.c,
	gcc.dg/cpp/normalize-4.c, gcc.dg/cpp/ucnid-1.c,
	gcc.dg/cpp/ucnid-2.c, gcc.dg/cpp/ucnid-3.c, gcc.dg/cpp/ucnid-4.c,
	gcc.dg/cpp/ucnid-5.c, gcc.dg/cpp/ucnid-7.c,gcc.dg/ucnid-1.c,
	gcc.dg/ucnid-2.c, gcc.dg/ucnid-3.c, gcc.dg/ucnid-4.c,
	gcc.dg/ucnid-5.c, gcc.dg/ucnid-6.c: Add -fextended-identifiers.
	* gcc.dg/cpp/ucnid-8.c: New test.

libcpp:
	* include/cpplib.h (struct cpp_options): Add extended_identifiers.
	* init.c (struct lang_flags, lang_defaults): Add
	extended_identifiers.
	(cpp_set_lang): Use it.
	* lex.c (forms_identifier_p): Check extended_identifiers.

From-SVN: r104462
2005-09-20 21:31:37 +01:00
Kelley Cook 200031d1d5 all files: Update FSF address in copyright headers.
2005-06-29  Kelley Cook  <kcook@gcc.gnu.org>

	* all files: Update FSF address in copyright headers.
	* makeucnid.c (write_copyright): Update outputted FSF address.

From-SVN: r101413
2005-06-29 02:34:39 +00:00
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
Geoffrey Keating 50668cf626 Index: gcc/ChangeLog
2005-03-14  Geoffrey Keating  <geoffk@apple.com>

	* doc/cppopts.texi (-fexec-charset): Add concept index entry.
	(-fwide-exec-charset): Likewise.
	(-finput-charset): Likewise.
	* doc/invoke.texi (Warning Options): Document -Wnormalized=.
	* c-opts.c (c_common_handle_option): Handle -Wnormalized=.
	* c.opt (Wnormalized): New.

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

	* init.c (cpp_create_reader): Default warn_normalize to normalized_C.
	* charset.c: Update for new format of ucnid.h.
	(ucn_valid_in_identifier): Update for new format of ucnid.h.
	Add NST parameter, and update it; update callers.
	(cpp_valid_ucn): Add NST parameter, update callers.  Replace abort
	with cpp_error.
	(convert_ucn): Pass normalize_state to cpp_valid_ucn.
	* internal.h (struct normalize_state): New.
	(INITIAL_NORMALIZE_STATE): New.
	(NORMALIZE_STATE_RESULT): New.
	(NORMALIZE_STATE_UPDATE_IDNUM): New.
	(_cpp_valid_ucn): New.
	* lex.c (warn_about_normalization): New.
	(forms_identifier_p): Add normalize_state parameter, update callers.
	(lex_identifier): Add normalize_state parameter, update callers.  Keep
	the state current.
	(lex_number): Likewise.
	(_cpp_lex_direct): Pass normalize_state to subroutines.  Check
	it with warn_about_normalization.
	* makeucnid.c: New.
	* ucnid.h: Replace.
	* ucnid.pl: Remove.
	* ucnid.tab: Make appropriate for input to makeucnid.c.  Remove
	comments about obsolete version of C++.
	* include/cpplib.h (enum cpp_normalize_level): New.
	(struct cpp_options): Add warn_normalize field.

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

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

From-SVN: r96459
2005-03-15 00:36:33 +00: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
Zack Weinberg c5ff069dc4 re PR middle-end/18785 (isdigit builtin function fails with EBCDIC character sets)
PR 18785
libcpp:
	* charset.c (LAST_POSSIBLY_BASIC_SOURCE_CHAR): New helper macro.
	(cpp_host_to_exec_charset): New function.
	* include/cpplib.h: Declare cpp_host_to_exec_charset.

gcc:
	* langhooks.h (struct lang_hooks): Add to_target_charset.
	* langhooks.c (lhd_to_target_charset): New function.
	* langhooks-def.h: Declare lhd_to_target_charset.
	(LANG_HOOKS_TO_TARGET_CHARSET): New macro.
	(LANG_HOOKS_INITIALIZER): Update.
	* c-common.c (c_common_to_target_charset): New function.
	* c-common.h: Declare it.
	* c-objc-common.h (LANG_HOOKS_TO_TARGET_CHARSET): Set to
	c_common_to_target_charset.

	* defaults.c (TARGET_BELL, TARGET_BS, TARGET_CR, TARGET_DIGIT0)
	(TARGET_ESC, TARGET_FF, TARGET_NEWLINE, TARGET_TAB, TARGET_VT):
	Delete definitions.
	* system.h: Poison them.
	* doc/tm.texi: Don't discuss them.
	* builtins.c (fold_builtin_isdigit): Use lang_hooks.to_target_charset.
	* c-pretty-print.c (pp_c_integer_constant): Don't use pp_c_char.
	(pp_c_char): Do not attempt to generate letter escapes for
	newline, tab, etc.
	* config/arm/arm.c (output_ascii_pseudo_op): Likewise.
	* config/mips/mips.c (mips_output_ascii): Likewise.
gcc/cp:
	* cp-objcp-common.h (LANG_HOOKS_TO_TARGET_CHARSET): Set to
	c_common_to_target_charset.  Delete bogus comment.
gcc/testsuite:
	* gcc.dg/charset/builtin1.c: New test.

From-SVN: r95304
2005-02-20 17:01:32 +00:00
Tobias Schlüter 6c25a4f7cb * include/cpplib.h: Also update copyright years.
From-SVN: r93191
2005-01-11 19:24:12 +01:00
Tobias Schlüter ecfd72e739 * include/cpplib.h (c_lang): Fix comment to say cpp_create_reader.
From-SVN: r93190
2005-01-11 19:19:56 +01:00
Roger Sayle c812785aaa internal.h: Replace all uses of uchar with unsigned char.
* internal.h: Replace all uses of uchar with unsigned char.
	* include/cpp-id-data.h: Likewise.  Guard typedef of uchar
	with !IN_GCC, so uchar is only defined whilst building libcpp.

Co-Authored-By: Zack Weinberg <zack@codesourcery.com>

From-SVN: r91394
2004-11-27 21:59:38 +00:00
Daniel Jacobowitz b5b3e36a98 sol2-c.c (solaris_register_pragmas): Use c_register_pragma_with_expansion.
gcc:
2004-11-23  Daniel Jacobowitz  <dan@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* config/sol2-c.c (solaris_register_pragmas): Use
	c_register_pragma_with_expansion.
	* config/sol2.h (HANDLE_PRAGMA_PACK_WITH_EXPANSION): Define.
	* c-pragma.c (c_register_pragma): Update call to
	cpp_register_pragma.
	(c_register_pragma_with_expansion): New function.
	(init_pragma): Honor HANDLE_PRAGMA_PACK_WITH_EXPANSION.
	* c-pragma.h (c_register_pragma_with_expansion): New prototype.
	* doc/extend.texi (Solaris Pragmas): Mention macro expansion for
	#pragma align.
	* doc/tm.texi (c_register_pragma_with_expansion,
	HANDLE_PRAGMA_PACK_WITH_EXPANSION): Document.

gcc/testsuite:
2004-11-23  Daniel Jacobowitz  <dan@codesourcery.com>

	* gcc.dg/pragma-align-2.c: Test macro expansion.
	* gcc.dg/pragma-pack-2.c: New test.

libcpp:
2004-11-23  Daniel Jacobowitz  <dan@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* internal.h (struct lexer_state): Add in_deferred_pragma.
	* directives.c (struct pragma_entry): Add allow_expansion.
	(insert_pragma_entry): Take allow_expansion flag.
	(register_pragma): Likewise.
	(cpp_register_pragma): Likewise.
	(_cpp_init_internal_pragmas): Update calls to cpp_register_pragma.
	(do_pragma): Honor allow_expansion.
	(cpp_handle_deferred_pragma): Set in_deferred_pragma.
	* include/cpplib.h (cpp_register_pragma): Update prototype.

Co-Authored-By: Joseph Myers <joseph@codesourcery.com>

From-SVN: r91117
2004-11-23 23:25:40 +00:00
Per Bothner a2981930a8 line-map.h (line_map_start): Add parameter names so preceding comment makes sense.
* include/line-map.h (line_map_start):  Add parameter names so
	preceding comment makes sense.
	(linemap_add):  Remove from comment mention of non-existing parameter.

From-SVN: r87561
2004-09-15 12:39:22 -07: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
Per Bothner f58f7def26 line-map.h (fileline): Remove old typedef.
* include/line-map.h (fileline):  Remove old typedef.
	* internal.h (struct cpp_reader):  Use source_location typedef instead.

From-SVN: r83924
2004-06-30 11:35:18 -07:00
Zack Weinberg 2cf2245154 ChangeLog: Merge text from include/ChangeLog.
* ChangeLog: Merge text from include/ChangeLog.
	* include/ChangeLog: Delete.

From-SVN: r82984
2004-06-11 18:07:12 +00: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
Geoffrey Keating b453c95fd3 Index: libcpp/ChangeLog
2004-05-29  Geoffrey Keating  <geoffk@apple.com>

	* symtab.c (ht_create): Set entries_owned.
	(ht_destroy): Honour entries_owned.
	(ht_expand): Likewise.
	(ht_load): New.

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

	* symtab.h (struct ht): New field 'entries_owned'
	(ht_load): New prototype.

Index: gcc/ChangeLog
2004-05-29  Geoffrey Keating  <geoffk@apple.com>

	* gengtype-yacc.y: Add NESTED_PTR token.
	(option): Record `nested_ptr' option.
	* gengtype-lex.l: Handle `nested_ptr' keyword.
	* gengtype.c (walk_type): Process `nested_ptr' option.
	* gengtype.h (struct nested_ptr_data): New.
	* doc/gty.texi (GTY Options): Document `nested_ptr' option.
	* stringpool.c (struct string_pool_data): Make 'entries' point to
	ht_identifier instead of tree.
	(gt_pch_save_stringpool): Don't adjust pointers.
	(gt_pch_restore_stringpool): Call ht_load.

From-SVN: r82438
2004-05-30 00:49: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