bug-glibc
[Top][All Lists]
Advanced

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

mktime.c vs. __mon_yday & __mktime_internal when linking with -static


From: Jim Meyering
Subject: mktime.c vs. __mon_yday & __mktime_internal when linking with -static
Date: Tue, 19 Nov 2002 09:37:04 +0100

Hi,

There was a minor problem building the coreutils with -static,
due to the `extern' scope of two symbols in mktime.  Here's the
problem report.

  http://mail.gnu.org/pipermail/bug-coreutils/2002-November/000058.html

It'd be nice if we could keep the version of mktime.c in glibc
in sync.  Here's a patch that will do that.
I noticed that strptime has the same problem.

2002-11-19  Jim Meyering  <address@hidden>

        * time/mktime.c (STATIC): Define.
        (__mon_yday, __mktime_internal) [!_LIBC]: Declare as `static'.
        * time/strptime.c (__mon_yday) [!_LIBC]: Declare as `static'.

Index: time/mktime.c
===================================================================
RCS file: /cvs/libc/time/mktime.c,v
retrieving revision 1.50
diff -u -p -u -p -r1.50 mktime.c
--- time/mktime.c       3 Aug 2002 12:08:54 -0000       1.50
+++ time/mktime.c       19 Nov 2002 08:10:28 -0000
@@ -29,6 +29,9 @@
 #ifdef _LIBC
 # define HAVE_LIMITS_H 1
 # define STDC_HEADERS 1
+# define STATIC /* empty */
+#else
+# define STATIC static
 #endif
 
 /* Assume that leap seconds are possible, unless told otherwise.
@@ -100,7 +103,7 @@
 #endif
 
 /* How many days come before each month (0-12).  */
-const unsigned short int __mon_yday[2][13] =
+STATIC const unsigned short int __mon_yday[2][13] =
   {
     /* Normal years.  */
     { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
@@ -213,7 +216,7 @@ ranged_convert (struct tm *(*convert) (c
    Use *OFFSET to keep track of a guess at the offset of the result,
    compared to what the result would be for UTC without leap seconds.
    If *OFFSET's guess is correct, only one CONVERT call is needed.  */
-time_t
+STATIC time_t
 __mktime_internal (struct tm *tp,
                   struct tm *(*convert) (const time_t *, struct tm *),
                   time_t *offset)
@@ -246,7 +249,7 @@ __mktime_internal (struct tm *tp,
   int mon_years = mon / 12 - negative_mon_remainder;
   int year = year_requested + mon_years;
 
-   /* The other values need not be in range:
+  /* The other values need not be in range:
      the remaining code handles minor overflows correctly,
      assuming int and time_t arithmetic wraps around.
      Major overflows are caught at the end.  */

Index: time/strptime.c
===================================================================
RCS file: /cvs/libc/time/strptime.c,v
retrieving revision 1.42
diff -u -p -u -p -r1.42 strptime.c
--- time/strptime.c     29 Aug 2002 07:26:10 -0000      1.42
+++ time/strptime.c     19 Nov 2002 08:30:18 -0000
@@ -185,7 +185,7 @@ static char const ab_month_name[][4] =
 # define HERE_T_FMT_AMPM "%I:%M:%S %p"
 # define HERE_T_FMT "%H:%M:%S"
 
-const unsigned short int __mon_yday[2][13] =
+static const unsigned short int __mon_yday[2][13] =
   {
     /* Normal years.  */
     { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },




reply via email to

[Prev in Thread] Current Thread [Next in Thread]