From 2e6c19abcf97c25f4d7458a9db89c5ab0158717d Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 21 Nov 2010 18:34:21 +0000 Subject: [PATCH] The 'X' printf type has a valid alternative form. Fixes PR8641. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119946 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/PrintfFormatString.cpp | 3 ++- test/Sema/format-strings.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index 57399d8efe..88671017a8 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -501,10 +501,11 @@ bool PrintfSpecifier::hasValidAlternativeForm() const { if (!HasAlternativeForm) return true; - // Alternate form flag only valid with the oxaAeEfFgG conversions + // Alternate form flag only valid with the oxXaAeEfFgG conversions switch (CS.getKind()) { case ConversionSpecifier::oArg: case ConversionSpecifier::xArg: + case ConversionSpecifier::XArg: case ConversionSpecifier::aArg: case ConversionSpecifier::AArg: case ConversionSpecifier::eArg: diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index 57f087b2e0..ba5fa8a3a6 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -325,3 +325,8 @@ void rdar8332221(va_list ap, int *x, long *y) { rdar8332221_vprintf_scanf("%", ap, "%d", x); // expected-warning{{incomplete format specifier}} } +// PR8641 +void pr8641() { + printf("%#x\n", 10); + printf("%#X\n", 10); +} -- 2.40.0