diff options
author | Devang Patel <dpatel@apple.com> | 2002-08-08 16:14:19 -0700 |
---|---|---|
committer | Devang Patel <dpatel@gcc.gnu.org> | 2002-08-08 16:14:19 -0700 |
commit | 7b9be5c7cbb31b0aad7ca2ce3b0d31b322aa2d42 (patch) | |
tree | 1c3d5900b372fd225e1625f1a80348962ade8465 /gcc/objc | |
parent | 6fde981568f348315bc0ba2b656c0a0b94f27b31 (diff) | |
download | gcc-7b9be5c7cbb31b0aad7ca2ce3b0d31b322aa2d42.zip gcc-7b9be5c7cbb31b0aad7ca2ce3b0d31b322aa2d42.tar.gz gcc-7b9be5c7cbb31b0aad7ca2ce3b0d31b322aa2d42.tar.bz2 |
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
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/objc-act.c | 26 |
1 files changed, 26 insertions, 0 deletions
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) |