aaron.ballman added a comment.

In D132266#3739600 <https://reviews.llvm.org/D132266#3739600>, @inclyc wrote:

> What I'm confusing is
> Which of the following two explanations is the exact meaning of `hhd`?
>
> 1. consumes a 32-bit signed integer, then truncates it *inside* printf
> 2. consumes an 8-bit signed integer
>
> If it is the case 1, we should not emit this warning, but N2562 said that it 
> still seems to be 2 ?

There's some confusion happening that we should clarify first. The sections 
you've been quoting so far are for the behavior of `fscanf` not `fprintf` and 
the requirements are different.

For `fprintf`, `hhd` means that `fprintf` consumes an `int`-sized object by 
calling effectively `signed char value = (signed char)va_arg(list, int);`.
For `fscanf`, `hhd` means that `fscanf` consumes a pointer in which to store 
the converted data by effectively calling `signed char *ptr = (signed char 
*)va_arg(list, signed char *); *ptr = value;`

This patch is currently handling only the `fprintf` cases and is not addressing 
the `fscanf` ones.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132266

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to