Make string and char pointers comparable

This commit is contained in:
2025-02-08 23:02:27 +01:00
parent 8a0f282714
commit d88bd652a4
15 changed files with 425 additions and 123 deletions

View File

@ -1,3 +1,20 @@
/* elna-diagnostic.cc -- Elna frontend specific diagnostic routines.
Copyright (C) 2025 Free Software Foundation, Inc.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "elna/gcc/elna-diagnostic.h"
#include "elna/gcc/elna-tree.h"
@ -12,7 +29,7 @@ namespace gcc
return linemap_position_for_column(line_table, position->column);
}
const char *print_type(tree type)
std::string print_type(tree type)
{
gcc_assert(TYPE_P(type));
@ -38,7 +55,7 @@ namespace gcc
}
else if (is_pointer_type(type))
{
return "pointer";
return std::string("\"pointer to " + print_type(TREE_TYPE(type)) + "\"");
}
else if (TREE_CODE(type) == ARRAY_TYPE)
{