On 12/4/24 8:26 AM, Matthew Malcomson wrote:
Attaching a patch with the changes requested.
Have adjusted the case statement formatting back to how it was
beforehand (also sending a separate patch for the relevant clang-format
config change
https://gcc.gnu.org/pipermail/gcc-patches/2024-December/670805.html ).
The clang-format config patch is OK.
Have removed `N.b.` from various comments I added to the source.
Blocked warnings under the same `complain` flag as requested (did not
have to change the testsuite since the warning is still emitted when
that variant is chosen, just emitted on a second call to
`finish_call_expr` after the correct template instantiation is chosen.
I didn't realise that would happen and it makes this change a much
clearer win than I expected).
I did not change how the `complain` flag is set when passing it in as
I'd asked about in an earlier email. This because the flag I'm passing
is a boolean (matching other calls into c-common.cc functions) and the
behaviour decision is to choose between both or neither of errors and
warnings. No reduction of the `tsubst_flags` bitflags can fully
represent the choice. Since there are only two warnings and many errors
in this chunk of code, I think the closest mapping of behaviour seems to
be to only focus on `tf_error`.
As it stands, the complain flags passed into `finish_call_expr` (and
hence used when calling `resolve_overloaded_builtin`) have either both
flags set or neither. So the choice doesn't actually change
----
Since you mentioned that the discrepency between clang and GCC about
this SFINAE multiple definitions thing may be a clang bug -- should I
remove mention of it in the commit message?
Yeah, it doesn't seem relevant to this change.
@@ -7752,7 +7859,7 @@ get_atomic_generic_size (location_t loc, tree function,
it by using TREE_INT_CST_LOW instead of tree_to_*hwi. Those high
bits will be checked later during expansion in target specific
way. */
- if (memmodel_base (TREE_INT_CST_LOW (p)) >= MEMMODEL_LAST)
+ if (memmodel_base (TREE_INT_CST_LOW (p)) >= MEMMODEL_LAST && complain)
warning_at (loc, OPT_Winvalid_memory_model,
"invalid memory model argument %d of %qE", x + 1,
function);
@@ -8383,7 +8491,7 @@ resolve_overloaded_builtin (location_t loc, tree function,
/* This target doesn't have, or doesn't need, active mitigation
against incorrect speculative execution. Simply return the
first parameter to the builtin. */
- if (!targetm.have_speculation_safe_value (false))
+ if (!targetm.have_speculation_safe_value (false) && complain)
/* The user has invoked __builtin_speculation_safe_value
even though __HAVE_SPECULATION_SAFE_VALUE is not
defined: emit a warning. */
In these places I was thinking that if !complain we want to return
error_mark_node to eliminate the candidate rather than continue and
possibly choose the candidate with these problems.
Jason