diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-10-25 12:39:28 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-10-25 12:39:28 +0000 |
commit | 7dc585763ee2a6d196760a5530c70b6db96351fe (patch) | |
tree | 39ed859545e1e2e9c794e4bcc57cfebaba16f33f | |
parent | 20aa1779d0ed3f5ded95a04717851e5acfc949f2 (diff) | |
download | bcm5719-llvm-7dc585763ee2a6d196760a5530c70b6db96351fe.tar.gz bcm5719-llvm-7dc585763ee2a6d196760a5530c70b6db96351fe.zip |
Fix diagnostic format string for err_os_log_argument_to_big
Patch by Sam McCall, test case by me.
Differential Revision: https://reviews.llvm.org/D25936
llvm-svn: 285065
-rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
-rw-r--r-- | clang/test/SemaObjC/format-strings-oslog.m | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 320fb5da689..4b0ed6b02f6 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7570,7 +7570,7 @@ def warn_cfstring_truncated : Warning< 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; diff --git a/clang/test/SemaObjC/format-strings-oslog.m b/clang/test/SemaObjC/format-strings-oslog.m index 3101a677960..15c88e1b379 100644 --- a/clang/test/SemaObjC/format-strings-oslog.m +++ b/clang/test/SemaObjC/format-strings-oslog.m @@ -36,6 +36,9 @@ void test_os_log_format(const char *pc, int i, void *p, void *buf) { 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. |