Why does lib/wchar.in.h have:
  #ifndef _GL_WCHAR_H
  ...
  #ifndef _GL_WCHAR_H
  #define _GL_WCHAR_H
rather than just:
  #ifndef _GL_WCHAR_H
  #define _GL_WCHAR_H

This causes a problem on HP-UX 11.00 because <wchar.h> is included more
than once.
  $ ./gnulib-tool --create-testdir --dir=t arpa_inet crypto/md5 \
  environ filemode fnmatch fnmatch-gnu getdate gettext glob human \
  iconv_open inet_pton lstat mbswidth memmem mktime modechange poll \
  regex socklen strcase strftime strptime strtok_r vsnprintf \
  vsnprintf-posix wcwidth
  $ cd t
  $ ./configure
  $ gmake
  ...
  cc -DHAVE_CONFIG_H -I. -I..  -I../intl   -g -c -o btowc.o btowc.c
  cc: "wchar.h", line 124: error 1000: Unexpected symbol: "btowc".
  cc: panic 2017: Cannot recover from earlier errors, terminating.
  gmake[4]: *** [btowc.o] Error 1

  $ cd gllib

  $ cc -DHAVE_CONFIG_H -I. -I..  -I../intl   -g -E btowc.c | grep wchar.h
  # 1 "./wchar.h"
  # 49 "./wchar.h"
  # 50 "./wchar.h"
  # 51 "./wchar.h"
  # 1 "///usr/include/wchar.h"
  # 33 "///usr/include/wchar.h"
  # 1 "./wchar.h"
  # 49 "./wchar.h"
  # 50 "./wchar.h"
  # 51 "./wchar.h"
  # 1 "///usr/include/wchar.h"
  # 57 "./wchar.h"
  # 1 "./wchar.h"
  # 42 "///usr/include/wchar.h"
  # 57 "./wchar.h"

  $ cc -DHAVE_CONFIG_H -I. -I..  -I../intl   -g -E btowc.c | \
  grep wint_t | head -2
  extern wint_t btowc (int c);
     typedef unsigned int wint_t;

Applying the attached patch fixes this:
  $ cc -DHAVE_CONFIG_H -I. -I..  -I../intl   -g -E btowc.c | grep wchar.h
  # 1 "./wchar.h"
  # 50 "./wchar.h"
  # 51 "./wchar.h"
  # 52 "./wchar.h"
  # 1 "///usr/include/wchar.h"
  # 33 "///usr/include/wchar.h"
  # 1 "./wchar.h"
  # 1 "./wchar.h"
  # 42 "///usr/include/wchar.h"
  # 58 "./wchar.h"

  $ cc -DHAVE_CONFIG_H -I. -I..  -I../intl   -g -E btowc.c | \
  grep wint_t | head -2
     typedef unsigned int wint_t;
   ...
  extern wint_t btowc (int c);

-- 
albert chin (ch...@thewrittenword.com)
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 74e5f24..e2e0b6c 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -39,6 +39,7 @@
 /* Normal invocation convention.  */
 
 #ifndef _GL_WCHAR_H
+#define _GL_WCHAR_H
 
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
@@ -55,9 +56,6 @@
 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
 #endif
 
-#ifndef _GL_WCHAR_H
-#define _GL_WCHAR_H
-
 /* The definition of GL_LINK_WARNING is copied here.  */
 
 #ifdef __cplusplus
@@ -288,5 +286,4 @@ extern int wcwidth (int /* actually wchar_t */);
 #endif
 
 #endif /* _GL_WCHAR_H */
-#endif /* _GL_WCHAR_H */
 #endif

Reply via email to