================
@@ -4742,6 +4742,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
     Args.ClaimAllArgs(options::OPT_gen_cdb_fragment_path);
   }
 
+  if (TC.getTriple().isAMDGPU() && types::isOpenCL(Input.getType())) {
+    if (Args.getLastArg(options::OPT_mprintf_kind_EQ)) {
+      CmdArgs.push_back(Args.MakeArgString(
+          "-mprintf-kind=" +
+          Args.getLastArgValue(options::OPT_mprintf_kind_EQ)));
+      // Force compiler error on invalid conversion specifiers
+      
CmdArgs.push_back(Args.MakeArgString("-Werror=format-invalid-specifier"));
----------------
ssahasra wrote:

Actually this is important. Converting a warning into an error can cause 
surprises when users build existing applications. It is upto the user to decide 
if they want this to be an error, which is why it is a command-line option. 
Even if the spec says undefined behaviour, we should just do something 
reasonable and accept whatever the user wrote without forcing an error. There 
is a lot of freedom in deciding what is "something reasonable" ... we could 
choose to print nothing, or a default value, or a placeholder instead of the 
actual printf format string, etc.

https://github.com/llvm/llvm-project/pull/72556
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to