summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-05-21 10:49:41 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2020-05-25 12:05:00 +0200
commitc378f9ee5746b06ead26793881b1449c53b1d7c6 (patch)
tree89d0c471b0085b9ba7b52c29076a6d748c55f111 /CMake
parent574249cd721a3cdbb79b6e457384a55827856b6a (diff)
Stub out i18n methods for -DUSE_NLS=OFF
Replacing the macros with stub inline functions allows for more versatile usage, e.g. fixing this compile error: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++locale.h:41, from /usr/include/c++/9/bits/localefwd.h:40, from /usr/include/c++/9/ios:41, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from include/apt-pkg/configuration.h:30, from ../apt-pkg/contrib/netrc.cc:16: /usr/include/c++/9/clocale:54:11: error: ‘::setlocale’ has not been declared 54 | using ::setlocale; Gbp-Dch: Ignore
Diffstat (limited to 'CMake')
-rw-r--r--CMake/apti18n.h.in13
1 files changed, 9 insertions, 4 deletions
diff --git a/CMake/apti18n.h.in b/CMake/apti18n.h.in
index 192979590..de9c84965 100644
--- a/CMake/apti18n.h.in
+++ b/CMake/apti18n.h.in
@@ -2,6 +2,9 @@
/* Internationalization macros for apt. This header should be included last
in each C file. */
+#ifndef APT_I18N_H
+#define APT_I18N_H
+
// Set by autoconf
#cmakedefine USE_NLS
@@ -19,11 +22,13 @@
# define N_(x) x
#else
// apt will not use any gettext
-# define setlocale(a, b)
-# define textdomain(a)
-# define bindtextdomain(a, b)
+extern "C" inline char* setlocale(int, const char*) throw() { return nullptr; }
+extern "C" inline char* textdomain(const char*) throw() { return nullptr; }
+extern "C" inline char* bindtextdomain(const char*, const char*) throw() { return nullptr; }
+extern "C" inline char* dgettext(const char*, const char* msg) throw() { return const_cast<char*>(msg); }
# define _(x) x
# define P_(msg,plural,n) (n == 1 ? msg : plural)
# define N_(x) x
-# define dgettext(d, m) m
+#endif
+
#endif