lib/tests: Pass int to va_arg instead of char.

* lib/tests/scaffold/70-stdarg.c (stdarg1, stdarg2, stdarg3): Pass int
to va_arg instead of char to avoid gcc trap "warning: 'char’ is promoted
to ‘int’ when passed through ‘...’ [enabled by default] (so you should
pass ‘int’ not ‘char’ to ‘va_arg’) if this code is reached, the program
will abort".
This commit is contained in:
W. J. van der Laan 2021-04-04 11:27:50 +00:00 committed by Jan (janneke) Nieuwenhuizen
parent d7b2e0ab9b
commit be4514c4de
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
*
* This file is part of GNU Mes.
*
@ -35,7 +36,7 @@ stdarg1 (long *one, ...)
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#endif
c = va_arg (ap, char);
c = va_arg (ap, int);
r = c;
eputs ("c:");
eputs (itoa (c));
@ -59,7 +60,7 @@ stdarg2 (long *one, long *two, ...)
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#endif
c = va_arg (ap, char);
c = va_arg (ap, int);
r = c;
eputs ("c:");
eputs (itoa (c));
@ -83,7 +84,7 @@ stdarg3 (long *one, long *two, long *three, ...)
ap += (__FOO_VARARGS + (__FUNCTION_ARGS << 1)) << 3;
#undef __FUNCTION_ARGS
#endif
c = va_arg (ap, char);
c = va_arg (ap, int);
r = c;
eputs ("c:");
eputs (itoa (c));