diff --git a/src/util/format/parser.cpp b/src/util/format/parser.cpp index 1e1c83e..212e182 100644 --- a/src/util/format/parser.cpp +++ b/src/util/format/parser.cpp @@ -305,6 +305,19 @@ constexpr void Parser::checkSpecifierIntegralType(const Specifier& specifier) }; } +constexpr void Parser::checkSpecifierPointerType(const Specifier& specifier) +{ + VERIFY(specifier.type == PresentationType::None || specifier.type == PresentationType::Pointer, + "invalid type specifier"); + + // Valid: fill, align, width + // Invalid: sign, alternativeForm, zeroPadding, precision + VERIFY(specifier.sign == Builder::Sign::None, "invalid specifier option"); + VERIFY(specifier.alternativeForm == false, "invalid specifier option"); + VERIFY(specifier.zeroPadding == false, "invalid specifier option"); + VERIFY(specifier.precision == -1, "invalid specifier option"); +} + constexpr void Parser::checkSpecifierType(const Specifier& specifier, ParameterType type) { switch (type) { @@ -344,9 +357,7 @@ constexpr void Parser::checkSpecifierType(const Specifier& specifier, ParameterT "invalid type specifier"); break; case ParameterType::Pointer: - VERIFY(specifier.type == PresentationType::None - || specifier.type == PresentationType::Pointer, - "invalid type specifier"); + checkSpecifierPointerType(specifier); break; default: VERIFY_NOT_REACHED(); diff --git a/src/util/format/parser.h b/src/util/format/parser.h index 8817cde..93f4c89 100644 --- a/src/util/format/parser.h +++ b/src/util/format/parser.h @@ -44,6 +44,7 @@ public: void parseSpecifier(Specifier& specifier, ParameterType type); constexpr void checkSpecifierIntegralType(const Specifier& specifier); + constexpr void checkSpecifierPointerType(const Specifier& specifier); constexpr void checkSpecifierType(const Specifier& specifier, ParameterType type); private: