Commit Graph

53 Commits

Author SHA1 Message Date
Diego Novillo 953ff28998 [multiple changes]
2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* libgomp: New directory.
	* Makefile.def: Add target_module libgomp.
	* Makefile.in: Regenerate.
	* configure.in (target_libraries): Add target-libgomp.
	* configure: Regenerate.


contrib/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* gcc_update (files_and_dependencies): Add libgomp files.


gcc/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* omp-low.c: New file.
	* c-omp.c: New file.

2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* doc/invoke.texi: Document -fopenmp.
	* tree-dump.h (debug_function): Declare.

	* hooks.c (hook_bool_tree_bool_false): New function.
	(hook_tree_tree_null): Remove.
	(hook_tree_tree_tree_null): New.
	* hooks.h: Update to match.

	* tree-pretty-print.c (debug_tree_chain): New.
	(print_generic_expr): Handle TDF_CHAIN.
	(dump_generic_node): Handle BLOCK.
	Do not abort with incomplete SWITCH_EXPRs.
	Do not dump body of an OpenMP directive if TDF_SLIM is given.
	<case OMP_PARALLEL, OMP_FOR, OMP_SECTIONS>: Don't
	print space after directive name.
	<OMP_FOR>: Handle printing OMP_FOR_PRE_BODY.
	Handle OMP_MASTER and OMP_ORDERED.
	Handle printing of OMP_BODY just in one place, goto
	dump_omp_body in the rest of OMP_* nodes that have
	OMP_BODY.
	Don't handle clause nodes here.  Update omp statements to
	use dump_omp_clauses.
	Handle OMP_SINGLE, OMP_SECTIONS, OMP_SECTION,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_SCHEDULE, OMP_ATOMIC,
	OMP_CRITICAL, OMP_CLAUSE_NOWAIT, GOMP_CLAUSE_IF,
	GOMP_CLAUSE_NUM_THREADS, GOMP_FOR, GOMP_CLAUSE_SHARED,
	GOMP_CLAUSE_FIRSTPRIVATE, GOMP_CLAUSE_LASTPRIVATE,
	GOMP_CLAUSE_COPYIN and GOMP_CLAUSE_COPYPRIVATE.
	Adjust output for GOMP_PARALLEL.
	(dump_omp_clauses): New.
	(print_declaration): Dump DECL_VALUE_EXPR.
	(op_symbol_1): Split out of op_symbol.
	(dumping_stmts): Remove.  Update all users.

	* cgraph.c (cgraph_analyze_queue): New.
	(cgraph_add_new_function): New.
	* cgraph.h (cgraph_analyze_queue): Declare.
	(cgraph_add_new_function): Declare.
	(cgraph_lower_function): Remove.

	* tree.c (walk_tree): Walk OMP_CLAUSE_CHAIN of OMP_CLAUSE_*
	nodes.  Use switch for all nodes, handle most of IS_EXPR_CODE_CLASS
	and TYPE_P nodes in its default clause.
	(empty_body_p): New.
	(tree_range_check_failed): New.
	(build5_stat): New.

	* tree.h (OMP_CLAUSE_REDUCTION_INIT,
	OMP_CLAUSE_REDUCTION_MERGE,
	OMP_CLAUSE_REDUCTION_PLACEHOLDER,
	OMP_CLAUSE_PRIVATE_DEBUG,
	OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE, OMP_FOR_PRE_BODY,
	OMP_MASTER_BODY, OMP_ORDERED_BODY OMP_BODY,
	OMP_CLAUSES, OMP_CLAUSE_DECL, OMP_CLAUSE_DEFAULT_KIND,
	OMP_CLAUSE_CHAIN, OMP_CLAUSE_OUTER_DECL,
	OMP_CLAUSE_INNER_DECL, OMP_CLAUSE_NUM_THREADS_EXPR,
	OMP_CLAUSE_IF_EXPR, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE. OMP_PARALLEL_VAR_INIT,
	OMP_PARALLEL_VAR_REDUC, OMP_FOR_VAR_INIT,
	OMP_FOR_VAR_LAST, OMP_FOR_VAR_REDUC,
	OMP_SECTIONS_VAR_INIT, OMP_SECTIONS_VAR_LAST,
	OMP_SECTIONS_VAR_REDUC, OMP_CLAUSE_REDUCTION_CODE
	OMP_SINGLE_CLAUSES, OMP_SINGLE_BODY,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE, OMP_SECTION_BODY,
	OMP_CRITICAL_NAME, OMP_CRITICAL_BODY): New.
	(TREE_RANGE_CHECK): New.
	(empty_body_p): Declare.
	(enum omp_clause_default_kind): New.
	(build_string_literal): Declare.
	(enum omp_clause_schedule_kind, OMP_CLAUSE_SCHEDULE_KIND): New.
	(build5_stat, build5): Declare.

	* tree-pass.h (TDF_CHAIN): Define.
	* tree-pass.h (PROP_gimple_lomp): Define.
	(pass_lower_omp): Declare.

	* diagnostic.h (debug_tree_chain): Declare.

	* builtins.c (get_builtin_sync_mode): Use 0 as last argument to
	mode_for_size.
	(expand_builtin): Handle sync BUILT_IN_*_16 builtins.
	* builtins.c (build_string_literal): Make extern.

	* gcc.c (include_spec_function): New.
	(static_spec_functions): Add it.
	(main): Move load of libgomp.spec ...
	(LINK_COMMAND_SPEC): ... here.
	(link_gomp_spec): New.
	(static_specs): Include it.
	(LINK_COMMAND_SPEC): Add link_gomp.
	(GOMP_SELF_SPECS): New.
	(driver_self_specs): Include it.
	(switch_matches): Don't mark inline.
	(main): Load libgomp.spec.

	* tree-gimple.c (is_gimple_stmt): True for OMP_MASTER,
	OMP_ORDERED, OMP_CRITICAL, OMP_SECTIONS, OMP_SECTION,
	and OMP_SINGLE, OMP_FOR and OMP_PARALLEL.

	* tree-gimple.h (enum omp_parallel): Declare.
	(determine_parallel_type): Declare.
	(omp_firstprivatize_variable): Declare.
	(omp_reduction_init): Declare.
	(diagnose_omp_structured_block_errors): Declare.
	(struct walk_stmt_info): Add want_return_expr.
	(struct walk_stmt_info): Add want_bind_expr, want_locations.
	(find_omp_clause): Declare.
	(insert_field_into_struct): Declare.
	(struct walk_stmt_info): Move from tree-nested.c
	(walk_stmts): Declare.

	* c-cppbuiltin.c (c_cpp_builtins): If -fopenmp, #define _OPENMP
	to 200505.

	* cgraphunit.c (cgraph_lower_function): Make static.
	(cgraph_finalize_pending_functions): New.
	(cgraph_finalize_function): Call it.
	(cgraph_finalize_compilation_unit): Likewise.

	* builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
	BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
	(BT_FN_UINT_UINT): New.
	(DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_7,
	DEF_FUNCTION_TYPE_VAR_4): Document.
	(BT_PTR_LONG, BT_PTR_PTR, BT_FN_BOOL, BT_FN_INT,
	BT_FN_VOID_PTRPTR, BT_PTR_FN_VOID_PTR,
	BT_FN_BOOL_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT,
	BT_FN_VOID_OMPFN_PTR_UINT_UINT,
	BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG): New.

	* builtins.def: Update DEF_BUILTIN comment to include COND argument.
	Move all DEF_SYNC_BUILTIN () and DEF_GOMP_BUILTIN () builtins
	into separate files.
	(DEF_GOMP_BUILTIN): New.
	(BUILT_IN_OMP_GET_THREAD_NUM, BUILT_IN_GOMP_BARRIER,
	BUILT_IN_GOMP_CRITICAL_START, BUILT_IN_GOMP_CRITICAL_END,
	BUILT_IN_GOMP_CRITICAL_NAME_START, BUILT_IN_GOMP_CRITICAL_NAME_END,
	BUILT_IN_GOMP_LOOP_STATIC_START, BUILT_IN_GOMP_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_GUIDED_START, BUILT_IN_GOMP_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_STATIC_NEXT, BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_RUNTIME_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
	BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_END, BUILT_IN_GOMP_LOOP_END_NOWAIT,
	BUILT_IN_GOMP_ORDERED_START, BUILT_IN_GOMP_ORDERED_END,
	BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END,
	BUILT_IN_GOMP_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_NEXT,
	BUILT_IN_GOMP_PARALLEL_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_END,
	BUILT_IN_GOMP_SECTIONS_END_NOWAIT, BUILT_IN_GOMP_SINGLE_START,
	BUILT_IN_GOMP_SINGLE_COPY_START, BUILT_IN_GOMP_SINGLE_COPY_END): New.
	* sync-builtins.def: New file, moved from builtins.def.
	* omp-builtins.def: New file, moved from builtins.def.

	* c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine.

	* gimple-low.c (lower_function_body): Clear data.
	(lower_stmt): Do not handle COMPOUND_EXPR.
	Remove call to print_node_brief.

	* c-tree.h (c_finish_omp_clauses): New prototype.
	(C_DECL_THREADPRIVATE_P): Define.
	(lookup_name_no_remap, c_omp_remap_private): Remove
	(c_begin_omp_parallel, c_finish_omp_parallel): Update.
	(check_for_loop_decls): Update decl.
	(lookup_name_no_remap, c_omp_remap_private): Declare.
	(build_indirect_ref, build_modify_expr, pushdecl,
	pushdecl_top_level): Move to c-common.h.

	* dwarf2out.c (loc_descriptor_from_tree_1): Don't set unsignedp
	before the switch, but just in the 2 places that need it.

	* c-decl.c (diagnose_mismatched_decls): Do not check for
	mismatched thread-local attributes when OLDDECL is marked
	threadprivate and NEWDECL has no thread-local attributes.
	(merge_decls): Merge C_DECL_THREADPRIVATE_P.
	(c_gimple_diagnostics_recursively): Rename from
	c_warn_unused_result_recursively.  Invoke
	diagnose_omp_structured_block_errors.
	(check_for_loop_decls): Return a singular decl found.

	* langhooks.c (lhd_omp_predetermined_sharing): Return
	OMP_CLAUSE_DEFAULT_SHARED for DECL_ARTIFICIAL decls.
	(lhd_omp_firstprivatize_type_sizes): New.
	(lhd_omp_assignment): New.
	(lhd_omp_predetermined_sharing): New.

	* langhooks.h (struct gimplify_omp_ctx): Forward declare.
	(struct lang_hooks_for_types): Add
	omp_firstprivatize_type_sizes, omp_privatize_by_reference,
	omp_predetermined_sharing, omp_disregard_value_expr,
	omp_private_debug_clause, omp_clause_default_ctor,
	omp_clause_copy_ctor, omp_clause_assign_op, omp_clause_dtor.

	(c_finish_omp_clauses): New.
	(c_finish_bc_stmt): Diagnose break within omp for.
	(c_begin_omp_parallel, c_finish_omp_parallel): New.
	(build_unary_op): Return error_mark after reporting
	a readonly_error.
	(build_modify_expr): Likewise.

	* gimplify.c: Include optabs.h and pointer-set.h.
	(enum gimplify_omp_var_data): Declare.
	(struct gimplify_omp_ctx): Declare.
	(struct gimplify_ctx): Add fields prev_context, combined_pre_p
	and combined_ctxp.
	(gimplify_ctxp, gimplify_omp_ctxp): New local variables.
	(push_gimplify_context, pop_gimplify_context): Allow nesting.
	(splay_tree_compare_decl_uid): New.
	(new_omp_context): New.
	(delete_omp_context): New.
	(gimple_add_tmp_var): Call omp_add_variable.
	(gimplify_bind_expr): Likewise.
	(gimplify_var_or_parm_decl): If omp_notice_variable returned
	true, disregard DECL_VALUE_EXPR on the decl if any.
	(gimplify_expr_in_ctx): New.
	(omp_firstprivatize_variable, omp_firstprivatize_type_sizes
	omp_add_variable, omp_notice_variable, omp_is_private
	gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1
	gimplify_adjust_omp_clauses, gimplify_omp_parallel
	gimplify_omp_for, gimplify_omp_workshare, goa_lhs_expr_p
	gimplify_omp_atomic_fetch_op, goa_stabilize_expr
	gimplify_omp_atomic_pipeline, gimplify_omp_atomic_mutex
	gimplify_omp_atomic): New.
	(gimplify_expr): Handle OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL and OMP_ATOMIC.
	(gimplify_body): Verify gimplify_ctxp is empty after gimplification.

	* c-pragma.h (enum pragma_kind): Add
	PRAGMA_OMP_ATOMIC, PRAGMA_OMP_BARRIER,
	PRAGMA_OMP_CRITICAL, PRAGMA_OMP_FLUSH, PRAGMA_OMP_FOR,
	PRAGMA_OMP_MASTER, PRAGMA_OMP_ORDERED,
	PRAGMA_OMP_PARALLEL, PRAGMA_OMP_PARALLEL_FOR,
	PRAGMA_OMP_PARALLEL_SECTIONS, PRAGMA_OMP_SECTION,
	PRAGMA_OMP_SECTIONS, PRAGMA_OMP_SINGLE,
	PRAGMA_OMP_THREADPRIVATE.

	* tree.def (OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL, OMP_ATOMIC, OMP_CLAUSE_PRIVATE,
	OMP_CLAUSE_SHARED, OMP_CLAUSE_FIRSTPRIVATE,
	OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_REDUCTION,
	OMP_CLAUSE_COPYIN, OMP_CLAUSE_COPYPRIVATE,
	OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS,
	OMP_CLAUSE_SCHEDULE, OMP_CLAUSE_NOWAIT,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_DEFAULT): Define.

	* print-tree.c (print_node): Dump DECL_VALUE_EXPR.

	* tree-ssa-dce.c (find_control_dependence): Do not assume that
	ENTRY_BLOCK_PTR->next_bb == single_succ (ENTRY_BLOCK_PTR).

	* tree-nested.c (convert_call_expr): Call walk_body on OMP_BODY for
	OpenMP directives.
	(struct nesting_info): Add field_map,
	suppress_expansion, debug_var_chain.
	(create_nesting_tree): Initialize them.
	(lookup_field_for_decl): Use field_map.
	(get_nonlocal_debug_decl, get_local_debug_decl): New.
	(convert_local_omp_clauses): New.
	(finalize_nesting_tree_1): Add debug_var_chain to toplevel block.
	(walk_body): Split out of walk_function.
	(convert_nonlocal_omp_clauses, convert_local_omp_clauses): New.
	(convert_nonlocal_reference): Handle omp statements.
	(convert_local_reference): Likewise.
	(unnest_nesting_tree_1): Split out of finalize_nesting_tree_1.
	(unnest_nesting_tree): New.
	(lower_nested_functions): Call it.
	(insert_field_into_struct): Make extern.
	(struct walk_stmt_info): Move to tree-gimple.h.
	(walk_stmts): Make extern.

	* omp-builtins.def: New file.

	* tree-iterator.c (expr_only): Clarify comment.

	* c-common.h (pushdecl_top_level, pushdecl,
	build_modify_expr, build_indirect_ref,
	c_finish_omp_master, c_finish_omp_critical,
	c_finish_omp_ordered, c_finish_omp_barrier,
	c_finish_omp_atomic, c_finish_omp_flush,
	c_finish_omp_for, c_split_parallel_clauses,
	omp_clause_default_kind, c_omp_sharing_predetermined,
	c_omp_remap_decl): Declare.

	* Makefile.in (BUILTINS_DEF): Add omp-builtins.def.
	(OBJS-common): Add omp-low.o.
	(c-omp.o, omp-low.o): Add.
	(gimplify.o): Add dependency on $(OPTABS_H).
	(GTFILES): Add omp-low.c.
	(gt-stringpool.h): Add.

	* tree-cfg.c (set_bb_for_stmt): Do not update the
	block-to-labels map if we are currently expanding to RTL.
	(tree_node_can_be_shared): Remove unnecessary CONSTANT_CLASS_P
	checks.
	Handle IDENTIFIER_NODE.
	(tree_verify_flow_info): Do not ICE when emitting error
	messages about invalid labels.
	(dump_function_to_file): Reset CFUN before emitting the body
	of the function.
	(debug_function): New.

	* passes.c (init_optimization_passes): Schedule
	pass_lower_omp.

	* langhooks-def.h (lhd_omp_predetermined_sharing,
	lhd_omp_assignment, lhd_omp_firstprivatize_type_sizes):
	Declare.
	(LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
	(LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE,
	LANG_HOOKS_OMP_PREDETERMINED_SHARING,
	LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
	LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE,
	LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR,
	LANG_HOOKS_OMP_CLAUSE_COPY_CTOR,
	LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP,
	LANG_HOOKS_OMP_CLAUSE_DTOR): Define.
	(LANG_HOOK_DECLS): Use them.


2006-01-18  Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
	    Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* c-parser.c (pragma_omp_clause): Define.
	(c_parser_declaration_or_fndef): Document OpenMP syntax.
	(c_parser_compound_statement): Likewise.
	(c_parser_statement): Likewise.
	(c_parser_pragma): Handle omp pragmas.
	(OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
	OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Define.
	(c_parser_omp_clause_name, check_no_duplicate_clause,
	c_parser_omp_variable_list,
	c_parser_omp_var_list_parens, c_parser_omp_clause_copyin,
	c_parser_omp_clause_copyprivate,
	c_parser_omp_clause_default,
	c_parser_omp_clause_firstprivate, c_parser_omp_clause_if,
	c_parser_omp_clause_lastprivate,
	c_parser_omp_clause_nowait,
	c_parser_omp_clause_num_threads,
	c_parser_omp_clause_ordered, c_parser_omp_clause_private,
	c_parser_omp_clause_reduction,
	c_parser_omp_clause_schedule, c_parser_omp_clause_shared,
	c_parser_omp_all_clauses, c_parser_omp_structured_block,
	c_parser_omp_atomic, c_parser_omp_barrier,
	c_parser_omp_critical, c_parser_omp_flush,
	c_parser_omp_for_loop, c_parser_omp_for,
	c_parser_omp_master, c_parser_omp_ordered,
	c_parser_omp_sections_scope, c_parser_omp_sections,
	c_parser_omp_parallel, c_parser_omp_single,
	c_parser_omp_construct, c_parser_omp_threadprivate): New.
	* c-pragma.c (init_pragma): Do omp pragma registration here.
	* c.opt (fopenmp): New flag.


2006-01-18  Eric Christopher  <echristo@apple.com>

	* gcc.c (GOMP_SELF_SPECS): Bracket in #ifndef/#endif.
	* config/darwin.h (GOMP_SELF_SPECS): Define.


testsuite/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>
            Uros Bizjak  <uros@kss-loka.si>

	* testsuite/gcc.dg/gomp: New directory.

From-SVN: r109902
2006-01-18 14:21:25 -05: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
Richard Henderson 75ce3d489c c-lex.c (pragma_lex): Rename from c_lex.
* c-lex.c (pragma_lex): Rename from c_lex.
        * c-pch.c: Update for pragma_lex rename.
        * c-pragma.c, c-pragma.h, config/ia64/ia64-c.c: Likewise.
        * config/m32c/m32c-pragma.c, config/darwin-c.c: Likewise.
        * config/rs6000/rs6000-c.c, config/c4x/c4x-c.c: Likewise.
        * config/sol2-c.c, config/v850/v850-c.c: Likewise.
        * doc/tm.texi: Likewise.
cp/
        * lex.c: Update for pragma_lex rename.
        * parser.c: Likewise.

From-SVN: r107544
2005-11-26 14:31:12 -08:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Kazu Hirata d4ff96d5fc builtin-attrs.def, [...]: Update copyright.
* builtin-attrs.def, c-lex.c, c-pragma.h, reg-stack.c,
	config/mips/vr.h: Update copyright.

From-SVN: r96369
2005-03-13 14:06:48 +00:00
Per Bothner 6037d88d58 c-tree.h (struct c_declarator): New id_loc field.
* c-tree.h (struct c_declarator): New id_loc field.
	* c-pragma.h (c_lex_with_flags): Take position reference.
	* c-lex.c (c_lex_with_flags): Set passed-in location from cpp token,
	iff USE_MAPPED_LOCATION. (Type doesn't match otherwise.)
	(c_lex): Pass dummy location to c_lex_with_flags.
	* c-parser.c (c_lex_one_token): Set c_token's location using
	c_lex_with_flags, instead of input_location, which might be "ahead".
	(c_parser_direct_declarator): Set declarator's id_loc from
	c_token's id_loc.
	* c-decl.c (grokdeclarator): Set DECL_SOURCE_LOCATION from
	declarator's id_loc, rather than probably-imprecise input_location.
	(build_id_declarator): Initialize c_declarator's id_loc field.

From-SVN: r96329
2005-03-11 22:37:46 -08:00
Joseph Myers 86f029aa95 [multiple changes]
2004-11-29  Daniel Jacobowitz  <dan@codesourcery.com>

	PR c/7544
	* Makefile.in (c-lang.o): Update dependencies.
	* c-lang.c: Include "c-pragma.h".
	(finish_file): Call maybe_apply_pending_pragma_weaks.
	* c-pragma.c (maybe_apply_pending_pragma_weaks): New function.
	* c-pragma.h (maybe_apply_pending_pragma_weaks): New prototype.

cp:
2004-11-29  Daniel Jacobowitz  <dan@codesourcery.com>

	* Make-lang.in (cp/decl2.o): Update dependencies.
	* decl2.c (finish_file): Call maybe_apply_pending_pragma_weaks.

objc:
2004-11-29  Joseph Myers  <joseph@codesourcery.com>

	* Make-lang.in (objc/objc-act.o): Update dependencies.
	* objc-act.c (objc_finish_file): Call
	maybe_apply_pending_pragma_weaks if not OBJCPLUS.

testsuite:
2004-11-29  Joseph Myers  <joseph@codesourcery.com>

	* g++.dg/ext/weak1.C, gcc.dg/weak/weak-10.c, objc.dg/weak-1.m: New
	tests.

From-SVN: r91479
2004-11-29 18:54:06 +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
Matt Austern c162c75e43 c-common.c (fix_string_type): Build the unqualified array type unconditionally...
2004-09-20  Matt Austern <austern@apple.com>
	    Zack Weinberg  <zack@codesourcery.com>

	* c-common.c (fix_string_type): Build the unqualified array
	type unconditionally, then use c_build_qualified_type to get
	the proper const-qualified variant, and set its
	TYPE_MAIN_VARIANT to refer to the unqualified type.
	* c-lex.c (c_lex_return_raw_string): New global.
	(c_lex_with_flags): Honor it.
	* c-pragma.h: Declare it.

cp:
	* decl.c (make_rtl_for_nonlocal_decl, start_preparsed_function):
	Apply lbasename to input_filename before passing to get_fileinfo.
	* semantics.c (begin_class_definition): Likewise.
	* lex.c (handle_pragma_interface): Apply get_fileinfo to the
	correct filename.  Rename variables to be less confusing.
	(handle_pragma_implementation): Likewise.  Disable "appears
	after file is included" diagnostic.

	* parser.c (struct cp_token): Add in_system_header fiag.
	(CP_TOKEN_BLOCK_NUM_TOKENS, struct cp_token_block)
	(CP_TOKEN_BUFFER_SIZE, cp_token_cache_push_token)
	(CPP_NONE, cp_lexer_read_token): Delete.
	(struct cp_lexer): Remove first_token, string_tokens,
	main_lexer_p fields.  Clarify comments.
	(struct cp_token_cache): Now just a pair of pointers.
	(CP_LEXER_BUFFER_SIZE): New #define.
	(CPP_PURGED): New fake token type.
	(cp_lexer_new_from_token_array, cp_lexer_destroy)
	(cp_lexer_peek_token_emit_debug_info, cp_lexer_skip_purged_tokens)
	(cp_lexer_handle_pragma, cp_token_cache_new, cp_parser_string_literal):
	New functions.
	(cp_lexer_new_from_tokens): Now a simple wrapper around
	cp_lexer_new_from_token_array.
	(cp_lexer_set_source_position_from_token): Also update
	in_system_header.
	(cp_lexer_next_token, cp_lexer_prev_token, cp_lexer_advance_token):
	Don't wrap round.
	(cp_lexer_token_difference): Dont handle wrapping round.
	(cp_lexer_new_main): Enable pragma deferral and raw strings,
	read the entire translation unit through c_lex_with_flags into
	this lexer's buffer, then turn raw strings back off again.
	(cp_lexer_grow_buffer): Adjust for buffer no longer being circular.
	(cp_lexer_get_preprocessor_token): No need to handle not being
	the main lexer.  Set token->in_system_header too.
	(cp_lexer_peek_token): Skip purged tokens.  Feed pragma tokens
	to cp_lexer_handle_pragma.  No need to call cp_lexer_read_token.
	(cp_lexer_peek_nth_token): Likewise.
	(cp_lexer_purge_token): Mark the token PURGED, don't shift all
	the other tokens down.
	(cp_lexer_purge_tokens_after): Likewise.
	(cp_lexer_save_tokens, cp_lexer_rollback_tokens): Don't worry
	about there being no tokens.
	(cp_lexer_print_token): Revise to give useful information on
	all tokens.
	(struct cp_parser): Add field translate_strings_p.
	(cp_parser_new): Initialize it.
	(cp_parser_translation_unit): Destroy the lexer when done.
	(cp_parser_parameter_declaration): Restructure saving of
	default arguments.
	(cp_parser_save_member_function_body): Likewise.
	(cp_parser_check_for_invalid_template_id)
	(cp_parser_nested_name_specifier_opt, cp_parser_template_id):
	Adjust calls to cp_lexer_advance_token.
	(cp_parser_skip_to_closing_parenthesis, cp_parser_declaration):
	No need to fiddle c_lex_string_translate.
	(cp_parser_primary_expression, cp_parser_linkage_specification)
	(cp_parser_asm_definition, cp_parser_asm_specification_opt)
	(cp_parser_asm_operand_list, cp_parser_asm_clobber_list)
	Use cp_parser_string_literal.
	(cp_parser_attribute_list): Save and restore
	parser->translate_strings_p, not c_lex_string_translate.
	(cp_parser_cache_group): Delete.
	(cp_parser_cache_group_1): Rename cp_parser_cache_group.  Do
	not take a cache argument.

From-SVN: r87786
2004-09-21 02:22:45 +00:00
Bernardo Innocenti f408614568 Makefile.in (C_PRAGMA_H): New variable to track dependencies of c-pragma.h.
* Makefile.in (C_PRAGMA_H): New variable to track dependencies
	of c-pragma.h.
	* c-pragma.h (c_lex, c_lex_with_flags): Change returntype to
	enum cpp_ttype.
	* c-lex.c: Likewise.

From-SVN: r85174
2004-07-26 02:29:41 +02:00
Niall Douglas d7afec4b07 re PR c++/9283 (__attribute__((visibility ("hidden"))) not supported for class/struct)
PR c++/9283
	PR c++/15000
	* c-common.c (c_common_attribute_table): Allow
	handle_visibility_attribute to be called for types.
	(handle_visibility_attribute) When given a type, set the visibility
	bits on the TYPE_NAME.  When given a decl, don't set no_add_attrs
	so that we can check later whether the attribute was present. Added
	warning if attribute applied to non class type.
	* c-decl.c (diagnose_mismatched_decls): Updated rules for merging
	decls and checking that they are consistent.
	* common.opt: Added -fvisibility.
	* c.opt, c-opts.c: Added -fvisibility-inlines-hidden.
	* c-pragma.h, c-pragma.c: Added handle_pragma_visibility().
	* flags.h, tree.h: Added assorted support defines for overall patch
	* opts.c: Added parsing support for -fvisibility.
	* tree.c (build_decl): Set visibility for all decls to be whatever
	is in force at that time.
	* varasm.c (default_binds_local_p_1): Reworked logic determining
	when to make a symbol locally bound.
	* doc/invoke.texi: Added documentation for -fvisibility and
	-fvisibility-inlines-hidden.

	PR c++/15000
	PR c++/9283
	* class.c (check_field_decls): Apply hidden visibility if
	-fvisibility-inlines-hidden and inlined unless otherwise specified
	(build_vtable): Set vtable visibility to class visibility.
	(check_field_decls): Default static member visibility to class
	visibility.
	(check_methods): Default method visibility to class visibility.
	* cp-tree.h: Added CLASSTYPE_VISIBILITY and
	CLASSTYPE_VISIBILITY_SPECIFIED macro.
	* decl.c (duplicate_decls): New logic for merging definition decls
	with declaration decls. Added ignore & warning when non default
	applied to global operator new or delete.
	* method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED
	wherever VISIBILITY was changed
	* rtti.c (get_tinfo_decl): Set typeinfo visibility to class
	visibility.
	(tinfo_base_init): Set typeinfo name visibility to class visibility.

	PR c++/9283
	PR c++/15000
	* gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests.
	* g++.dg/ext/visibility/: New directory.
	* g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C
	g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C,
	g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C,
	g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/.
	* g++.dg/ext/visibility/fvisibility.C,
	g++.dg/ext/visibility/fvisibility-inlines-hidden.C,
	g++.dg/ext/visibility/fvisibility-override1.C
	g++.dg/ext/visibility/fvisibility-override2.C
	g++.dg/ext/visibility/memfuncts.C
	g++.dg/ext/visibility/noPLT.C
	g++.dg/ext/visibility/pragma.C
	g++.dg/ext/visibility/pragma-override1.C
	g++.dg/ext/visibility/pragma-override2.C
	g++.dg/ext/visibility/staticmemfuncts.C
	g++.dg/ext/visibility/virtual.C: New tests.

Co-Authored-By: Brian Ryner <bryner@brianryner.com>

From-SVN: r85167
2004-07-25 22:52:22 +00:00
Alexandre Oliva 0173bb6f2d c-pragma.h (c_lex_string_translate): Change type to int.
gcc/ChangeLog:
* c-pragma.h (c_lex_string_translate): Change type to int.
* c-parse.in: Change all assignments of c_lex_string_translate
to true and false to 1 and 0.
* c-lex.c (c_lex_string_translate): Likewise.
(lex_string): Convert string without translation in the -1
case.
gcc/cp/ChangeLog:
* parser.c: Change all assignments of c_lex_string_translate
to true and false to 1 and 0.
(cp_lexer_read_token): Convert type of the translated string.
(cp_parser_skip_to_closing_parentheses): Preserve original
value of c_lex_string_translate, and set it to -1 while
running.
(cp_parser_cache_group): Likewise.
(cp_parser_cache_group_1): Renamed.
(cp_parser_asm_operand_list): Remove redundant setting of
c_lex_string_translate.
(cp_parser_primary_expression) [CPP_STRING, CPP_WSTRING]:
Handle chained strings.

From-SVN: r83201
2004-06-15 21:43:21 +00:00
Eric Christopher 2152660651 target-supports.exp (check-iconv-available): New function.
2004-02-26  Eric Christopher  <echristo@redhat.com>

	* lib/target-supports.exp (check-iconv-available): New function.
	* lib/gcc-dg.exp (dg-require-iconv): New function.
	Use above.
        * gcc.dg/charset: New directory.
        * gcc.dg/charset/charset.exp: New file.
        * gcc.dg/charset/asm1.c: Ditto.
        * gcc.dg/charset/asm2.c: Ditto.
        * gcc.dg/charset/asm3.c: Ditto.
        * gcc.dg/charset/asm4.c: Ditto.
        * gcc.dg/charset/asm5.c: Ditto.
        * gcc.dg/charset/attribute1.c: Ditto.
        * gcc.dg/charset/attribute2.c: Ditto.
        * gcc.dg/charset/string1.c: Ditto.
        * g++.dg/charset: New directory.
        * g++.dg/dg.exp: Add here. Special options.
        * g++.dg/charset/charset.exp: New file.
        * g++.dg/charset/asm1.c: Ditto.
        * g++.dg/charset/asm2.c: Ditto.
        * g++.dg/charset/asm3.c: Ditto.
        * g++.dg/charset/asm4.c: Ditto.
        * g++.dg/charset/attribute1.c: Ditto.
        * g++.dg/charset/attribute2.c: Ditto.
        * g++.dg/charset/extern1.cc: Ditto.
        * g++.dg/charset/extern2.cc: Ditto.
        * g++.dg/charset/string1.c: Ditto.

2004-02-26  Eric Christopher  <echristo@redhat.com>

	* c-lex.c (c_lex_string_translate): New variable.
	(lex_string): Use to determine string translation.
	* c-pragma.h: Prototype.
	* c-parse.in (start_string_translation): New. Set above.
	(stop_string_translation): Ditto.
	(attribute, attribute_list, asm_def, asm_stmt,
	asm_operand): Use above functions.
	* cp/parser.c (cp_parser_declaration): Translate strings
	unless token is RID_EXTERN. Set c_lex_string_translate
	for recursive use.
	(cp_parser_asm_definition): Only translate argument strings
	to asms.
	(cp_parser_asm_operand_list): Ditto.
	(cp_parser_attribute_list): Do not translate attribute strings.

From-SVN: r78548
2004-02-27 02:01:10 +00:00
Kazu Hirata 283334f011 alloc-pool.c, c-lex.c, c-pragma.h, c-semantics.c, cfghooks.c,
cfghooks.h, cfglayout.c, cfgloopmanip.c, debug.c, debug.h,
	flow.c, genextract.c, ggc-common.c, ggc-page.c, ggc.h,
	ifcvt.c, jump.c, loop-unswitch.c, timevar.c, timevar.def,
	tree-optimize.c, vmsdbgout.c, config/fp-bit.c,
	config/alpha/alpha.c, config/alpha/alpha.h,
	config/alpha/alpha.md, config/alpha/unicosmk.h,
	config/alpha/vms.h, config/arm/linux-elf.h, config/avr/avr.c,
	config/c4x/c4x-protos.h, config/c4x/c4x.md,
	config/d30v/d30v.h, config/frv/frv.md, config/frv/frvbegin.c,
	config/frv/frvend.c, config/i386/cygming.h,
	config/i386/djgpp.h, config/i386/emmintrin.h,
	config/i386/gthr-win32.c, config/i386/i386-interix.h,
	config/i386/i386-protos.h, config/i386/openbsd.h,
	config/i386/winnt.c, config/i386/xm-mingw32.h,
	config/i386/xmmintrin.h, config/ia64/ia64.md,
	config/iq2000/iq2000.md, config/m32r/m32r.md,
	config/m68k/m68k.md, config/mcore/mcore-elf.h,
	config/mcore/mcore.md, config/mips/elf.h, config/mips/elf64.h,
	config/mips/iris5gas.h, config/mips/iris6.h,
	config/mips/iris6gas.h, config/mips/linux.h,
	config/mips/mips.md, config/mips/netbsd.h,
	config/mips/openbsd.h, config/mips/windiss.h,
	config/pa/fptr.c, config/rs6000/aix.h,
	config/rs6000/altivec.h, config/rs6000/darwin.h,
	config/rs6000/xcoff.h, config/s390/s390-protos.h,
	config/s390/s390.c, config/s390/s390.h, config/s390/s390.md,
	config/sh/netbsd-elf.h, config/sh/sh.h, config/sh/vxworks.h,
	config/sparc/sol2.h: Update copyright.

From-SVN: r77018
2004-01-31 02:07:12 +00:00
Giovanni Bajo 7625e73d57 c-lex.c (c_lex): Rename to...
* c-lex.c (c_lex): Rename to...
	(c_lex_with_flags): Add new parameter to get CPP flags.
	(c_lex): Thunk to c_lex_with_flags while keeping the old interface.
	* c-pragma.h (c_lex_with_flags): Declare.

From-SVN: r76844
2004-01-29 04:19:01 +00:00
J"orn Rennecke 1e0343ddbb c-pragma.h (HANDLE_PRAGMA_WEAK): Always define to SUPPORTS_WEAK.
gcc:
	* c-pragma.h (HANDLE_PRAGMA_WEAK): Always define to SUPPORTS_WEAK.
gcc/testsuite:
	* gcc.dg/asm-names.c (ymain): Make it weak.

From-SVN: r69459
2003-07-16 17:25:15 +01:00
Andreas Jaeger f55ade6e34 basic-block.h: Convert prototypes to ISO C90.
* basic-block.h: Convert prototypes to ISO C90.
	* c-parse.in: Likewise.
	* c-pragma.h: Likewise.
	* c-typeck.c: Likewise.
	* cfghooks.h: Likewise.
	* cfgloopanal.c: Likewise.
	* dbxout.h: Likewise.
	* debug.h: Likewise.
	* dwarf2asm.h: Likewise.
	* gcov.c: Likewise.
	* gengtype-lex.l: Likewise.
	* sched-int.h: Likewise.
	* timevar.c: Likewise.

From-SVN: r69010
2003-07-06 20:59:38 +02:00
Andreas Jaeger 5055d3a3e8 Convert to ISO C90.
From-SVN: r68332
2003-06-22 17:07:31 +02:00
Stan Shebs e150159cbe coretypes.h (cpp_reader): Forward declare struct.
* coretypes.h (cpp_reader): Forward declare struct.
        * c-pragma.h (cpp_reader): Remove forward declaration.
        * hashtable.h (cpp_reader): Likewise.
        * scan.h (cpp_reader): Likewise.
        * tree.h (cpp_reader): Likewise.
        * config/darwin-protos.h (cpp_reader): Likewise.
        * config/arm/arm-protos.h (cpp_reader): Likewise.
        * config/rs6000/rs6000-protos.h: Remove GCC_CPPLIB_H ifdef, use
        struct cpp_reader in prototypes.

From-SVN: r62050
2003-01-28 23:26:28 +00:00
Neil Booth c58b209a5d c-pragma.c (c_register_pragma): New.
* c-pragma.c (c_register_pragma): New.
	(init_pragma): Use it.
	* c-pragma.h (cpp_register_pragma): Don't declare.
	(c_register_pragma): New.
	* cpplib.h: Remove #ifdef GCC_C_PRAGMA_H.
	* config/darwin.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/arm/arm.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/c4x/c4x.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/h8300/h8300.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/i370/i370.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/i960/i960.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/rs6000/rs6000.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/sh/sh.h (REGISTER_TARGET_PRAGMAS): Update.
	* config/v850/v850.h (REGISTER_TARGET_PRAGMAS): Update.
	* doc/tm.texi (REGISTER_TARGET_PRAGMAS): Update
cp:
	* lex.c: Remove superfluous include of cpplib.h.
	(CONSTRAINT): Define without conditions.
	(init_cp_pragma): Use c_register_pragma.

From-SVN: r60740
2003-01-01 12:27:02 +00:00
Steve Ellcey 0c3a2ea093 c-pragma.h (add_to_renaming_pragma_list): New function.
* gcc/c-pragma.h (add_to_renaming_pragma_list): New function.
	* gcc/c-pragma.c (add_to_renaming_pragma_list): New function.
	(handle_pragma_redefine_extname): Change to use new function.

From-SVN: r55330
2002-07-08 17:53:24 +00:00
Neil Booth 81a75f0f43 Makefile.in (C_COMMON_H): Fix.
* Makefile.in (C_COMMON_H): Fix.
	Update other targets.
	* c-common.c: Don't include c-lex.h.
	(builtin_define_with_value): Make static and prototype.
	(builtin_define_std): Move from c-lex.h.
	* c-common.h (init_c_lex): Move from c-lex.h.
	* c-decl.c: Don't include c-lex.h.
	(make_pointer_declarator): Move from c-parse.in.
	* c-lex.c: Don't include c-lex.h.
	* c-lex.h: Remove.
	* c-parse.in: Don't include c-lex.h; include c-pragma.h.
	(make_pointer_declarator): Move to c-decl.c.
	* c-pragma.c: Don't include c-lex.h.
	* c-pragma.h (yydebug, YYDEBUG, parse_in, c_lex): Move from c-lex.h.
	* c-tree.h (make_pointer_declarator): New.
cp:
	* lex.c: Don't include c-lex.h.
	* parse.y, spew.c: Don't include c-lex.h; include c-pragma.h.
doc:
	* passes.texi, tm.texi: Update.
objc:
	* Make-lang.in: Update and correct.
	* objc-act.c: Don't include c-lex.h or cpplib.h.
treelang:
	* treetree.c: Don't include c-lex.h.
config:
	* darwin-c.c: Don't include c-lex.h.
	* c4x/c4x-c.c: Don't include c-lex.h.
	* c4x/t-c4x: Update.
	* i370/i370-c.c: Don't include c-lex.h.
	* i370/t-i370: Update.
	* i960/i960-c.c: Don't include c-lex.h.
	* i960/i960.c: Don't include cpplib.h, c-lex.h or c-pragma.h.
	* i960/t-960bare: Update.
	* i960/t-vxworks: Update.
	* rs6000/rs6000-c.c: Don't include c-lex.h; include c-pragma.h.
	* rs6000/t-darwin: Update.
	* rs6000/t-rs6000-c-rule: Update.
	* v850/v850-c.c: Don't include c-lex.h.
	* v850/v850.c: Don't include c-lex.h or cpplib.h.

From-SVN: r53876
2002-05-25 22:01:55 +00:00
Richard Henderson 41c643948c c-pragma.c (maybe_apply_renaming_pragma): New.
* c-pragma.c (maybe_apply_renaming_pragma): New.
        (handle_pragma_redefine_extname, pending_redefine_extname): New.
        (handle_pragma_extern_prefix, pragma_extern_prefix): New.
        (init_pragma): Register them.
        * c-pragma.h (maybe_apply_renaming_pragma): Declare.
        * c-decl.c (finish_decl): Call it.
        * cp/decl.c (cp_finish_decl): Likewise.
        * doc/extend.texi: Document the new pragmas.

        * config/alpha/osf.h (CPP_SUBTARGET_SPEC): Add __EXTERN_PREFIX.
        (HANDLE_PRAGMA_EXTERN_PREFIX): New.

        * config/i386/sol2.h (CPP_PREDEFINES): Add __PRAGMA_REDEFINE_EXTNAME.
        (HANDLE_PRAGMA_REDEFINE_EXTNAME): New.
        * config/sparc/sol2.h: Likewise.

        * g++.dg/other/pragma-re-1.C: New.
        * g++.dg/other/pragma-ep-1.C: New.
        * gcc.dg/pragma-re-1.c, gcc.dg/pragma-re-2.c: New.
        * gcc.dg/pragma-ep-1.c, gcc.dg/pragma-ep-2.c: New.
        * gcc.dg/pragma-ep-3.c: New.

From-SVN: r51200
2002-03-22 14:51:48 -08:00
Richard Henderson ecb0eecefb c-decl.c: Include c-pragma.h.
* c-decl.c: Include c-pragma.h.
        (start_decl, start_function): Invoke maybe_apply_pragma_weak.
        (finish_function): Tidy.
        * c-pragma.c: Include c-common.h.
        (pending_weaks, apply_pragma_weak, maybe_apply_pragma_weak): New.
        (handle_pragma_weak): Use them.
        (init_pragma): Register pending_weaks.
        * c-pragma.h (maybe_apply_pragma_weak): Declare.
        * print-tree.c (print_node): Print DECL_WEAK.
        * varasm.c (mark_weak_decls): Remove.
        (remove_from_pending_weak_list): Remove.
        (add_weak): Remove.
        (asm_emit_uninitialised): Call globalize_decl for weak commons.
        (weak_decls): Make a tree_list.
        (declare_weak): Cons weak_decls directly.
        (globalize_decl): Remove weak_decls elements directly.
        (weak_finish): Simplify weak_decls walk.  Don't weaken unused
        symbols.  Don't pretend to handle aliases.
        (init_varasm_once): Update weak_decls registry.
	* Makefile.in: Update dependencies.

        * cp/decl.c: Include c-pragma.h.
        (start_decl, start_function): Invoke maybe_apply_pragma_weak.
	* cp/Make-lang.in: Update dependencies.

	* gcc.dg/weak-1.c: New.

From-SVN: r50797
2002-03-14 23:11:14 -08:00
Alan Modra 79c4e63fcb tm.texi (ASM_WEAKEN_DECL): Document.
* doc/tm.texi (ASM_WEAKEN_DECL): Document.
	(ASM_WEAKEN_LABEL): Mention ASM_WEAKEN_DECL.
	(SUPPORTS_WEAK): Likewise.
	* output.h (add_weak): Add tree param.
	* varasm.c (add_weak): Likewise.  Save decl.
	(struct weak_syms): Add decl field.
	(mark_weak_decls): New function.
	(init_varasm_once): ggc_add_root mark_weak_decls.
	(assemble_start_function): Use ASM_WEAKEN_DECL.
	(assemble_variable): Likewise.
	(assemble_alias): Likewise.
	(declare_weak): Pass decl to add_weak.
	(weak_finish): Use ASM_WEAKEN_DECL. Try to find decl.
	(remove_from_pending_weak_list): Declare and define for
	ASM_WEAKEN_DECL.
	* c-pragma.c (handle_pragma_weak): Adjust add_weak call.
	* c-pragma.h (HANDLE_PRAGMA_WEAK): Define if ASM_WEAKEN_DECL too.
	* defaults.h (SUPPORTS_WEAK): Likewise.
	* config/rs6000/linux64.h (ASM_DECLARE_FUNCTION_NAME): Don't emit
	.weak for code sym.  Do emit .size for descriptor sym.
	(ASM_DECLARE_FUNCTION_SIZE): Define.
	* config/rs6000/rs6000.h (ASM_WEAKEN_DECL): Define.
	(ASM_OUTPUT_DEF_FROM_DECLS): Don't emit .weak here.  Don't output
	.lglobl unless TARGET_XCOFF.  Formatting fixes.
	* config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Don't emit
	.weak for code sym.
	(HANDLE_PRAGMA_WEAK): Remove.
	(ASM_WEAKEN_LABEL): Remove.
	* config/rs6000/aix.h (HANDLE_SYSV_PRAGMA): Define.

Co-Authored-By: David Edelsohn <edelsohn@gnu.org>

From-SVN: r50181
2002-03-01 16:30:38 +10:30
Kazu Hirata 3ef42a0c4f bitmap.h: Fix comment formatting.
* bitmap.h: Fix comment formatting.
	* combine.c: Likewise.
	* cppfiles.c: Likewise.
	* c-pragma.h: Likewise.
	* c-typeck.c: Likewise.
	* df.c: Likewise.
	* dwarf2out.c: Likewise.
	* function.c: Likewise.
	* gcc.c: Likewise.
	* genattrtab.c: Likewise.
	* gthr-win32.h: Likewise.
	* haifa-sched.c: Likewise.
	* predict.c: Likewise.
	* rtlanal.c: Likewise.
	* rtl.h: Likewise.
	* unwind-dw2-fde.h: Likewise.
	* unwind-pe.h: Likewise.
	* vmsdbgout.c: Likewise.

From-SVN: r48987
2002-01-18 13:40:36 +00:00
Neil Booth a5da89c6a8 c-pragma.h (cpp_register_pragma_space): Remove.
* c-pragma.h (cpp_register_pragma_space): Remove.
	* cpplib.h (cpp_register_pragma_space): Remove.
	* cpplib.c (lookup_pragma_entry, insert_pragma_entry): New.
	(cpp_register_pragma_space): Remove.
	(cpp_register_pragma): Simplify using lookup_pragma_entry,
	add sanity checks.
	(do_pragma): Similarly.
	(_cpp_init_internal_pragmas): Don't register namespaces.

	* config/v850/v850.h (REGISTER_TARGET_PRAGMAS):
	Don't register namespaces.
	* cp/lex.c (init_cp_pragma): Similarly.
	* doc/tm.texi: Update.

From-SVN: r46254
2001-10-14 17:44:00 +00:00
Eric Christopher 46f9491e74 c-pragma.h (add_weak): Move prototype from here...
2001-08-28  Eric Christopher <echristo@redhat.com>
	    Richard Henderson <rth@redhat.com>

	* c-pragma.h (add_weak): Move prototype from here...
	* output.h (add_weak): ... to here.
	* varasm.c (add_weak): Fix typo.
	* config/mips/crti.asm: New file.
	* config/mips/crtn.asm: Ditto.
	* config/mips/elf.h (SBSS_SECTION_ASM_OP) Add #undef.
	(CTOR_LISTS_DEFINED_EXTERNALLY): Remove.
	(INVOKE__main): Ditto.
	(INIT_SECTION_ASM_OP): New.
	(FINI_SECTION_ASM_OP): Ditto.
	(STARTFILE_SPEC): Add crti.
	(ENDFILE_SPEC): Add crtn.
	* config/mips/elf64.h: Same.
	* config/mips/rtems64.h (INVOKE__main, NAME__MAIN, SYMBOL__MAIN):
	Remove.
	* config/mips/vxworks.h: Ditto.
	* config/mips/t-elf: Support crti and crtn.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r45243
2001-08-28 23:03:52 +00:00
Jason Merrill 4ae08f95bb c-pragma.h: Move weak_syms and weak_decls...
* c-pragma.h: Move weak_syms and weak_decls...
        * varasm.c: ...here.  Now static.
        (declare_weak, weak_finish, remove_from_pending_weak_list): Don't
        depend on HANDLE_PRAGMA_WEAK.

From-SVN: r45146
2001-08-24 08:08:35 -04:00
Lars Brinkhoff 1322177dbd Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
	bitmap.h, builtin-types.def, builtins.c, builtins.def,
	c-aux-info.c, c-common.c, c-common.def, c-common.h,
	c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
	c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
	c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
	caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
	conditions.h, config.gcc, configure.frag, configure.in,
	conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
	cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
	dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
	doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
	dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
	emit-rtl.c, errors.c, errors.h, except.c, except.h,
	exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
	fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
	function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
	gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
	gencheck.c, gencodes.c, genconfig.c, genemit.c,
	genextract.c, genflags.c, gengenrtl.c, genmultilib,
	genopinit.c, genoutput.c, genpeep.c, genrecog.c,
	gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
	ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
	graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
	gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
	gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
	hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
	integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
	libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
	machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
	mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
	mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
	params.h, predict.c, predict.def, predict.h, prefix.c,
	prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
	read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
	regclass.c, regmove.c, regrename.c, regs.h, reload.c,
	reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
	rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
	sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
	sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
	ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
	stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
	tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
	tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
	unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
	unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
	xcoffout.h: replace "GNU CC" with "GCC".

From-SVN: r45105
2001-08-22 14:35:51 +00:00
H.J. Lu 3aa8ab7bfa c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIAS are defined.
* c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and
	ASM_OUTPUT_WEAK_ALIAS are defined.
	* defaults.h (ASM_OUTPUT_WEAK_ALIAS): Define if possible.
	* config/mips/iris6.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL):
	Moved ...
	* config/mips/iris5.h: ... here.
	(HANDLE_SYSV_PRAGMA): Defined as 1.
	* varasm.c (weak_finish): Use ASM_OUTPUT_WEAK_ALIAS.
	* doc/tm.texi (ASM_OUTPUT_WEAK_ALIAS): Support the undefined weak
	symbol.

Co-Authored-By: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>

From-SVN: r44072
2001-07-17 12:55:19 +00:00
Richard Henderson 88657302b7 Standardize header guards.
From-SVN: r42615
2001-05-25 18:31:47 -07:00
Neil Booth 2a967f3d3a Makefile.in (OBJS, [...]): Update.
* 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
2001-05-20 06:26:45 +00:00
Neil Booth a32f2771a5 c-common.c: Remove USE_CPPLIB conditional inclusions.
* c-common.c: Remove USE_CPPLIB conditional inclusions.
        * c-common.h: Similarly.
        * c-decl.c: Similarly.
        * c-lang.c: Similarly.
        * c-lex.c: Similarly.
        * c-parse.in: Similarly.
        * c-pragma.c: Similarly.
        * c-pragma.h: Similarly.
        * gcc.c: Similarly.
        * toplev.c: Similarly.
        * cp/cp-tree.h: Similarly.
        * cp/decl2.c: Similarly.
        * cp/lang-specs.h: Similarly.
        * cp/lex.c: Similarly.
        * cp/lex.h: Similarly.
        * cp/spew.c: Similarly.
        * java/lang-options.h: Similarly.
        * objc/lang-specs.h: Similarly.
        * objc/objc-act.c: Similarly.

        * configure.in: Remove configure option.
        * config.in: Regenerate.
        * configure: Regenerate.

From-SVN: r37742
2000-11-25 19:28:44 +00:00
Zack Weinberg ae54392bb9 c-pragma.c: Don't elide entire file if !HANDLE_GENERIC_PRAGMAS.
* c-pragma.c: Don't elide entire file if !HANDLE_GENERIC_PRAGMAS.
	(init_pragma): Avoid warning if pfile happens to be unused.
	* c-pragma.h: Never define HANDLE_GENERIC_PRAGMAS.  Never
	define init_pragma to nothing.  Always prototype
	init_pragma.  Prototype dispatch_pragma if !USE_CPPLIB.

	* c-lex.c (process_directive): Always call dispatch_pragma.
	Initialize entering_c_header to 0.

From-SVN: r36277
2000-09-08 22:17:24 +00:00
Zack Weinberg 8b97c5f8ef c-pragma.h: Define HANDLE_GENERIC_PRAGMAS if REGISTER_TARGET_PRAGMAS is defined.
* c-pragma.h: Define HANDLE_GENERIC_PRAGMAS if
	REGISTER_TARGET_PRAGMAS is defined.  Duplicate some
	definitions from cpplib.h.
	* cpplib.h: Don't typedef struct cpp_reader if c-pragma.h has
	already done it.
	* tm.texi: Document HANDLE_PRAGMA as no longer supported.  Add
	documentation for REGISTER_TARGET_PRAGMAS.

	* c-lex.c: Include cpplib.h before c-pragma.h.  Define a
	default-pragma callback to implement -Wunknown-pragmas if
	USE_CPPLIB.
	* c-parse.in: Move all includes to top of file.
	* c-pragma.c: Include cpplib.h before c-pragma.h.  Include
	tm_p.h.
	(dispatch_pragma): Put the namespace in the -Wunknown-pragmas
	warning.
	(init_pragma): If REGISTER_TARGET_PRAGMAS is defined, call it.

	* arm.h, arm-protos.h, arm.c,
	  c4x.h, c4x-protos.h, c4x.c,
	  h8300.h, h8300-protos.h, h8300.c,
	  i370.h, i370-protos.h, i370.c,
	  i960.h, i960-protos.h, i960.c,
	  sh.h, sh-protos.h, sh.c,
	  v850.h, v850-protos.h, v850.c: Convert HANDLE_PRAGMA-based
	pragmata scheme to use REGISTER_TARGET_PRAGMAS instead.

	* d30v.h: Don't mention HANDLE_PRAGMA in comment.  Add
	multiple include guard.
	* i370.md (untyped_call): Use GEN_CALL.
	(umodsi3): Remove unused variable.
	* sh/elf.h: Don't undef HANDLE_SYSV_PRAGMA.
	* v850.c (output_move_single, output_move_double): Constify
	return value.
	(print_operand): Constify a char *.
	* v850.h (struct small_memory_info): Constify name member.

From-SVN: r36249
2000-09-07 22:24:34 +00:00
Zack Weinberg 0e5921e8a0 Integrated preprocessor.
top level:
	* Makefile.in: Remove all references to c-parse.gperf,
	c-gperf.h, and c-parse.h.  Remove -d from yacc command line
	generating c-parse.c.  Update dependencies.
	* c-parse.gperf, c-gperf.h: Delete.

	* c-common.c: Don't define parse_options, cpp_token, yy_cur,
	yy_lim, or yy_get_token.  Don't define get_directive_line if
	USE_CPPLIB.
	* c-common.h: Add multiple include guard.  Define RID values
	for every keyword in C, C++, and Objective C.  Put all the
	modifiers first.
	(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
	* c-decl.c (c_decode_option): Handle -lang-objc here.
	(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
	(grokdeclarator): Adjust for new RID scheme.
	(extract_interface_info): New stub.
	* c-lang.c: Don't declare yy_cur or parse_options.
	(lang_init_options): Call cpp_init.  Don't call
	cpp_options_init.
	(lang_init): Don't call check_newline if USE_CPPLIB.

	* c-lex.c: Don't include c-parse.h.  Do include timevar.h.
	Elide lots of unnecessary code if USE_CPPLIB.  Delete code
	rendered unnecessary by new architecture.  Move routines not
	shared with C++ to c-parse.in.  Maintain a local idea of the
	line number.    Handle C++ as well as C.
	[USE_CPPLIB]: Declare and register callbacks for #ident and
	for entering/leaving files.
	(init_c_lex, c_lex): Are now the entry points to this file.
	(check_newline): Break out directive handling to
	process_directive.
	(read_ucs, is_extended_char, utf8_extend_token): Moved here
	from C++ front end.
	(readescape, parse_float): Overhaul.
	(lex_number, lex_string, lex_charconst): Break out of c_lex
	(n'ee yylex).
	(get_fileinfo, update_header_times, dump_one_header,
	dump_time_statistics): New and/or moved here from C++.
	Support per-file data needed by C++ and per-header timing
	statistics (C++ only, at the moment).
	* c-lex.h: Update prototypes.  Add multiple include guard.
	* c-tree.h (struct lang_identifier): Add rid_code field.
	(C_IS_RESERVED_WORD, C_RID_CODE): New.

	* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
	reinit_parse_for_function and/or position_after_white_space.
	(save_filename, save_lineno): Look ahead before saving.
	(label -> identifier ':'): Save file and line before shifting ':'.
	(reservedwords): No need to call get_identifier.
	(init_parse, finish_parse, yyerror, yylex, yyprint,
	make_pointer_declarator): Are now here for C/ObjC.
	(rid_to_yy): Conversion table from RID constants to Yacc codes.

	* c-pragma.c: Rewrite parsing logic to fit with cpplib's
	#pragma registry.  Provide dummy implementation of that
	interface if !USE_CPPLIB.
	* c-pragma.h: Update to match.

	* flags.h: Add multiple include guard.
	(flag_detailed_statistics): Moved here from C++.
	* toplev.c: Define flag_detailed_statistics.

	* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
	#if USE_CPPLIB.
	* timevar.def (TV_CPP, TV_LEX): New.
	* timevar.h: Add multiple include guard.

	* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
	#if USE_CPPLIB.
	* objc/objc-act.c: Don't mention yy_cur or parse_options.
	Initialize cpplib properly.  Force lineno to 0 after first
	call to check_newline.  Don't handle -lang-objc here.
	Move forget_protocol_qualifiers and remember_protocol_qualifiers here.

cp:
	* Make-lang.in, Makefile.in: Remove all references to input.c,
	gxx.gperf, and hash.h.  Add ../c-lex.o to C_OBJS.
	* gxx.gperf, hash.h, input.c: Delete.
	* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
	initialized properly.

	* class.c (fixup_pending_inline): Take a tree, not a
	struct pending_inline *.  All callers changed.
	(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
	RID_PROTECTED entries in ridpointers[] array here.
	* decl.c (duplicate_decls): Do not refer to struct
	pending_inline.
	(record_builtin_type, init_decl_processing): Use RID_MAX not
	CP_RID_MAX.
	(grokdeclarator): Use C_IS_RESERVED_WORD.
	* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
	cpplib.
	(grok_x_components): Do not inspect pending_inlines chain.

	* cp-tree.h (struct lang_identifier): Add rid_code entry.
	(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
	(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
	(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
	TIME_IDENTIFIER_FILEINFO): Kill.
	Update prototypes.
	* lex.h: Expunge cp_rid.  Rewrite RIDBIT macros to use just a
	single 32-bit word.
	* parse.y: Call do_pending_inlines unconditionally.
	reinit_parse_for_method is now snarf_method.  fn.defpen is no
	longer necessary.  Remove unnecessary <itype> annotation on
	SCOPE.  Do not refer to end_of_file or struct pending_inline.
	* semantics.c (begin_inline_definitions): Call
	do_pending_inlines unconditionally.

	* lex.c: Remove all code now shared with C front end.
	Initialize cpplib properly if USE_CPPLIB.  Put reserved words
	into the get_identifier table.  Rewrite pragma handling to
	work with the registry.  Move code to save tokens for later
	processing to spew.c.

	* spew.c: Rewrite everything in terms of token streams instead
	of text.  Move routines here from lex.c / input.c as
	appropriate.  GC-mark trees hanging off the pending inlines
	chain.

testsuite:
	* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
	ERROR markers.
	* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
	* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
	* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
	* gcc.dg/wtr-suffix-1.c: Correct error regexps.
	* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
	Preprocess only.
	* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
	* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.

From-SVN: r36216
2000-09-07 00:37:14 +00:00
Zack Weinberg 63ad61edae top level:
* c-common.c (declare_function_name): Use func_id_node,
	function_id_node, and pretty_function_id_node.  Do not make
	__func__ visible at file scope.
	* c-common.h (c_tree_index): Add CTI_FUNCTION_ID,
	CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID.
	(function_id_node, pretty_function_id_node, func_id_node): New
	macros.
	* c-decl.c (init_decl_processing): Initialize function_id_node,
	pretty_function_id_node, and func_id_node.
	(c_make_fname_decl): Correct comment.

	* tree.h (struct tree_identifier): Constify pointer member.

	* c-decl.c (pushdecl, implicit_decl_warning): Constify a char *.
	* c-pragma.h (struct weak_syms): Constify name and value members.
	(add_weak): Constify arguments.

	* calls.c (special_function_p): Constify a char *.
	(expand_call): Remove variable which is initialized and then
	never used.
	* dependence.c (struct def_use, struct induction, struct subscript):
	Constify 'variable' member.
	(get_low_bound, have_induction_variable): Constify char * argument.
	(find_induction_variable): Add braces to avoid dangling else.
	(classify_dependence): Constify char * arrays.
	* profile.c (output_func_start_profiler): Constify a char *.
	* stor-layout.c (finalize_record_size): Constify a char *.
	* tree.c (is_attribute_p): Constify a char *.
	* varasm.c (add_weak, remove_from_pending_weak_list): Constify argument.

	* varasm.c (make_function_rtl, make_decl_rtl): Rearrange code
	for comprehensibility.  Do not call get_identifier if we did
	not change the DECL_ASSEMBLER_NAME of the decl.  Use alloca to
	create temporary string constants, not ggc_alloc_string.  No
	need to copy result of ASM_FORMAT_PRIVATE_NAME.  Use const
	char * to hold IDENTIFIER_POINTERs.
ch:
	* inout.c (add_enum_to_list): Use DECL_NAME directly, don't get
	its IDENTIFIER_POINTER and immediately call get_identifier on it.
	* lex.c (yywrap): Constify a char *.
cp:
	* class.c (build_secondary_vtable): Constify a char *.
	* decl.c (init_decl_processing): Initialize function_id_node,
	pretty_function_id_node, and func_id_node.
	* input.c (struct input_source): Constify 'str'.
	(feed_input): Constify first argument.
	* mangle.c (write_identifier): Constify argument.
	* pt.c (mangle_class_name_for_template): Constify argument.
f:
	* ansify.c: Use #line, not # <number>.
java:
	* jcf-parse.c (set_source_filename): Constify a char *.
	* jcf-write.c (append_innerclasses_attribute,
	make_class_file_name): Constify a char *.  Don't recycle a
	variable for an unrelated purpose.
	* parse.y: (build_alias_initializer_parameter_list): Constify a char *.
	(breakdown_qualified): Do not modify IDENTIFIER_POINTER strings.

From-SVN: r36055
2000-08-29 21:39:49 +00:00
Kaveh R. Ghazi 6e090c767a c-common.c: PROTO -> PARAMS.
* c-common.c: PROTO -> PARAMS.
        * c-common.h: Likewise.
        * c-decl.c: Likewise.
        * c-iterate.c: Likewise.
        * c-lang.c: Likewise.
        * c-lex.c: Likewise.
        * c-lex.h: Likewise.
        * c-parse.in: Likewise.
        * c-pragma.c: Likewise.
        * c-pragma.h: Likewise.
        * c-tree.h: Likewise.
        * c-typeck.c: Likewise.
        * objc/objc-act.c: Likewise.
        * objc/objc-act.h: Likewise.

From-SVN: r31362
2000-01-12 22:47:13 +00:00
Mumit Khan 61e8b354cf Applied Mumit Khan's patch to fix #pragma push/pop handling.
From-SVN: r30084
1999-10-19 10:44:30 +00:00
Richard Henderson 568767a62c c-pragma.c (mark_align_stack): New.
* c-pragma.c (mark_align_stack): New.
        (init_pragma): New.
        * c-pragma.h (init_pragma): Declare it.
        * c-lex.c (init_parse): Call it.

From-SVN: r29502
1999-09-18 11:54:36 -07:00
Geoff Keating fc009f966c Makefile.in (cppexp.o): Depend on cpphash.h.
* Makefile.in (cppexp.o): Depend on cpphash.h.
	* cppexp.c (cpp_lex): Handle `defined (xxx)' for poisoned xxx.
	Include cpphash.h.
	* cpphash.c (special_symbol): Handle plain `xxx' for poisoned xxx.
	* cpplib.c (do_define): Generalise to handle poisoned definitions,
	redefining poisoned identifiers, etc.
	(do_undef): Don't allow poisoned identifiers to be undefined.
	(do_pragma): Add #pragma poison.
	(do_xifdef): Handle `#ifdef xxx' for poisoned xxx.

	* cccp.c: Add T_POISON node type.
	(special_symbol): Handle `defined(xxx)' and plain `xxx' for
	poisoned xxx.
	(do_define): Generalise to handle poisoned definitions,
	redefining poisoned identifiers, etc.
	(do_undef): Don't allow poisoned identifiers to be undefined.
	(do_pragma): Add #pragma poison.
	(do_xifdef): Handle `#ifdef xxx' for poisoned xxx.

	* c-pragma.c (handle_pragma_token): Ignore #pragma poison.
	* c-pragma.h: Add ps_poison state.  We now always have generic
	pragmas.

From-SVN: r29224
1999-09-09 04:00:37 +00:00
Jason Merrill 0f92adae32 c-pragma.c (push_alignment): Don't ignore alignments greater than 4 bytes.
* c-pragma.c (push_alignment): Don't ignore alignments greater than
	4 bytes.
	(handle_pragma_token): Likewise.
	* c-pragma.c: Support for #pragma pack (push, <id>, <n>).
	(struct align_stack): Add id field.
	(push_alignment, pop_alignment): Take id parameter.
	(handle_pragma_token): Add necessary states.
	* c-pragma.h (enum pragma_state): Add necessary states.

From-SVN: r26662
1999-04-26 17:18:08 -04:00
Jeffrey A Law 0e9264a2d4 * c-pragma.c (add_weak); Delete. Moved into...
* varasm.c (add_weak): New external function.
        (declare_weak): If HANDLE_PRAGMA_WEAK, then add the function to
        the list of weak functions.
        * c-pragma (add_weak): Declare.

From-SVN: r25454
1999-02-25 18:29:21 -07:00
Kaveh R. Ghazi 5d5993dd31 bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
        * bitmap.h (bitmap_print): Likewise.
        * c-decl.c (builtin_function, grokdeclarator, grokfield): Likewise.
        * c-lang.c (build_objc_string): Likewise.
        * c-lex.c (yyerror, extend_token_buffer): Likewise.  Don't include
        limits.h or ctype.h.  Remove unused variable `p'.
        * c-lex.h (yyerror): Qualify a char* with the `const' keyword.
        * c-pragma.c (handle_pragma_token): Likewise.
        * c-pragma.h (handle_pragma_token): Likewise.
        * c-tree.h (build_objc_string, builtin_function, grokfield,
        build_indirect_ref, lvalue_or_else, readonly_warning, error_init,
        pedwarn_init): Likewise.
        * c-typeck.c (convert_for_assignment, warn_for_assignment,
        push_string, warning_init, incomplete_type_error,
        build_indirect_ref, lvalue_or_else, readonly_warning,
        build_c_cast, spelling, push_member_name, print_spelling,
        error_init, pedwarn_init, start_init): Likewise.
        * objc/objc-act.c (build_objc_string): Likewise.
        * print-tree.c (print_node_brief, print_node): Likewise.
        * tree.h (lvalue_or_else, print_node, print_node_brief): Likewise.

From-SVN: r25296
1999-02-18 20:38:48 +00:00
Nick Clifton bf294d9262 Fix spelling typo in comment.
From-SVN: r22895
1998-10-07 14:48:02 +00:00
Nick Clifton e2af664c2d Add support for #pragma pack(push,<n>) and #pragma pack(pop).
From-SVN: r22710
1998-10-01 10:50:15 +00:00
Nick Clifton f09db6e0ca Change HANDLE_PRAGMA macro so that it will work with USE_CPPLIB.
Add INSERT_ATTRIBUTES macro.

From-SVN: r22165
1998-09-02 09:59:57 +00:00
Richard Kenner 940d9d638b Update FSF address.
From-SVN: r9959
1995-06-15 07:33:25 -04:00
Jason Merrill daefd78b4c Update weak symbol support
From-SVN: r9697
1995-05-16 01:02:59 +00:00