> Date: Wed, 09 Jul 2014 16:02:31 -0600 > From: Eric Blake <ebl...@redhat.com> > > On 07/09/2014 05:13 AM, Pavel Hrdina wrote: > > The commit fcfce839 improved localization of names for week days > > and months, but the author forget to include windows.h in order > > to use 'GetACP ()'. Without this header file build using mingw > > fails with this error message: > > > > ../../../gnulib/lib/nl_langinfo.c: In function 'ctype_codeset': > > ../../../gnulib/lib/nl_langinfo.c:76:5: warning: implicit declaration of > > function 'GetACP' [-Wimplicit-function-declaration] > > sprintf (buf + 2, "%u", GetACP ()); > > ^ > > In file included from > > /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:73:0, > > from ../../../gnulib/lib/nl_langinfo.c:149: > > /usr/i686-w64-mingw32/sys-root/mingw/include/winnls.h: At top level: > > /usr/i686-w64-mingw32/sys-root/mingw/include/winnls.h:653:64: error: > > conflicting types for 'GetACP' > > WINBASEAPI UINT WINAPI GetACP(void); > > ^ > > ../../../gnulib/lib/nl_langinfo.c:76:29: note: previous implicit > > declaration of 'GetACP' was here > > sprintf (buf + 2, "%u", GetACP ()); > > ^ > > > > Signed-off-by: Pavel Hrdina <phrd...@redhat.com> > > --- > > lib/nl_langinfo.c | 1 + > > 1 file changed, 1 insertion(+) > > ACK, fix pushed.
I believe this commit caused redundant inclusion of header files. I suggest the simple follow-up patch below. nl_langinfo: Fix last change. Don't include stdio.h and windows.h twice on MS-Windows. Also, define WIN32_LEAN_AND_MEAN before including windows.h. diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c index b5f2000..1ab551d 100644 --- a/lib/nl_langinfo.c +++ b/lib/nl_langinfo.c @@ -23,6 +23,7 @@ #include <locale.h> #include <string.h> #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> # include <stdio.h> #endif @@ -140,22 +141,9 @@ rpl_nl_langinfo (nl_item item) #else -/* Provide nl_langinfo from scratch. */ - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -/* Native Windows platforms. */ - -# define WIN32_LEAN_AND_MEAN /* avoid including junk */ -# include <windows.h> - -# include <stdio.h> - -# else - -/* An old Unix platform without locales, such as Linux libc5 or BeOS. */ - -# endif +/* Provide nl_langinfo from scratch, either for native MS-Windows, or + for old Unix platforms without locales, such as Linux libc5 or + BeOS. */ # include <time.h>