[PATCH] D132568: [clang][Sema] check default argument promotions for printf
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 31 10:22:13 PDT 2022
efriedma added inline comments.
================
Comment at: clang/docs/ReleaseNotes.rst:141
+- Implemented `WG14 N2562 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2562.pdf>`_.
+ Clang will now consider default argument promotions in printf, and remove unnecessary warnings.
----------------
It seems a little weird to say we "implemented" this. The standard doesn't require any warnings for misuse of printf etc., and clang doesn't actually implement printf, so we don't need to do anything to be standard-compliant. I'd just say that we adjusted -Wformat warnings to avoid false positives.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:10124
+ // Consider character literal is a 'char' in C
+ // printf("%hd", 'a'); is more likey a type confusion situation
+ // We will suggest our users to use %hhd by discarding MatchPromotion
----------------
*likely
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132568/new/
https://reviews.llvm.org/D132568
More information about the cfe-commits
mailing list