Commit 2c45d1a0 by Richard Henderson Committed by Jeff Law

alloca-conf.h (alloca): Don't use Gcc builtin or <alloca.h>.

        * alloca-conf.h (alloca) [C_ALLOCA]: Don't use Gcc builtin
        or <alloca.h>.
        * clock.c (GNU_HZ): New definition.
        (clock): Use it.
        * getruntime.c: Likewise.

        * config.table: Use mh-beos.
        * config/mh-beos: New file.

From-SVN: r29680
parent e5da599a
...@@ -181,6 +181,17 @@ Sun Apr 11 23:20:59 1999 Mumit Khan <khan@xraylith.wisc.edu> ...@@ -181,6 +181,17 @@ Sun Apr 11 23:20:59 1999 Mumit Khan <khan@xraylith.wisc.edu>
(xcalloc): UWIN has sbrk. (xcalloc): UWIN has sbrk.
(xrealloc): Fix guard macro. (xrealloc): Fix guard macro.
1999-04-11 Richard Henderson <rth@cygnus.com>
* alloca-conf.h (alloca) [C_ALLOCA]: Don't use Gcc builtin
or <alloca.h>.
* clock.c (GNU_HZ): New definition.
(clock): Use it.
* getruntime.c: Likewise.
* config.table: Use mh-beos.
* config/mh-beos: New file.
1999-04-11 Mark Mitchell <mark@codesourcery.com> 1999-04-11 Mark Mitchell <mark@codesourcery.com>
* cplus-dem.c (demangle_template_value_parm): Handle * cplus-dem.c (demangle_template_value_parm): Handle
......
#include "config.h" #include "config.h"
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(C_ALLOCA)
# ifndef alloca # ifndef alloca
# define alloca __builtin_alloca # define alloca __builtin_alloca
# endif # endif
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# ifdef _AIX # ifdef _AIX
#pragma alloca #pragma alloca
# else # else
# ifdef HAVE_ALLOCA_H # if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
# include <alloca.h> # include <alloca.h>
# else /* ! defined (HAVE_ALLOCA_H) */ # else /* ! defined (HAVE_ALLOCA_H) */
# ifdef __STDC__ # ifdef __STDC__
......
...@@ -36,8 +36,20 @@ the executable file might be covered by the GNU General Public License. */ ...@@ -36,8 +36,20 @@ the executable file might be covered by the GNU General Public License. */
#include <sys/times.h> #include <sys/times.h>
#endif #endif
#if defined (HAVE_TIMES) && ! defined (HZ) && defined (CLOCKS_PER_SEC) #ifdef HAVE_UNISTD_H
#define HZ CLOCKS_PER_SEC #include <unistd.h>
#endif
#ifdef _SC_CLK_TCK
#define GNU_HZ sysconf(_SC_CLK_TCK)
#else
#ifdef HZ
#define GNU_HZ HZ
#else
#ifdef CLOCKS_PER_SEC
#define GNU_HZ CLOCKS_PER_SEC
#endif
#endif
#endif #endif
/* FIXME: should be able to declare as clock_t. */ /* FIXME: should be able to declare as clock_t. */
...@@ -56,7 +68,7 @@ clock () ...@@ -56,7 +68,7 @@ clock ()
struct tms tms; struct tms tms;
times (&tms); times (&tms);
return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ); return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
#else #else
#ifdef VMS #ifdef VMS
struct struct
......
...@@ -6,6 +6,7 @@ case "${host}" in ...@@ -6,6 +6,7 @@ case "${host}" in
*-*-freebsd2.2.[012]) frag=mh-fbsd21 ;; *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
i370-*-opened*) frag=mh-openedition ;; i370-*-opened*) frag=mh-openedition ;;
i[345]86-*-windows*) frag=mh-windows ;; i[345]86-*-windows*) frag=mh-windows ;;
*-*-beos*) frag=mh-beos ;;
esac esac
frags=$frag frags=$frag
......
# Host makefile fragment for BeOS
# This is a temporary hack until the wimpy default 64k stack
# limit in BeOS is either increased or made user settable somehow.
# This probably won't happen until after the DR9 release.
EXTRA_OFILES = alloca.o
...@@ -40,6 +40,10 @@ Boston, MA 02111-1307, USA. */ ...@@ -40,6 +40,10 @@ Boston, MA 02111-1307, USA. */
#include <sys/times.h> #include <sys/times.h>
#endif #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/* This is a fallback; if wrong, it will likely make obviously wrong /* This is a fallback; if wrong, it will likely make obviously wrong
results. */ results. */
...@@ -47,8 +51,16 @@ Boston, MA 02111-1307, USA. */ ...@@ -47,8 +51,16 @@ Boston, MA 02111-1307, USA. */
#define CLOCKS_PER_SEC 1 #define CLOCKS_PER_SEC 1
#endif #endif
#if defined (HAVE_TIMES) && ! defined (HZ) #ifdef _SC_CLK_TCK
#define HZ CLOCKS_PER_SEC #define GNU_HZ sysconf(_SC_CLK_TCK)
#else
#ifdef HZ
#define GNU_HZ HZ
#else
#ifdef CLOCKS_PER_SEC
#define GNU_HZ CLOCKS_PER_SEC
#endif
#endif
#endif #endif
long long
...@@ -65,7 +77,7 @@ get_run_time () ...@@ -65,7 +77,7 @@ get_run_time ()
struct tms tms; struct tms tms;
times (&tms); times (&tms);
return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ); return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
#else /* ! HAVE_TIMES */ #else /* ! HAVE_TIMES */
/* Fall back on clock and hope it's correctly implemented. */ /* Fall back on clock and hope it's correctly implemented. */
const long clocks_per_sec = CLOCKS_PER_SEC; const long clocks_per_sec = CLOCKS_PER_SEC;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment