This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
glibc strftime.c _REENTRANT problem (GNU Emacs 20.3, Solaris 2.6)
- To: libc-alpha@cygnus.com
- Subject: glibc strftime.c _REENTRANT problem (GNU Emacs 20.3, Solaris 2.6)
- From: Paul Eggert <eggert@twinsun.com>
- Date: Mon, 7 Sep 1998 00:02:26 -0700 (PDT)
On Solaris 2.6, GNU Emacs 20.3's config.h file includes <time.h>
indirectly, which means that the "#define _REENTRANT 1" in glibc
strftime.c is ineffective: it doesn't occur until after config.h is
included. (The explicit "#include <time.h>" in strftime.c has no
effect, since <time.h> was already included by config.h and <time.h>
protects itself against multiple inclusion.)
The symptoms are that localtime_r and gmtime_r are not declared by
<time.h>, which causes compiler complaints on Solaris 2.6.
Here is a patch.
1998-09-06 Paul Eggert <eggert@twinsun.com>
* strftime.c (_REENTRANT): Define before including <config.h>.
===================================================================
RCS file: strftime.c,v
retrieving revision 20.3.0.2
retrieving revision 20.3.0.3
diff -u -r20.3.0.2 -r20.3.0.3
--- strftime.c 1998/09/07 06:28:58 20.3.0.2
+++ strftime.c 1998/09/07 06:54:16 20.3.0.3
@@ -18,15 +18,17 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Some hosts need this in order to declare localtime_r properly. */
+/* Some hosts need this in order to declare localtime_r properly.
+ This must appear before <config.h> is included, because Emacs's
+ <config.h> includes <time.h> on some hosts. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_MBLEN 1