re PR libfortran/47972 (error.c:158:7: warning: return makes pointer from integer without a cast)

PR libfortran/47972
	* runtime/error.c (gf_strerror): Silence warning.

From-SVN: r181180
This commit is contained in:
Francois-Xavier Coudert 2011-11-08 21:58:47 +00:00 committed by François-Xavier Coudert
parent e948157df8
commit 6ef982714c
2 changed files with 12 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/47972
* runtime/error.c (gf_strerror): Silence warning.
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> 2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/47970 PR libfortran/47970

View File

@ -219,19 +219,13 @@ gf_strerror (int errnum,
size_t buflen __attribute__((unused))) size_t buflen __attribute__((unused)))
{ {
#ifdef HAVE_STRERROR_R #ifdef HAVE_STRERROR_R
/* TODO: How to prevent the compiler warning due to strerror_r of return
the untaken branch having the wrong return type? */ __builtin_choose_expr (__builtin_classify_type (strerror_r (0, buf, 0))
if (__builtin_classify_type (strerror_r (0, buf, 0)) == 5) == 5,
{ /* GNU strerror_r() */
/* GNU strerror_r() */ strerror_r (errnum, buf, buflen),
return strerror_r (errnum, buf, buflen); /* POSIX strerror_r () */
} (strerror_r (errnum, buf, buflen), buf));
else
{
/* POSIX strerror_r () */
strerror_r (errnum, buf, buflen);
return buf;
}
#else #else
/* strerror () is not necessarily thread-safe, but should at least /* strerror () is not necessarily thread-safe, but should at least
be available everywhere. */ be available everywhere. */