aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2011-11-08 21:58:47 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2011-11-08 21:58:47 +0000
commit6ef982714cf2a0a796cd55805ceeeaa07726a903 (patch)
tree4c1042f4f7959d4beab1d77033f4d9c4f0386f0c
parente948157df85d8bfbb9302263227dab1ff8d9ba74 (diff)
downloadgcc-6ef982714cf2a0a796cd55805ceeeaa07726a903.zip
gcc-6ef982714cf2a0a796cd55805ceeeaa07726a903.tar.gz
gcc-6ef982714cf2a0a796cd55805ceeeaa07726a903.tar.bz2
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
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/runtime/error.c20
2 files changed, 12 insertions, 13 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index becb601..3a2db6d 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,5 +1,10 @@
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>
+
PR libfortran/47970
* intrinsics/c99_functions.c (round): Move higher in the file.
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index aa44706..cb06429 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -219,19 +219,13 @@ gf_strerror (int errnum,
size_t buflen __attribute__((unused)))
{
#ifdef HAVE_STRERROR_R
- /* TODO: How to prevent the compiler warning due to strerror_r of
- the untaken branch having the wrong return type? */
- if (__builtin_classify_type (strerror_r (0, buf, 0)) == 5)
- {
- /* GNU strerror_r() */
- return strerror_r (errnum, buf, buflen);
- }
- else
- {
- /* POSIX strerror_r () */
- strerror_r (errnum, buf, buflen);
- return buf;
- }
+ return
+ __builtin_choose_expr (__builtin_classify_type (strerror_r (0, buf, 0))
+ == 5,
+ /* GNU strerror_r() */
+ strerror_r (errnum, buf, buflen),
+ /* POSIX strerror_r () */
+ (strerror_r (errnum, buf, buflen), buf));
#else
/* strerror () is not necessarily thread-safe, but should at least
be available everywhere. */