Commit Graph

23 Commits

Author SHA1 Message Date
Volker Reichelt
24871154f3 re PR c/23439 ("f(){for" crashes the C frontend)
PR c/23439
	* c-parser.c (c_parser_for_statement): Use location of RID_FOR
	to initialize loc.

	* gcc.dg/for-1.c: New test.

From-SVN: r105422
2005-10-14 21:35:47 +00:00
Andrew Pinski
8f078c0837 re PR objc/20574 (weird error message after a parse error)
2005-09-08  Andrew Pinski  <pinskia@physics.uc.edu>

        PR objc/20574
        PR objc/19324
        * c-parser.c (c_parser_objc_method_definition): If the next
        token is not "{", error out and don't start the function.

2005-09-08  Andrew Pinski  <pinskia@physics.uc.edu>

        PR objc/20574
        PR objc/19324
        * objc.dg/error-1.m: New test.

From-SVN: r104032
2005-09-08 06:09:49 -07:00
Joseph Myers
91d975b88e re PR c/23143 (parameter forward declarations broken)
PR c/23143
	* c-parser.c (c_parser_parms_list_declarator): Call
	mark_forward_parm_decls.
	* c-decl.c (merge_decls): Only check DECL_IN_SYSTEM_HEADER for
	decls with visibility structure.

testsuite:
	* gcc.dg/parm-forwdecl-1.c, gcc.dg/parm-forwdecl-2.c,
	gcc.dg/parm-forwdecl-3.c, gcc.dg/parm-forwdecl-4.c: New tests.

From-SVN: r102581
2005-07-30 02:34:58 +01:00
Joseph Myers
f2a71bbcb2 c-tree.h (default_function_array_conversion): Take and return struct c_expr.
* c-tree.h (default_function_array_conversion): Take and return
	struct c_expr.
	* c-typeck.c (default_function_array_conversion): Split into
	array_to_pointer_conversion and function_to_pointer_conversion.
	Take and return struct c_expr.
	(array_to_pointer_conversion): Do not handle type qualifiers or
	COMPOUND_EXPRs specially.
	(build_function_call): Call function_to_pointer_conversion for
	function designators.
	(build_unary_op): Call array_to_pointer_conversion, not
	default_function_array_conversion.
	(digest_init, output_init_element): Likewise.
	* c-parser.c: All callers of default_function_array_conversion
	changed.

From-SVN: r101440
2005-06-29 23:13:56 +01:00
Kelley Cook
366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Joseph Myers
46bdb9cffb c-tree.h (default_function_array_conversion): Declare.
* c-tree.h (default_function_array_conversion): Declare.
	* c-typeck.c (default_function_array_conversion): Export.  Correct
	comment.
	(default_conversion): Do not call
	default_function_array_conversion.  Do not allow FUNCTION_TYPE.
	(build_function_call): Call default_function_array_conversion on
	the function.
	(convert_arguments): Do not call it on the function arguments.
	(build_unary_op): Do not allow ARRAY_TYPE or FUNCTION_TYPE for
	TRUTH_NOT_EXPR.  Call default_function_array_conversion for taking
	address of ARRAY_REF.
	(build_compound_expr): Do not call
	default_function_array_conversion.
	(build_c_cast): Do not call default_function_array_conversion.
	(convert_for_assignment): Do not call default_conversion.
	(digest_init): Call default_function_array_conversion to convert
	string constants and compound literals to pointers, but not
	otherwise.
	(output_init_element): Likewise.
	(build_asm_expr): Do not call default_function_array_conversion.
	(c_process_expr_stmt): Likewise.
	(c_objc_common_truthvalue_conversion): Likewise.  Do not allow
	FUNCTION_TYPE.
	* c-parser.c (c_parser_expression_conv): New.
	(c_parser_asm_operands, c_parser_expr_list): Add convert_p
	argument.  All callers changed.  Call
	default_function_array_conversion if convert_p.
	(c_parser_initializer, c_parser_initval): Call
	default_function_array_conversion except for string constants and
	compound literals.
	(c_parser_initelt): Call default_function_array_conversion for
	ObjC expression received.
	(c_parser_statement_after_labels): Call c_parser_expression_conv
	for return and expression statements.
	(c_parser_paren_condition, c_parser_for_statement,
	c_parser_conditional_expression): Call c_parser_expression_conv.
	(c_parser_expr_no_commas, c_parser_conditional_expression,
	c_parser_binary_expression, c_parser_cast_expression,
	c_parser_unary_expression): Call
	default_function_array_conversion.

objc:
	* objc-act.c (my_build_string_pointer): New.
	(objc_get_class_reference, get_super_receiver): Call
	my_build_string_pointer instead of my_build_string when building
	function arguments.

testsuite:
	* gcc.dg/noncompile/20040203-3.c: Update expected message.

From-SVN: r100984
2005-06-15 16:55:47 +01:00
Jakub Jelinek
4b794eaf73 exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format.
gcc/po/
	* exgettext: Handle gmsgid and cmsgid arguments specially,
	as gcc-internal-format and c-format.  Because of xgettext
	bug, invoke xgettext once with --language=c, once with
	--language=GCC-source and then merge together.  Fail if
	xgettext is not 0.14.5 or later.
gcc/
	* intl.h (G_): New macro.
	* rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid
	instead of msgid for argument name.
	* tree-ssa.c (warn_uninit): Likewise.
	* c-parser.c (c_parser_error): Likewise.
	* config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise.
	* config/darwin-c.c (BAD): Likewise.
	* config/c4x/c4x-c.c (BAD): Likewise.
	* c-pragma.c (GCC_BAD, GCC_BAD2): Likewise.
	* c-errors.c (pedwarn_c99, pedwarn_c90): Likewise.
	* c-common.c (c_parse_error): Likewise.
	* diagnostic.c (diagnostic_set_info, verbatim, inform, warning,
	warning0, pedwarn, error, sorry, fatal_error, internal_error):
	Likewise.
	(fnotice): Use cmsgid instead of msgid for argument name.
	* gcov.c (fnotice): Likewise.
	* protoize.c (notice): Likewise.
	* final.c (output_operand_lossage): Likewise.
	* gcc.c (fatal, notice): Likewise.
	(error): Use gmsgid instead of msgid for argument name.
	* collect2.c (notice, fatal_perror, fatal): Use cmsgid instead
	of msgid for argument name.
	(error): Use gmsgid instead of msgid for argument name.
	* c-decl.c (locate_old_decl, implicit_decl_warning): Use G_()
	instead of N_().
	* c-typeck.c (readonly_error, convert_for_assignment): Likewise.
	* tree-inline.c (inline_forbidden_p_1): Likewise.
	* ABOUT-GCC-NLS: Require gettext 0.14.5 or later.  Mention the new
	conventions for marking translations.
	* doc/install.texi: Mention gettext 0.14.5 or later requirement.
gcc/cp/
	* error.c (locate_error): Use gmsgid instead of msgid for argument
	name.
	(cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise.
gcc/java/
	* jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of
	msgid for argument name.
	* gjavah.c (error): Likewise.
	* java-tree.h (parse_error_context): Likewise.
	* parse.y (parse_error_context, parse_warning_context,
	issue_warning_error_from_context): Likewise.

From-SVN: r100676
2005-06-06 21:31:40 +02:00
Geoffrey Keating
7fa3585cd4 c-parser.c (c_parser_parms_declarator): Don't use chainon().
* c-parser.c (c_parser_parms_declarator): Don't use chainon().
	(c_parser_expr_list): Don't use chainon().

From-SVN: r100567
2005-06-04 00:06:22 +00:00
Kazu Hirata
0fa2e4df47 c-common.c, [...]: Fix comment typos.
* c-common.c, c-parser.c, cfgbuild.c, cfghooks.c, cfghooks.h,
	cfgrtl.c, cgraphunit.c, ddg.c, expr.h, gcse.c, ggc-page.c,
	ggc-zone.c, gimplify.c, ipa-inline.c, longlong.h, targhooks.c,
	tree-flow-inline.h, tree-pass.h, tree-ssa-dse.c,
	tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c,
	tree-ssa-operands.c, tree-vect-analyze.c,
	tree-vect-transform.c, tree-vectorizer.c, tree.c,
	config/arm/arm.c, config/bfin/bfin.c, config/frv/frv.c,
	config/frv/frv.md, config/i386/i386.c, config/i386/sse.md,
	config/m68hc11/m68hc11.c, config/m68hc11/m68hc11.h,
	config/mcore/mcore.c, config/mips/mips.c, config/mips/mips.md,
	config/rs6000/darwin-ldouble.c, config/rs6000/rs6000.c,
	config/rs6000/rs6000.h, config/sh/sh.c, config/sh/sh.md,
	config/sh/ushmedia.h, config/sparc/sparc.c,
	config/sparc/sparc.md, config/stormy16/stormy-abi: Fix comment
	typos.  Follow spelling conventions.
	* doc/invoke.texi, doc/tm.texi, doc/tree-ssa.texi: Fix typos.
	Follow spelling conventions.

From-SVN: r100218
2005-05-26 18:15:27 +00:00
DJ Delorie
44c21c7f03 c-common.c (unsigned_conversion_warning): Move warning control from if() to warning(OPT_*).
* c-common.c (unsigned_conversion_warning): Move warning control
from if() to warning(OPT_*).
(c_common_truthvalue_conversion): Likewise.
(c_do_switch_warnings): Likewise.
* c-decl.c (diagnose_mismatched_decls): Likewise.
(diagnose_mismatched_decls): Likewise.
(define_label): Likewise.
(grokdeclarator): Likewise.
* c-format.c (check_format_info): Likewise.
* c-lex.c (interpret_integer): Likwise.
(lex_string): Likewise.
* c-opts.c (c_common_post_options): Likewise.
* c-parser.c (c_parser_unary_expression): Likewise.
* c-pragma.c (handle_pragma_redefine_extname): Likewise.
(handle_pragma_extern_prefix): Likewise.
* c-typeck.c (build_binary_op): Likewise.
* gcse.c (is_too_expensive): Likewise.
* opts.c (decode_options): Likewise.
* stor-layout.c (place_field): Likewise.
* tree-cfg.c (remove_bb): Likewise.

* c.opt (-Wreturn-type): Add Var(warn_return_type).
* flags.h (warn_return_type): Remove.
* toplev.c (warn_return_type): Likewise.

From-SVN: r100135
2005-05-24 23:59:00 -04:00
Roger Sayle
43f6dfd3ec c-tree.h (parser_build_unary_op): New prototype.
* c-tree.h (parser_build_unary_op): New prototype.
	* c-typeck.c (parser_build_unary_op): New function to construct
	a unary operation in the C parser.
	* c-parser.c (c_parser_unary_expression):  Use the new function
	parser_build_unary_op when appropriate.

From-SVN: r99471
2005-05-09 20:48:33 +00:00
DJ Delorie
d4ee4d2525 diagnostic.c (warning): Accept parameter to classify warning option.
* diagnostic.c (warning): Accept parameter to classify warning option.
(warning0): New, for when a pointer to an error() like function is needed.
* errors.c (warning): Likewise.
* errors.h (warning, warning0): Adjust prototypes.
* toplev.h (warning, warning0): Likewise.

* attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c,
c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c,
c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c,
fold-const.c, fortran/trans-decl.c, function.c, gcse.c,
genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c,
reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c,
tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c,
tree-ssa.c, tree.c, varasm.c: Adjust warning() callers.

* config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c,
config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c,
config/darwin.c, config/darwin.h, config/h8300/h8300.c,
config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c,
config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c,
config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c,
config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h,
config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h,
config/rs6000/aix52.h, config/rs6000/darwin.h,
config/rs6000/rs6000-c.c, config/rs6000/rs6000.c,
config/s390/s390.c, config/sh/sh.c, config/sh/sh.h,
config/sh/symbian.c, config/sol2-c.c, config/sol2.c,
config/stormy16/stormy16.c, config/v850/v850-c.c,
config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning()
callers.

* ada/misc.c: Adjust warning() callers.

* cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c,
cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c,
cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c,
cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers.

* fortran/trans-decl.c: Adjust warning() callers.

* java/class.c, java/decl.c, java/expr.c, java/jcf-io.c,
java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning()
callers.

* objc/objc-act.c: Adjust warning() callers.

* treelang/parse.y: Adjust warning() callers.

From-SVN: r98633
2005-04-23 17:29:07 -04:00
Roger Sayle
dbb743654f c-common.h (objc_build_method_signature): Update prototype.
* c-common.h (objc_build_method_signature): Update prototype.
	* stub-objc.c (objc_build_method_signature): Update the stub
	implementation to accept and ignore additional parameter.
	* c-parser.c (c_parser_objc_method_decl): Reorgnize to pass
	the value of ellipsis to objc_build_method_signature instead
	of setting TREE_OVERFLOW on the parms TREE_LIST node.

	* objc-act.h (METHOD_ADD_ARGS_ELLIPSIS_P): New macro for accessing
	this field of an objc method decl.
	* objc-act.c (build_method_decl): Take an additional "ellipsis"
	argument, and set METHOD_ADD_ARGS_ELLIPSIS_P as appropriate.
	(objc_build_method_signature): Accept additional "ellipsis"
	argument and pass it to build_method_decl.
	(get_arg_type_list, start_method_def, gen_method_decl): Use
	the new METHOD_ADD_ARGS_ELLIPSIS_P instead of examining the
	TREE_OVERFLOW field of a TREE_LIST node.

From-SVN: r98528
2005-04-21 21:31:40 +00:00
Kazu Hirata
911204fec2 * c-parser.c (N_C_TTYPES): Remove.
From-SVN: r98260
2005-04-17 06:37:15 +00:00
Joseph Myers
d1edc39366 re PR c/20672 (New C parser doesn't check whether functions that end files are closed properly)
PR c/20672
	* c-parser.c (c_parser_compound_statement_nostart): Give error
	message for EOF instead of just setting parser->error.

testsuite:
	* gcc.dg/pr20672-1.c: New test.

From-SVN: r97197
2005-03-29 19:54:44 +01:00
Joseph Myers
8549882418 c-common.c (c_common_truthvalue_conversion): Adjust comment.
* c-common.c (c_common_truthvalue_conversion): Adjust comment.
	Call c_common_truthvalue_conversion rather than
	lang_hooks.truthvalue_conversion.
	* c-convert.c (convert): Call c_objc_common_truthvalue_conversion.
	* c-objc-common.c (c_objc_common_truthvalue_conversion): Move to
	c-typeck.c.
	* c-objc-common.h (LANG_HOOKS_TRUTHVALUE_CONVERSION): Change to
	c_common_truthvalue_conversion.
	* c-parser.c (c_parser_paren_condition, c_parser_for_statement,
	c_parser_conditional_expression, c_parser_binary_expression): Call
	c_objc_common_truthvalue_conversion.
	* c-typeck.c (build_unary_op): Call
	c_objc_common_truthvalue_conversion.
	(build_conditional_expr): Do not call
	lang_hooks.truthvalue_conversion.
	(build_binary_op): Call c_common_truthvalue_conversion.
	(c_objc_common_truthvalue_conversion): Moved from
	c-objc-common.c.  Call default_function_array_conversion instead
	of default_conversion.

objc:
	* objc-act.c (next_sjlj_build_enter_and_setjmp,
	next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally):
	Call c_common_truthvalue_conversion.

From-SVN: r96917
2005-03-23 01:35:06 +00:00
Joseph Myers
f6d1c3a69b c-common.c (handle_aligned_attribute, [...]): Do not strip NOPS from INTEGER_CSTs.
* c-common.c (handle_aligned_attribute, check_function_sentinel,
	get_nonnull_operand, handle_sentinel_attribute,
	check_function_arguments_recurse): Do not strip NOPS from
	INTEGER_CSTs.
	* c-decl.c (check_bitfield_type_and_width, build_enumerator):
	Likewise.
	* c-format.c (get_constant): Likewise.
	* c-parser.c (c_parser_postfix_expression): Likewise.
	* c-typeck.c (set_init_index): Likewise.
	(convert_arguments): Don't check for NOP_EXPR containing integer
	constant.

From-SVN: r96760
2005-03-20 15:23:50 +00:00
Joseph Myers
67c2939d3e re PR c/20402 (gcc.dg/noncompile/920923-1.c ICE)
PR c/20402
	* c-parser.c (c_parser_struct_or_union_specifier): Don't fall
	through into call to parser_xref_tag after parse error.
	(c_parser_struct_declaration): Consistently return NULL_TREE on
	error.

testsuite:
	* gcc.dg/noncompile/920923-1.c: Detail expected diagnostics for
	new parser.

From-SVN: r96363
2005-03-13 01:09:47 +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
Per Bothner
dbce15707a Various fixes to allow us to again build if --enable-mapped-location:
* c-decl.c (finish_function): Use SET_EXPR_LOCATION instead of
	unavailable annotate_with_file_line, if USE_MAPPED_LOCATION.
	* tree-cfg.c (remove_bb): If USE_MAPPED_LOCATION, change type of
	local variable loc. Change logic appropriately.
	* tree-vect-transform.c (vect_finish_stmt_generation): Use
	EXPR_LOCATION rather than EXPR_LOCUS if USE_MAPPED_LOCATION.
	* c-parser.c (c_parser_for_statement): Initialize loc variable.
	* tree.h (DECL_IS_BUILTIN): Temporarily revert definition of
	DECL_IS_BUILTIN in the USE_MAPPED_LOCATION because of jc1 issues.

From-SVN: r96045
2005-03-07 13:14:12 -08:00
Joseph Myers
766beb4020 re PR c/8927 (Gcc give error for wrong line of C code.)
PR c/8927
	* c-tree.h (undeclared_variable, build_external_ref): Add extra
	argument.
	* c-decl.c (undeclared_variable): Take location as argument.
	* c-typeck.c (build_external_ref): Likewise.
	* c-parser.c (c_parser_postfix_expression): Pass location of
	identifier to build_external_ref.

testsuite:
	* gcc.dg/pr8927-1.c: New test.

From-SVN: r95773
2005-03-02 02:50:25 +00:00
Joseph Myers
4e3d914635 re PR c/20245 (ICE on invalid function declaration)
PR c/20245
	* c-parser.c (c_parser_compound_statement): Return error_mark_node
	instead of NULL_TREE on error.

testsuite:
	* gcc.dg/pr20245-1.c: New test.

From-SVN: r95693
2005-02-28 19:22:41 +00:00
Joseph Myers
27bf414caa c-parser.c: New file.
* c-parser.c: New file.
	* c-parse.in: Remove.
	* Makefile.in (c-parse.o-warn, c-parse.o, c-parse.c, c-parse.y):
	Remove.
	(c-parser.o): Add dependencies.
	(C_AND_OBJC_OBJC, C_OBJS, gcc.srcextra, GTFILES, distclean,
	maintainer-clean, TAGS): Update.
	* c-config-lang.in (gtfiles): Update.
	* gengtype-lex.l: Don't handle "@@".
	* stub-objc.c (objc_get_class_ivars, objc_build_throw_stmt,
	objc_build_synchronized, objc_begin_try_stmt,
	objc_begin_catch_clause, objc_finish_catch_clause,
	objc_build_finally_clause, objc_finish_try_stmt): New.
	* c-tree.h (struct c_declspecs): Add declspecs_seen_p and
	type_seen_p.
	(c_parse_init): Update comment.
	* c-decl.c (c_init_decl_processing): Update comment.
	(build_null_declspecs, declspecs_add_qual, declspecs_add_type,
	declspecs_add_scspec, declspecs_add_attrs): Initialize and update
	new c_declspecs members.

objc:
	* Make-lang.in (objc/objc-parse.o-warn, objc/objc-parse.o,
	objc/objc-parse.c, objc/objc-parse.y): Remove
	(OBJC_OBJS, objc.srcextra, objc.tags, objc.mostlyclean,
	objc.distclean, objc.maintainer-clean): Update for new parser.
	* config-lang.in (gtfiles): Update for new parser.

testsuite:
	* gcc.dg/cpp/separate-1.c, gcc.dg/noncompile/971104-1.c,
	gcc.dg/noncompile/990416-1.c: Adjust expected messages for new
	parser.

From-SVN: r95558
2005-02-25 23:20:48 +00:00