summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-09-27 10:45:52 -0700
committerJeff Law <law@gcc.gnu.org>1999-09-27 11:45:52 -0600
commit2c45d1a04de4cd940c53191e51e2e21ace86e541 (patch)
tree5bbe710f0cbb1ee8f863137e230b1b3ebca95869 /libiberty
parente5da599a0c4457eb6e3e7bc801d10898c34c3c47 (diff)
downloadgcc-2c45d1a04de4cd940c53191e51e2e21ace86e541.tar.gz
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
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog11
-rw-r--r--libiberty/alloca-conf.h4
-rw-r--r--libiberty/clock.c18
-rw-r--r--libiberty/config.table1
-rw-r--r--libiberty/config/mh-beos7
-rw-r--r--libiberty/getruntime.c18
6 files changed, 51 insertions, 8 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 6b6a6434b9f..d5c865f82ef 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -181,6 +181,17 @@ Sun Apr 11 23:20:59 1999 Mumit Khan <khan@xraylith.wisc.edu>
(xcalloc): UWIN has sbrk.
(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>
* cplus-dem.c (demangle_template_value_parm): Handle
diff --git a/libiberty/alloca-conf.h b/libiberty/alloca-conf.h
index 4eb87d3cfa4..9c3eea396c1 100644
--- a/libiberty/alloca-conf.h
+++ b/libiberty/alloca-conf.h
@@ -1,6 +1,6 @@
#include "config.h"
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(C_ALLOCA)
# ifndef alloca
# define alloca __builtin_alloca
# endif
@@ -8,7 +8,7 @@
# ifdef _AIX
#pragma alloca
# else
-# ifdef HAVE_ALLOCA_H
+# if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
# include <alloca.h>
# else /* ! defined (HAVE_ALLOCA_H) */
# ifdef __STDC__
diff --git a/libiberty/clock.c b/libiberty/clock.c
index 8d265406c39..db2509c17f2 100644
--- a/libiberty/clock.c
+++ b/libiberty/clock.c
@@ -36,8 +36,20 @@ the executable file might be covered by the GNU General Public License. */
#include <sys/times.h>
#endif
-#if defined (HAVE_TIMES) && ! defined (HZ) && defined (CLOCKS_PER_SEC)
-#define HZ CLOCKS_PER_SEC
+#ifdef HAVE_UNISTD_H
+#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
/* FIXME: should be able to declare as clock_t. */
@@ -56,7 +68,7 @@ clock ()
struct tms tms;
times (&tms);
- return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
+ return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
#else
#ifdef VMS
struct
diff --git a/libiberty/config.table b/libiberty/config.table
index 248aa13ae29..814c9eb1d9b 100644
--- a/libiberty/config.table
+++ b/libiberty/config.table
@@ -6,6 +6,7 @@ case "${host}" in
*-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
i370-*-opened*) frag=mh-openedition ;;
i[345]86-*-windows*) frag=mh-windows ;;
+ *-*-beos*) frag=mh-beos ;;
esac
frags=$frag
diff --git a/libiberty/config/mh-beos b/libiberty/config/mh-beos
new file mode 100644
index 00000000000..9b75e7d3372
--- /dev/null
+++ b/libiberty/config/mh-beos
@@ -0,0 +1,7 @@
+# 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
diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c
index c7a33d78d7c..b855ea6e82f 100644
--- a/libiberty/getruntime.c
+++ b/libiberty/getruntime.c
@@ -40,6 +40,10 @@ Boston, MA 02111-1307, USA. */
#include <sys/times.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* This is a fallback; if wrong, it will likely make obviously wrong
results. */
@@ -47,8 +51,16 @@ Boston, MA 02111-1307, USA. */
#define CLOCKS_PER_SEC 1
#endif
-#if defined (HAVE_TIMES) && ! defined (HZ)
-#define HZ CLOCKS_PER_SEC
+#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
long
@@ -65,7 +77,7 @@ get_run_time ()
struct tms 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 */
/* Fall back on clock and hope it's correctly implemented. */
const long clocks_per_sec = CLOCKS_PER_SEC;