https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90451

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The 3 messages are there because we call mark_used 3 times in that case:
#4  0x0000000002506120 in warning (opt=457, gmsgid=0x27bc403 "%qD is
deprecated: %s") at ../../gcc/diagnostic.c:1320
#5  0x000000000194a43b in warn_deprecated_use (node=<function_decl
0x7fffea951d00 static_deprecate>, attr=<tree_list 0x7fffea963078>)
    at ../../gcc/tree.c:13033
#6  0x0000000000a0ac99 in cp_warn_deprecated_use (decl=<function_decl
0x7fffea951d00 static_deprecate>, complain=3) at ../../gcc/cp/decl2.c:5387
#7  0x0000000000a0c729 in mark_used (decl=<function_decl 0x7fffea951d00
static_deprecate>, complain=3) at ../../gcc/cp/decl2.c:5507
#8  0x0000000000bd4e01 in finish_qualified_id_expr
(qualifying_class=<record_type 0x7fffea962000 myclass>, expr=<baselink
0x7fffea961810>, 
    done=false, address_p=false, template_p=false, template_arg_p=false,
complain=3) at ../../gcc/cp/semantics.c:2119
#9  0x0000000000bdd7e6 in finish_id_expression_1
(id_expression=<identifier_node 0x7fffea960a40 static_deprecate>, 
    decl=<baselink 0x7fffea961810>, scope=<record_type 0x7fffea962000 myclass>,
idk=0x7fffffffc14c, integral_constant_expression_p=false, 
    allow_non_integral_constant_expression_p=false,
non_integral_constant_expression_p=0x7fffea8237e5, template_p=false,
done=false, 
    address_p=false, template_arg_p=false, error_msg=0x7fffffffbcf8,
location=295727) at ../../gcc/cp/semantics.c:3918
#10 0x0000000000bddea7 in finish_id_expression (id_expression=<identifier_node
0x7fffea960a40 static_deprecate>, decl=<baselink 0x7fffea961810>, 
    scope=<record_type 0x7fffea962000 myclass>, idk=0x7fffffffc14c,
integral_constant_expression_p=false, 
    allow_non_integral_constant_expression_p=false,
non_integral_constant_expression_p=0x7fffea8237e5, template_p=false,
done=false, 
    address_p=false, template_arg_p=false, error_msg=0x7fffffffbcf8,
location=295727) at ../../gcc/cp/semantics.c:4029
first, then
#4  0x0000000002506120 in warning (opt=457, gmsgid=0x27bc403 "%qD is
deprecated: %s") at ../../gcc/diagnostic.c:1320
#5  0x000000000194a43b in warn_deprecated_use (node=<function_decl
0x7fffea951d00 static_deprecate>, attr=<tree_list 0x7fffea963078>)
    at ../../gcc/tree.c:13033
#6  0x0000000000a0ac99 in cp_warn_deprecated_use (decl=<function_decl
0x7fffea951d00 static_deprecate>, complain=3) at ../../gcc/cp/decl2.c:5387
#7  0x0000000000a0c729 in mark_used (decl=<function_decl 0x7fffea951d00
static_deprecate>, complain=3) at ../../gcc/cp/decl2.c:5507
#8  0x00000000008f1dba in build_over_call (cand=0x35231d0, flags=3, complain=3)
at ../../gcc/cp/call.c:8947
#9  0x00000000008f6e09 in build_new_method_call_1 (instance=<indirect_ref
0x7fffea94fd40>, fns=<function_decl 0x7fffea951d00 static_deprecate>, 
    args=0x7fffffffc0d0, conversion_path=<tree_binfo 0x7fffea956420>, flags=3,
fn_p=0x0, complain=3) at ../../gcc/cp/call.c:10194
#10 0x00000000008f72f7 in build_new_method_call (instance=<indirect_ref
0x7fffea94fd40>, fns=<baselink 0x7fffea961810>, args=0x7fffffffc0d0, 
    conversion_path=<tree 0x0>, flags=3, fn_p=0x0, complain=3) at
../../gcc/cp/call.c:10269
#11 0x0000000000bd63d7 in finish_call_expr (fn=<baselink 0x7fffea961810>,
args=0x7fffffffc0d0, disallow_virtual=true, koenig_p=false, complain=3)
    at ../../gcc/cp/semantics.c:2585
and finally
#4  0x0000000002506120 in warning (opt=457, gmsgid=0x27bc403 "%qD is
deprecated: %s") at ../../gcc/diagnostic.c:1320
#5  0x000000000194a43b in warn_deprecated_use (node=<function_decl
0x7fffea951d00 static_deprecate>, attr=<tree_list 0x7fffea963078>)
    at ../../gcc/tree.c:13033
#6  0x0000000000a0ac99 in cp_warn_deprecated_use (decl=<function_decl
0x7fffea951d00 static_deprecate>, complain=3) at ../../gcc/cp/decl2.c:5387
#7  0x0000000000a0c729 in mark_used (decl=<function_decl 0x7fffea951d00
static_deprecate>, complain=3) at ../../gcc/cp/decl2.c:5507
#8  0x0000000000c43ef5 in cp_build_addr_expr_1 (arg=<function_decl
0x7fffea951d00 static_deprecate>, strict_lvalue=false, complain=3)
    at ../../gcc/cp/typeck.c:6256
#9  0x0000000000c44483 in cp_build_addr_expr (arg=<function_decl 0x7fffea951d00
static_deprecate>, complain=3) at ../../gcc/cp/typeck.c:6304
#10 0x0000000000c34308 in decay_conversion (exp=<function_decl 0x7fffea951d00
static_deprecate>, complain=3, reject_builtin=false)
    at ../../gcc/cp/typeck.c:2097
#11 0x00000000008d173f in build_addr_func (function=<function_decl
0x7fffea951d00 static_deprecate>, complain=3) at ../../gcc/cp/call.c:287
#12 0x00000000008f20c5 in build_over_call (cand=0x35231d0, flags=3, complain=3)
at ../../gcc/cp/call.c:8974
#13 0x00000000008f6e09 in build_new_method_call_1 (instance=<indirect_ref
0x7fffea94fd40>, fns=<function_decl 0x7fffea951d00 static_deprecate>, 
    args=0x7fffffffc0d0, conversion_path=<tree_binfo 0x7fffea956420>, flags=3,
fn_p=0x0, complain=3) at ../../gcc/cp/call.c:10194
#14 0x00000000008f72f7 in build_new_method_call (instance=<indirect_ref
0x7fffea94fd40>, fns=<baselink 0x7fffea961810>, args=0x7fffffffc0d0, 
    conversion_path=<tree 0x0>, flags=3, fn_p=0x0, complain=3) at
../../gcc/cp/call.c:10269
#15 0x0000000000bd63d7 in finish_call_expr (fn=<baselink 0x7fffea961810>,
args=0x7fffffffc0d0, disallow_virtual=true, koenig_p=false, complain=3)
    at ../../gcc/cp/semantics.c:2585

Now, we can't really cache on the decl whether we've already warned about the
deprecated use, because we do want to warn if the deprecated function is called
multiple times.  So, either we need to avoid calling mark_used for the same
expression multiple times, or we need some other way how to avoid the dups.

Reply via email to