diff options
| author | Richard Henderson <rth@redhat.com> | 2004-12-12 00:59:05 -0800 |
|---|---|---|
| committer | Richard Henderson <rth@gcc.gnu.org> | 2004-12-12 00:59:05 -0800 |
| commit | 7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35 (patch) | |
| tree | cb0ecd2cd7b8c21d4d1c38261b5b7116e8dd2782 /libgfortran/runtime | |
| parent | c431e4997fcca052667b780341ddf4df5f6eb55c (diff) | |
| download | gcc-7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35.zip gcc-7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35.tar.gz gcc-7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35.tar.bz2 | |
acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New.
* acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New.
(LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT): New.
(LIBGFOR_CHECK_ATTRIBUTE_ALIAS): New.
* configure.ac: Use them.
* configure, config.h.in, aclocal.m4: Rebuild.
* libgfortran.h (prefix): Remove.
(PREFIX, IPREFIX): New.
(sym_rename, sym_rename1, sym_rename2): New.
(internal_proto, export_proto, export_proto_np): New.
(iexport_proto, iexport): New.
(iexport_data_proto, iexport_data): New.
* intrinsics/abort.c, intrinsics/args.c, intrinsics/associated.c,
intrinsics/cpu_time.c, intrinsics/cshift0.c,
intrinsics/date_and_time.c, intrinsics/env.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/etime.c, intrinsics/exit.c,
intrinsics/flush.c, intrinsics/fnum.c, intrinsics/getXid.c,
intrinsics/getcwd.c, intrinsics/ishftc.c, intrinsics/mvbits.c,
intrinsics/pack_generic.c, intrinsics/rand.c, intrinsics/random.c,
intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system.c,
intrinsics/system_clock.c, intrinsics/transpose_generic.c,
intrinsics/umask.c, intrinsics/unlink.c, intrinsics/unpack_generic.c,
io/backspace.c, io/close.c, io/endfile.c, io/inquire.c, io/io.h,
io/open.c, io/rewind.c, io/transfer.c, libgfortran.h, m4/cshift1.m4,
m4/dotprod.m4, m4/dotprodc.m4, m4/dotprodl.m4, m4/eoshift1.m4,
m4/eoshift3.m4, m4/exponent.m4, m4/fraction.m4, m4/iforeach.m4,
m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/nearest.m4,
m4/pow.m4, m4/reshape.m4, m4/set_exponent.m4, m4/shape.m4,
m4/transpose.m4, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c,
runtime/main.c, runtime/memory.c, runtime/pause.c, runtime/select.c,
runtime/stop.c: Use them to mark symbols internal or external.
* generated/*: Rebuild.
From-SVN: r92045
Diffstat (limited to 'libgfortran/runtime')
| -rw-r--r-- | libgfortran/runtime/environ.c | 2 | ||||
| -rw-r--r-- | libgfortran/runtime/error.c | 8 | ||||
| -rw-r--r-- | libgfortran/runtime/in_pack_generic.c | 3 | ||||
| -rw-r--r-- | libgfortran/runtime/in_unpack_generic.c | 3 | ||||
| -rw-r--r-- | libgfortran/runtime/main.c | 7 | ||||
| -rw-r--r-- | libgfortran/runtime/memory.c | 45 | ||||
| -rw-r--r-- | libgfortran/runtime/pause.c | 9 | ||||
| -rw-r--r-- | libgfortran/runtime/select.c | 11 | ||||
| -rw-r--r-- | libgfortran/runtime/stop.c | 6 |
9 files changed, 55 insertions, 39 deletions
diff --git a/libgfortran/runtime/environ.c b/libgfortran/runtime/environ.c index dc6e590..02831f1 100644 --- a/libgfortran/runtime/environ.c +++ b/libgfortran/runtime/environ.c @@ -37,7 +37,7 @@ Boston, MA 02111-1307, USA. */ * but other variables are checked during execution of the user's * program. */ -options_t options; +options_t options = { }; extern char **environ; diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index 913812c..2ccaff0 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -48,8 +48,11 @@ Boston, MA 02111-1307, USA. */ * that files that report loci and those that do not can be linked * together without reporting an erroneous position. */ -char *filename; -unsigned line; +char *filename = 0; +iexport_data(filename); + +unsigned line = 0; +iexport_data(line); static char buffer[32]; /* buffer for integer/ascii conversions */ @@ -332,6 +335,7 @@ runtime_error (const char *message) st_printf ("Fortran runtime error: %s\n", message); sys_exit (2); } +iexport(runtime_error); /* void internal_error()-- These are this-can't-happen errors diff --git a/libgfortran/runtime/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c index fefac07..7849a58 100644 --- a/libgfortran/runtime/in_pack_generic.c +++ b/libgfortran/runtime/in_pack_generic.c @@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */ #include <string.h> #include "libgfortran.h" +extern void *internal_pack (gfc_array_char *); +export_proto(internal_pack); + void * internal_pack (gfc_array_char * source) { diff --git a/libgfortran/runtime/in_unpack_generic.c b/libgfortran/runtime/in_unpack_generic.c index d468e74..313a79f 100644 --- a/libgfortran/runtime/in_unpack_generic.c +++ b/libgfortran/runtime/in_unpack_generic.c @@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */ #include <string.h> #include "libgfortran.h" +extern void internal_unpack (gfc_array_char *, const void *); +export_proto(internal_unpack); + void internal_unpack (gfc_array_char * d, const void * s) { diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c index 4e1f78c..882946c 100644 --- a/libgfortran/runtime/main.c +++ b/libgfortran/runtime/main.c @@ -29,12 +29,11 @@ Boston, MA 02111-1307, USA. */ /* This is the offset (in bytes) required to cast from logical(8)* to logical(4)*. and still get the same result. Will be 0 for little-endian machines and 4 for big-endian machines. */ -int l8_to_l4_offset; +int l8_to_l4_offset = 0; /* Figure out endianness for this machine. */ -#define detetmine_endianness prefix(determine_endianness) static void determine_endianness (void) { @@ -95,12 +94,10 @@ init (void) if (argc > 1 && strcmp (argv[1], "--help") == 0) show_variables (); -/* if (argc > 1 && strcmp(argv[1], "--resume") == 0) resume(); */ + /* if (argc > 1 && strcmp(argv[1], "--resume") == 0) resume(); */ #endif - memory_init (); random_seed(NULL,NULL,NULL); - } diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index 2280848..71bad9f 100644 --- a/libgfortran/runtime/memory.c +++ b/libgfortran/runtime/memory.c @@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA. */ the memory we allocate internally. We could also use this for user allocated memory (ALLOCATE/DEALLOCATE). This should be stored in a seperate list. */ -#define malloc_t prefix(malloc_t) typedef struct malloc_t { int magic; @@ -59,31 +58,25 @@ malloc_t; /* The root of the circular double linked list for compiler generated malloc calls. */ -static malloc_t mem_root; - - -void -memory_init (void) -{ - /* The root should never be used directly, so don't set the magic. */ - mem_root.magic = 0; - mem_root.next = &mem_root; - mem_root.prev = &mem_root; - mem_root.marker = 0; -} - - +static malloc_t mem_root = { + .next = &mem_root, + .prev = &mem_root +}; + +#if 0 +/* ??? Disabled because, well, it wasn't being called before transforming + it to a destructor, and turning it on causes testsuite failures. */ /* Doesn't actually do any cleaning up, just throws an error if something has got out of sync somewhere. */ -void +static void __attribute__((destructor)) runtime_cleanup (void) { /* Make sure all memory we've allocated is freed on exit. */ if (mem_root.next != &mem_root) runtime_error ("Unfreed memory on program termination"); } - +#endif void * @@ -92,13 +85,9 @@ get_mem (size_t n) void *p; #ifdef GFC_CLEAR_MEMORY - p = (void *) calloc (n, 1); + p = (void *) calloc (1, n); #else -#define temp malloc -#undef malloc p = (void *) malloc (n); -#define malloc temp -#undef temp #endif if (p == NULL) os_error ("Memory allocation failed"); @@ -157,6 +146,8 @@ internal_malloc_size (size_t size) return DATA_POINTER (newmem); } +extern void *internal_malloc (GFC_INTEGER_4); +export_proto(internal_malloc); void * internal_malloc (GFC_INTEGER_4 size) @@ -170,6 +161,8 @@ internal_malloc (GFC_INTEGER_4 size) return internal_malloc_size ((size_t) size); } +extern void *internal_malloc64 (GFC_INTEGER_8); +export_proto(internal_malloc64); void * internal_malloc64 (GFC_INTEGER_8 size) @@ -209,6 +202,7 @@ internal_free (void *mem) free (m); } +iexport(internal_free); /* User-allocate, one call for each member of the alloc-list of an @@ -244,6 +238,8 @@ allocate_size (void **mem, size_t size, GFC_INTEGER_4 * stat) *stat = 0; } +extern void allocate (void **, GFC_INTEGER_4, GFC_INTEGER_4 *); +export_proto(allocate); void allocate (void **mem, GFC_INTEGER_4 size, GFC_INTEGER_4 * stat) @@ -258,6 +254,8 @@ allocate (void **mem, GFC_INTEGER_4 size, GFC_INTEGER_4 * stat) allocate_size (mem, (size_t) size, stat); } +extern void allocate64 (void **, GFC_INTEGER_8, GFC_INTEGER_4 *); +export_proto(allocate64); void allocate64 (void **mem, GFC_INTEGER_8 size, GFC_INTEGER_4 * stat) @@ -276,6 +274,9 @@ allocate64 (void **mem, GFC_INTEGER_8 size, GFC_INTEGER_4 * stat) /* User-deallocate; pointer is NULLified. */ +extern void deallocate (void **, GFC_INTEGER_4 *); +export_proto(deallocate); + void deallocate (void **mem, GFC_INTEGER_4 * stat) { diff --git a/libgfortran/runtime/pause.c b/libgfortran/runtime/pause.c index e2d08be..e6d683b 100644 --- a/libgfortran/runtime/pause.c +++ b/libgfortran/runtime/pause.c @@ -25,9 +25,6 @@ Boston, MA 02111-1307, USA. */ #include "libgfortran.h" -#define pause_numeric prefix(pause_numeric) -#define pause_string prefix(pause_string) - static void do_pause (void) { @@ -42,6 +39,10 @@ do_pause (void) } /* A numeric or blank STOP statement. */ + +extern void pause_numeric (GFC_INTEGER_4 code); +export_proto(pause_numeric); + void pause_numeric (GFC_INTEGER_4 code) { @@ -55,6 +56,8 @@ pause_numeric (GFC_INTEGER_4 code) do_pause (); } +extern void pause_string (char *string, GFC_INTEGER_4 len); +export_proto(pause_string); void pause_string (char *string, GFC_INTEGER_4 len) diff --git a/libgfortran/runtime/select.c b/libgfortran/runtime/select.c index 5ee873a..807845c 100644 --- a/libgfortran/runtime/select.c +++ b/libgfortran/runtime/select.c @@ -30,15 +30,18 @@ typedef struct } select_struct; - -#define select_string prefix(select_string) +extern void * select_string (select_struct *table, int table_len, + void *default_jump, const char *selector, + int selector_len); +export_proto(select_string); /* select_string()-- Given a selector string and a table of * select_struct structures, return the address to jump to. */ -void *select_string (select_struct *table, int table_len, void *default_jump, - const char *selector, int selector_len) +void * +select_string (select_struct *table, int table_len, void *default_jump, + const char *selector, int selector_len) { select_struct *t; int i, low, high, mid; diff --git a/libgfortran/runtime/stop.c b/libgfortran/runtime/stop.c index ef8741a..5ae06ec 100644 --- a/libgfortran/runtime/stop.c +++ b/libgfortran/runtime/stop.c @@ -24,8 +24,6 @@ Boston, MA 02111-1307, USA. */ #include "libgfortran.h" -#define stop_string prefix(stop_string) - /* A numeric or blank STOP statement. */ void stop_numeric (GFC_INTEGER_4 code) @@ -39,7 +37,11 @@ stop_numeric (GFC_INTEGER_4 code) sys_exit (code); } +iexport(stop_numeric); + +extern void stop_string (const char *string, GFC_INTEGER_4 len); +export_proto(stop_string); void stop_string (const char *string, GFC_INTEGER_4 len) |
