This makes clang actually do something for kprintf.  This is a minimal
diff that actually allows some FreeBSD-specific kprintf type
specifiers.  But I'd prefer to do a proper overhaul of this code
upstream first and keep the diffs minimal at this point.

ok?


Index: gnu/llvm/tools/clang/lib/Sema/SemaChecking.cpp
===================================================================
RCS file: /cvs/src/gnu/llvm/tools/clang/lib/Sema/SemaChecking.cpp,v
retrieving revision 1.2
diff -u -p -r1.2 SemaChecking.cpp
--- gnu/llvm/tools/clang/lib/Sema/SemaChecking.cpp      27 Jul 2017 20:15:24 
-0000      1.2
+++ gnu/llvm/tools/clang/lib/Sema/SemaChecking.cpp      6 Aug 2017 19:57:54 
-0000
@@ -6352,8 +6352,9 @@ static void CheckFormatString(Sema &S, c
   }
 
   if (Type == Sema::FST_Printf || Type == Sema::FST_NSString ||
-      Type == Sema::FST_FreeBSDKPrintf || Type == Sema::FST_OSLog ||
-      Type == Sema::FST_OSTrace || Type == Sema::FST_Syslog) {
+      Type == Sema::FST_Kprintf || Type == Sema::FST_FreeBSDKPrintf ||
+      Type == Sema::FST_OSLog || Type == Sema::FST_OSTrace ||
+      Type == Sema::FST_Syslog) {
     CheckPrintfHandler H(
         S, FExpr, OrigFormatExpr, Type, firstDataArg, numDataArgs,
         (Type == Sema::FST_NSString || Type == Sema::FST_OSTrace), Str,
@@ -6363,7 +6364,7 @@ static void CheckFormatString(Sema &S, c
     if (!analyze_format_string::ParsePrintfString(H, Str, Str + StrLen,
                                                   S.getLangOpts(),
                                                   S.Context.getTargetInfo(),
-                                            Type == Sema::FST_FreeBSDKPrintf))
+                Type == Sema::FST_Kprintf || Type == Sema::FST_FreeBSDKPrintf))
       H.DoneProcessing();
   } else if (Type == Sema::FST_Scanf) {
     CheckScanfHandler H(S, FExpr, OrigFormatExpr, Type, firstDataArg,

Reply via email to