Mercurial > projects > ldc
comparison dmd/mars.h @ 1372:229e02867307
Fix format-string bugs by adding __attribute__((__format__)) in all applicable
places and fixing all warnings my gcc produced.
Among other things, this should fix several segfaults (including one I just
ran into).
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 17 May 2009 00:15:25 +0200 |
parents | 8026319762be |
children | 1311dabc6a1f |
comparison
equal
deleted
inserted
replaced
1371:967d28b7febe | 1372:229e02867307 |
---|---|
72 #ifdef __DMC__ | 72 #ifdef __DMC__ |
73 #ifdef DEBUG | 73 #ifdef DEBUG |
74 #undef assert | 74 #undef assert |
75 #define assert(e) (static_cast<void>((e) || (printf("assert %s(%d) %s\n", __FILE__, __LINE__, #e), halt()))) | 75 #define assert(e) (static_cast<void>((e) || (printf("assert %s(%d) %s\n", __FILE__, __LINE__, #e), halt()))) |
76 #endif | 76 #endif |
77 #endif | |
78 | |
79 #ifndef IS_PRINTF | |
80 # ifdef __GNUC__ | |
81 # define IS_PRINTF(FMTARG) __attribute((__format__ (__printf__, (FMTARG), (FMTARG)+1) )) | |
82 # else | |
83 # define IS_PRINTF(FMTARG) | |
84 # endif | |
77 #endif | 85 #endif |
78 | 86 |
79 #ifdef IN_GCC | 87 #ifdef IN_GCC |
80 /* Changes for the GDC compiler by David Friedman */ | 88 /* Changes for the GDC compiler by David Friedman */ |
81 #endif | 89 #endif |
393 MATCHconst, // match with conversion to const | 401 MATCHconst, // match with conversion to const |
394 #endif | 402 #endif |
395 MATCHexact // exact match | 403 MATCHexact // exact match |
396 }; | 404 }; |
397 | 405 |
398 void warning(Loc loc, const char *format, ...); | 406 void warning(Loc loc, const char *format, ...) IS_PRINTF(2); |
399 void vwarning(Loc loc, const char *format, va_list); | 407 void vwarning(Loc loc, const char *format, va_list); |
400 void error(Loc loc, const char *format, ...); | 408 void error(Loc loc, const char *format, ...) IS_PRINTF(2); |
401 void verror(Loc loc, const char *format, va_list); | 409 void verror(Loc loc, const char *format, va_list); |
402 void fatal(); | 410 void fatal(); |
403 void err_nomem(); | 411 void err_nomem(); |
404 void inifile(char *argv0, const char *inifile); | 412 void inifile(char *argv0, const char *inifile); |
405 void halt(); | 413 void halt(); |