aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-05-17 08:42:10 -0600
committerTom Tromey <tromey@adacore.com>2019-05-17 10:16:40 -0600
commit33d0e35aed8870ad317af7eeca5274cf4fd87d15 (patch)
tree628739a434dc0bccf8e121f44e514976f66eb0df
parenta45575b0356d671df2c55fcfc66de719b6b2e5e5 (diff)
downloadgdb-33d0e35aed8870ad317af7eeca5274cf4fd87d15.zip
gdb-33d0e35aed8870ad317af7eeca5274cf4fd87d15.tar.gz
gdb-33d0e35aed8870ad317af7eeca5274cf4fd87d15.tar.bz2
Don't cast away const in find_and_open_source
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.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/source.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 146cb00..713b1ca 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
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.
* annotate.h (annotate_source): Use const.
diff --git a/gdb/source.c b/gdb/source.c
index b61880a..9a30209 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -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'))
{