1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

AK: When printf assert on unsupported specifier, specify which one!

We were asserting without saying why. That's a bit unhelpful. :^)
This commit is contained in:
Andreas Kling 2019-09-06 20:27:58 +02:00
parent 56e0e6be56
commit d10ca2b010

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/LogStream.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <stdarg.h> #include <stdarg.h>
@ -10,7 +11,7 @@ static constexpr const char* printf_hex_digits_upper = "0123456789ABCDEF";
#ifdef __serenity__ #ifdef __serenity__
extern "C" size_t strlen(const char*); extern "C" size_t strlen(const char*);
#else #else
#include <string.h> # include <string.h>
#endif #endif
template<typename PutChFunc, typename T> template<typename PutChFunc, typename T>
@ -266,9 +267,9 @@ template<typename PutChFunc>
goto one_more; goto one_more;
} }
if (*p == '*') { if (*p == '*') {
fieldWidth = va_arg(ap, int); fieldWidth = va_arg(ap, int);
if (*(p + 1)) if (*(p + 1))
goto one_more; goto one_more;
} }
if (*p == 'l') { if (*p == 'l') {
++long_qualifiers; ++long_qualifiers;
@ -352,6 +353,7 @@ template<typename PutChFunc>
ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, true, true, 8); ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, true, true, 8);
break; break;
default: default:
dbg() << "printf_internal: Unimplemented format specifier " << *p;
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
} else { } else {