From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id BC16E386F83F for ; Wed, 16 Dec 2020 09:54:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BC16E386F83F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ldv@altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 36F9772C8B5 for ; Wed, 16 Dec 2020 12:54:09 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 297457CC819; Wed, 16 Dec 2020 12:54:09 +0300 (MSK) Date: Wed, 16 Dec 2020 12:54:09 +0300 From: "Dmitry V. Levin" To: elfutils-devel@sourceware.org Subject: [PATCH 1/4] Consistently define _(Str) using dgettext ("elfutils", Str) Message-ID: <20201216095408.GA26456@altlinux.org> References: <20201216014759.GA21292@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201216014759.GA21292@altlinux.org> X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 09:54:11 -0000 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 663a7aa5..48b496ce 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 84b22d7c..f0e3d07a 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 0424afc8..7c094985 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 78f1baa4..98ac3315 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 53d8f3a0..8b72f32b 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 ab568f55..20fec602 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 c18eea43..7174ea93 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 fc64eafd..f9f6f01f 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 2aa1b5e0..01ec18e2 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 4c6fcb28..4344e356 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 e0862ec3..33208f0d 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 599f6378..fa1c2c9f 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 41727fbd..acd9f8f0 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2020-12-16 Dmitry V. Levin + + * libelfP.h (_): Remove. + 2020-12-12 Dmitry V. Levin * common.h: Fix spelling typo in comment. diff --git a/libelf/libelfP.h b/libelf/libelfP.h index b8ffa18d..fc1aebec 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 72f70343..27e64384 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 231b941d..85803295 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 2c83f690..119cf8e7 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 9251d158..bec8a07c 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 }, -- ldv