[PATCH] D25936: Fix format string for err_os_log_argument_to_big (currently unused)

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 05:48:58 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL285065: Fix diagnostic format string for err_os_log_argument_to_big (authored by d0k).

Changed prior to commit:
  https://reviews.llvm.org/D25936?vs=75685&id=75687#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25936

Files:
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/test/SemaObjC/format-strings-oslog.m


Index: cfe/trunk/test/SemaObjC/format-strings-oslog.m
===================================================================
--- cfe/trunk/test/SemaObjC/format-strings-oslog.m
+++ cfe/trunk/test/SemaObjC/format-strings-oslog.m
@@ -36,6 +36,9 @@
   wchar_t wcs[] = {'a', 0};
   __builtin_os_log_format(buf, "%S", wcs);
   printf("%S", wcs);
+
+  struct { char data[0x100]; } toobig;
+  __builtin_os_log_format(buf, "%s", toobig); // expected-error {{os_log() argument 2 is too big (256 bytes, max 255)}}
 }
 
 // Test os_log_format primitive with ObjC string literal format argument.
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -7570,7 +7570,7 @@
 def err_os_log_format_not_string_constant : Error<
   "os_log() format argument is not a string constant">;
 def err_os_log_argument_too_big : Error<
-  "os_log() argument %d is too big (%d bytes, max %d)">;
+  "os_log() argument %0 is too big (%1 bytes, max %2)">;
 def warn_os_log_format_narg : Error<
  "os_log() '%%n' format specifier is not allowed">, DefaultError;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25936.75687.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161025/e286e73f/attachment.bin>


More information about the cfe-commits mailing list