From 5afc8bb99662a22a7b7f1b617df364f741c840dd Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 10 Jun 2023 04:04:15 +0300 Subject: [PATCH 25/25] Add macros to mark secfile entries ignored These macros (secfile_entry_ignore() and secfile_entry_ignore_by_path() ) silence "unused entry" warnings from secfile loading. They wrap secfile_entry_lookup() and secfile_entry_by_path() calls traditionally used for the task, but names of these new macros should indicate more clearly why the entry lookup is done, and also makes it possible to search for these specific cases. Some cases in tilespec code have been converted to use the new macros as an example, but mostly this patch just provides the macros. They are not taken to use everywhere yet. See osdn #48208 Signed-off-by: Marko Lindqvist --- client/tilespec.c | 4 ++-- utility/registry_ini.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/tilespec.c b/client/tilespec.c index 5fdab36087..1a627b0a0a 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -1583,10 +1583,10 @@ static void scan_specfile(struct tileset *t, struct specfile *sf, } /* Currently unused */ - (void) secfile_entry_lookup(file, "info.artists"); + secfile_entry_ignore(file, "info.artists"); /* Not used here */ - (void) secfile_entry_lookup(file, "file.gfx"); + secfile_entry_ignore(file, "file.gfx"); if ((sections = secfile_sections_by_name_prefix(file, "grid_"))) { section_list_iterate(sections, psection) { diff --git a/utility/registry_ini.h b/utility/registry_ini.h index b1c10662d6..f09d817ed5 100644 --- a/utility/registry_ini.h +++ b/utility/registry_ini.h @@ -404,6 +404,13 @@ struct entry *secfile_entry_lookup(const struct section_file *secfile, const char *path, ...) fc__attribute((__format__ (__printf__, 2, 3))); +/* Macros to silence "unused entry" warnings about entries that + * we intentionally ignore. */ +#define secfile_entry_ignore(_sfile_, _fmt_, ...) \ + (void) secfile_entry_lookup(_sfile_, _fmt_, ## __VA_ARGS__) +#define secfile_entry_ignore_by_path(_sfile_, _path_) \ + (void) secfile_entry_by_path(_sfile_, _path_) + bool secfile_lookup_bool(const struct section_file *secfile, bool *bval, const char *path, ...) fc__warn_unused_result -- 2.39.2