X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fcharset.c;h=4e459c2b45d8a85144e9320f14c688524acc8a5b;hb=31ce04e9e0ce96e752e2c53dfad5881d24e9f080;hp=9df46c0c74dd7d15b6ae83be91a2e59e1c73829e;hpb=268a13a5a3f7c6b9b6ffc5ac2d1b24eb41f3fbdc;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/charset.c b/gdb/charset.c index 9df46c0c74..4e459c2b45 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -1,6 +1,6 @@ /* Character set conversion support for GDB. - Copyright (C) 2001-2019 Free Software Foundation, Inc. + Copyright (C) 2001-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -23,7 +23,6 @@ #include "gdb_obstack.h" #include "gdbsupport/gdb_wait.h" #include "charset-list.h" -#include "gdbsupport/vec.h" #include "gdbsupport/environ.h" #include "arch-utils.h" #include "gdbsupport/gdb_vecs.h" @@ -817,10 +816,10 @@ find_charset_names (void) #ifdef ICONV_BIN { - char *iconv_dir = relocate_gdb_directory (ICONV_BIN, - ICONV_BIN_RELOCATABLE); - iconv_program = concat (iconv_dir, SLASH_STRING, "iconv", NULL); - xfree (iconv_dir); + std::string iconv_dir = relocate_gdb_directory (ICONV_BIN, + ICONV_BIN_RELOCATABLE); + iconv_program + = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", (char *) NULL); } #else iconv_program = xstrdup ("iconv"); @@ -946,15 +945,9 @@ default_auto_wide_charset (void) #define ENDIAN_SUFFIX "LE" #endif -/* The code below serves to generate a compile time error if - gdb_wchar_t type is not of size 2 nor 4, despite the fact that - macro __STDC_ISO_10646__ is defined. - This is better than a gdb_assert call, because GDB cannot handle - strings correctly if this size is different. */ +/* GDB cannot handle strings correctly if this size is different. */ -extern char your_gdb_wchar_t_is_bogus[(sizeof (gdb_wchar_t) == 2 - || sizeof (gdb_wchar_t) == 4) - ? 1 : -1]; +gdb_static_assert (sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4); /* intermediate_encoding returns the charset used internally by GDB to convert between target and host encodings. As the test above @@ -997,13 +990,14 @@ intermediate_encoding (void) /* Not valid, free the allocated memory. */ xfree (result); /* No valid charset found, generate error here. */ - error (_("Unable to find a vaild charset for string conversions")); + error (_("Unable to find a valid charset for string conversions")); } #endif /* USE_INTERMEDIATE_ENCODING_FUNCTION */ +void _initialize_charset (); void -_initialize_charset (void) +_initialize_charset () { /* The first element is always "auto". */ charsets.charsets.push_back (xstrdup ("auto"));