[PATCH] D66186: [Sema] Don't warn on printf('%hd', [char]) (PR41467)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 15:05:35 PDT 2019


aaron.ballman added a comment.

There was a request in the linked bug for some code archaeology to see why this behavior exists in the first place. What were the results of that? I'm not opposed to the patch, but I would like to understand why it behaves the way it does.

I could imagine "confusing user intent" being a valid reason why someone might want this warning, so we may want to default-off this diagnostic (because the code is safe) but still provide users with a way to enable it.



================
Comment at: clang/test/Sema/format-strings-enum-fixed-type.cpp:82
 
   // This is not correct but it is safe. We warn because '%hd' shows intent.
+  printf("%hd", input);        // no-warning
----------------
This comment is now incorrect.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66186/new/

https://reviews.llvm.org/D66186





More information about the cfe-commits mailing list