Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
b5fa435a
Commit
b5fa435a
authored
Jan 27, 2011
by
Janne Blomqvist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pr 47431 CTIME/FDATE thread-safety using ctime_r()
From-SVN: r169338
parent
6a0f6e77
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
8 deletions
+42
-8
libgfortran/ChangeLog
+12
-0
libgfortran/config.h.in
+3
-0
libgfortran/configure
+1
-1
libgfortran/configure.ac
+1
-1
libgfortran/intrinsics/ctime.c
+25
-6
No files found.
libgfortran/ChangeLog
View file @
b5fa435a
2011-01-27 Janne Blomqvist <jb@gcc.gnu.org>
2011-01-27 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/47431
* config.h.in: Regenerated.
* configure: Regenerated.
* configure.ac: Add check for ctime_r().
* intrinsics/ctime.c (ctime_r): Fallback implementation.
(fdate): Use ctime_r() instead of ctime().
(fdate_sub): Likewise.
(ctime): Likewise.
(ctime_sub): Likewise.
2011-01-27 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/47432
PR libfortran/47432
* config.h.in: Regenerated.
* config.h.in: Regenerated.
* configure: Regenerated.
* configure: Regenerated.
...
...
libgfortran/config.h.in
View file @
b5fa435a
...
@@ -318,6 +318,9 @@
...
@@ -318,6 +318,9 @@
/* Define to 1 if you have the `ctime' function. */
/* Define to 1 if you have the `ctime' function. */
#undef HAVE_CTIME
#undef HAVE_CTIME
/* Define to 1 if you have the `ctime_r' function. */
#undef HAVE_CTIME_R
/* Define to 1 if you have the <dlfcn.h> header file. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
#undef HAVE_DLFCN_H
...
...
libgfortran/configure
View file @
b5fa435a
...
@@ -16367,7 +16367,7 @@ _ACEOF
...
@@ -16367,7 +16367,7 @@ _ACEOF
fi
fi
done
done
for
ac_func
in
localtime_r gmtime_r strerror_r getpwuid_r ttyname_r
for
ac_func
in
localtime_r gmtime_r strerror_r getpwuid_r ttyname_r
ctime_r
do
:
do
:
as_ac_var
=
`
$as_echo
"ac_cv_func_
$ac_func
"
|
$as_tr_sh
`
as_ac_var
=
`
$as_echo
"ac_cv_func_
$ac_func
"
|
$as_tr_sh
`
ac_fn_c_check_func
"
$LINENO
"
"
$ac_func
"
"
$as_ac_var
"
ac_fn_c_check_func
"
$LINENO
"
"
$ac_func
"
"
$as_ac_var
"
...
...
libgfortran/configure.ac
View file @
b5fa435a
...
@@ -251,7 +251,7 @@ AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
...
@@ -251,7 +251,7 @@ AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
AC_CHECK_FUNCS(localtime_r gmtime_r strerror_r getpwuid_r ttyname_r)
AC_CHECK_FUNCS(localtime_r gmtime_r strerror_r getpwuid_r ttyname_r
ctime_r
)
# Check for glibc backtrace functions
# Check for glibc backtrace functions
AC_CHECK_FUNCS(backtrace backtrace_symbols)
AC_CHECK_FUNCS(backtrace backtrace_symbols)
...
...
libgfortran/intrinsics/ctime.c
View file @
b5fa435a
/* Implementation of the CTIME and FDATE g77 intrinsics.
/* Implementation of the CTIME and FDATE g77 intrinsics.
Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
Copyright (C) 2005, 2007, 2009
, 2011
Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
This file is part of the GNU Fortran
95
runtime library (libgfortran).
This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
modify it under the terms of the GNU General Public
...
@@ -41,6 +41,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
...
@@ -41,6 +41,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <string.h>
#include <string.h>
#ifndef HAVE_CTIME_R
static
char
*
ctime_r
(
const
time_t
*
timep
,
char
*
buf
__attribute__
((
unused
)))
{
#ifdef HAVE_CTIME
return
ctime
(
timep
);
#else
return
NULL
;
#endif
}
#endif
/* ctime_r() buffer size needs to be at least 26 bytes. */
#define CSZ 26
extern
void
fdate
(
char
**
,
gfc_charlen_type
*
);
extern
void
fdate
(
char
**
,
gfc_charlen_type
*
);
export_proto
(
fdate
);
export_proto
(
fdate
);
...
@@ -48,9 +63,10 @@ void
...
@@ -48,9 +63,10 @@ void
fdate
(
char
**
date
,
gfc_charlen_type
*
date_len
)
fdate
(
char
**
date
,
gfc_charlen_type
*
date_len
)
{
{
#if defined(HAVE_TIME) && defined(HAVE_CTIME)
#if defined(HAVE_TIME) && defined(HAVE_CTIME)
char
cbuf
[
CSZ
];
int
i
;
int
i
;
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
*
date
=
ctime
(
&
now
);
*
date
=
ctime
_r
(
&
now
,
cbuf
);
if
(
*
date
!=
NULL
)
if
(
*
date
!=
NULL
)
{
{
*
date
=
strdup
(
*
date
);
*
date
=
strdup
(
*
date
);
...
@@ -79,6 +95,7 @@ void
...
@@ -79,6 +95,7 @@ void
fdate_sub
(
char
*
date
,
gfc_charlen_type
date_len
)
fdate_sub
(
char
*
date
,
gfc_charlen_type
date_len
)
{
{
#if defined(HAVE_TIME) && defined(HAVE_CTIME)
#if defined(HAVE_TIME) && defined(HAVE_CTIME)
char
cbuf
[
CSZ
];
int
i
;
int
i
;
char
*
d
;
char
*
d
;
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
...
@@ -86,7 +103,7 @@ fdate_sub (char * date, gfc_charlen_type date_len)
...
@@ -86,7 +103,7 @@ fdate_sub (char * date, gfc_charlen_type date_len)
memset
(
date
,
' '
,
date_len
);
memset
(
date
,
' '
,
date_len
);
#if defined(HAVE_TIME) && defined(HAVE_CTIME)
#if defined(HAVE_TIME) && defined(HAVE_CTIME)
d
=
ctime
(
&
now
);
d
=
ctime
_r
(
&
now
,
cbuf
);
if
(
d
!=
NULL
)
if
(
d
!=
NULL
)
{
{
i
=
0
;
i
=
0
;
...
@@ -105,9 +122,10 @@ void
...
@@ -105,9 +122,10 @@ void
PREFIX
(
ctime
)
(
char
**
date
,
gfc_charlen_type
*
date_len
,
GFC_INTEGER_8
t
)
PREFIX
(
ctime
)
(
char
**
date
,
gfc_charlen_type
*
date_len
,
GFC_INTEGER_8
t
)
{
{
#if defined(HAVE_CTIME)
#if defined(HAVE_CTIME)
char
cbuf
[
CSZ
];
time_t
now
=
t
;
time_t
now
=
t
;
int
i
;
int
i
;
*
date
=
ctime
(
&
now
);
*
date
=
ctime
_r
(
&
now
,
cbuf
);
if
(
*
date
!=
NULL
)
if
(
*
date
!=
NULL
)
{
{
*
date
=
strdup
(
*
date
);
*
date
=
strdup
(
*
date
);
...
@@ -136,6 +154,7 @@ void
...
@@ -136,6 +154,7 @@ void
ctime_sub
(
GFC_INTEGER_8
*
t
,
char
*
date
,
gfc_charlen_type
date_len
)
ctime_sub
(
GFC_INTEGER_8
*
t
,
char
*
date
,
gfc_charlen_type
date_len
)
{
{
#if defined(HAVE_CTIME)
#if defined(HAVE_CTIME)
char
cbuf
[
CSZ
];
int
i
;
int
i
;
char
*
d
;
char
*
d
;
time_t
now
=
*
t
;
time_t
now
=
*
t
;
...
@@ -143,7 +162,7 @@ ctime_sub (GFC_INTEGER_8 * t, char * date, gfc_charlen_type date_len)
...
@@ -143,7 +162,7 @@ ctime_sub (GFC_INTEGER_8 * t, char * date, gfc_charlen_type date_len)
memset
(
date
,
' '
,
date_len
);
memset
(
date
,
' '
,
date_len
);
#if defined(HAVE_CTIME)
#if defined(HAVE_CTIME)
d
=
ctime
(
&
now
);
d
=
ctime
_r
(
&
now
,
cbuf
);
if
(
d
!=
NULL
)
if
(
d
!=
NULL
)
{
{
i
=
0
;
i
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment