[review] Fix up safe_strerror constification

Message ID gerrit.1572562283000.I2b8be88444ad8b5e92e9d57d28e66874142b72f7@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Oct. 31, 2019, 10:51 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/478
......................................................................

Fix up safe_strerror constification

The earlier patch to constify safe_strerror missed a couple of spots,
corrected here.

gdb/ChangeLog
2019-10-31  Tom Tromey  <tromey@adacore.com>

	* gdbsupport/mingw-strerror.c (safe_strerror): Constify result.
	* gdbsupport/gdb-dlfcn.c (gdb_dlopen): Update.

Change-Id: I2b8be88444ad8b5e92e9d57d28e66874142b72f7
---
M gdb/ChangeLog
M gdb/gdbsupport/gdb-dlfcn.c
M gdb/gdbsupport/mingw-strerror.c
3 files changed, 7 insertions(+), 2 deletions(-)
  

Comments

Simon Marchi (Code Review) Oct. 31, 2019, 11:09 p.m. UTC | #1
Christian Biesinger has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/478
......................................................................


Patch Set 1: Code-Review+1

Thanks, I should've grepped instead of relying on the compiler.
  
Simon Marchi (Code Review) Nov. 1, 2019, 4:17 p.m. UTC | #2
Sergio Durigan Junior has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/478
......................................................................


Patch Set 1: Code-Review+1

LGTM, thanks for fixing the breakage.
  
Simon Marchi (Code Review) Nov. 1, 2019, 5:54 p.m. UTC | #3
Tom Tromey has abandoned this change. ( https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/478 )

Change subject: Fix up safe_strerror constification
......................................................................


Abandoned

I pushed this but somehow the change-id changed so gerrit did not notice.
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 245fcdf..9f34dbc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@ 
 2019-10-31  Tom Tromey  <tromey@adacore.com>
 
+	* gdbsupport/mingw-strerror.c (safe_strerror): Constify result.
+	* gdbsupport/gdb-dlfcn.c (gdb_dlopen): Update.
+
+2019-10-31  Tom Tromey  <tromey@adacore.com>
+
 	* gdbsupport/gdb-dlfcn.c (gdb_dlopen): Use safe_strerror.
 
 2019-10-31  Christian Biesinger  <cbiesinger@google.com>
diff --git a/gdb/gdbsupport/gdb-dlfcn.c b/gdb/gdbsupport/gdb-dlfcn.c
index 12a35fe..5cd0486 100644
--- a/gdb/gdbsupport/gdb-dlfcn.c
+++ b/gdb/gdbsupport/gdb-dlfcn.c
@@ -73,7 +73,7 @@ 
   error (_("Could not load %s: %s"), filename, dlerror());
 #else
   {
-    char *msg = safe_strerror (GetLastError ());
+    const char *msg = safe_strerror (GetLastError ());
     error (_("Could not load %s: %s"), filename, msg);
   }
 #endif
diff --git a/gdb/gdbsupport/mingw-strerror.c b/gdb/gdbsupport/mingw-strerror.c
index 6386330..893b7ca 100644
--- a/gdb/gdbsupport/mingw-strerror.c
+++ b/gdb/gdbsupport/mingw-strerror.c
@@ -28,7 +28,7 @@ 
    unfortunately this includes all socket-related error codes.
    This replacement tries to find a system-provided error message.  */
 
-char *
+const char *
 safe_strerror (int errnum)
 {
   static char *buffer;