|
Revision 1568:a591aa6bd6dc, 0.7 kB
(checked in by Tomas Lindquist Olsen <tomas.l.olsen gmail com>, 3 years ago)
|
Forgot to add files.
|
| Line | |
|---|
| 1 |
#include "mars.h" |
|---|
| 2 |
#include "mtype.h" |
|---|
| 3 |
#include "expression.h" |
|---|
| 4 |
|
|---|
| 5 |
#include "gen/warnings.h" |
|---|
| 6 |
|
|---|
| 7 |
void warnInvalidPrintfCall(Loc loc, Expression* arguments, size_t nargs) |
|---|
| 8 |
{ |
|---|
| 9 |
Expression* arg = arguments; |
|---|
| 10 |
|
|---|
| 11 |
// make sure first argument is a string literal, or we can't do much |
|---|
| 12 |
// TODO make it smarter ? |
|---|
| 13 |
if (arg->op != TOKstring) |
|---|
| 14 |
return; // assume valid |
|---|
| 15 |
|
|---|
| 16 |
StringExp* strexp = (StringExp*)arg; |
|---|
| 17 |
|
|---|
| 18 |
// not wchar or dhar |
|---|
| 19 |
if (strexp->sz != 1) |
|---|
| 20 |
{ |
|---|
| 21 |
warning(loc, "printf does not support wchar and dchar strings"); |
|---|
| 22 |
return; |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
#if 0 |
|---|
| 26 |
// check the format string |
|---|
| 27 |
const char* str = (char*)strexp->string; |
|---|
| 28 |
for (size_t i = 0; i < strexp->len; ++i) |
|---|
| 29 |
{ |
|---|
| 30 |
// TODO |
|---|
| 31 |
} |
|---|
| 32 |
#endif |
|---|
| 33 |
} |
|---|