diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2011-05-14 10:55:51 +0300 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2011-05-14 10:55:51 +0300 |
commit | 1028b2bded33a9ee92db6a1a968258f3ba29aa24 (patch) | |
tree | cd0c97323c6980b35b95ce189ac0bdc597d9c4dc /libgfortran/runtime/stop.c | |
parent | b4224aec547b9e01f0b79d65c31c7b6da998b8cd (diff) | |
download | gcc-1028b2bded33a9ee92db6a1a968258f3ba29aa24.zip gcc-1028b2bded33a9ee92db6a1a968258f3ba29aa24.tar.gz gcc-1028b2bded33a9ee92db6a1a968258f3ba29aa24.tar.bz2 |
Error printing thread safety, remove GFORTRAN_USE_STDERR
From-SVN: r173749
Diffstat (limited to 'libgfortran/runtime/stop.c')
-rw-r--r-- | libgfortran/runtime/stop.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libgfortran/runtime/stop.c b/libgfortran/runtime/stop.c index 29f5031..b6f61ff 100644 --- a/libgfortran/runtime/stop.c +++ b/libgfortran/runtime/stop.c @@ -1,8 +1,8 @@ /* Implementation of the STOP statement. - Copyright 2002, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright 2002, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> -This file is part of the GNU Fortran 95 runtime library (libgfortran). +This file is part of the GNU Fortran runtime library (libgfortran). Libgfortran is free software; you can redistribute it and/or modify it under the terms of the GNU General Public @@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <string.h> +#include <unistd.h> /* A numeric STOP statement. */ @@ -65,10 +66,10 @@ stop_string (const char *string, GFC_INTEGER_4 len) { if (string) { - st_printf ("STOP "); - while (len--) - st_printf ("%c", *(string++)); - st_printf ("\n"); + estr_write ("STOP "); + ssize_t w = write (STDERR_FILENO, string, len); + (void) sizeof (w); /* Avoid compiler warning about not using w. */ + estr_write ("\n"); } sys_exit (0); } @@ -86,10 +87,10 @@ export_proto(error_stop_string); void error_stop_string (const char *string, GFC_INTEGER_4 len) { - st_printf ("ERROR STOP "); - while (len--) - st_printf ("%c", *(string++)); - st_printf ("\n"); + estr_write ("ERROR STOP "); + ssize_t w = write (STDERR_FILENO, string, len); + (void) sizeof (w); /* Avoid compiler warning about not using w. */ + estr_write ("\n"); sys_exit (1); } |