diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-09 18:25:58 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-09 18:25:58 +0000 |
commit | a1aa1d3077cf008c27eb9411fd247f695dbf6bbc (patch) | |
tree | 8b9c2e9bcc9e893681a7abd25852a18d141f8f6d /libgfortran/intrinsics | |
parent | b88c56264035fe4267a4197d1cc06fcd6ffebb32 (diff) | |
download | ppe42-gcc-a1aa1d3077cf008c27eb9411fd247f695dbf6bbc.tar.gz ppe42-gcc-a1aa1d3077cf008c27eb9411fd247f695dbf6bbc.zip |
Configure cleanup.
2011-11-09 Janne Blomqvist <jb@gcc.gnu.org>
* configure.ac (AC_STDC_HEADERS): Remove.
(AC_HEADER_TIME): Remove.
(AC_HAVE_HEADERS, AC_CHECK_HEADERS): Move into a single invocation
of AC_CHECK_HEADERS_ONCE, don't check for presence of C89 headers.
(AC_CHECK_MEMBERS): Use single invocation.
(AC_CHECK_FUNCS): Move into single invocation of
AC_CHEC_FUNCS_ONCE, don't check for presence of C89 functions.
* config.h.in: Regenerate.
* configure: Regenerate.
* intrinsics/clock.c: Include time.h.
(mclock): Assume clock() is present.
(mclock8): Likewise.
* intrinsics/ctime.c (strctime): Assume strftime is present.
(fdate): Assume time() is present.
(fdate_sub): Likewise.
(ctime): Likewise.
* intrinsics/date_and_time.c: Don't provide abs macro.
(HAVE_NO_DATE_TIME): Remove code related to macro which is never
set.
* intrinsics/execute_command_line.c: Assume stdlib.h is present.
* intrinsics/exit.c: Likewise.
* intrinsics/extends_type_of.c: Likewise.
* intrinsics/gerror.c: Assume strerror() is present.
* intrinsics/kill.c: Assume signal.h is present.
* intrinsics/malloc.c: Assume stdlib.h is present.
* intrinsics/move_alloc.c: Likewise.
* intrinsics/perror.c: Assume perror() is present.
* intrinsics/signal.c: Assume signal.h is present.
* intrinsics/stat.c: Assume stdlib.h is present.
* intrinsics/system.c: Likewise.
* intrinsics/time.c: Include time.h, assume time() is present.
* intrinsics/time_1.h: Conditionally include sys/time.h,
unconditionally time.h.
(gf_cputime): Do division in double, fallback using clock().
(gf_gettime): Assume time() is present.
* intrinsics/umask.c: Assume stdlib.h is present.
* runtime/backtrace.c: Likewise.
* runtime/compile_options.c: Assume signal.h is present, assume
C89 signals are present.
* runtime/error.c: Assume signal.h and stdlib.h are present.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181227 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r-- | libgfortran/intrinsics/clock.c | 26 | ||||
-rw-r--r-- | libgfortran/intrinsics/ctime.c | 20 | ||||
-rw-r--r-- | libgfortran/intrinsics/date_and_time.c | 28 | ||||
-rw-r--r-- | libgfortran/intrinsics/execute_command_line.c | 6 | ||||
-rw-r--r-- | libgfortran/intrinsics/exit.c | 8 | ||||
-rw-r--r-- | libgfortran/intrinsics/extends_type_of.c | 7 | ||||
-rw-r--r-- | libgfortran/intrinsics/gerror.c | 6 | ||||
-rw-r--r-- | libgfortran/intrinsics/kill.c | 8 | ||||
-rw-r--r-- | libgfortran/intrinsics/malloc.c | 8 | ||||
-rw-r--r-- | libgfortran/intrinsics/move_alloc.c | 8 | ||||
-rw-r--r-- | libgfortran/intrinsics/perror.c | 6 | ||||
-rw-r--r-- | libgfortran/intrinsics/signal.c | 26 | ||||
-rw-r--r-- | libgfortran/intrinsics/stat.c | 7 | ||||
-rw-r--r-- | libgfortran/intrinsics/system.c | 7 | ||||
-rw-r--r-- | libgfortran/intrinsics/time.c | 20 | ||||
-rw-r--r-- | libgfortran/intrinsics/time_1.h | 39 | ||||
-rw-r--r-- | libgfortran/intrinsics/umask.c | 7 |
17 files changed, 53 insertions, 184 deletions
diff --git a/libgfortran/intrinsics/clock.c b/libgfortran/intrinsics/clock.c index b1d61d8866b..29ccc15cdd6 100644 --- a/libgfortran/intrinsics/clock.c +++ b/libgfortran/intrinsics/clock.c @@ -1,8 +1,8 @@ /* Implementation of the MCLOCK and MCLOCK8 g77 intrinsics. - Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2009, 2011 Free Software Foundation, Inc. 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 modify it under the terms of the GNU General Public @@ -24,19 +24,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #include "libgfortran.h" - -#ifdef TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> -#else -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# ifdef HAVE_TIME_H -# include <time.h> -# endif -# endif -#endif +#include <time.h> /* INTEGER(KIND=4) FUNCTION MCLOCK() */ @@ -47,11 +35,7 @@ export_proto(mclock); GFC_INTEGER_4 mclock (void) { -#ifdef HAVE_CLOCK return (GFC_INTEGER_4) clock (); -#else - return (GFC_INTEGER_4) -1; -#endif } @@ -63,10 +47,6 @@ export_proto(mclock8); GFC_INTEGER_8 mclock8 (void) { -#ifdef HAVE_CLOCK return (GFC_INTEGER_8) clock (); -#else - return (GFC_INTEGER_8) -1; -#endif } diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c index 1c924a11da4..05bf31fc779 100644 --- a/libgfortran/intrinsics/ctime.c +++ b/libgfortran/intrinsics/ctime.c @@ -39,7 +39,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see static size_t strctime (char *s, size_t max, const time_t *timep) { -#ifdef HAVE_STRFTIME struct tm ltm; int failed; /* Some targets provide a localtime_r based on a draft of the POSIX @@ -52,9 +51,6 @@ strctime (char *s, size_t max, const time_t *timep) if (failed) return 0; return strftime (s, max, "%c", <m); -#else - return 0; -#endif } /* In the default locale, the date and time representation fits in 26 @@ -67,15 +63,9 @@ export_proto(fdate); void fdate (char ** date, gfc_charlen_type * date_len) { -#if defined(HAVE_TIME) time_t now = time(NULL); *date = get_mem (CSZ); *date_len = strctime (*date, CSZ, &now); -#else - - *date = NULL; - *date_len = 0; -#endif } @@ -85,15 +75,11 @@ export_proto(fdate_sub); void fdate_sub (char * date, gfc_charlen_type date_len) { -#if defined(HAVE_TIME) time_t now = time(NULL); char *s = get_mem (date_len + 1); size_t n = strctime (s, date_len + 1, &now); fstrcpy (date, date_len, s, n); free (s); -#else - memset (date, ' ', date_len); -#endif } @@ -104,15 +90,9 @@ export_proto_np(PREFIX(ctime)); void PREFIX(ctime) (char ** date, gfc_charlen_type * date_len, GFC_INTEGER_8 t) { -#if defined(HAVE_TIME) time_t now = t; *date = get_mem (CSZ); *date_len = strctime (*date, CSZ, &now); -#else - - *date = NULL; - *date_len = 0; -#endif } diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c index fa51d5f5ba2..3c386363df4 100644 --- a/libgfortran/intrinsics/date_and_time.c +++ b/libgfortran/intrinsics/date_and_time.c @@ -31,10 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "time_1.h" -#ifndef abs -#define abs(x) ((x)>=0 ? (x) : -(x)) -#endif - /* If the re-entrant version of gmtime is not available, provide a fallback implementation. On some targets where the _r version is @@ -143,7 +139,6 @@ date_and_time (char *__date, char *__time, char *__zone, char zone[ZONE_LEN + 1]; GFC_INTEGER_4 values[VALUES_SIZE]; -#ifndef HAVE_NO_DATE_TIME time_t lt; struct tm local_time; struct tm UTC_time; @@ -193,21 +188,6 @@ date_and_time (char *__date, char *__time, char *__zone, for (i = 0; i < VALUES_SIZE; i++) values[i] = - GFC_INTEGER_4_HUGE; } -#else /* if defined HAVE_NO_DATE_TIME */ - /* We really have *nothing* to return, so return blanks and HUGE(0). */ - - memset (date, ' ', DATE_LEN); - date[DATE_LEN] = '\0'; - - memset (timec, ' ', TIME_LEN); - timec[TIME_LEN] = '\0'; - - memset (zone, ' ', ZONE_LEN); - zone[ZONE_LEN] = '\0'; - - for (i = 0; i < VALUES_SIZE; i++) - values[i] = - GFC_INTEGER_4_HUGE; -#endif /* HAVE_NO_DATE_TIME */ /* Copy the values into the arguments. */ if (__values) @@ -321,7 +301,6 @@ secnds (GFC_REAL_4 *x) static void itime0 (int x[3]) { -#ifndef HAVE_NO_DATE_TIME time_t lt; struct tm local_time; @@ -335,9 +314,6 @@ itime0 (int x[3]) x[1] = local_time.tm_min; x[2] = local_time.tm_sec; } -#else - x[0] = x[1] = x[2] = -1; -#endif } extern void itime_i4 (gfc_array_i4 *); @@ -403,7 +379,6 @@ itime_i8 (gfc_array_i8 *__values) static void idate0 (int x[3]) { -#ifndef HAVE_NO_DATE_TIME time_t lt; struct tm local_time; @@ -417,9 +392,6 @@ idate0 (int x[3]) x[1] = 1 + local_time.tm_mon; x[2] = 1900 + local_time.tm_year; } -#else - x[0] = x[1] = x[2] = -1; -#endif } extern void idate_i4 (gfc_array_i4 *); diff --git a/libgfortran/intrinsics/execute_command_line.c b/libgfortran/intrinsics/execute_command_line.c index d0b79a45a52..25eb4a3e6b8 100644 --- a/libgfortran/intrinsics/execute_command_line.c +++ b/libgfortran/intrinsics/execute_command_line.c @@ -1,5 +1,5 @@ /* Implementation of the EXECUTE_COMMAND_LINE intrinsic. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2011 Free Software Foundation, Inc. Contributed by François-Xavier Coudert. This file is part of the GNU Fortran runtime library (libgfortran). @@ -26,10 +26,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <string.h> #include <stdbool.h> - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif + #ifdef HAVE_UNISTD_H #include <unistd.h> #endif diff --git a/libgfortran/intrinsics/exit.c b/libgfortran/intrinsics/exit.c index 7787581d021..c7da4979970 100644 --- a/libgfortran/intrinsics/exit.c +++ b/libgfortran/intrinsics/exit.c @@ -1,8 +1,8 @@ /* Implementation of the EXIT intrinsic. - Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc. Contributed by Steven G. Kargl <kargls@comcast.net>. -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 modify it under the terms of the GNU General Public @@ -25,10 +25,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif + /* SUBROUTINE EXIT(STATUS) INTEGER, INTENT(IN), OPTIONAL :: STATUS */ diff --git a/libgfortran/intrinsics/extends_type_of.c b/libgfortran/intrinsics/extends_type_of.c index 2fd149c18a5..223423428d5 100644 --- a/libgfortran/intrinsics/extends_type_of.c +++ b/libgfortran/intrinsics/extends_type_of.c @@ -1,8 +1,8 @@ /* Implementation of the EXTENDS_TYPE_OF intrinsic. - Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc. Contributed by Janus Weil <janus@gcc.gnu.org>. -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 modify it under the terms of the GNU General Public @@ -25,10 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif typedef struct vtype diff --git a/libgfortran/intrinsics/gerror.c b/libgfortran/intrinsics/gerror.c index 6feadc9b7c7..492f7af118f 100644 --- a/libgfortran/intrinsics/gerror.c +++ b/libgfortran/intrinsics/gerror.c @@ -1,8 +1,8 @@ /* Implementation of the GERROR g77 intrinsic. - 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> -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 modify it under the terms of the GNU General Public @@ -33,7 +33,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see message corresponding to the last system error (C errno). CHARACTER(len=*), INTENT(OUT) :: MESSAGE */ -#ifdef HAVE_STRERROR void PREFIX(gerror) (char *, gfc_charlen_type); export_proto_np(PREFIX(gerror)); @@ -56,4 +55,3 @@ PREFIX(gerror) (char * msg, gfc_charlen_type msg_len) if (msg_len > p_len) memset (&msg[p_len], ' ', msg_len - p_len); } -#endif diff --git a/libgfortran/intrinsics/kill.c b/libgfortran/intrinsics/kill.c index 83e8b2838ec..be36b00aa1c 100644 --- a/libgfortran/intrinsics/kill.c +++ b/libgfortran/intrinsics/kill.c @@ -1,8 +1,8 @@ /* Implementation of the KILL g77 intrinsic. - 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> -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 modify it under the terms of the GNU General Public @@ -25,10 +25,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <errno.h> - -#ifdef HAVE_SIGNAL_H #include <signal.h> -#endif + /* SUBROUTINE KILL(PID, SIGNAL, STATUS) INTEGER, INTENT(IN) :: PID, SIGNAL diff --git a/libgfortran/intrinsics/malloc.c b/libgfortran/intrinsics/malloc.c index 19001aef89c..5edc1be8e09 100644 --- a/libgfortran/intrinsics/malloc.c +++ b/libgfortran/intrinsics/malloc.c @@ -1,8 +1,8 @@ /* Implementation of the MALLOC and FREE 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> -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 modify it under the terms of the GNU General Public @@ -24,10 +24,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #include "libgfortran.h" - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif + extern void PREFIX(free) (void **); export_proto_np(PREFIX(free)); diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c index f76c20c7b6d..7b489ade4c7 100644 --- a/libgfortran/intrinsics/move_alloc.c +++ b/libgfortran/intrinsics/move_alloc.c @@ -1,8 +1,8 @@ /* Generic implementation of the MOVE_ALLOC intrinsic - Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2009, 2011 Free Software Foundation, Inc. Contributed by Paul Thomas -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 modify it under the terms of the GNU General Public @@ -24,10 +24,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #include "libgfortran.h" - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif + extern void move_alloc (gfc_array_char *, gfc_array_char *); export_proto(move_alloc); diff --git a/libgfortran/intrinsics/perror.c b/libgfortran/intrinsics/perror.c index 10348bd0828..bb203c4f7ec 100644 --- a/libgfortran/intrinsics/perror.c +++ b/libgfortran/intrinsics/perror.c @@ -1,8 +1,8 @@ /* Implementation of the PERROR intrinsic. - 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> -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 modify it under the terms of the GNU General Public @@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* SUBROUTINE PERROR(STRING) CHARACTER(len=*), INTENT(IN) :: STRING */ -#ifdef HAVE_PERROR extern void perror_sub (char *, gfc_charlen_type); iexport_proto(perror_sub); @@ -52,4 +51,3 @@ perror_sub (char *string, gfc_charlen_type string_len) perror (str); } iexport(perror_sub); -#endif diff --git a/libgfortran/intrinsics/signal.c b/libgfortran/intrinsics/signal.c index 66e54f33af0..85179ee30fa 100644 --- a/libgfortran/intrinsics/signal.c +++ b/libgfortran/intrinsics/signal.c @@ -1,8 +1,8 @@ /* Implementation of the SIGNAL and ALARM 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> -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 modify it under the terms of the GNU General Public @@ -29,9 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <unistd.h> #endif -#ifdef HAVE_SIGNAL_H #include <signal.h> -#endif #ifdef HAVE_INTTYPES_H #include <inttypes.h> @@ -46,7 +44,6 @@ iexport_proto(signal_sub); void signal_sub (int *number, void (*handler)(int), int *status) { -#ifdef HAVE_SIGNAL intptr_t ret; if (status != NULL) @@ -56,11 +53,6 @@ signal_sub (int *number, void (*handler)(int), int *status) } else signal (*number, handler); -#else - errno = ENOSYS; - if (status != NULL) - *status = -1; -#endif } iexport(signal_sub); @@ -72,7 +64,6 @@ iexport_proto(signal_sub_int); void signal_sub_int (int *number, int *handler, int *status) { -#ifdef HAVE_SIGNAL intptr_t ptr = *handler, ret; if (status != NULL) @@ -82,11 +73,6 @@ signal_sub_int (int *number, int *handler, int *status) } else signal (*number, (void (*)(int)) ptr); -#else - errno = ENOSYS; - if (status != NULL) - *status = -1; -#endif } iexport(signal_sub_int); @@ -129,7 +115,7 @@ alarm_sub_i4 (int * seconds __attribute__ ((unused)), void (*handler)(int) __attribute__ ((unused)), GFC_INTEGER_4 *status) { -#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL) +#if defined (SIGALRM) && defined (HAVE_ALARM) if (status != NULL) { if (signal (SIGALRM, handler) == SIG_ERR) @@ -159,7 +145,7 @@ alarm_sub_i8 (int *seconds __attribute__ ((unused)), void (*handler)(int) __attribute__ ((unused)), GFC_INTEGER_8 *status) { -#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL) +#if defined (SIGALRM) && defined (HAVE_ALARM) if (status != NULL) { if (signal (SIGALRM, handler) == SIG_ERR) @@ -190,7 +176,7 @@ alarm_sub_int_i4 (int *seconds __attribute__ ((unused)), int *handler __attribute__ ((unused)), GFC_INTEGER_4 *status) { -#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL) +#if defined (SIGALRM) && defined (HAVE_ALARM) if (status != NULL) { if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR) @@ -220,7 +206,7 @@ alarm_sub_int_i8 (int *seconds __attribute__ ((unused)), int *handler __attribute__ ((unused)), GFC_INTEGER_8 *status) { -#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL) +#if defined (SIGALRM) && defined (HAVE_ALARM) if (status != NULL) { if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR) diff --git a/libgfortran/intrinsics/stat.c b/libgfortran/intrinsics/stat.c index 22d4f79796c..28821f1546d 100644 --- a/libgfortran/intrinsics/stat.c +++ b/libgfortran/intrinsics/stat.c @@ -1,8 +1,9 @@ /* Implementation of the STAT and FSTAT intrinsics. - Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2009, 2011 + Free Software Foundation, Inc. Contributed by Steven G. Kargl <kargls@comcast.net>. -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 modify it under the terms of the GNU General Public @@ -32,9 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <sys/stat.h> #endif -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif #ifdef HAVE_STAT diff --git a/libgfortran/intrinsics/system.c b/libgfortran/intrinsics/system.c index 831823ffc4c..5bc083a1ad0 100644 --- a/libgfortran/intrinsics/system.c +++ b/libgfortran/intrinsics/system.c @@ -1,8 +1,8 @@ /* Implementation of the SYSTEM intrinsic. - Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc. Contributed by Tobias Schlüter. -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 modify it under the terms of the GNU General Public License as published by the Free @@ -25,10 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <string.h> - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif extern void system_sub (const char *fcmd, GFC_INTEGER_4 * status, gfc_charlen_type cmd_len); diff --git a/libgfortran/intrinsics/time.c b/libgfortran/intrinsics/time.c index d046e87ecba..151466a9da0 100644 --- a/libgfortran/intrinsics/time.c +++ b/libgfortran/intrinsics/time.c @@ -1,8 +1,8 @@ /* Implementation of the TIME and TIME8 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> -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 modify it under the terms of the GNU General Public @@ -24,24 +24,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #include "libgfortran.h" - -#ifdef TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> -#else -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# ifdef HAVE_TIME_H -# include <time.h> -# endif -# endif -#endif +#include <time.h> /* INTEGER(KIND=4) FUNCTION TIME() */ -#ifdef HAVE_TIME extern GFC_INTEGER_4 time_func (void); export_proto(time_func); @@ -61,4 +48,3 @@ time8_func (void) { return (GFC_INTEGER_8) time (NULL); } -#endif diff --git a/libgfortran/intrinsics/time_1.h b/libgfortran/intrinsics/time_1.h index 12d79ebc12f..73977cbef61 100644 --- a/libgfortran/intrinsics/time_1.h +++ b/libgfortran/intrinsics/time_1.h @@ -40,19 +40,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see As usual with UNIX systems, unfortunately no single way is available for all systems. */ -#ifdef TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> -#else -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# ifdef HAVE_TIME_H -# include <time.h> -# endif -# endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> #endif +#include <time.h> + #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif @@ -174,20 +167,21 @@ gf_cputime (long *user_sec, long *user_usec, long *system_sec, long *system_usec clock_t err; err = times (&buf); *user_sec = buf.tms_utime / HZ; - *user_usec = buf.tms_utime % HZ * (1000000 / HZ); + *user_usec = buf.tms_utime % HZ * (1000000. / HZ); *system_sec = buf.tms_stime / HZ; - *system_usec = buf.tms_stime % HZ * (1000000 / HZ); + *system_usec = buf.tms_stime % HZ * (1000000. / HZ); if ((err == (clock_t) -1) && errno != 0) return -1; return 0; #else - - /* We have nothing to go on. Return -1. */ - *user_sec = *system_sec = 0; - *user_usec = *system_usec = 0; - errno = ENOSYS; - return -1; + clock_t c = clock (); + *user_sec = c / CLOCKS_PER_SEC; + *user_usec = c % CLOCKS_PER_SEC * (1000000. / CLOCKS_PER_SEC); + *system_sec = *system_usec = 0; + if (c == (clock_t) -1) + return -1; + return 0; #endif } @@ -218,7 +212,7 @@ gf_gettime (time_t * secs, long * usecs) *secs = tv.tv_sec; *usecs = tv.tv_usec; return err; -#elif HAVE_TIME +#else time_t t, t2; t = time (&t2); *secs = t2; @@ -226,11 +220,6 @@ gf_gettime (time_t * secs, long * usecs) if (t == ((time_t)-1)) return -1; return 0; -#else - *secs = 0; - *usecs = 0; - errno = ENOSYS; - return -1; #endif } diff --git a/libgfortran/intrinsics/umask.c b/libgfortran/intrinsics/umask.c index 9df684bfc8e..d939e5de318 100644 --- a/libgfortran/intrinsics/umask.c +++ b/libgfortran/intrinsics/umask.c @@ -1,8 +1,8 @@ /* Implementation of the UMASK intrinsic. - Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc. Contributed by Steven G. Kargl <kargls@comcast.net>. -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 modify it under the terms of the GNU General Public @@ -25,10 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" - -#ifdef HAVE_STDLIB_H #include <stdlib.h> -#endif #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> |