Commit 5a59b39e by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/39554 (-Wdisallowed-function-list fails when #including <algorithm>)

	PR c++/39554
	* opts.c (warn_if_disallowed_function_p): Don't assume
	get_callee_fndecl must return non-NULL.

	* gcc.dg/wdisallowed-functions-3.c: New test.
	* g++.dg/warn/Wdisallowed-functions-3.C: New test.

From-SVN: r145094
parent d5f89b53
2009-03-26 Jakub Jelinek <jakub@redhat.com>
PR c++/39554
* opts.c (warn_if_disallowed_function_p): Don't assume
get_callee_fndecl must return non-NULL.
2009-03-26 Vladimir Makarov <vmakarov@redhat.com> 2009-03-26 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/39522 PR rtl-optimization/39522
......
...@@ -745,13 +745,21 @@ flag_instrument_functions_exclude_p (tree fndecl) ...@@ -745,13 +745,21 @@ flag_instrument_functions_exclude_p (tree fndecl)
void void
warn_if_disallowed_function_p (const_tree exp) warn_if_disallowed_function_p (const_tree exp)
{ {
if (TREE_CODE(exp) == CALL_EXPR if (TREE_CODE (exp) == CALL_EXPR
&& VEC_length (char_p, warning_disallowed_functions) > 0) && VEC_length (char_p, warning_disallowed_functions) > 0)
{ {
int i; int i;
char *s; char *s;
const char *fnname = tree fndecl = get_callee_fndecl (exp);
IDENTIFIER_POINTER (DECL_NAME (get_callee_fndecl (exp))); const char *fnname;
if (fndecl == NULL)
return;
fnname = get_name (fndecl);
if (fnname == NULL)
return;
for (i = 0; VEC_iterate (char_p, warning_disallowed_functions, i, s); for (i = 0; VEC_iterate (char_p, warning_disallowed_functions, i, s);
++i) ++i)
{ {
......
2009-03-26 Jakub Jelinek <jakub@redhat.com>
PR c++/39554
* gcc.dg/wdisallowed-functions-3.c: New test.
* g++.dg/warn/Wdisallowed-functions-3.C: New test.
2009-03-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2009-03-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/inline-33.c: Fix when pic. * gcc.dg/inline-33.c: Fix when pic.
......
// PR c++/39554
// { dg-do compile }
// { dg-options "-Wdisallowed-function-list=bar" }
void
foo (void (*p) (), void (*bar) ())
{
p ();
bar ();
}
/* PR c++/39554 */
/* { dg-do compile } */
/* { dg-options "-Wdisallowed-function-list=bar" } */
void
foo (void (*p) (void), void (*bar) (void))
{
p ();
bar ();
}
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