Re: [s390:features 73/81] drivers/s390/crypto/ap_queue.c:201:18: warning: format specifies type 'unsigned char' but the argument has type 'int'

Vasily Gorbik
2020-10-08T08:34:34Z

On Thu, Oct 08, 2020 at 09:00:00AM +0200, Harald Freudenberger wrote:
>
> On 08.10.20 01:41, kernel test robot wrote:
> > 2ea2a6099ae3d1708f90f43c81a98cba3d4bb74c [73/81] s390/ap: add error response code field for ap queue devices
>
> Fixed ... but why do these warnings not appear with normal build or with C=1 build ?
>
> Maybe there is some pragma needed somewhere at where the debug feature printfs expand to ?
>
> drivers/s390/crypto/ap_debug.h:26:47: note: expanded from macro 'AP_DBF_WARN'
> debug_sprintf_event(ap_dbf_info, DBF_WARN, ##__VA_ARGS__)

It seems to be the same for printk as well.

Variable function arguments which are passed via ... and of smaller
sizes then int are promoted to ints. It's called "default argument
promotion". So, its not like your code would crash or print garbage
if you use "%hhu" format and pass int or use "%d" and pass unsigned
char. It looks like gcc simply does not complain about such things,
while clang does.