From 8f4f91b66729871b5a730ae19f76e34ac1dbfedc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Feb 2021 09:56:37 +0100 Subject: [PATCH] all: add "nm-glib-aux/nm-default-glib-i18n-prog.h" as replacement for "nm-default.h" --- Makefile.am | 10 ++++----- shared/nm-default.h | 3 +-- .../nm-glib-aux/nm-default-glib-i18n-prog.h | 21 +++++++++++++++++++ shared/nm-glib-aux/tests/meson.build | 6 ++---- shared/nm-glib-aux/tests/test-json-aux.c | 2 +- .../nm-glib-aux/tests/test-shared-general.c | 2 +- shared/nm-platform/tests/meson.build | 3 +-- shared/nm-platform/tests/test-nm-platform.c | 2 +- 8 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 shared/nm-glib-aux/nm-default-glib-i18n-prog.h diff --git a/Makefile.am b/Makefile.am index c487ae01a0..c7348cb0cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -398,6 +398,7 @@ shared_nm_glib_aux_libnm_glib_aux_la_SOURCES = \ shared/nm-glib-aux/nm-dedup-multi.c \ shared/nm-glib-aux/nm-dedup-multi.h \ shared/nm-glib-aux/nm-default-glib-i18n-lib.h \ + shared/nm-glib-aux/nm-default-glib-i18n-prog.h \ shared/nm-glib-aux/nm-default-glib.h \ shared/nm-glib-aux/nm-enum-utils.c \ shared/nm-glib-aux/nm-enum-utils.h \ @@ -552,8 +553,7 @@ check_programs += shared/nm-platform/tests/test-nm-platform shared_nm_platform_tests_test_nm_platform_CPPFLAGS = \ $(dflt_cppflags) \ -I$(srcdir)/shared \ - -DNETWORKMANAGER_COMPILATION_TEST \ - -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)' \ + -DG_LOG_DOMAIN=\""test"\" \ $(CODE_COVERAGE_CFLAGS) \ $(SYSTEMD_JOURNAL_CFLAGS) \ $(GLIB_CFLAGS) \ @@ -740,8 +740,7 @@ check_programs += shared/nm-glib-aux/tests/test-shared-general shared_nm_glib_aux_tests_test_shared_general_CPPFLAGS = \ $(dflt_cppflags) \ -I$(srcdir)/shared \ - -DNETWORKMANAGER_COMPILATION_TEST \ - -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)' \ + -DG_LOG_DOMAIN=\""test"\" \ $(CODE_COVERAGE_CFLAGS) \ $(GLIB_CFLAGS) \ $(SANITIZER_LIB_CFLAGS) \ @@ -769,8 +768,7 @@ check_programs += shared/nm-glib-aux/tests/test-json-aux shared_nm_glib_aux_tests_test_json_aux_CPPFLAGS = \ $(dflt_cppflags) \ -I$(srcdir)/shared \ - -DNETWORKMANAGER_COMPILATION_TEST \ - -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)' \ + -DG_LOG_DOMAIN=\""test"\" \ $(CODE_COVERAGE_CFLAGS) \ $(GLIB_CFLAGS) \ $(JANSSON_CFLAGS) \ diff --git a/shared/nm-default.h b/shared/nm-default.h index 689c946b16..44428b237e 100644 --- a/shared/nm-default.h +++ b/shared/nm-default.h @@ -22,8 +22,7 @@ #error Define NETWORKMANAGER_COMPILATION accordingly #endif -#if NETWORKMANAGER_COMPILATION \ - < (NM_NETWORKMANAGER_COMPILATION_GLIB | NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG) +#if NETWORKMANAGER_COMPILATION < NM_NETWORKMANAGER_COMPILATION_CLIENT #error Dont include this header with such NETWORKMANAGER_COMPILATION #endif diff --git a/shared/nm-glib-aux/nm-default-glib-i18n-prog.h b/shared/nm-glib-aux/nm-default-glib-i18n-prog.h new file mode 100644 index 0000000000..0abe807b9d --- /dev/null +++ b/shared/nm-glib-aux/nm-default-glib-i18n-prog.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2015 Red Hat, Inc. + */ + +#ifndef __NM_DEFAULT_GLIB_I18N_PROG_H__ +#define __NM_DEFAULT_GLIB_I18N_PROG_H__ + +/*****************************************************************************/ + +#define _NETWORKMANAGER_COMPILATION_GLIB_I18N_PROG + +#include "nm-glib-aux/nm-default-glib.h" + +#undef NETWORKMANAGER_COMPILATION +#define NETWORKMANAGER_COMPILATION \ + (NM_NETWORKMANAGER_COMPILATION_GLIB | NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG) + +/*****************************************************************************/ + +#endif /* __NM_DEFAULT_GLIB_I18N_PROG_H__ */ diff --git a/shared/nm-glib-aux/tests/meson.build b/shared/nm-glib-aux/tests/meson.build index d1f23eedc0..464f4e7c86 100644 --- a/shared/nm-glib-aux/tests/meson.build +++ b/shared/nm-glib-aux/tests/meson.build @@ -4,8 +4,7 @@ exe = executable( 'test-shared-general', 'test-shared-general.c', c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', + '-DG_LOG_DOMAIN="test"', ], dependencies: libnm_glib_aux_dep, link_with: libnm_systemd_logging_stub, @@ -23,8 +22,7 @@ if jansson_dep.found() 'test-json-aux', 'test-json-aux.c', c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', + '-DG_LOG_DOMAIN="test"', ], dependencies: [ libnm_glib_aux_dep, diff --git a/shared/nm-glib-aux/tests/test-json-aux.c b/shared/nm-glib-aux/tests/test-json-aux.c index 9275e6713f..efbeec48c4 100644 --- a/shared/nm-glib-aux/tests/test-json-aux.c +++ b/shared/nm-glib-aux/tests/test-json-aux.c @@ -2,7 +2,7 @@ #define NM_TEST_UTILS_NO_LIBNM 1 -#include "nm-default.h" +#include "nm-glib-aux/nm-default-glib-i18n-prog.h" #include diff --git a/shared/nm-glib-aux/tests/test-shared-general.c b/shared/nm-glib-aux/tests/test-shared-general.c index d0fdedd516..8fa8617729 100644 --- a/shared/nm-glib-aux/tests/test-shared-general.c +++ b/shared/nm-glib-aux/tests/test-shared-general.c @@ -5,7 +5,7 @@ #define NM_TEST_UTILS_NO_LIBNM 1 -#include "nm-default.h" +#include "nm-glib-aux/nm-default-glib-i18n-prog.h" #include "nm-std-aux/unaligned.h" #include "nm-glib-aux/nm-random-utils.h" diff --git a/shared/nm-platform/tests/meson.build b/shared/nm-platform/tests/meson.build index 8d2b9c0f6e..a8fcdbca8e 100644 --- a/shared/nm-platform/tests/meson.build +++ b/shared/nm-platform/tests/meson.build @@ -4,8 +4,7 @@ exe = executable( 'test-nm-platform', 'test-nm-platform.c', c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', + '-DG_LOG_DOMAIN="test"', ], dependencies: [ libnm_log_core_dep, diff --git a/shared/nm-platform/tests/test-nm-platform.c b/shared/nm-platform/tests/test-nm-platform.c index 0386a3a546..3c5e41f0f1 100644 --- a/shared/nm-platform/tests/test-nm-platform.c +++ b/shared/nm-platform/tests/test-nm-platform.c @@ -2,7 +2,7 @@ #define NM_TEST_UTILS_NO_LIBNM 1 -#include "nm-default.h" +#include "nm-glib-aux/nm-default-glib-i18n-prog.h" #include "nm-log-core/nm-logging.h" #include "nm-platform/nm-netlink.h"