RESOLVED FIXED297946
Enable format string attributes in Objective-C++ sources
https://bugs.webkit.org/show_bug.cgi?id=297946
Summary Enable format string attributes in Objective-C++ sources
David Kilzer (:ddkilzer)
Reported 2025-08-26 19:43:26 PDT
Remove hack that disables format string attributes in Objective-C++ sources. This is the code that disables format string attributes in Source/WTF/wtf/Assertions.h: ``` #if COMPILER(GCC_COMPATIBLE) && !defined(__OBJC__) /* WTF logging functions can process %@ in the format string to log a NSObject* but the printf format attribute emits a warning when %@ is used in the format string. Until <rdar://problem/5195437> is resolved we can't include the attribute when being used from Objective-C code in case it decides to use %@. */ #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__((__format__(printf, formatStringArgument, extraArguments))) #else #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) #endif ``` This is now fixable after this clang change from a few years ago: <https://github.com/llvm/llvm-project/commit/91ed7e19418181ae385c2626cedd3b08b6ba43a6> We can introduce a new attribute and a separate logging function that uses the attribute so the compiler is able to verify placeholders correctly: __attribute__((__format__(__NSString__, format, vaargs)))
Attachments
Radar WebKit Bug Importer
Comment 1 2025-08-26 19:43:47 PDT
David Kilzer (:ddkilzer)
Comment 2 2025-08-26 20:06:08 PDT
EWS
Comment 3 2025-08-27 20:44:33 PDT
Committed 299238@main (1c37850168d7): <https://commits.webkit.org/299238@main> Reviewed commits have been landed. Closing PR #49918 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.