[RESEND,2/2] Fix time/mktime.c and time/gmtime.c for gnulib compatibility

Message ID 20190219141810.1768-2-lukma@denx.de
State Superseded
Headers

Commit Message

Lukasz Majewski Feb. 19, 2019, 2:18 p.m. UTC
  From: Paul Eggert <eggert@cs.ucla.edu>

Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu.

	* time/mktime.c
	(__mktime64): Guard weak_alias with #ifdef
	(__mktime64): Guard libc_hidden_def with #if _LIBC
	(__mktime64): Guard libc_hidden_weak with #if _LIBC
	(mktime): Only build when _LIBC is defined
	* time/timegm.c:
	(timegm): Only build when _LIBC is defined
---
 time/mktime.c | 15 +++------------
 time/timegm.c |  2 +-
 2 files changed, 4 insertions(+), 13 deletions(-)
  

Comments

Lukasz Majewski Feb. 26, 2019, 7:20 a.m. UTC | #1
Dear All,

> From: Paul Eggert <eggert@cs.ucla.edu>
> 
> Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu.
> 
> 	* time/mktime.c
> 	(__mktime64): Guard weak_alias with #ifdef
> 	(__mktime64): Guard libc_hidden_def with #if _LIBC
> 	(__mktime64): Guard libc_hidden_weak with #if _LIBC
> 	(mktime): Only build when _LIBC is defined
> 	* time/timegm.c:
> 	(timegm): Only build when _LIBC is defined

Gentle ping on this patch.

> ---
>  time/mktime.c | 15 +++------------
>  time/timegm.c |  2 +-
>  2 files changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/time/mktime.c b/time/mktime.c
> index 26c2417431..5d6a65dab6 100644
> --- a/time/mktime.c
> +++ b/time/mktime.c
> @@ -549,18 +549,14 @@ __mktime64 (struct tm *tp)
>    return mktime (tp);
>  # endif
>  }
> -#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
>  
> -#ifdef weak_alias
>  weak_alias (__mktime64, __timelocal64)
> -#endif
> -
> -#ifdef _LIBC
>  libc_hidden_def (__mktime64)
>  libc_hidden_weak (__timelocal64)
> -#endif
>  
> -#if __TIMESIZE != 64
> +#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
> +
> +#if defined _LIBC && __TIMESIZE != 64
>  
>  /* The 32-bit-time wrapper.  */
>  time_t
> @@ -573,13 +569,8 @@ mktime (struct tm *tp)
>    return -1;
>  }
>  
> -#ifdef weak_alias
>  weak_alias (mktime, timelocal)
> -#endif
> -
> -#ifdef _LIBC
>  libc_hidden_def (mktime)
>  libc_hidden_weak (timelocal)
> -#endif
>  
>  #endif
> diff --git a/time/timegm.c b/time/timegm.c
> index 71303622af..57bbc85436 100644
> --- a/time/timegm.c
> +++ b/time/timegm.c
> @@ -35,7 +35,7 @@ __timegm64 (struct tm *tmp)
>    return __mktime_internal (tmp, __gmtime64_r, &gmtime_offset);
>  }
>  
> -#if __TIMESIZE != 64
> +#if defined _LIBC &&  __TIMESIZE != 64
>  
>  time_t
>  timegm (struct tm *tmp)




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
  

Patch

diff --git a/time/mktime.c b/time/mktime.c
index 26c2417431..5d6a65dab6 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -549,18 +549,14 @@  __mktime64 (struct tm *tp)
   return mktime (tp);
 # endif
 }
-#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
 
-#ifdef weak_alias
 weak_alias (__mktime64, __timelocal64)
-#endif
-
-#ifdef _LIBC
 libc_hidden_def (__mktime64)
 libc_hidden_weak (__timelocal64)
-#endif
 
-#if __TIMESIZE != 64
+#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
+
+#if defined _LIBC && __TIMESIZE != 64
 
 /* The 32-bit-time wrapper.  */
 time_t
@@ -573,13 +569,8 @@  mktime (struct tm *tp)
   return -1;
 }
 
-#ifdef weak_alias
 weak_alias (mktime, timelocal)
-#endif
-
-#ifdef _LIBC
 libc_hidden_def (mktime)
 libc_hidden_weak (timelocal)
-#endif
 
 #endif
diff --git a/time/timegm.c b/time/timegm.c
index 71303622af..57bbc85436 100644
--- a/time/timegm.c
+++ b/time/timegm.c
@@ -35,7 +35,7 @@  __timegm64 (struct tm *tmp)
   return __mktime_internal (tmp, __gmtime64_r, &gmtime_offset);
 }
 
-#if __TIMESIZE != 64
+#if defined _LIBC &&  __TIMESIZE != 64
 
 time_t
 timegm (struct tm *tmp)