diff options
author | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-08-10 13:48:38 +0000 |
---|---|---|
committer | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-08-10 13:48:38 +0000 |
commit | af7017351ef6065c5b9d6dcb6ced3aa19bbbe5a7 (patch) | |
tree | ad181f8771daf0871cb85c93e1228412f4d525fe /libgfortran | |
parent | 922bb4f72f77932a22053183fed62145b47271a0 (diff) |
* fmain.c (main): Do not call init and cleanup; call set_args instead.
* libgfortran.h (init, cleanup): Remove declarations.
(set_args): Add declaration.
* runtime/main.c (init, cleanup): Make them static, and give them
the constructor and destructor attributes.
(set_args): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@70291 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 9 | ||||
-rw-r--r-- | libgfortran/fmain.c | 7 | ||||
-rw-r--r-- | libgfortran/libgfortran.h | 9 | ||||
-rw-r--r-- | libgfortran/runtime/main.c | 19 |
4 files changed, 26 insertions, 18 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1caea5e9862..8fb05632c8f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2003-08-10 Erik Schnetter <schnetter@uni-tuebingen.de> + + * fmain.c (main): Do not call init and cleanup; call set_args instead. + * libgfortran.h (init, cleanup): Remove declarations. + (set_args): Add declaration. + * runtime/main.c (init, cleanup): Make them static, and give them + the constructor and destructor attributes. + (set_args): New function. + 2003-08-10 Paul Brook <paul@nowt.org> * intrinsics/strinf_intrinsics.c (compare_string): Return value based diff --git a/libgfortran/fmain.c b/libgfortran/fmain.c index 0b283637860..ec621256df1 100644 --- a/libgfortran/fmain.c +++ b/libgfortran/fmain.c @@ -6,20 +6,17 @@ void MAIN__ (void); /* Main procedure for fortran programs. All we do is set up the environment - for the Fortran program. There's not a lot we can do right now. */ + for the Fortran program. */ int main (int argc, char *argv[]) { /* Set up the runtime environment. */ - init (argc, argv); + set_args (argc, argv); /* Call the Fortran main program. Internally this is a function called MAIN__ */ MAIN__ (); - /* And shut everything down again. */ - cleanup (); - /* Bye-bye! */ return 0; } diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 61e1c4250b8..ee258be3b24 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -228,18 +228,15 @@ extern char *filename; /* main.c */ -#define init prefix(init) -void init (int, char **); - -#define cleanup prefix(cleanup) -void cleanup (void); - #define library_start prefix(library_start) void library_start (void); #define library_end prefix(library_end) void library_end (void); +#define set_args prefix(set_args) +void set_args (int, char **); + #define get_args prefix(get_args) void get_args (int *, char ***); diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c index 67a4939c820..016387a2f68 100644 --- a/libgfortran/runtime/main.c +++ b/libgfortran/runtime/main.c @@ -57,6 +57,15 @@ determine_endianness (void) static int argc_save; static char **argv_save; +/* Set the saved values of the command line arguments. */ + +void +set_args (int argc, char **argv) +{ + argc_save = argc; + argv_save = argv; +} + /* Retrieve the saved values of the command line arguments. */ void @@ -70,13 +79,9 @@ get_args (int *argc, char ***argv) /* Initialize the runtime library. */ -void -init (int argc, char *argv[]) +static void __attribute__((constructor)) +init (void) { - /* Save for access via intrinsic extensions */ - argc_save = argc; - argv_save = argv; - /* Figure out the machine endianness. */ determine_endianness (); @@ -100,7 +105,7 @@ init (int argc, char *argv[]) /* Cleanup the runtime library. */ -void +static void __attribute__((destructor)) cleanup () { close_units (); |