+2025-02-04 Bruno Haible <bruno@clisp.org>
+
+ *vasnprintf: Add a stricter runtime check.
+ * lib/printf-args.c (PRINTF_FETCHARGS): Abort in case of an unknown
+ type.
+
2025-02-03 Bruno Haible <bruno@clisp.org>
bootstrap: Remove undesired output.
2025-02-03 Paul Eggert <eggert@cs.ucla.edu>
- c-vasnprintf: pacify -Wswitch-enum
+ *vasnprintf: pacify -Wswitch-enum
* lib/printf-args.c (PRINTF_FETCHARGS):
Mention TYPE_NONE as being a default case.
* lib/vasnprintf.c (VASNPRINTF): Use switch (+E).
/* Get INT_WIDTH. */
#include <limits.h>
+/* Get abort(). */
+#include <stdlib.h>
+
#ifdef STATIC
STATIC
#endif
break;
#endif
case TYPE_NONE:
- default:
- /* Unknown type. */
+ /* Argument i is not used by any directive, but some argument with
+ number > i is used by a format directive. POSIX says that this
+ is invalid:
+ "When numbered argument specifications are used, specifying the
+ Nth argument requires that all the leading arguments, from the
+ first to the (N-1)th, are specified in the format string."
+ The reason is that we cannot know how many bytes to skip in the
+ va_arg sequence. */
return -1;
+ default:
+ /* Unknown type. Should not happen. */
+ abort ();
}
return 0;
}