| 1 |
/* |
| 2 |
REQUIRED_ARGS: -de |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/chkformat.d(101): Deprecation: width argument `0L` for format specification `"%*.*d"` must be `int`, not `long` |
| 6 |
fail_compilation/chkformat.d(101): Deprecation: precision argument `1L` for format specification `"%*.*d"` must be `int`, not `long` |
| 7 |
fail_compilation/chkformat.d(101): Deprecation: argument `2L` for format specification `"%*.*d"` must be `int`, not `long` |
| 8 |
fail_compilation/chkformat.d(104): Deprecation: argument `4` for format specification `"%lld"` must be `long`, not `int` |
| 9 |
fail_compilation/chkformat.d(105): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `int` |
| 10 |
fail_compilation/chkformat.d(106): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t`, not `double` |
| 11 |
fail_compilation/chkformat.d(107): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t`, not `double` |
| 12 |
fail_compilation/chkformat.d(108): Deprecation: argument `8.0L` for format specification `"%g"` must be `double`, not `real` |
| 13 |
fail_compilation/chkformat.d(109): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real`, not `double` |
| 14 |
fail_compilation/chkformat.d(110): Deprecation: argument `10` for format specification `"%p"` must be `void*`, not `int` |
| 15 |
fail_compilation/chkformat.d(111): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `uint*` |
| 16 |
fail_compilation/chkformat.d(113): Deprecation: argument `& u` for format specification `"%lln"` must be `long*`, not `int*` |
| 17 |
fail_compilation/chkformat.d(114): Deprecation: argument `& u` for format specification `"%hn"` must be `short*`, not `int*` |
| 18 |
fail_compilation/chkformat.d(115): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*` |
| 19 |
fail_compilation/chkformat.d(116): Deprecation: argument `16L` for format specification `"%c"` must be `char`, not `long` |
| 20 |
fail_compilation/chkformat.d(117): Deprecation: argument `17L` for format specification `"%c"` must be `char`, not `long` |
| 21 |
fail_compilation/chkformat.d(118): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*` |
| 22 |
fail_compilation/chkformat.d(119): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*`$?:windows= |
| 23 |
fail_compilation/chkformat.d(122): Deprecation: argument `0LU` for format specification `"%lu"` must be `uint`, not `ulong` |
| 24 |
fail_compilation/chkformat.d(122): C `long` is 4 bytes on your system|32= |
| 25 |
fail_compilation/chkformat.d(122): Deprecation: argument `0LU` for format specification `"%lu"` must be `uint`, not `ulong` |
| 26 |
fail_compilation/chkformat.d(122): C `long` is 4 bytes on your system$ |
| 27 |
fail_compilation/chkformat.d(123): Deprecation: argument `p` for format specification `"%n"` must be `int*`, not `const(int)*` |
| 28 |
fail_compilation/chkformat.d(201): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` |
| 29 |
fail_compilation/chkformat.d(202): Deprecation: more format specifiers than 1 arguments |
| 30 |
fail_compilation/chkformat.d(203): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` |
| 31 |
fail_compilation/chkformat.d(204): Deprecation: argument `0L` for format specification `"%3u"` must be `uint*`, not `long` |
| 32 |
fail_compilation/chkformat.d(205): Deprecation: argument `u` for format specification `"%200u"` must be `uint*`, not `uint` |
| 33 |
fail_compilation/chkformat.d(206): Deprecation: argument `3.0` for format specification `"%hhd"` must be `byte*`, not `double` |
| 34 |
fail_compilation/chkformat.d(207): Deprecation: argument `4` for format specification `"%hd"` must be `short*`, not `int` |
| 35 |
fail_compilation/chkformat.d(209): Deprecation: argument `4` for format specification `"%lld"` must be `long*`, not `int` |
| 36 |
fail_compilation/chkformat.d(210): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t*`, not `int` |
| 37 |
fail_compilation/chkformat.d(211): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t*`, not `double` |
| 38 |
fail_compilation/chkformat.d(212): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t*`, not `double` |
| 39 |
fail_compilation/chkformat.d(213): Deprecation: format specifier `"%Ld"` is invalid |
| 40 |
fail_compilation/chkformat.d(214): Deprecation: argument `0` for format specification `"%u"` must be `uint*`, not `int` |
| 41 |
fail_compilation/chkformat.d(215): Deprecation: argument `0` for format specification `"%hhu"` must be `ubyte*`, not `int` |
| 42 |
fail_compilation/chkformat.d(216): Deprecation: argument `0` for format specification `"%hu"` must be `ushort*`, not `int` |
| 43 |
fail_compilation/chkformat.d(218): Deprecation: argument `0` for format specification `"%llu"` must be `ulong*`, not `int` |
| 44 |
fail_compilation/chkformat.d(219): Deprecation: argument `0` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t*`, not `int` |
| 45 |
fail_compilation/chkformat.d(220): Deprecation: argument `0` for format specification `"%zu"` must be `size_t*`, not `int` |
| 46 |
fail_compilation/chkformat.d(221): Deprecation: argument `0` for format specification `"%tu"` must be `ptrdiff_t*`, not `int` |
| 47 |
fail_compilation/chkformat.d(222): Deprecation: argument `8.0L` for format specification `"%g"` must be `float*`, not `real` |
| 48 |
fail_compilation/chkformat.d(223): Deprecation: argument `8.0L` for format specification `"%lg"` must be `double*`, not `real` |
| 49 |
fail_compilation/chkformat.d(224): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real*`, not `double` |
| 50 |
fail_compilation/chkformat.d(225): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*` |
| 51 |
fail_compilation/chkformat.d(226): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*` |
| 52 |
fail_compilation/chkformat.d(227): Deprecation: argument `v` for format specification `"%p"` must be `void**`, not `void*` |
| 53 |
fail_compilation/chkformat.d(228): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `ushort*` |
| 54 |
fail_compilation/chkformat.d(229): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*` |
| 55 |
fail_compilation/chkformat.d(230): Deprecation: format specifier `"%[n"` is invalid |
| 56 |
fail_compilation/chkformat.d(231): Deprecation: format specifier `"%]"` is invalid |
| 57 |
fail_compilation/chkformat.d(232): Deprecation: argument `& u` for format specification `"%90s"` must be `char*`, not `int*` |
| 58 |
fail_compilation/chkformat.d(233): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` |
| 59 |
fail_compilation/chkformat.d(234): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` |
| 60 |
--- |
| 61 |
*/ |
| 62 |
|
| 63 |
|
| 64 |
import core.stdc.stdio; |
| 65 |
|
| 66 |
#line 100 |
| 67 |
|
| 68 |
void test1() { printf("%*.*d\n", 0L, 1L, 2L); } |
| 69 |
//void test2() { } |
| 70 |
//void test3() { printf("%ld\n", 3.0); } |
| 71 |
void test4() { printf("%lld\n", 4); } |
| 72 |
void test5() { printf("%jd\n", 5); } |
| 73 |
void test6() { printf("%zd\n", 6.0); } |
| 74 |
void test7() { printf("%td\n", 7.0); } |
| 75 |
void test8() { printf("%g\n", 8.0L); } |
| 76 |
void test9() { printf("%Lg\n", 9.0); } |
| 77 |
void test10() { printf("%p\n", 10); } |
| 78 |
void test11() { uint u; printf("%n\n", &u); } |
| 79 |
//void test12() { ushort u; printf("%ln\n", &u); } |
| 80 |
void test13() { int u; printf("%lln\n", &u); } |
| 81 |
void test14() { int u; printf("%hn\n", &u); } |
| 82 |
void test15() { int u; printf("%hhn\n", &u); } |
| 83 |
void test16() { printf("%c\n", 16L); } |
| 84 |
void test17() { printf("%c\n", 17L); } |
| 85 |
void test18() { int u; printf("%s\n", &u); } |
| 86 |
void test19() { int u; printf("%ls\n", &u); } |
| 87 |
//void test20() { int u; char[] s; sprintf(&s[0], "%d\n", &u); } |
| 88 |
//void test21() { int u; fprintf(null, "%d\n", &u); } |
| 89 |
void test20() { printf("%lu", ulong.init); } |
| 90 |
void test22() { int i; const(int)* p = &i; printf("%n", p); } |
| 91 |
|
| 92 |
#line 200 |
| 93 |
|
| 94 |
void test31() { scanf("%d\n", 0L); } |
| 95 |
void test32() { int i; scanf("%d %d\n", &i); } |
| 96 |
void test33() { scanf("%d%*c\n", 0L); } |
| 97 |
void test34() { scanf("%3u\n", 0L); } |
| 98 |
void test35() { uint u; scanf("%200u%*s\n", u); } |
| 99 |
void test36() { scanf("%hhd\n", 3.0); } |
| 100 |
void test37() { scanf("%hd\n", 4); } |
| 101 |
//void test38() { scanf("%ld\n", 3.0); } |
| 102 |
void test39() { scanf("%lld\n", 4); } |
| 103 |
void test40() { scanf("%jd\n", 5); } |
| 104 |
void test41() { scanf("%zd\n", 6.0); } |
| 105 |
void test42() { scanf("%td\n", 7.0); } |
| 106 |
void test43() { scanf("%Ld\n", 0); } |
| 107 |
void test44() { scanf("%u\n", 0); } |
| 108 |
void test45() { scanf("%hhu\n", 0); } |
| 109 |
void test46() { scanf("%hu\n", 0); } |
| 110 |
//void test47() { scanf("%lu\n", 0); } |
| 111 |
void test48() { scanf("%llu\n", 0); } |
| 112 |
void test49() { scanf("%ju\n", 0); } |
| 113 |
void test50() { scanf("%zu\n", 0); } |
| 114 |
void test51() { scanf("%tu\n", 0); } |
| 115 |
void test52() { scanf("%g\n", 8.0L); } |
| 116 |
void test53() { scanf("%lg\n", 8.0L); } |
| 117 |
void test54() { scanf("%Lg\n", 9.0); } |
| 118 |
void test55() { int u; scanf("%s\n", &u); } |
| 119 |
void test56() { int u; scanf("%ls\n", &u); } |
| 120 |
void test57() { void* v; scanf("%p\n", v); } |
| 121 |
void test58() { ushort u; scanf("%n\n", &u); } |
| 122 |
void test59() { int u; scanf("%hhn\n", &u); } |
| 123 |
void test60() { int u; scanf("%[n", &u); } |
| 124 |
void test61() { int u; scanf("%]\n", &u); } |
| 125 |
void test62() { int u; scanf("%90s\n", &u); } |
| 126 |
void test63() { sscanf("1234", "%d\n", 0L); } |
| 127 |
void test64() { fscanf(null, "%d\n", 0L); } |
| 128 |
|
| 129 |
/* TEST_OUTPUT: |
| 130 |
--- |
| 131 |
fail_compilation/chkformat.d(301): Deprecation: format specifier `"%K"` is invalid |
| 132 |
fail_compilation/chkformat.d(302): Deprecation: format specifier `"%Q"` is invalid |
| 133 |
--- |
| 134 |
*/ |
| 135 |
|
| 136 |
import core.stdc.stdarg; |
| 137 |
|
| 138 |
#line 300 |
| 139 |
|
| 140 |
void test301() { va_list vargs; vprintf("%K", vargs); } |
| 141 |
void test302() { va_list vargs; vscanf("%Q", vargs); } |
| 142 |
|
| 143 |
// TODO - C++ 11 only: |
| 144 |
//void test() { vscanf(); } |
| 145 |
//void test() { vfscanf(); } |
| 146 |
//void test() { vsscanf(); } |
| 147 |
|
| 148 |
/* TEST_OUTPUT: |
| 149 |
--- |
| 150 |
fail_compilation/chkformat.d(401): Deprecation: argument `p` for format specification `"%u"` must be `uint`, not `char*` |
| 151 |
fail_compilation/chkformat.d(402): Deprecation: argument `p` for format specification `"%d"` must be `int`, not `char*` |
| 152 |
fail_compilation/chkformat.d(403): Deprecation: argument `p` for format specification `"%hhu"` must be `ubyte`, not `char*` |
| 153 |
fail_compilation/chkformat.d(404): Deprecation: argument `p` for format specification `"%hhd"` must be `byte`, not `char*` |
| 154 |
fail_compilation/chkformat.d(405): Deprecation: argument `p` for format specification `"%hu"` must be `ushort`, not `char*` |
| 155 |
fail_compilation/chkformat.d(406): Deprecation: argument `p` for format specification `"%hd"` must be `short`, not `char*` |
| 156 |
fail_compilation/chkformat.d(407): Deprecation: argument `p` for format specification `"%lu"` must be `$?:windows=uint|32=uint|64=ulong$`, not `char*` |
| 157 |
fail_compilation/chkformat.d(408): Deprecation: argument `p` for format specification `"%ld"` must be `$?:windows=int|32=int|64=long$`, not `char*` |
| 158 |
fail_compilation/chkformat.d(409): Deprecation: argument `p` for format specification `"%llu"` must be `ulong`, not `char*` |
| 159 |
fail_compilation/chkformat.d(410): Deprecation: argument `p` for format specification `"%lld"` must be `long`, not `char*` |
| 160 |
fail_compilation/chkformat.d(411): Deprecation: argument `p` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t`, not `char*` |
| 161 |
fail_compilation/chkformat.d(412): Deprecation: argument `p` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `char*` |
| 162 |
--- |
| 163 |
*/ |
| 164 |
|
| 165 |
#line 400 |
| 166 |
|
| 167 |
void test401() { char* p; printf("%u", p); } |
| 168 |
void test402() { char* p; printf("%d", p); } |
| 169 |
void test403() { char* p; printf("%hhu", p); } |
| 170 |
void test404() { char* p; printf("%hhd", p); } |
| 171 |
void test405() { char* p; printf("%hu", p); } |
| 172 |
void test406() { char* p; printf("%hd", p); } |
| 173 |
void test407() { char* p; printf("%lu", p); } |
| 174 |
void test408() { char* p; printf("%ld", p); } |
| 175 |
void test409() { char* p; printf("%llu", p); } |
| 176 |
void test410() { char* p; printf("%lld", p); } |
| 177 |
void test411() { char* p; printf("%ju", p); } |
| 178 |
void test412() { char* p; printf("%jd", p); } |
| 179 |
|
| 180 |
/* https://issues.dlang.org/show_bug.cgi?id=23247 |
| 181 |
TEST_OUTPUT: |
| 182 |
--- |
| 183 |
fail_compilation/chkformat.d(501): Deprecation: argument `p` for format specification `"%a"` must be `double`, not `char*` |
| 184 |
fail_compilation/chkformat.d(502): Deprecation: argument `p` for format specification `"%La"` must be `real`, not `char*` |
| 185 |
fail_compilation/chkformat.d(503): Deprecation: argument `p` for format specification `"%a"` must be `float*`, not `char*` |
| 186 |
fail_compilation/chkformat.d(504): Deprecation: argument `p` for format specification `"%la"` must be `double*`, not `char*` |
| 187 |
fail_compilation/chkformat.d(505): Deprecation: argument `p` for format specification `"%La"` must be `real*`, not `char*` |
| 188 |
--- |
| 189 |
*/ |
| 190 |
#line 500 |
| 191 |
|
| 192 |
void test501() { char* p; printf("%a", p); } |
| 193 |
void test502() { char* p; printf("%La", p); } |
| 194 |
void test503() { char* p; scanf("%a", p); } |
| 195 |
void test504() { char* p; scanf("%la", p); } |
| 196 |
void test505() { char* p; scanf("%La", p); } |