[PATCH] D132266: [Clang][SemaChecking] move %hh and %h -Wformat warnings to -Wformat-pedantic

YingChi Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 10:23:25 PDT 2022


inclyc added a comment.

> format specifies type 'short' but the argument has type 'double' (promoted from 'float')

I'm not sure about this. I'm curious about we just consider any integer with width less than or equal to `int` may be specified by `%hhd` ? (Because of default argument promotions). For example, we may expect `%hhd` could accept `int` `short` and `char`. And give diagnostics like

  format specifies integers with width less than or equal to 'int', but the argument has type 'double' (promoted from 'float')
  
  note: {info about why %hhd consumes argument like this}



> fwprintf shall behave as if it uses va_arg with a type argument naming the type resulting from
> applying the default argument promotions to the type corresponding to the conversion specification and
> then converting the result of the va_arg expansion to the type corresponding to the conversion
> specification.



---------

OpenCL seems to defined a series of length modifiers for vectors, Is it more reasonable to consider `hh` as fixed length (char) only? Because vectors are passed without argument promotions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132266



More information about the cfe-commits mailing list