diff options
Diffstat (limited to 'test/Sema/format-strings-enum-fixed-type.cpp')
-rw-r--r-- | test/Sema/format-strings-enum-fixed-type.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/Sema/format-strings-enum-fixed-type.cpp b/test/Sema/format-strings-enum-fixed-type.cpp index 8b6b23764520..0022ccbc66ba 100644 --- a/test/Sema/format-strings-enum-fixed-type.cpp +++ b/test/Sema/format-strings-enum-fixed-type.cpp @@ -16,7 +16,7 @@ typedef enum : short { Constant = 0 } TestEnum; // This is why we don't check for that in the expected output. void test(TestEnum input) { - printf("%hhd", input); // expected-warning{{format specifies type 'char' but the argument has type 'TestEnum'}} + printf("%hhd", input); // expected-warning{{format specifies type 'char' but the argument has underlying type 'short'}} printf("%hhd", Constant); // expected-warning{{format specifies type 'char'}} printf("%hd", input); // no-warning @@ -26,7 +26,7 @@ void test(TestEnum input) { printf("%d", input); // no-warning printf("%d", Constant); // no-warning - printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has type 'TestEnum'}} + printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has underlying type 'short'}} printf("%lld", Constant); // expected-warning{{format specifies type 'long long'}} } @@ -34,7 +34,7 @@ void test(TestEnum input) { typedef enum : unsigned long { LongConstant = ~0UL } LongEnum; void testLong(LongEnum input) { - printf("%u", input); // expected-warning{{format specifies type 'unsigned int' but the argument has type 'LongEnum'}} + printf("%u", input); // expected-warning{{format specifies type 'unsigned int' but the argument has underlying type 'unsigned long'}} printf("%u", LongConstant); // expected-warning{{format specifies type 'unsigned int'}} printf("%lu", input); @@ -46,7 +46,7 @@ typedef short short_t; typedef enum : short_t { ShortConstant = 0 } ShortEnum; void testUnderlyingTypedef(ShortEnum input) { - printf("%hhd", input); // expected-warning{{format specifies type 'char' but the argument has type 'ShortEnum'}} + printf("%hhd", input); // expected-warning{{format specifies type 'char' but the argument has underlying type 'short_t' (aka 'short')}} printf("%hhd", ShortConstant); // expected-warning{{format specifies type 'char'}} printf("%hd", input); // no-warning @@ -56,7 +56,7 @@ void testUnderlyingTypedef(ShortEnum input) { printf("%d", input); // no-warning printf("%d", ShortConstant); // no-warning - printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has type 'ShortEnum'}} + printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has underlying type 'short_t' (aka 'short')}} printf("%lld", ShortConstant); // expected-warning{{format specifies type 'long long'}} } @@ -64,10 +64,10 @@ void testUnderlyingTypedef(ShortEnum input) { typedef ShortEnum ShortEnum2; void testTypedefChain(ShortEnum2 input) { - printf("%hhd", input); // expected-warning{{format specifies type 'char' but the argument has type 'ShortEnum2' (aka 'ShortEnum')}} + printf("%hhd", input); // expected-warning{{format specifies type 'char' but the argument has underlying type 'short_t' (aka 'short')}} printf("%hd", input); // no-warning printf("%d", input); // no-warning - printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has type 'ShortEnum2' (aka 'ShortEnum')}} + printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has underlying type 'short_t' (aka 'short')}} } @@ -80,13 +80,13 @@ void testChar(CharEnum input) { printf("%hhd", CharConstant); // no-warning // This is not correct but it is safe. We warn because '%hd' shows intent. - printf("%hd", input); // expected-warning{{format specifies type 'short' but the argument has type 'CharEnum'}} + printf("%hd", input); // expected-warning{{format specifies type 'short' but the argument has underlying type 'char'}} printf("%hd", CharConstant); // expected-warning{{format specifies type 'short'}} // This is not correct but it matches the promotion rules (and is safe). printf("%d", input); // no-warning printf("%d", CharConstant); // no-warning - printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has type 'CharEnum'}} + printf("%lld", input); // expected-warning{{format specifies type 'long long' but the argument has underlying type 'char'}} printf("%lld", CharConstant); // expected-warning{{format specifies type 'long long'}} } |