summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-20 04:44:11 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-20 04:44:11 +0000
commit070cc7908ad9a33d66643c48beba23f9cb8e6b63 (patch)
tree9eb7755ffeb7c601a8f6b2bf59f09b47b648f7a0 /libgfortran
parentdedd562f4fba462129efa36422191222627849ed (diff)
downloadgcc-070cc7908ad9a33d66643c48beba23f9cb8e6b63.tar.gz
2010-05-19 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/43851 * runtime/stop.c (error_stop_numeric): New function and updated comment. Add declaration for stop_numeric and remove declaration for stop_string. (stop_string): Use for blank STOP. (stop_numeric): Remove use of special -1 stop code. * runtime/pause.c (do_pause): Use stop_string for blank stop. (pause_numeric): Remove use of special -1 pause code. * gfortran.map: Add new symbol to run-time library. * libgfortran.h: Move declaration for stop_string to here to make function visible for do_pause. Remove declaration for stop_numeric. 2010-05-19 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/43851 * trans-stmt.c (gfc_trans_stop): Add generation of call to gfortran_error_stop_numeric. Fix up some whitespace. Use stop_string for blank STOP, handling a null expression. (gfc_trans_pause): Use pause_string for blank PAUSE. * trans.h: Add external function declaration for error_stop_numeric. * trans-decl.c (gfc_build_builtin_function_decls): Add the building of the declaration for the library call. Adjust whitespaces. * match.c (gfc_match_stopcode): Remove use of the actual stop code to signal no stop code. Match the expression following the stop and pass that to the translators. Remove the old use of digit matching. Add checks that the stop_code expression is INTEGER or CHARACTER, constant, and if CHARACTER, default character KIND. 2010-05-19 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/43851 * gfortran.dg/label_1.f90: Update test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159609 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog13
-rw-r--r--libgfortran/gfortran.map5
-rw-r--r--libgfortran/libgfortran.h5
-rw-r--r--libgfortran/runtime/pause.c15
-rw-r--r--libgfortran/runtime/stop.c39
5 files changed, 53 insertions, 24 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index c6153d8490a..0f001411834 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,16 @@
+2010-05-19 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/43851
+ * runtime/stop.c (error_stop_numeric): New function and updated comment.
+ Add declaration for stop_numeric and remove declaration for stop_string.
+ (stop_string): Use for blank STOP.
+ (stop_numeric): Remove use of special -1 stop code.
+ * runtime/pause.c (do_pause): Use stop_string for blank stop.
+ (pause_numeric): Remove use of special -1 pause code.
+ * gfortran.map: Add new symbol to run-time library.
+ * libgfortran.h: Move declaration for stop_string to here to make
+ function visible for do_pause. Remove declaration for stop_numeric.
+
2010-05-08 Janne Blomqvist <jb@gcc.gnu.org>
* io/unix.h (mem_alloc_r): Fix typo to reduce visibility.
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index bcca95788f3..3e854eb0eae 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -1103,6 +1103,11 @@ GFORTRAN_1.3 {
_gfortran_error_stop_string;
} GFORTRAN_1.2;
+GFORTRAN_1.4 {
+ global:
+ _gfortran_error_stop_numeric;
+} GFORTRAN_1.3;
+
F2C_1.0 {
global:
_gfortran_f2c_specific__abs_c4;
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index f51ef00e1c5..99f7342958f 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -827,8 +827,9 @@ internal_proto(filename_from_unit);
/* stop.c */
-extern void stop_numeric (GFC_INTEGER_4) __attribute__ ((noreturn));
-iexport_proto(stop_numeric);
+extern void stop_string (const char *, GFC_INTEGER_4)
+ __attribute__ ((noreturn));
+export_proto(stop_string);
/* reshape_packed.c */
diff --git a/libgfortran/runtime/pause.c b/libgfortran/runtime/pause.c
index 7db536b665b..28edf6c5029 100644
--- a/libgfortran/runtime/pause.c
+++ b/libgfortran/runtime/pause.c
@@ -26,7 +26,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <string.h>
-
static void
do_pause (void)
{
@@ -36,26 +35,24 @@ do_pause (void)
fgets(buff, 4, stdin);
if (strncmp(buff, "go\n", 3) != 0)
- stop_numeric (-1);
+ stop_string ('\0', 0);
st_printf ("RESUMED\n");
}
-/* A numeric or blank STOP statement. */
+/* A numeric PAUSE statement. */
-extern void pause_numeric (GFC_INTEGER_4 code);
+extern void pause_numeric (GFC_INTEGER_4);
export_proto(pause_numeric);
void
pause_numeric (GFC_INTEGER_4 code)
{
- if (code == -1)
- st_printf ("PAUSE\n");
- else
- st_printf ("PAUSE %d\n", (int)code);
-
+ st_printf ("PAUSE %d\n", (int) code);
do_pause ();
}
+/* A character string or blank PAUSE statement. */
+
extern void pause_string (char *string, GFC_INTEGER_4 len);
export_proto(pause_string);
diff --git a/libgfortran/runtime/stop.c b/libgfortran/runtime/stop.c
index 14a88c418cd..87c0411acbe 100644
--- a/libgfortran/runtime/stop.c
+++ b/libgfortran/runtime/stop.c
@@ -26,22 +26,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <string.h>
-/* A numeric or blank STOP statement. */
+/* A numeric STOP statement. */
+
+extern void stop_numeric (GFC_INTEGER_4)
+ __attribute__ ((noreturn));
+export_proto(stop_numeric);
+
void
stop_numeric (GFC_INTEGER_4 code)
{
- if (code == -1)
- code = 0;
- else
- st_printf ("STOP %d\n", (int)code);
-
+ st_printf ("STOP %d\n", (int)code);
sys_exit (code);
}
-iexport(stop_numeric);
-
-extern void stop_string (const char *string, GFC_INTEGER_4 len);
-export_proto(stop_string);
+/* A character string or blank STOP statement. */
void
stop_string (const char *string, GFC_INTEGER_4 len)
@@ -54,14 +52,16 @@ stop_string (const char *string, GFC_INTEGER_4 len)
sys_exit (0);
}
-extern void error_stop_string (const char *, GFC_INTEGER_4);
-export_proto(error_stop_string);
-
/* Per Fortran 2008, section 8.4: "Execution of a STOP statement initiates
normal termination of execution. Execution of an ERROR STOP statement
initiates error termination of execution." Thus, error_stop_string returns
a nonzero exit status code. */
+
+extern void error_stop_string (const char *, GFC_INTEGER_4)
+ __attribute__ ((noreturn));
+export_proto(error_stop_string);
+
void
error_stop_string (const char *string, GFC_INTEGER_4 len)
{
@@ -72,3 +72,16 @@ error_stop_string (const char *string, GFC_INTEGER_4 len)
sys_exit (1);
}
+
+/* A numeric or blank ERROR STOP statement. */
+
+extern void error_stop_numeric (GFC_INTEGER_4)
+ __attribute__ ((noreturn));
+export_proto(error_stop_numeric);
+
+void
+error_stop_numeric (GFC_INTEGER_4 code)
+{
+ st_printf ("ERROR STOP %d\n", (int) code);
+ sys_exit (code);
+}