PR 47802 Use builtins to check localtime_r return type
From-SVN: r170683
This commit is contained in:
parent
87e7b310b3
commit
246a273017
@ -1,3 +1,9 @@
|
||||
2011-03-04 Janne Blomqvist <jb@gcc.gnu.org>
|
||||
|
||||
PR libfortran/47802
|
||||
* intrinsics/ctime.c (strctime): Use builtins to check localtime_r
|
||||
return type.
|
||||
|
||||
2011-03-04 Janne Blomqvist <jb@gcc.gnu.org>
|
||||
|
||||
PR libfortran/47802
|
||||
|
@ -40,11 +40,16 @@ strctime (char *s, size_t max, const time_t *timep)
|
||||
{
|
||||
#ifdef HAVE_STRFTIME
|
||||
struct tm ltm;
|
||||
/* Note: We can't use the return value of localtime_r, as some
|
||||
targets provide localtime_r based on a draft of the POSIX
|
||||
int failed;
|
||||
/* Some targets provide a localtime_r based on a draft of the POSIX
|
||||
standard where the return type is int rather than the
|
||||
standardized struct tm*. */
|
||||
localtime_r (timep, <m);
|
||||
__builtin_choose_expr (__builtin_classify_type (localtime_r (timep, <m))
|
||||
== 5,
|
||||
failed = localtime_r (timep, <m) == NULL,
|
||||
failed = localtime_r (timep, <m) != 0);
|
||||
if (failed)
|
||||
return 0;
|
||||
return strftime (s, max, "%c", <m);
|
||||
#else
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user