(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
This commit is contained in:
@@ -59,50 +59,34 @@ struct DebugLevel {
|
||||
|
||||
#if !defined(NO_DEBUG_MESSAGES)
|
||||
|
||||
/** Functionized DEBUG macro for compilers that don't support
|
||||
* variadic macros (__VA_ARGS__) such as...yes MSVC2003 and lower */
|
||||
#if defined(NO_VARARG_MACRO)
|
||||
void CDECL DEBUG(int name, int level, ...)
|
||||
{
|
||||
va_list va;
|
||||
const char *dbg;
|
||||
const DebugLevel *dl = &debug_level[name];
|
||||
|
||||
if (level != 0 && *dl->level < level) return;
|
||||
dbg = dl->name;
|
||||
va_start(va, level);
|
||||
#else
|
||||
void CDECL debug(const char *dbg, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, dbg);
|
||||
#endif /* NO_VARARG_MACRO */
|
||||
{
|
||||
const char *s;
|
||||
char buf[1024];
|
||||
const char *s;
|
||||
char buf[1024];
|
||||
|
||||
s = va_arg(va, const char*);
|
||||
vsnprintf(buf, lengthof(buf), s, va);
|
||||
va_end(va);
|
||||
s = va_arg(va, const char*);
|
||||
vsnprintf(buf, lengthof(buf), s, va);
|
||||
va_end(va);
|
||||
#if defined(ENABLE_NETWORK)
|
||||
if (_debug_socket != INVALID_SOCKET) {
|
||||
char buf2[lengthof(buf) + 32];
|
||||
if (_debug_socket != INVALID_SOCKET) {
|
||||
char buf2[lengthof(buf) + 32];
|
||||
|
||||
snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
|
||||
send(_debug_socket, buf2, strlen(buf2), 0);
|
||||
} else
|
||||
snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
|
||||
send(_debug_socket, buf2, strlen(buf2), 0);
|
||||
} else
|
||||
#endif /* ENABLE_NETWORK */
|
||||
{
|
||||
{
|
||||
#if defined(WINCE)
|
||||
/* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
|
||||
TCHAR tbuf[512];
|
||||
_sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
|
||||
NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
|
||||
/* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
|
||||
TCHAR tbuf[512];
|
||||
_sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
|
||||
NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
|
||||
#else
|
||||
fprintf(stderr, "dbg: [%s] %s\n", dbg, buf);
|
||||
fprintf(stderr, "dbg: [%s] %s\n", dbg, buf);
|
||||
#endif
|
||||
IConsoleDebug(dbg, buf);
|
||||
}
|
||||
IConsoleDebug(dbg, buf);
|
||||
}
|
||||
}
|
||||
#endif /* NO_DEBUG_MESSAGES */
|
||||
|
||||
38
src/debug.h
38
src/debug.h
@@ -19,44 +19,14 @@
|
||||
* 6.. - extremely detailed spamming
|
||||
*/
|
||||
|
||||
/* Of course MSVC 2003 and lower has no support for variadic macros
|
||||
* so we need to work around this... *sigh* */
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
||||
#define NO_VARARG_MACRO
|
||||
#endif
|
||||
|
||||
#if defined(NO_VARARG_MACRO)
|
||||
enum DebugLevelType {
|
||||
ai,
|
||||
driver,
|
||||
grf,
|
||||
map,
|
||||
misc,
|
||||
ms,
|
||||
net,
|
||||
sprite,
|
||||
oldloader,
|
||||
ntp,
|
||||
npf,
|
||||
yapf,
|
||||
freetype,
|
||||
sl,
|
||||
station,
|
||||
};
|
||||
#endif /* NO_VARARG_MACRO */
|
||||
|
||||
#ifdef NO_DEBUG_MESSAGES
|
||||
#if defined(NO_VARARG_MACRO)
|
||||
static inline void DEBUG(int name, int level, ...) {}
|
||||
#elif defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#define DEBUG(name, level, args...)
|
||||
#else
|
||||
#define DEBUG(name, level, ...)
|
||||
#endif
|
||||
#else /* NO_DEBUG_MESSAGES */
|
||||
#if defined(NO_VARARG_MACRO)
|
||||
void CDECL DEBUG(int name, int level, ...);
|
||||
#elif defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#define DEBUG(name, level, args...) if ((level == 0) || ( _debug_ ## name ## _level >= level)) debug(#name, args)
|
||||
#else
|
||||
#define DEBUG(name, level, ...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__)
|
||||
@@ -78,9 +48,7 @@
|
||||
extern int _debug_sl_level;
|
||||
extern int _debug_station_level;
|
||||
|
||||
#if !defined(NO_VARARG_MACRO)
|
||||
void CDECL debug(const char *dbg, ...);
|
||||
#endif /* NO_VARARG_MACRO */
|
||||
void CDECL debug(const char *dbg, ...);
|
||||
#endif /* NO_DEBUG_MESSAGES */
|
||||
|
||||
void SetDebugString(const char *s);
|
||||
|
||||
@@ -43,7 +43,7 @@ enum {
|
||||
};
|
||||
|
||||
/* Apparently these don't play well with enums. */
|
||||
static const OverflowSafeInt64 INVALID_DATAPOINT = INT64_MAX; // Value used for a datapoint that shouldn't be drawn.
|
||||
static const OverflowSafeInt64 INVALID_DATAPOINT(INT64_MAX); // Value used for a datapoint that shouldn't be drawn.
|
||||
static const uint INVALID_DATAPOINT_POS = UINT_MAX; // Used to determine if the previous point was drawn.
|
||||
|
||||
struct GraphDrawer {
|
||||
|
||||
24
src/stdafx.h
24
src/stdafx.h
@@ -156,19 +156,17 @@
|
||||
#pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied
|
||||
#pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union
|
||||
|
||||
#if (_MSC_VER >= 1400) // MSVC 2005 safety checks
|
||||
#pragma warning(disable: 4996) // 'strdup' was declared deprecated
|
||||
#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
|
||||
#pragma warning(disable: 6308) // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked
|
||||
#pragma warning(disable: 6011) // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001
|
||||
#pragma warning(disable: 6326) // code analyzer: potential comparison of a constant with another constant
|
||||
#pragma warning(disable: 6031) // code analyzer: Return value ignored: 'ReadFile'
|
||||
#pragma warning(disable: 6255) // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
|
||||
#pragma warning(disable: 6246) // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ...
|
||||
#else /* _MSC_VER >= 1400 ( <1400 for MSVC2003) */
|
||||
#pragma warning(disable: 4288) // nonstandard extension used : 'y' : loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope
|
||||
#pragma warning(disable: 4292) // compiler limit : terminating debug information emission for enum 'StringIdEnum' with member 'STR_801D_COAL_CAR'
|
||||
#endif /* _MSC_VER >= 1400 */
|
||||
#if (_MSC_VER < 1400) // MSVC 2005 safety checks
|
||||
#error "Only MSVC 2005 or higher are supported. MSVC 2003 and earlier are not!. Upgrade your compiler."
|
||||
#endif /* (_MSC_VER < 1400) */
|
||||
#pragma warning(disable: 4996) // 'strdup' was declared deprecated
|
||||
#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
|
||||
#pragma warning(disable: 6308) // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked
|
||||
#pragma warning(disable: 6011) // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001
|
||||
#pragma warning(disable: 6326) // code analyzer: potential comparison of a constant with another constant
|
||||
#pragma warning(disable: 6031) // code analyzer: Return value ignored: 'ReadFile'
|
||||
#pragma warning(disable: 6255) // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
|
||||
#pragma warning(disable: 6246) // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ...
|
||||
|
||||
#include <malloc.h> // alloca()
|
||||
#define NORETURN __declspec(noreturn)
|
||||
|
||||
Reference in New Issue
Block a user