Don't cast away const in find_and_open_source
authorTom Tromey <tromey@adacore.com>
Fri, 17 May 2019 14:42:10 +0000 (08:42 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 17 May 2019 16:16:40 +0000 (10:16 -0600)
find_and_open_source casts away const, but hasn't needed to in a
while.  This removes the cast and a strangely hostile comment.

gdb/ChangeLog
2019-05-17  Tom Tromey  <tromey@adacore.com>

* source.c (find_and_open_source): Remove cast.

gdb/ChangeLog
gdb/source.c

index 146cb00ef4caafd2ecbc4df6b612af7940fbf00a..713b1cae3bfcf93d271d5d3c96b2d534fd965608 100644 (file)
@@ -1,3 +1,7 @@
+2019-05-17  Tom Tromey  <tromey@adacore.com>
+
+       * source.c (find_and_open_source): Remove cast.
+
 2019-05-17  Tom Tromey  <tromey@adacore.com>
 
        * annotate.c (annotate_source): Make "filename" const.
index b61880ab503c6f957de9120d0bc77c3f06a1ad2c..9a30209880b9a5ca56677d5e5dab0c6ca8a827a2 100644 (file)
@@ -1009,9 +1009,7 @@ find_and_open_source (const char *filename,
       /* Replace a path entry of $cdir with the compilation directory
         name.  */
 #define        cdir_len        5
-      /* We cast strstr's result in case an ANSIhole has made it const,
-         which produces a "required warning" when assigned to a nonconst.  */
-      p = (char *) strstr (source_path, "$cdir");
+      p = strstr (source_path, "$cdir");
       if (p && (p == path || p[-1] == DIRNAME_SEPARATOR)
          && (p[cdir_len] == DIRNAME_SEPARATOR || p[cdir_len] == '\0'))
        {
This page took 0.028696 seconds and 4 git commands to generate.