From 077fdcfaacbac2b2f9769de7b2fcacefdfdc1882 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 28 Dec 2022 11:33:39 -0800 Subject: [PATCH] followup for miscellaneous objects[] macros The DUMP_ENUMS definition of 'MARKER()' had the expansion of its arguments backwards but isn't even needed, so get rid of it rather than reverse them. nethack --dumpenums handles them separately from object definitions. --- include/objects.h | 2 +- src/allmain.c | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/objects.h b/include/objects.h index 14200c487..4a2a0223c 100644 --- a/include/objects.h +++ b/include/objects.h @@ -60,7 +60,7 @@ #define OBJECT(obj,bits,prp,sym,prob,dly,wt, \ cost,sdam,ldam,oc1,oc2,nut,color,sn) \ { sn, #sn } -#define MARKER(tag,sn) { tag, #sn }, +#define MARKER(tag,sn) /*empty*/ #else #error Unproductive inclusion of objects.h diff --git a/src/allmain.c b/src/allmain.c index 72a898958..7a56b4695 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -1054,18 +1054,20 @@ dump_enums(void) static const char *const titles[NUM_ENUM_DUMPS] = { "monnums", "objects_nums" , "misc_object_nums" }; +#define dump_om(om) { om, #om } static const struct enum_dump omdump[] = { - { FIRST_AMULET, "FIRST_AMULET" }, - { LAST_AMULET, "LAST_AMULET" }, - { FIRST_SPELL, "FIRST_SPELL" }, - { LAST_SPELL, "LAST_SPELL" }, - { MAXSPELL, "MAXSPELL" }, - { FIRST_REAL_GEM, "FIRST_REAL_GEM" }, - { LAST_REAL_GEM, "LAST_REAL_GEM" }, - { FIRST_GLASS_GEM, "FIRST_GLASS_GEM" }, - { LAST_GLASS_GEM, "LAST_GLASS_GEM" }, - { NUM_GLASS_GEMS, "NUM_GLASS_GEMS" }, + dump_om(FIRST_AMULET), + dump_om(LAST_AMULET), + dump_om(FIRST_SPELL), + dump_om(LAST_SPELL), + dump_om(MAXSPELL), + dump_om(FIRST_REAL_GEM), + dump_om(LAST_REAL_GEM), + dump_om(FIRST_GLASS_GEM), + dump_om(LAST_GLASS_GEM), + dump_om(NUM_GLASS_GEMS), }; +#undef dump_om static const struct enum_dump *const ed[NUM_ENUM_DUMPS] = { monsdump, objdump, omdump };