[pacman-dev] [PATCH] Fix build warnings with --disable-nls

Allan McRae allan at archlinux.org
Sat Dec 21 03:12:19 EST 2013


The gettext functions return a "char *", so do the same for the defines
in the case where gettext is unavailable.  This prevents a number of
warnings about const being dropped.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/util.h | 2 +-
 src/pacman/util.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index c12b39b..2142171 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -47,7 +47,7 @@
 /* define _() as shortcut for gettext() */
 #define _(str) dgettext ("libalpm", str)
 #else
-#define _(s) s
+#define _(s) (char *)s
 #endif
 
 void _alpm_alloc_fail(size_t size);
diff --git a/src/pacman/util.h b/src/pacman/util.h
index e2297f8..9920e74 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -34,8 +34,8 @@
 #define _(str) gettext(str)
 #define _n(str1, str2, ct) ngettext(str1, str2, ct)
 #else
-#define _(str) str
-#define _n(str1, str2, ct) (ct == 1 ? str1 : str2)
+#define _(str) (char *)str
+#define _n(str1, str2, ct) (char *)(ct == 1 ? str1 : str2)
 #endif
 
 typedef struct _pm_target_t {
-- 
1.8.5.2



More information about the pacman-dev mailing list