From c0065c95a479c7111417a6547d26594a5e31378b Mon Sep 17 00:00:00 2001 From: Pierre Le Marre Date: Thu, 21 Sep 2023 20:06:27 +0200 Subject: Messages: merge macros with and without message code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we had two types of macros for logging: with and without message code. They were intended to be merged afterwards. The idea is to use a special code – `XKB_LOG_MESSAGE_NO_ID = 0` – that should *not* be displayed. But we would like to avoid checking this special code at run time. This is achieved using macro tricks; they are detailed in the code (see: `PREPEND_MESSAGE_ID`). Now it is also easier to spot the remaining undocumented log entries: just search `XKB_LOG_MESSAGE_NO_ID`. --- src/xkbcomp/keymap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/xkbcomp/keymap.c') diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index 0878159..0aaed1f 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -248,14 +248,15 @@ CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) XKB_WARNING_UNSUPPORTED_GEOMETRY_SECTION, "Geometry sections are not supported; ignoring\n"); } else { - log_err(ctx, "Cannot define %s in a keymap file\n", + log_err(ctx, XKB_LOG_MESSAGE_NO_ID, + "Cannot define %s in a keymap file\n", xkb_file_type_to_string(file->file_type)); } continue; } if (files[file->file_type]) { - log_err(ctx, + log_err(ctx, XKB_LOG_MESSAGE_NO_ID, "More than one %s section in keymap file; " "All sections after the first ignored\n", xkb_file_type_to_string(file->file_type)); @@ -274,7 +275,8 @@ CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) type <= LAST_KEYMAP_FILE_TYPE; type++) { if (files[type] == NULL) { - log_err(ctx, "Required section %s missing from keymap\n", + log_err(ctx, XKB_LOG_MESSAGE_NO_ID, + "Required section %s missing from keymap\n", xkb_file_type_to_string(type)); ok = false; } @@ -286,12 +288,14 @@ CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) for (type = FIRST_KEYMAP_FILE_TYPE; type <= LAST_KEYMAP_FILE_TYPE; type++) { - log_dbg(ctx, "Compiling %s \"%s\"\n", + log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID, + "Compiling %s \"%s\"\n", xkb_file_type_to_string(type), files[type]->name); ok = compile_file_fns[type](files[type], keymap, merge); if (!ok) { - log_err(ctx, "Failed to compile %s\n", + log_err(ctx, XKB_LOG_MESSAGE_NO_ID, + "Failed to compile %s\n", xkb_file_type_to_string(type)); return false; } -- cgit v1.2.3