Tweaks to nhassert implementation. Change to warnings on MSC build.

This commit is contained in:
Bart House
2019-07-12 18:40:34 -07:00
parent 0e8e5aac93
commit 2f3da35c68
5 changed files with 44 additions and 4 deletions

View File

@@ -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(impossible, (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 *, const char *, int));
E void FDECL(nhassert_failed, (const char *, int));
/* ### polyself.c ### */

View File

@@ -378,7 +378,7 @@ struct savefile_info {
/* Supply nhassert macro if not supplied by port */
#ifndef nhassert
#define nhassert(expression) (void)((!!(expression)) || \
(nhassert_failed(#expression, __FILE__, __LINE__), 0))
(nhassert_failed(__FILE__, __LINE__), 0))
#endif
#endif /* GLOBAL_H */

View File

@@ -134,6 +134,8 @@ extern void NDECL(getlock);
#ifndef HAS_STDINT_H
#define HAS_STDINT_H /* force include of stdint.h in integer.h */
#endif
/* Turn on some additional warnings */
#pragma warning(3:4389)
#endif /* _MSC_VER */
/* The following is needed for prototypes of certain functions */
@@ -270,4 +272,14 @@ extern int FDECL(alternative_palette, (char *));
#define nethack_enter(argc, argv) nethack_enter_winnt()
extern void FDECL(nethack_exit, (int)) NORETURN;
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 */