SET_EXPR_LOCATION (expr, input_location);
if (TREE_THIS_VOLATILE (fn) && cfun)
current_function_returns_abnormally = 1;
+ if (TREE_DEPRECATED (fn)
+ && warning_suppressed_at (input_location,
+ OPT_Wdeprecated_declarations))
+ /* Make the expr consistent with the location. */
+ TREE_NO_WARNING (expr) = true;
if (immediate_invocation_p (fn))
{
tree obj_arg = NULL_TREE, exprimm = expr;
if (TREE_CODE (c) == CALL_EXPR)
suppress_warning (c /* Suppress all warnings. */);
}
+ else if (TREE_DEPRECATED (fn)
+ && warning_suppressed_at (input_location,
+ OPT_Wdeprecated_declarations))
+ {
+ tree c = extract_call_expr (call);
+ if (TREE_CODE (c) == CALL_EXPR)
+ TREE_NO_WARNING (c) = true;
+ }
return call;
}
}
}
else
- warned = warn_deprecated_use (decl, NULL_TREE);
+ {
+ if (!warning_suppressed_at (input_location,
+ OPT_Wdeprecated_declarations))
+ warned = warn_deprecated_use (decl, NULL_TREE);
+ suppress_warning_at (input_location, OPT_Wdeprecated_declarations);
+ }
return warned;
}
orig_fn = sel_fn;
}
- result = build_call_vec (TREE_TYPE (result), orig_fn, orig_args);
- SET_EXPR_LOCATION (result, input_location);
- KOENIG_LOOKUP_P (result) = koenig_p;
+ tree r = build_call_vec (TREE_TYPE (result), orig_fn, orig_args);
+ SET_EXPR_LOCATION (r, input_location);
+ KOENIG_LOOKUP_P (r) = koenig_p;
+ TREE_NO_WARNING (r) = TREE_NO_WARNING (result);
release_tree_vector (orig_args);
- result = convert_from_reference (result);
+ result = convert_from_reference (r);
}
return result;
--- /dev/null
+// { dg-additional-options -fmodules }
+
+export module M;
+
+[[deprecated]] void depr_fn() {}
+
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+export {
+ template <class T> void f(T) { depr_fn(); }
+}
--- /dev/null
+// { dg-additional-options -fmodules }
+
+import M;
+
+int main()
+{
+ f(42);
+}
--- /dev/null
+// { dg-do compile { target c++11 } }
+
+[[deprecated]] void depr_fn() {}
+
+template <class T> void f(T) {
+ depr_fn(); // { dg-warning "deprecated" }
+}
+
+int main()
+{
+ f(42);
+}
bool has_warning_spec (const_tree t)
{
const location_t loc = get_location (t);
- return !RESERVED_LOCATION_P (loc) && !get_no_warning_bit (t);
+ return !RESERVED_LOCATION_P (loc) && get_no_warning_bit (t);
}
/* Retrieve warning dispostion bitmap for tree streaming. */