gcc: Make strchr return value pointers const

This fixes compilation of codepaths for dos-like filesystems
with Clang. When built with clang, it treats C input files as C++
when the compiler driver is invoked in C++ mode, triggering errors
when the return value of strchr() on a pointer to const is assigned
to a pointer to non-const variable.

This matches similar variables outside of the ifdefs for dos-like
path handling.

2020-09-07  Martin Storsjö  <martin@martin.st>

gcc/
	* dwarf2out.c (file_name_acquire): Make a strchr return value
	pointer to const.
libcpp/
	* files.c (remap_filename): Make a strchr return value pointer
	to const.
This commit is contained in:
Martin Storsjö
2020-09-07 13:18:42 +02:00
committed by Jakub Jelinek
parent 2b0df0a6ac
commit 3fe3efe5c1
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1693,7 +1693,7 @@ remap_filename (cpp_reader *pfile, _cpp_file *file)
p = strchr (fname, '/');
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
char *p2 = strchr (fname, '\\');
const char *p2 = strchr (fname, '\\');
if (!p || (p > p2))
p = p2;
}