diff options
author | Christian Biesinger <cbiesinger@google.com> | 2019-10-07 12:33:06 -0500 |
---|---|---|
committer | Christian Biesinger <cbiesinger@google.com> | 2019-10-07 12:49:26 -0500 |
commit | 51f1fdc3d2235ffe94172b51d33fec0e5c5edeca (patch) | |
tree | 10bd5c388c1fb5ccdc6928fb6ad3dfe316b2bb33 /gdb | |
parent | 606813d5cd94f2fc69351881a2279798eda12c99 (diff) | |
download | gdb-51f1fdc3d2235ffe94172b51d33fec0e5c5edeca.zip gdb-51f1fdc3d2235ffe94172b51d33fec0e5c5edeca.tar.gz gdb-51f1fdc3d2235ffe94172b51d33fec0e5c5edeca.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/charset.c | 12 |
2 files changed, 8 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index daf79b05..0f79f2d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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> * ../Makefile.def (dependencies): Add all-libctf to all-gdb diff --git a/gdb/charset.c b/gdb/charset.c index 9df46c0..7313165 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -946,15 +946,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. */ - -extern char your_gdb_wchar_t_is_bogus[(sizeof (gdb_wchar_t) == 2 - || sizeof (gdb_wchar_t) == 4) - ? 1 : -1]; +/* GDB cannot handle strings correctly if this size is different. */ + +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 |