================
@@ -624,6 +624,10 @@ following requirements:
 The attribute shall be present on the first declaration of a function and
 may optionally be present on subsequent declarations.
 
+The attribute is ignored, with a warning, when applied to a variadic function.
+A variadic function cannot be called from device code, so there is no reason to
+emit device code for one.
----------------
tahonermann wrote:

It's a little funny that we document this with a statement that "there is no 
reason to emit device code for one" and then have a test which validates that a 
variadic function is actually emitted if ODR-used (in a way other than a 
function call).

With the PR as is, we're arguably introducing a strange inconsistency by 
allowing a variadic function to be ODR-used if the ODR-use is in the same 
translation unit as the function, but not permitting such an ODR-use to occur 
from another translation unit (because ignoring `SYCL_EXTERNAL` prevents that).

I think we should proceed with the behavior in the PR for now. I filed a 
request with the Khronos Group to clarify what the intended behavior is. If and 
when the intended behavior is made clear, we can adjust the behavior 
accordingly.
- [SYCL-Docs #1061](https://github.com/KhronosGroup/SYCL-Docs/issues/1061): Can 
a variadic function be ODR-used by device code as long as it isn't called?

In the meantime, how about a tweak to note the special case?
```suggestion
SYCL prohibits calls to a variadic function in device functions. Since there is
little reason to emit a function that cannot be called, the attribute is 
ignored,
with a warning, when applied to a variadic function.
```

https://github.com/llvm/llvm-project/pull/216393
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to