| 1 |
// https://issues.dlang.org/show_bug.cgi?id=21177 |
| 2 |
/* |
| 3 |
REQUIRED_ARGS: -verrors=simple |
| 4 |
DISABLED: win |
| 5 |
TEST_OUTPUT: |
| 6 |
--- |
| 7 |
compilable/test21177.d(103): Deprecation: more format specifiers than 0 arguments |
| 8 |
compilable/test21177.d(111): Deprecation: more format specifiers than 0 arguments |
| 9 |
compilable/test21177.d(150): Deprecation: more format specifiers than 0 arguments |
| 10 |
compilable/test21177.d(151): Deprecation: more format specifiers than 0 arguments |
| 11 |
compilable/test21177.d(152): Deprecation: more format specifiers than 0 arguments |
| 12 |
compilable/test21177.d(153): Deprecation: more format specifiers than 0 arguments |
| 13 |
compilable/test21177.d(154): Deprecation: more format specifiers than 0 arguments |
| 14 |
compilable/test21177.d(155): Deprecation: more format specifiers than 0 arguments |
| 15 |
compilable/test21177.d(202): Deprecation: format specifier `"%m"` is invalid |
| 16 |
compilable/test21177.d(203): Deprecation: argument `d` for format specification `"%mc"` must be `char**`, not `int` |
| 17 |
compilable/test21177.d(204): Deprecation: argument `c` for format specification `"%ms"` must be `char**`, not `char*` |
| 18 |
compilable/test21177.d(205): Deprecation: format specifier `"%ml"` is invalid |
| 19 |
compilable/test21177.d(206): Deprecation: argument `d` for format specification `"%mlc"` must be `wchar_t**`, not `int` |
| 20 |
compilable/test21177.d(207): Deprecation: argument `c` for format specification `"%mls"` must be `wchar_t**`, not `char*` |
| 21 |
--- |
| 22 |
*/ |
| 23 |
|
| 24 |
import core.stdc.stdio; |
| 25 |
import core.stdc.string; |
| 26 |
import core.stdc.stdlib; |
| 27 |
|
| 28 |
void main() |
| 29 |
{ |
| 30 |
version (CRuntime_Glibc) |
| 31 |
{ |
| 32 |
#line 100 |
| 33 |
printf("%m this is a string in errno"); |
| 34 |
printf("%s %m", "str".ptr, 2); |
| 35 |
printf("%m %a", 2.); |
| 36 |
printf("%m %m %s"); |
| 37 |
printf("%m"); |
| 38 |
printf("%*m"); |
| 39 |
pragma(msg, "compilable/test21177.d(111): Deprecation: more format specifiers than 0 arguments"); |
| 40 |
} |
| 41 |
else |
| 42 |
{ |
| 43 |
pragma(msg, "compilable/test21177.d(103): Deprecation: more format specifiers than 0 arguments"); |
| 44 |
printf("%m"); |
| 45 |
} |
| 46 |
{ |
| 47 |
char* a, b; |
| 48 |
sscanf("salut poilu", "%ms %m[^\n]", &a, &b); |
| 49 |
assert(!strcmp(a, b)); |
| 50 |
free(a); |
| 51 |
free(b); |
| 52 |
|
| 53 |
char* t; wchar_t* p; |
| 54 |
sscanf("Tomate Patate", "%mc %mlc", &t, &p); |
| 55 |
free(t); |
| 56 |
free(p); |
| 57 |
|
| 58 |
#line 150 |
| 59 |
sscanf("150", "%m"); |
| 60 |
sscanf("151", "%ms"); |
| 61 |
sscanf("152", "%mc"); |
| 62 |
sscanf("153", "%ml"); |
| 63 |
sscanf("154", "%mls"); |
| 64 |
sscanf("155", "%mlc"); |
| 65 |
|
| 66 |
#line 200 |
| 67 |
char* c; |
| 68 |
int d; |
| 69 |
sscanf("204", "%m", c); |
| 70 |
sscanf("205", "%mc", d); |
| 71 |
sscanf("206", "%ms", c); |
| 72 |
sscanf("207", "%ml", d); |
| 73 |
sscanf("208", "%mlc", d); |
| 74 |
sscanf("209", "%mls", c); |
| 75 |
} |
| 76 |
} |