Revert "Tweaks to nhassert implementation. Change to warnings on MSC build."
This reverts commit 2f3da35c68.
This commit is contained in:
+1
-1
@@ -1932,7 +1932,7 @@ E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2);
|
|||||||
E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2);
|
E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2);
|
||||||
E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2);
|
E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2);
|
||||||
E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2);
|
E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2);
|
||||||
E void FDECL(nhassert_failed, (const char *, int));
|
E void FDECL(nhassert_failed, (const char *, const char *, int));
|
||||||
|
|
||||||
/* ### polyself.c ### */
|
/* ### polyself.c ### */
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -378,7 +378,7 @@ struct savefile_info {
|
|||||||
/* Supply nhassert macro if not supplied by port */
|
/* Supply nhassert macro if not supplied by port */
|
||||||
#ifndef nhassert
|
#ifndef nhassert
|
||||||
#define nhassert(expression) (void)((!!(expression)) || \
|
#define nhassert(expression) (void)((!!(expression)) || \
|
||||||
(nhassert_failed(__FILE__, __LINE__), 0))
|
(nhassert_failed(#expression, __FILE__, __LINE__), 0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* GLOBAL_H */
|
#endif /* GLOBAL_H */
|
||||||
|
|||||||
@@ -134,8 +134,6 @@ extern void NDECL(getlock);
|
|||||||
#ifndef HAS_STDINT_H
|
#ifndef HAS_STDINT_H
|
||||||
#define HAS_STDINT_H /* force include of stdint.h in integer.h */
|
#define HAS_STDINT_H /* force include of stdint.h in integer.h */
|
||||||
#endif
|
#endif
|
||||||
/* Turn on some additional warnings */
|
|
||||||
#pragma warning(3:4389)
|
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
/* The following is needed for prototypes of certain functions */
|
/* The following is needed for prototypes of certain functions */
|
||||||
@@ -272,14 +270,4 @@ extern int FDECL(alternative_palette, (char *));
|
|||||||
#define nethack_enter(argc, argv) nethack_enter_winnt()
|
#define nethack_enter(argc, argv) nethack_enter_winnt()
|
||||||
extern void FDECL(nethack_exit, (int)) NORETURN;
|
extern void FDECL(nethack_exit, (int)) NORETURN;
|
||||||
extern boolean FDECL(file_exists, (const char *));
|
extern boolean FDECL(file_exists, (const char *));
|
||||||
|
|
||||||
/* Override the default version of nhassert. The default version is unable
|
|
||||||
* to generate a string form of the expression due to the need to be
|
|
||||||
* compatible with compilers which do not support macro stringization (i.e.
|
|
||||||
* #x to turn x into its string form).
|
|
||||||
*/
|
|
||||||
extern void FDECL(nt_assert_failed, (const char *, const char *, int));
|
|
||||||
#define nhassert(expression) (void)((!!(expression)) || \
|
|
||||||
(nt_assert_failed(#expression, __FILE__, __LINE__), 0))
|
|
||||||
|
|
||||||
#endif /* NTCONF_H */
|
#endif /* NTCONF_H */
|
||||||
|
|||||||
+2
-13
@@ -583,20 +583,9 @@ VA_DECL(const char *, str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* nhassert_failed is called when an nhassert's condition is false */
|
/* nhassert_failed is called when an nhassert's condition is false */
|
||||||
void
|
void nhassert_failed(const char * exp, const char * file, int line)
|
||||||
nhassert_failed(filepath, line)
|
|
||||||
const char * filepath;
|
|
||||||
int line;
|
|
||||||
{
|
{
|
||||||
const char * filename;
|
impossible("NHASSERT(%s) in '%s' at line %d", exp, file, line);
|
||||||
|
|
||||||
/* attempt to get filename from path. TODO: we really need a port provided
|
|
||||||
* function to return a filename from a path */
|
|
||||||
filename = strrchr(filepath, '/');
|
|
||||||
filename = (filename == NULL ? strrchr(filepath, '\\') : filename);
|
|
||||||
filename = (filename == NULL ? filepath : filename + 1);
|
|
||||||
|
|
||||||
impossible("nhassert failed in file '%s' at line %d", filename, line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*pline.c*/
|
/*pline.c*/
|
||||||
|
|||||||
@@ -708,23 +708,6 @@ sys_random_seed(VOID_ARGS)
|
|||||||
}
|
}
|
||||||
return ourseed;
|
return ourseed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nt_assert_failed is called when an nhassert's condition is false */
|
|
||||||
void
|
|
||||||
nt_assert_failed(expression, filepath, line)
|
|
||||||
const char * expression;
|
|
||||||
const char * filepath;
|
|
||||||
int line;
|
|
||||||
{
|
|
||||||
const char * filename;
|
|
||||||
|
|
||||||
/* get file name from path */
|
|
||||||
filename = strrchr(filepath, '\\');
|
|
||||||
filename = (filename == NULL ? filepath : filename + 1);
|
|
||||||
impossible("nhassert(%s) failed in file '%s' at line %d",
|
|
||||||
expression, filename, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/*winnt.c*/
|
/*winnt.c*/
|
||||||
|
|||||||
Reference in New Issue
Block a user