On 12/6/24 12:01 PM, Matthew Malcomson wrote:
On 12/4/24 19:09, Jason Merrill wrote:
External email: Use caution opening links or attachments
@@ -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.
Ah -- I see. (And it was obvious in what you wrote so I'm not quite
sure why I didn't see before -- apologies).
Attached patch with this on -- have bootstrapped & regtested this on
AArch64.
N.b. this does mean that we now have a different SFINAE behaviour to
clang on `__atomic_load(x, y, 12)` -- we fail that and clang accepts it.
I added that as a disclaimer to the patch cover letter.
Sounds good.
+++ b/gcc/c-family/c-common.h
@@ -859,8 +859,9 @@ extern void check_function_arguments_recurse (void (*)
void *, tree,
unsigned HOST_WIDE_INT,
opt_code);
-extern bool check_builtin_function_arguments (location_t, vec<location_t>,
- tree, tree, int, tree *);
+extern bool
+check_builtin_function_arguments (location_t, vec<location_t>, tree, tree, int,
+ tree *, bool = true);
extern void check_function_format (const_tree, tree, int, tree *,
vec<location_t> *,
bool (*comp_types) (tree, tree));
@@ -1105,7 +1106,8 @@ extern tree build_function_call_vec (location_t,
vec<location_t>, tree,
vec<tree, va_gc> *, vec<tree, va_gc> *,
tree = NULL_TREE);
-extern tree resolve_overloaded_builtin (location_t, tree, vec<tree, va_gc> *);
+extern tree
+resolve_overloaded_builtin (location_t, tree, vec<tree, va_gc> *, bool = true);
The GNU coding standards convention of putting the function name at the
beginning of the line is only for definitions, I believe to help tools
like etags find them. I don't know whether also doing that with forward
declarations will confuse those tools, but it's generally not done in
GCC, so please revert that change here and elsewhere in the patch.
OK with that change.
Jason