diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2018-02-23 11:07:24 +0200 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2018-02-23 11:07:24 +0200 |
commit | dffb1e2279fc9df82b2817c87a9a6319e7508532 (patch) | |
tree | 858fec6d98338d83564c6149d999223d2f44d204 /libgfortran/caf | |
parent | 355436fb15420a1b05d3e333f202fa3296b4baaf (diff) | |
download | gcc-dffb1e2279fc9df82b2817c87a9a6319e7508532.tar.gz |
PR 84519 Handle optional QUIET specifier for STOP and ERROR STOP
Fortran 2018 adds a new QUIET specifier for the STOP and ERROR STOP
statements, in order to suppress the printing of signaling FP
exceptions and the stop code. This patch adds the necessary library
changes, but for now the new specifier is not parsed and the frontend
unconditionally adds a false value for the new argument.
Regtested on x86_64-pc-linux-gnu.
gcc/fortran/ChangeLog:
2018-02-23 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/84519
* trans-decl.c (gfc_build_builtin_function_decls): Add bool
argument to stop and error stop decls.
* trans-stmt.c (gfc_trans_stop): Add false value to argument
lists.
libgfortran/ChangeLog:
2018-02-23 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/84519
* caf/libcaf.h (_gfortran_caf_stop_numeric): Add bool argument.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
* caf/mpi.c (_gfortran_caf_error_stop_str): Handle new argument.
(_gfortran_caf_error_stop): Likewise.
* caf/single.c (_gfortran_caf_stop_numeric): Likewise.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
* libgfortran.h (stop_string): Add bool argument.
* runtime/pause.c (do_pause): Add false argument.
* runtime/stop.c (stop_numeric): Handle new argument.
(stop_string): Likewise.
(error_stop_string): Likewise.
(error_stop_numeric): Likewise.
From-SVN: r257928
Diffstat (limited to 'libgfortran/caf')
-rw-r--r-- | libgfortran/caf/libcaf.h | 8 | ||||
-rw-r--r-- | libgfortran/caf/mpi.c | 19 | ||||
-rw-r--r-- | libgfortran/caf/single.c | 42 |
3 files changed, 39 insertions, 30 deletions
diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h index 198a0e9efd3..dd97166952c 100644 --- a/libgfortran/caf/libcaf.h +++ b/libgfortran/caf/libcaf.h @@ -197,13 +197,13 @@ void _gfortran_caf_sync_all (int *, char *, size_t); void _gfortran_caf_sync_memory (int *, char *, size_t); void _gfortran_caf_sync_images (int, int[], int *, char *, size_t); -void _gfortran_caf_stop_numeric (int) +void _gfortran_caf_stop_numeric (int, bool) __attribute__ ((noreturn)); -void _gfortran_caf_stop_str (const char *, size_t) +void _gfortran_caf_stop_str (const char *, size_t, bool) __attribute__ ((noreturn)); -void _gfortran_caf_error_stop_str (const char *, size_t) +void _gfortran_caf_error_stop_str (const char *, size_t, bool) __attribute__ ((noreturn)); -void _gfortran_caf_error_stop (int) __attribute__ ((noreturn)); +void _gfortran_caf_error_stop (int, bool) __attribute__ ((noreturn)); void _gfortran_caf_fail_image (void) __attribute__ ((noreturn)); void _gfortran_caf_co_broadcast (gfc_descriptor_t *, int, int *, char *, size_t); diff --git a/libgfortran/caf/mpi.c b/libgfortran/caf/mpi.c index 14c10b536e3..55d9908b8de 100644 --- a/libgfortran/caf/mpi.c +++ b/libgfortran/caf/mpi.c @@ -358,13 +358,15 @@ error_stop (int error) /* ERROR STOP function for string arguments. */ void -_gfortran_caf_error_stop_str (const char *string, size_t len) +_gfortran_caf_error_stop_str (const char *string, size_t len, bool quiet) { - fputs ("ERROR STOP ", stderr); - while (len--) - fputc (*(string++), stderr); - fputs ("\n", stderr); - + if (!quiet) + { + fputs ("ERROR STOP ", stderr); + while (len--) + fputc (*(string++), stderr); + fputs ("\n", stderr); + } error_stop (1); } @@ -372,8 +374,9 @@ _gfortran_caf_error_stop_str (const char *string, size_t len) /* ERROR STOP function for numerical arguments. */ void -_gfortran_caf_error_stop (int error) +_gfortran_caf_error_stop (int error, bool quiet) { - fprintf (stderr, "ERROR STOP %d\n", error); + if (!quiet) + fprintf (stderr, "ERROR STOP %d\n", error); error_stop (error); } diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c index 053ec87d562..1ad13bd5643 100644 --- a/libgfortran/caf/single.c +++ b/libgfortran/caf/single.c @@ -267,33 +267,38 @@ _gfortran_caf_sync_images (int count __attribute__ ((unused)), void -_gfortran_caf_stop_numeric(int stop_code) +_gfortran_caf_stop_numeric(int stop_code, bool quiet) { - fprintf (stderr, "STOP %d\n", stop_code); + if (!quiet) + fprintf (stderr, "STOP %d\n", stop_code); exit (0); } void -_gfortran_caf_stop_str(const char *string, size_t len) +_gfortran_caf_stop_str(const char *string, size_t len, bool quiet) { - fputs ("STOP ", stderr); - while (len--) - fputc (*(string++), stderr); - fputs ("\n", stderr); - + if (!quiet) + { + fputs ("STOP ", stderr); + while (len--) + fputc (*(string++), stderr); + fputs ("\n", stderr); + } exit (0); } void -_gfortran_caf_error_stop_str (const char *string, size_t len) +_gfortran_caf_error_stop_str (const char *string, size_t len, bool quiet) { - fputs ("ERROR STOP ", stderr); - while (len--) - fputc (*(string++), stderr); - fputs ("\n", stderr); - + if (!quiet) + { + fputs ("ERROR STOP ", stderr); + while (len--) + fputc (*(string++), stderr); + fputs ("\n", stderr); + } exit (1); } @@ -367,9 +372,10 @@ _gfortran_caf_stopped_images (gfc_descriptor_t *array, void -_gfortran_caf_error_stop (int error) +_gfortran_caf_error_stop (int error, bool quiet) { - fprintf (stderr, "ERROR STOP %d\n", error); + if (!quiet) + fprintf (stderr, "ERROR STOP %d\n", error); exit (error); } @@ -2990,7 +2996,7 @@ _gfortran_caf_lock (caf_token_t token, size_t index, } return; } - _gfortran_caf_error_stop_str (msg, strlen (msg)); + _gfortran_caf_error_stop_str (msg, strlen (msg), false); } @@ -3023,7 +3029,7 @@ _gfortran_caf_unlock (caf_token_t token, size_t index, } return; } - _gfortran_caf_error_stop_str (msg, strlen (msg)); + _gfortran_caf_error_stop_str (msg, strlen (msg), false); } int |