On Solaris, gettext.h was sometimes converting char const * to char * without a cast, which violates a constraint of the C standard. GCC 3.4.3 complained about this. Though the compile succeeded it’s better to not violate constraints when it’s easy. * lib/gettext.h (gettext, dgettext, dcgettext) [__sun && __GNUC__ && !__clang__ && !__cplusplus && !ENABLE_NLS]: Cast msgid to char * before returning. --- ChangeLog | 9 +++++++++ lib/gettext.h | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 3c2c873517..97ce480fd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2026-07-25 Paul Eggert <[email protected]> + gettext-h: conform to C on Solaris + On Solaris, gettext.h was sometimes converting char const * to char * + without a cast, which violates a constraint of the C standard. + GCC 3.4.3 complained about this. Though the compile succeeded + it’s better to not violate constraints when it’s easy. + * lib/gettext.h (gettext, dgettext, dcgettext) + [__sun && __GNUC__ && !__clang__ && !__cplusplus && !ENABLE_NLS]: + Cast msgid to char * before returning. + verify: port to Solaris 10 + gcc 3.4.3 + assert-h I ran into this problem when building GNU m4 (Savannah commit 7d5125b78d56dfa08b6bb4205428eb9962ad9244) on Solaris 10 sparc. diff --git a/lib/gettext.h b/lib/gettext.h index 02b8b7b8de..4238340305 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -112,7 +112,11 @@ const char * gettext (const char *msgid) { - return msgid; + return +# ifdef __sun + (char *) +# endif + msgid; } # if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 __attribute__ ((__always_inline__, __gnu_inline__)) @@ -127,7 +131,11 @@ char * dgettext (const char *domain, const char *msgid) { (void) domain; - return msgid; + return +# ifdef __sun + (char *) +# endif + msgid; } # if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 __attribute__ ((__always_inline__, __gnu_inline__)) @@ -143,7 +151,11 @@ dcgettext (const char *domain, const char *msgid, int category) { (void) domain; (void) category; - return msgid; + return +# ifdef __sun + (char *) +# endif + msgid; } # if __GNUC__ >= 9 # pragma GCC diagnostic pop -- 2.55.0
