diff options
author | Pierre Le Marre <dev@wismill.eu> | 2023-09-21 20:06:27 +0200 |
---|---|---|
committer | Wismill <dev@wismill.eu> | 2023-09-24 09:09:24 +0200 |
commit | c0065c95a479c7111417a6547d26594a5e31378b (patch) | |
tree | 9fd55ccc2e0db97338f8d5f96d0b7432e73d5150 /src/xkbcomp/keymap.c | |
parent | a83d745b62ea8ec89e939b00bb3754ad54280942 (diff) | |
download | libxkbcommon-c0065c95a479c7111417a6547d26594a5e31378b.tar.gz libxkbcommon-c0065c95a479c7111417a6547d26594a5e31378b.tar.bz2 libxkbcommon-c0065c95a479c7111417a6547d26594a5e31378b.zip |
Messages: merge macros with and without message code
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`.
Diffstat (limited to 'src/xkbcomp/keymap.c')
-rw-r--r-- | src/xkbcomp/keymap.c | 14 |
1 files changed, 9 insertions, 5 deletions
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; } |