langinfo: Avoid #define replacements in C++ mode.
[gnulib.git] / lib / langinfo.in.h
index 3d3e2ba..54fa1af 100644 (file)
@@ -123,14 +123,12 @@ typedef int nl_item;
 
 #endif
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Declare overridden functions.  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 
 /* Return a piece of locale dependent information.
    Note: The difference between nl_langinfo (CODESET) and locale_charset ()
@@ -138,12 +136,19 @@ extern "C" {
 
 #if @GNULIB_NL_LANGINFO@
 # if @REPLACE_NL_LANGINFO@
-#  undef nl_langinfo
-#  define nl_langinfo rpl_nl_langinfo
-# endif
-# if !@HAVE_NL_LANGINFO@ || @REPLACE_NL_LANGINFO@
-extern char *nl_langinfo (nl_item item);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef nl_langinfo
+#   define nl_langinfo rpl_nl_langinfo
+#  endif
+_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
+_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
+# else
+#  if !@HAVE_NL_LANGINFO@
+_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
+#  endif
+_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
 # endif
+_GL_CXXALIASWARN (nl_langinfo);
 #elif defined GNULIB_POSIXCHECK
 # undef nl_langinfo
 # if HAVE_RAW_DECL_NL_LANGINFO
@@ -153,10 +158,5 @@ _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
 #endif
 
 
-#ifdef __cplusplus
-}
-#endif
-
-
 #endif /* _GL_LANGINFO_H */
 #endif /* _GL_LANGINFO_H */