From 0a5defb64e94ecb2847b98b2c29155131edeaf97 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 16 Dec 2020 08:00:00 +0000 Subject: [PATCH] Consistently define _(Str) using dgettext ("elfutils", Str) Move the definition of _(Str) macro to lib/eu-config.h which already provides a definition of N_(Str) macro. Since lib/eu-config.h is appended to config.h, it is included into every compilation unit and therefore both macros are now universally available. Remove all other definitions of N_(Str) and _(Str) macros from other files to avoid conflicts and redundancies. The next step is to replace all uses of gettext(Str) with _(Str). Signed-off-by: Dmitry V. Levin --- lib/ChangeLog | 5 +++++ lib/eu-config.h | 3 ++- lib/xmalloc.c | 4 ---- libasm/ChangeLog | 4 ++++ libasm/libasmP.h | 3 --- libdw/ChangeLog | 4 ++++ libdw/libdwP.h | 4 ---- libdwfl/ChangeLog | 5 +++++ libdwfl/argp-std.c | 3 --- libdwfl/libdwflP.h | 3 --- libebl/ChangeLog | 4 ++++ libebl/libeblP.h | 5 ----- libelf/ChangeLog | 4 ++++ libelf/libelfP.h | 3 --- src/ChangeLog | 4 ++++ src/unstrip.c | 4 ---- tests/ChangeLog | 4 ++++ tests/dwflmodtest.c | 4 ---- 18 files changed, 36 insertions(+), 34 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 663a7aa..48b496c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2020-12-16 Dmitry V. Levin + + * eu-config.h (_): New macro. + * xmalloc.c (_): Remove. + 2020-11-01 Érico N. Rolim * system.h (ACCESSPERMS): Define macro if it doesn't exist. diff --git a/lib/eu-config.h b/lib/eu-config.h index 84b22d7..f0e3d07 100644 --- a/lib/eu-config.h +++ b/lib/eu-config.h @@ -52,8 +52,9 @@ # define rwlock_unlock(lock) ((void) (lock)) #endif /* USE_LOCKS */ -/* gettext helper macro. */ +/* gettext helper macros. */ #define N_(Str) Str +#define _(Str) dgettext ("elfutils", Str) /* Compiler-specific definitions. */ #define strong_alias(name, aliasname) \ diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 0424afc..7c09498 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -36,10 +36,6 @@ #include #include "system.h" -#ifndef _ -# define _(str) gettext (str) -#endif - /* Allocate N bytes of memory dynamically, with error checking. */ void * diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 78f1baa..98ac331 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,7 @@ +2020-12-16 Dmitry V. Levin + + * libasmP.h (_): Remove. + 2020-12-12 Dmitry V. Levin * asm_begin.c (prepare_binary_output): Fix spelling typo in comment. diff --git a/libasm/libasmP.h b/libasm/libasmP.h index 53d8f3a..8b72f32 100644 --- a/libasm/libasmP.h +++ b/libasm/libasmP.h @@ -36,9 +36,6 @@ #include "libdwelf.h" -/* gettext helper macros. */ -#define _(Str) dgettext ("elfutils", Str) - /* Known error codes. */ enum diff --git a/libdw/ChangeLog b/libdw/ChangeLog index ab568f5..20fec60 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2020-12-16 Dmitry V. Levin + + * libdwP.h (_): Remove. + 2020-12-12 Dmitry V. Levin * dwarf.h: Fix spelling typo in comment. diff --git a/libdw/libdwP.h b/libdw/libdwP.h index c18eea4..7174ea9 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -38,10 +38,6 @@ #include "atomics.h" -/* gettext helper macros. */ -#define _(Str) dgettext ("elfutils", Str) - - /* Known location expressions already decoded. */ struct loc_s { diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index fc64eaf..f9f6f01 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2020-12-16 Dmitry V. Levin + + * argp-std.c (_): Remove. + * libdwflP.h (_): Likewise. + 2020-12-12 Dmitry V. Levin * libdwfl.h: Fix spelling typos in comments. diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c index 2aa1b5e..01ec18e 100644 --- a/libdwfl/argp-std.c +++ b/libdwfl/argp-std.c @@ -38,9 +38,6 @@ #include #include -/* gettext helper macros. */ -#define _(Str) dgettext ("elfutils", Str) - #define OPT_DEBUGINFO 0x100 #define OPT_COREFILE 0x101 diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h index 4c6fcb2..4344e35 100644 --- a/libdwfl/libdwflP.h +++ b/libdwfl/libdwflP.h @@ -47,9 +47,6 @@ typedef struct Dwfl_Process Dwfl_Process; -/* gettext helper macros. */ -#define _(Str) dgettext ("elfutils", Str) - #define DWFL_ERRORS \ DWFL_ERROR (NOERROR, N_("no error")) \ DWFL_ERROR (UNKNOWN_ERROR, N_("unknown error")) \ diff --git a/libebl/ChangeLog b/libebl/ChangeLog index e0862ec..33208f0 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,7 @@ +2020-12-16 Dmitry V. Levin + + * libeblP.h (_): Remove. + 2020-12-15 Dmitry V. Levin * eblbackendname.c (ebl_backend_name): Replace gettext(...) with _(...). diff --git a/libebl/libeblP.h b/libebl/libeblP.h index 599f637..fa1c2c9 100644 --- a/libebl/libeblP.h +++ b/libebl/libeblP.h @@ -86,11 +86,6 @@ struct ebl typedef Ebl *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *); -/* gettext helper macros. */ -#undef _ -#define _(Str) dgettext ("elfutils", Str) - - /* LEB128 constant helper macros. */ #define ULEB128_7(x) (BUILD_BUG_ON_ZERO ((x) >= (1U << 7)) + (x)) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index a280a26..dbc99ee 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2020-12-16 Dmitry V. Levin + + * libelfP.h (_): Remove. + 2020-12-15 Mark Wielaard * elf_begin.c (get_shnum): Make sure the full Ehdr is available. diff --git a/libelf/libelfP.h b/libelf/libelfP.h index b8ffa18..fc1aebe 100644 --- a/libelf/libelfP.h +++ b/libelf/libelfP.h @@ -39,9 +39,6 @@ #include #include -/* gettext helper macros. */ -#define _(Str) dgettext ("elfutils", Str) - /* Helper Macros to write 32 bit and 64 bit functions. */ #define __elfw2_(Bits, Name) __elf##Bits##_##Name diff --git a/src/ChangeLog b/src/ChangeLog index 72f7034..27e6438 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2020-12-16 Dmitry V. Levin + + * unstrip.c (_): Remove. + 2020-12-15 Mark Wielaard * elflint.c (check_symtab): Always print symbol name (if known) diff --git a/src/unstrip.c b/src/unstrip.c index 231b941..8580329 100644 --- a/src/unstrip.c +++ b/src/unstrip.c @@ -52,10 +52,6 @@ #include "libeu.h" #include "printversion.h" -#ifndef _ -# define _(str) gettext (str) -#endif - /* Name and version of program. */ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; diff --git a/tests/ChangeLog b/tests/ChangeLog index 2c83f69..119cf8e 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2020-12-16 Dmitry V. Levin + + * dwflmodtest.c (N_): Remove. + 2020-12-12 Dmitry V. Levin * dwarf-die-addr-die.c (main): Fix spelling typo in error diagnostics. diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c index 9251d15..bec8a07 100644 --- a/tests/dwflmodtest.c +++ b/tests/dwflmodtest.c @@ -204,10 +204,6 @@ print_module (Dwfl_Module *mod __attribute__ ((unused)), static bool show_functions; -/* gettext helper macro. */ -#undef N_ -#define N_(Str) Str - static const struct argp_option options[] = { { "functions", 'f', NULL, 0, N_("Additionally show function names"), 0 }, -- 2.7.4