Commit dd3017e4 by Zack Weinberg

objc-act.c: Change annotate_with_locus to SET_EXPR_LOCATION throughout.

objc:
	* objc-act.c: Change annotate_with_locus to SET_EXPR_LOCATION
	throughout.
	(objc_init): Only set input_line to 0 #ifndef USE_MAPPED_LOCATION.
	(build_selector_translation_table): Use %J in diagnostic
	instead of diddling input_line.  Fix spelling.
testsuite:
	* objc.dg/proto-lossage-4.m: Use long instead of int to avoid
	extra diagnostics on targets with 64-bit pointers.
	* objc.dg/selector-1.m: Adjust dg-warning regexp.

From-SVN: r88072
parent 2fbebc71
2004-09-24 Zack Weinberg <zack@codesourcery.com>
* objc-act.c: Change annotate_with_locus to SET_EXPR_LOCATION
throughout.
(objc_init): Only set input_line to 0 #ifndef USE_MAPPED_LOCATION.
(build_selector_translation_table): Use %J in diagnostic
instead of diddling input_line. Fix spelling.
2004-09-21 Ziemowit Laski <zlaski@apple.com> 2004-09-21 Ziemowit Laski <zlaski@apple.com>
* objc-act.c (objc_fold_objc_type_ref): New function. * objc-act.c (objc_fold_objc_type_ref): New function.
...@@ -225,7 +233,7 @@ ...@@ -225,7 +233,7 @@
(gen_type_name, gen_type_name_0): New functions. (gen_type_name, gen_type_name_0): New functions.
(gen_method_decl): Remove second parameter; call gen_type_name() (gen_method_decl): Remove second parameter; call gen_type_name()
instead of gen_declaration_1(). instead of gen_declaration_1().
(dump_interface): Adjust calls to gen_declaration() and (dump_interface): Adjust calls to gen_declaration() and
gen_method_decl(); do not allocate a separate string buffer. gen_method_decl(); do not allocate a separate string buffer.
(init_objc): Allocate a larger string buffer to accommodate (init_objc): Allocate a larger string buffer to accommodate
dump_interface(); adjust call to build_module_descriptor(); dump_interface(); adjust call to build_module_descriptor();
...@@ -263,7 +271,7 @@ ...@@ -263,7 +271,7 @@
objc_check_decl, build_encode_expr): Remove prototypes. objc_check_decl, build_encode_expr): Remove prototypes.
(imp_count, cat_count): Make GGC-aware. (imp_count, cat_count): Make GGC-aware.
(OBJC_SET_TYPE_NAME): New macro. (OBJC_SET_TYPE_NAME): New macro.
2004-09-03 Ziemowit Laski <zlaski@apple.com> 2004-09-03 Ziemowit Laski <zlaski@apple.com>
* config-lang.in: Update copyright notice. * config-lang.in: Update copyright notice.
...@@ -292,7 +300,7 @@ ...@@ -292,7 +300,7 @@
(build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr().
(build_objc_string_object): Rename prototype to (build_objc_string_object): Rename prototype to
objc_build_string_object(). objc_build_string_object().
2004-09-01 Ziemowit Laski <zlaski@apple.com> 2004-09-01 Ziemowit Laski <zlaski@apple.com>
* objc-act.c (lookup_interface): Make function 'static' and add a * objc-act.c (lookup_interface): Make function 'static' and add a
...@@ -300,7 +308,7 @@ ...@@ -300,7 +308,7 @@
(objc_check_decl, get_class_reference, objc_declare_alias, (objc_check_decl, get_class_reference, objc_declare_alias,
objc_declare_class, objc_is_object_ptr): Call objc_is_class_name() objc_declare_class, objc_is_object_ptr): Call objc_is_class_name()
instead of is_class_name(). instead of is_class_name().
(get_super_receiver, objc_clear_super_receiver): Call (get_super_receiver, objc_clear_super_receiver): Call
objc_get_current_scope() instead of get_current_scope(). objc_get_current_scope() instead of get_current_scope().
(is_class_name): Rename to objc_is_class_name. (is_class_name): Rename to objc_is_class_name.
(lookup_objc_ivar): Rename to objc_lookup_ivar. (lookup_objc_ivar): Rename to objc_lookup_ivar.
...@@ -324,11 +332,11 @@ ...@@ -324,11 +332,11 @@
(LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS, (LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS,
LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION, LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION,
LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS, LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS,
LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P, LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P,
LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE, LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE,
LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION, LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION,
LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL, LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL,
LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME,
LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL,
LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED, LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED,
LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL,
......
...@@ -534,10 +534,12 @@ objc_init (void) ...@@ -534,10 +534,12 @@ objc_init (void)
#endif #endif
return false; return false;
#ifndef USE_MAPPED_LOCATION
/* Force the line number back to 0; check_newline will have /* Force the line number back to 0; check_newline will have
raised it to 1, which will make the builtin functions appear raised it to 1, which will make the builtin functions appear
not to be built in. */ not to be built in. */
input_line = 0; input_line = 0;
#endif
/* If gen_declaration desired, open the output file. */ /* If gen_declaration desired, open the output file. */
if (flag_gen_declaration) if (flag_gen_declaration)
...@@ -2305,15 +2307,8 @@ build_selector_translation_table (void) ...@@ -2305,15 +2307,8 @@ build_selector_translation_table (void)
} }
} }
if (!found) if (!found)
{ warning ("%Jcreating selector for nonexistent method %qE",
/* Adjust line number for warning message. */ TREE_PURPOSE (chain), TREE_VALUE (chain));
int save_lineno = input_line;
if (flag_next_runtime && TREE_PURPOSE (chain))
input_line = DECL_SOURCE_LINE (TREE_PURPOSE (chain));
warning ("creating selector for non existant method %s",
IDENTIFIER_POINTER (TREE_VALUE (chain)));
input_line = save_lineno;
}
} }
expr = build_selector (TREE_VALUE (chain)); expr = build_selector (TREE_VALUE (chain));
...@@ -3031,11 +3026,11 @@ next_sjlj_build_catch_list (void) ...@@ -3031,11 +3026,11 @@ next_sjlj_build_catch_list (void)
{ {
t = build (MODIFY_EXPR, void_type_node, cur_try_context->rethrow_decl, t = build (MODIFY_EXPR, void_type_node, cur_try_context->rethrow_decl,
cur_try_context->caught_decl); cur_try_context->caught_decl);
annotate_with_locus (t, cur_try_context->end_catch_locus); SET_EXPR_LOCATION (t, cur_try_context->end_catch_locus);
append_to_statement_list (t, last); append_to_statement_list (t, last);
t = next_sjlj_build_try_exit (); t = next_sjlj_build_try_exit ();
annotate_with_locus (t, cur_try_context->end_catch_locus); SET_EXPR_LOCATION (t, cur_try_context->end_catch_locus);
append_to_statement_list (t, last); append_to_statement_list (t, last);
} }
...@@ -3096,18 +3091,18 @@ next_sjlj_build_try_catch_finally (void) ...@@ -3096,18 +3091,18 @@ next_sjlj_build_try_catch_finally (void)
/* Build the outermost varible binding level. */ /* Build the outermost varible binding level. */
bind = build (BIND_EXPR, void_type_node, rethrow_decl, NULL, NULL); bind = build (BIND_EXPR, void_type_node, rethrow_decl, NULL, NULL);
annotate_with_locus (bind, cur_try_context->try_locus); SET_EXPR_LOCATION (bind, cur_try_context->try_locus);
TREE_SIDE_EFFECTS (bind) = 1; TREE_SIDE_EFFECTS (bind) = 1;
/* Initialize rethrow_decl. */ /* Initialize rethrow_decl. */
t = build (MODIFY_EXPR, void_type_node, rethrow_decl, t = build (MODIFY_EXPR, void_type_node, rethrow_decl,
convert (objc_object_type, null_pointer_node)); convert (objc_object_type, null_pointer_node));
annotate_with_locus (t, cur_try_context->try_locus); SET_EXPR_LOCATION (t, cur_try_context->try_locus);
append_to_statement_list (t, &BIND_EXPR_BODY (bind)); append_to_statement_list (t, &BIND_EXPR_BODY (bind));
/* Build the outermost TRY_FINALLY_EXPR. */ /* Build the outermost TRY_FINALLY_EXPR. */
try_fin = build (TRY_FINALLY_EXPR, void_type_node, NULL, NULL); try_fin = build (TRY_FINALLY_EXPR, void_type_node, NULL, NULL);
annotate_with_locus (try_fin, cur_try_context->try_locus); SET_EXPR_LOCATION (try_fin, cur_try_context->try_locus);
TREE_SIDE_EFFECTS (try_fin) = 1; TREE_SIDE_EFFECTS (try_fin) = 1;
append_to_statement_list (try_fin, &BIND_EXPR_BODY (bind)); append_to_statement_list (try_fin, &BIND_EXPR_BODY (bind));
...@@ -3127,11 +3122,11 @@ next_sjlj_build_try_catch_finally (void) ...@@ -3127,11 +3122,11 @@ next_sjlj_build_try_catch_finally (void)
} }
else else
catch_seq = next_sjlj_build_exc_extract (rethrow_decl); catch_seq = next_sjlj_build_exc_extract (rethrow_decl);
annotate_with_locus (catch_seq, cur_try_context->end_try_locus); SET_EXPR_LOCATION (catch_seq, cur_try_context->end_try_locus);
/* Build the main register-and-try if statement. */ /* Build the main register-and-try if statement. */
t = next_sjlj_build_enter_and_setjmp (); t = next_sjlj_build_enter_and_setjmp ();
annotate_with_locus (t, cur_try_context->try_locus); SET_EXPR_LOCATION (t, cur_try_context->try_locus);
COND_EXPR_THEN (t) = catch_seq; COND_EXPR_THEN (t) = catch_seq;
COND_EXPR_ELSE (t) = cur_try_context->try_body; COND_EXPR_ELSE (t) = cur_try_context->try_body;
TREE_OPERAND (try_fin, 0) = t; TREE_OPERAND (try_fin, 0) = t;
...@@ -3141,7 +3136,7 @@ next_sjlj_build_try_catch_finally (void) ...@@ -3141,7 +3136,7 @@ next_sjlj_build_try_catch_finally (void)
t = build_stmt (COND_EXPR, t = build_stmt (COND_EXPR,
lang_hooks.truthvalue_conversion (rethrow_decl), lang_hooks.truthvalue_conversion (rethrow_decl),
NULL, t); NULL, t);
annotate_with_locus (t, cur_try_context->finally_locus); SET_EXPR_LOCATION (t, cur_try_context->finally_locus);
append_to_statement_list (t, &TREE_OPERAND (try_fin, 1)); append_to_statement_list (t, &TREE_OPERAND (try_fin, 1));
append_to_statement_list (cur_try_context->finally_body, append_to_statement_list (cur_try_context->finally_body,
...@@ -3152,7 +3147,7 @@ next_sjlj_build_try_catch_finally (void) ...@@ -3152,7 +3147,7 @@ next_sjlj_build_try_catch_finally (void)
t = build_stmt (COND_EXPR, t = build_stmt (COND_EXPR,
lang_hooks.truthvalue_conversion (rethrow_decl), lang_hooks.truthvalue_conversion (rethrow_decl),
t, NULL); t, NULL);
annotate_with_locus (t, cur_try_context->end_finally_locus); SET_EXPR_LOCATION (t, cur_try_context->end_finally_locus);
append_to_statement_list (t, &TREE_OPERAND (try_fin, 1)); append_to_statement_list (t, &TREE_OPERAND (try_fin, 1));
return bind; return bind;
...@@ -3293,12 +3288,12 @@ objc_finish_try_stmt (void) ...@@ -3293,12 +3288,12 @@ objc_finish_try_stmt (void)
if (c->catch_list) if (c->catch_list)
{ {
stmt = build_stmt (TRY_CATCH_EXPR, stmt, c->catch_list); stmt = build_stmt (TRY_CATCH_EXPR, stmt, c->catch_list);
annotate_with_locus (stmt, cur_try_context->try_locus); SET_EXPR_LOCATION (stmt, cur_try_context->try_locus);
} }
if (c->finally_body) if (c->finally_body)
{ {
stmt = build_stmt (TRY_FINALLY_EXPR, stmt, c->finally_body); stmt = build_stmt (TRY_FINALLY_EXPR, stmt, c->finally_body);
annotate_with_locus (stmt, cur_try_context->try_locus); SET_EXPR_LOCATION (stmt, cur_try_context->try_locus);
} }
} }
add_stmt (stmt); add_stmt (stmt);
...@@ -3345,13 +3340,13 @@ objc_build_synchronized (location_t start_locus, tree mutex, tree body) ...@@ -3345,13 +3340,13 @@ objc_build_synchronized (location_t start_locus, tree mutex, tree body)
mutex = save_expr (mutex); mutex = save_expr (mutex);
args = tree_cons (NULL, mutex, NULL); args = tree_cons (NULL, mutex, NULL);
call = build_function_call (objc_sync_enter_decl, args); call = build_function_call (objc_sync_enter_decl, args);
annotate_with_locus (call, start_locus); SET_EXPR_LOCATION (call, start_locus);
add_stmt (call); add_stmt (call);
/* Build the mutex unlock. */ /* Build the mutex unlock. */
args = tree_cons (NULL, mutex, NULL); args = tree_cons (NULL, mutex, NULL);
call = build_function_call (objc_sync_exit_decl, args); call = build_function_call (objc_sync_exit_decl, args);
annotate_with_locus (call, input_location); SET_EXPR_LOCATION (call, input_location);
/* Put the that and the body in a TRY_FINALLY. */ /* Put the that and the body in a TRY_FINALLY. */
objc_begin_try_stmt (start_locus, body); objc_begin_try_stmt (start_locus, body);
......
2004-09-24 Zack Weinberg <zack@codesourcery.com>
* objc.dg/proto-lossage-4.m: Use long instead of int to avoid
extra diagnostics on targets with 64-bit pointers.
* objc.dg/selector-1.m: Adjust dg-warning regexp.
2004-09-24 Joseph S. Myers <jsm@polyomino.org.uk> 2004-09-24 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17188 PR c/17188
......
...@@ -7,25 +7,25 @@ ...@@ -7,25 +7,25 @@
typedef struct objc_object { struct objc_class *class_pointer; } *id; typedef struct objc_object { struct objc_class *class_pointer; } *id;
@protocol Proto @protocol Proto
- (int)someValue; - (long)someValue;
@end @end
@interface Obj @interface Obj
- (int)anotherValue; - (long)anotherValue;
@end @end
int foo(void) { long foo(void) {
int receiver = 2; long receiver = 2;
Obj *objrcvr; Obj *objrcvr;
Obj <Proto> *objrcvr2; Obj <Proto> *objrcvr2;
receiver += [receiver someValue]; /* { dg-warning "invalid receiver type .int( )?." } */ receiver += [receiver someValue]; /* { dg-warning "invalid receiver type .long int." } */
/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 22 } */ /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 22 } */
/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 22 } */ /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 22 } */
/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 22 } */ /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 22 } */
/* { dg-warning "assignment makes integer from pointer without a cast" "" { target *-*-* } 22 } */ /* { dg-warning "assignment makes integer from pointer without a cast" "" { target *-*-* } 22 } */
receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver type .int( )?." } */ receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver type .long int." } */
/* { dg-warning "assignment makes integer from pointer without a cast" "" { target *-*-* } 28 } */ /* { dg-warning "assignment makes integer from pointer without a cast" "" { target *-*-* } 28 } */
receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */ receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */
......
...@@ -19,7 +19,7 @@ typedef struct objc_selector *SEL; ...@@ -19,7 +19,7 @@ typedef struct objc_selector *SEL;
- (void) foo - (void) foo
{ {
SEL a,b,c; SEL a,b,c;
a = @selector(b1ar); /* { dg-warning "creating selector for non existant method b1ar" } */ a = @selector(b1ar); /* { dg-warning "creating selector for nonexistent method .b1ar." } */
b = @selector(bar); b = @selector(bar);
} }
@end @end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment