We get the following warning when compiling on Windows:
common.c: In function 'handle_conversion_specifier_std':
common.c:1419:30: warning: 'wint_t' {aka 'short unsigned int'} is promoted to 'int' when passed through '...'
1419 | BUF_STD_APPEND_SINGLE_ARG(wint_t);
| ^
common.c:1419:4: note: in expansion of macro 'BUF_STD_APPEND_SINGLE_ARG'
1419 | BUF_STD_APPEND_SINGLE_ARG(wint_t);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
common.c:1419:30: note: (so you should pass 'int' not 'wint_t' {aka 'short unsigned int'} to 'va_arg')
1419 | BUF_STD_APPEND_SINGLE_ARG(wint_t);
| ^
When expanded, this problematic macro usage contains:
wint_t _arg = va_arg(*args, wint_t);
I think the suggestion of passing `int`, not `wint_t` makes sense. This
is because any integral argument smaller than an int would have already
been promoted to int when passed to the variable arguments function
that eventually called handle_conversion_specifier_std. So it makes
sense to fetch this variable as an int.
We don't see this warning on x86-64 Linux because there, sizeof(wint_t)
is 4, the same as an int.
Change-Id: Ia1519b15a56a58022254be98597c1f3e020db9b9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2160
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
switch (length_mod) {
case LENGTH_MOD_NONE:
- BUF_STD_APPEND_SINGLE_ARG(int);
- break;
case LENGTH_MOD_LOW_L:
- BUF_STD_APPEND_SINGLE_ARG(wint_t);
+ BUF_STD_APPEND_SINGLE_ARG(int);
break;
default:
abort();