From 7b9be5c7cbb31b0aad7ca2ce3b0d31b322aa2d42 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 8 Aug 2002 16:14:19 -0700 Subject: objc-act.c (build_selector_translation_table): Issue warning... * objc/objc-act.c (build_selector_translation_table): Issue warning, when -Wselector is used,if method for which selector is being created does not exist. Testsuite: *objc.dg/selector-1.m: New test From-SVN: r56142 --- gcc/objc/objc-act.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gcc/objc') diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 7ebb9f2..c16e57c 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1886,6 +1886,32 @@ build_selector_translation_table () { tree expr; + if (warn_selector && objc_implementation_context) + { + tree method_chain; + bool found = false; + for (method_chain = meth_var_names_chain; + method_chain; + method_chain = TREE_CHAIN (method_chain)) + { + if (TREE_VALUE (method_chain) == TREE_VALUE (chain)) + { + found = true; + break; + } + } + if (!found) + { + /* Adjust line number for warning message. */ + int save_lineno = lineno; + if (flag_next_runtime && TREE_PURPOSE (chain)) + lineno = DECL_SOURCE_LINE (TREE_PURPOSE (chain)); + warning ("creating selector for non existant method %s", + IDENTIFIER_POINTER (TREE_VALUE (chain))); + lineno = save_lineno; + } + } + expr = build_selector (TREE_VALUE (chain)); if (flag_next_runtime) -- cgit v1.1