aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorSteven G. Kargl <kargls@comcast.net>2004-09-21 12:38:34 +0000
committerTobias Schlüter <tobi@gcc.gnu.org>2004-09-21 14:38:34 +0200
commitc6847e25b997c686563a537de5fb9eaa34568730 (patch)
tree15e69fd9c82b5c56916211a2a3e1f19fbaf48919 /libgfortran
parent936f1f064115f94425c521a5c94f0957f67a480d (diff)
downloadgcc-c6847e25b997c686563a537de5fb9eaa34568730.zip
gcc-c6847e25b997c686563a537de5fb9eaa34568730.tar.gz
gcc-c6847e25b997c686563a537de5fb9eaa34568730.tar.bz2
libgfortran.h: define gfc_alloca()
2004-09-21 Steven G. Kargl <kargls@comcast.net> * libgfortran.h: define gfc_alloca() * intrinsics/env.c (getenv, get_environment_variable_i4): Use it. From-SVN: r87801
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/intrinsics/env.c5
-rw-r--r--libgfortran/libgfortran.h7
3 files changed, 13 insertions, 4 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 2908775..4f282d5 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-21 Steven G. Kargl <kargls@comcast.net>
+
+ * libgfortran.h: define gfc_alloca()
+ * intrinsics/env.c (getenv, get_environment_variable_i4): Use it.
+
2004-09-21 Bud Davis <bdavis9659@comcast.net>
PR fortran/17286
diff --git a/libgfortran/intrinsics/env.c b/libgfortran/intrinsics/env.c
index b50c1f0..ab596fc 100644
--- a/libgfortran/intrinsics/env.c
+++ b/libgfortran/intrinsics/env.c
@@ -24,7 +24,6 @@ Boston, MA 02111-1307, USA. */
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
-#include <alloca.h>
#include "libgfortran.h"
@@ -55,7 +54,7 @@ prefix(getenv) (char * name,
name_len--;
/* Make a null terminated copy of the string. */
- name_nt = alloca (name_len + 1);
+ name_nt = gfc_alloca (name_len + 1);
memcpy (name_nt, name, name_len);
name_nt[name_len] = '\0';
@@ -131,7 +130,7 @@ prefix(get_environment_variable_i4)
name_len--;
}
/* Make a null terminated copy of the name. */
- name_nt = alloca (name_len + 1);
+ name_nt = gfc_alloca (name_len + 1);
memcpy (name_nt, name, name_len);
name_nt[name_len] = '\0';
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 463cd60..bbe6824 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -1,5 +1,5 @@
/* Common declarations for all of libgfor.
- Copyright 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>, and
Andy Vaught <andy@xena.eas.asu.edu>
@@ -237,6 +237,11 @@ extern unsigned line; /* Location of the current libray call (optional). */
#define filename prefix(filename)
extern char *filename;
+/* Avoid conflicting prototypes of alloca() in system headers by using
+ GCC's builtin alloca(). */
+
+#define gfc_alloca(x) __builtin_alloca(x)
+
/* main.c */