glademm 2.5: Why does non-NLS version undefine gettext() etc?

From a glademm-2.5 generated source code file:

#  include <libintl.h>
#  undef _
#  define _(String) dgettext (GETTEXT_PACKAGE, String)
#  ifdef gettext_noop
#    define N_(String) gettext_noop (String)
#  else
#    define N_(String) (String)
#  endif
#  define textdomain(String) (String)
#  define gettext(String) (String)
#  define dgettext(Domain,Message) (Message)
#  define dcgettext(Domain,Message,Type) (Message)
#  define bindtextdomain(Domain,Directory) (Domain)
#  define _(String) (String)
#  define N_(String) (String)

Why does the #else branch do all this? I mean, shouldn't it just define _() and N_(), and leave gettext() etc. alone? Isn't the point of using _()/_N() precisely to avoid overriding the "gettext" calls themselves?

The above construction leads to a compilation error if you don't define ENABLE_NLS, but happen to include libintl.h anyway - like this:

/usr/include/libintl.h:40: parse error before `__const'
/usr/include/libintl.h:44: parse error before `__const'
/usr/include/libintl.h:51: parse error before `__const'
/usr/include/libintl.h:81: parse error before `__const'
/usr/include/libintl.h:85: parse error before `__const'

which is due to the fact that the function prototypes will be changed by macro expansion, so that e.g.

extern char *gettext (__const char *__msgid) __THROW;


extern char *(__const char *__msgid) throw ();

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]