[PATCH] D16484: [CUDA] Disallow variadic functions other than printf in device code.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 13:13:57 PST 2016


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

Small nit. LGTM otherwise.


================
Comment at: lib/Sema/SemaDecl.cpp:8291-8293
@@ +8290,5 @@
+    // in device-side CUDA code.
+    if (NewFD->isVariadic() && (NewFD->hasAttr<CUDADeviceAttr>() ||
+                                NewFD->hasAttr<CUDAGlobalAttr>()) &&
+        !(II && II->isStr("printf") && !D.isFunctionDefinition())) {
+      Diag(NewFD->getLocation(), diag::err_variadic_device_fn);
----------------
It would be nice to emit this diagnostics on one side of compilation only.

Nit - unneeded {}


http://reviews.llvm.org/D16484





More information about the cfe-commits mailing list