add support for [[maybe_unused]] if available
This commit is contained in:
@@ -389,6 +389,14 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
|||||||
#define FALLTHROUGH [[fallthrough]]
|
#define FALLTHROUGH [[fallthrough]]
|
||||||
/* #warning [[fallthrough]] from C23 */
|
/* #warning [[fallthrough]] from C23 */
|
||||||
#endif /* __has_c_attribute(fallthrough) */
|
#endif /* __has_c_attribute(fallthrough) */
|
||||||
|
/*
|
||||||
|
* maybe_unused
|
||||||
|
*/
|
||||||
|
#if __has_c_attribute(maybe_unused)
|
||||||
|
#ifndef ATTRUNUSED
|
||||||
|
#define ATTRUNUSED [[maybe_unused]]
|
||||||
|
#endif
|
||||||
|
#endif /* __has_c_attribute(maybe_unused) */
|
||||||
#endif /* NH_C >= 202300L */
|
#endif /* NH_C >= 202300L */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -416,7 +424,9 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
|||||||
#define PRINTF_F_PTR(f, v) PRINTF_F(f, v)
|
#define PRINTF_F_PTR(f, v) PRINTF_F(f, v)
|
||||||
#endif
|
#endif
|
||||||
#if __GNUC__ >= 3
|
#if __GNUC__ >= 3
|
||||||
|
#ifndef ATTRUNUSED
|
||||||
#define UNUSED __attribute__((unused))
|
#define UNUSED __attribute__((unused))
|
||||||
|
#endif
|
||||||
#ifndef ATTRNORETURN
|
#ifndef ATTRNORETURN
|
||||||
#ifndef NORETURN
|
#ifndef NORETURN
|
||||||
#define NORETURN __attribute__((noreturn))
|
#define NORETURN __attribute__((noreturn))
|
||||||
@@ -496,6 +506,9 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
|||||||
#define NH_PRAGMA_MESSAGE 1
|
#define NH_PRAGMA_MESSAGE 1
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
|
#if !defined(UNUSED) && defined(ATTRUNUSED)
|
||||||
|
#define UNUSED ATTRUNUSED
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Fallback implementations */
|
/* Fallback implementations */
|
||||||
#ifndef PRINTF_F
|
#ifndef PRINTF_F
|
||||||
@@ -507,6 +520,9 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
|||||||
#ifndef UNUSED
|
#ifndef UNUSED
|
||||||
#define UNUSED
|
#define UNUSED
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ATTRUNUSED
|
||||||
|
#define ATTRUNUSED
|
||||||
|
#endif
|
||||||
#ifndef FALLTHROUGH
|
#ifndef FALLTHROUGH
|
||||||
#define FALLTHROUGH
|
#define FALLTHROUGH
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ static char bid[40];
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
void
|
void
|
||||||
crashreport_init(int argc UNUSED, char *argv[] UNUSED)
|
crashreport_init(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
static int once = 0;
|
static int once = 0;
|
||||||
if (once++) /* NetHackW.exe calls us twice */
|
if (once++) /* NetHackW.exe calls us twice */
|
||||||
@@ -169,6 +169,8 @@ crashreport_init(int argc UNUSED, char *argv[] UNUSED)
|
|||||||
Strcpy(bid, "unknown");
|
Strcpy(bid, "unknown");
|
||||||
HASH_CLEANUP(ctxp);
|
HASH_CLEANUP(ctxp);
|
||||||
HASH_PRAGMA_END
|
HASH_PRAGMA_END
|
||||||
|
nhUse(argc);
|
||||||
|
nhUse(argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef HASH_CONTEXTPTR
|
#undef HASH_CONTEXTPTR
|
||||||
|
|||||||
@@ -1311,7 +1311,7 @@ extern void objects_globals_init(void);
|
|||||||
DISABLE_WARNING_UNREACHABLE_CODE
|
DISABLE_WARNING_UNREACHABLE_CODE
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc UNUSED, char *argv[] UNUSED)
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, tilenum;
|
int i, tilenum;
|
||||||
char filename[30];
|
char filename[30];
|
||||||
@@ -1395,6 +1395,8 @@ main(int argc UNUSED, char *argv[] UNUSED)
|
|||||||
free_tilerefs();
|
free_tilerefs();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
nhUse(argc);
|
||||||
|
nhUse(argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1491,7 +1493,7 @@ add_tileref(
|
|||||||
const char *prefix)
|
const char *prefix)
|
||||||
{
|
{
|
||||||
struct tiles_used temp = { 0 };
|
struct tiles_used temp = { 0 };
|
||||||
static const char ellipsis[] UNUSED = "...";
|
static const char ellipsis[] = "...";
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
|
|
||||||
if (!tilelist[n]) {
|
if (!tilelist[n]) {
|
||||||
@@ -1519,6 +1521,7 @@ add_tileref(
|
|||||||
(strlen(temp.references) >= (sizeof temp.references - 7) - 1)
|
(strlen(temp.references) >= (sizeof temp.references - 7) - 1)
|
||||||
? buf
|
? buf
|
||||||
: "");
|
: "");
|
||||||
|
nhUse(ellipsis);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user