Use gdb_static_assert in charset.c

It currently has a "manual" static assert.

gdb/ChangeLog:

2019-10-07  Christian Biesinger  <cbiesinger@google.com>

	* charset.c (your_gdb_wchar_t_is_bogus): Replace with a
	gdb_static_assert.
This commit is contained in:
Christian Biesinger
2019-10-07 12:33:06 -05:00
parent 606813d5cd
commit 51f1fdc3d2
2 changed files with 7 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2019-10-07 Christian Biesinger <cbiesinger@google.com>
* charset.c (your_gdb_wchar_t_is_bogus): Replace with a
gdb_static_assert.
2019-10-07 Weimin Pan <weimin.pan@oracle.com> 2019-10-07 Weimin Pan <weimin.pan@oracle.com>
* ../Makefile.def (dependencies): Add all-libctf to all-gdb * ../Makefile.def (dependencies): Add all-libctf to all-gdb

View File

@ -946,15 +946,9 @@ default_auto_wide_charset (void)
#define ENDIAN_SUFFIX "LE" #define ENDIAN_SUFFIX "LE"
#endif #endif
/* The code below serves to generate a compile time error if /* GDB cannot handle strings correctly if this size is different. */
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. */
extern char your_gdb_wchar_t_is_bogus[(sizeof (gdb_wchar_t) == 2 gdb_static_assert (sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4);
|| sizeof (gdb_wchar_t) == 4)
? 1 : -1];
/* intermediate_encoding returns the charset used internally by /* intermediate_encoding returns the charset used internally by
GDB to convert between target and host encodings. As the test above GDB to convert between target and host encodings. As the test above