mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gunicode.h: fix warning with -Wcast-qual for define g_utf8_next_char()
The define for g_utf8_next_char(p) includes a not needed final cast to (char *). In fact, this cast has the adverse effect of causing a warning if p is a (const char *) with gcc/clang compiler option -Wcast-qual. So lets remove the not needed cast and add option -Werror=cast-qual to glib/tests/utf8-pointer.c which uses g_utf8_next_char(). Now utf8-pointer.c compiles also with compiler option -Werror=cast-qual and passes all tests.
This commit is contained in:
parent
81eaabb308
commit
c583162cc6
@ -806,7 +806,7 @@ GLIB_VAR const gchar * const g_utf8_skip;
|
||||
* Before using this macro, use g_utf8_validate() to validate strings
|
||||
* that may contain invalid UTF-8.
|
||||
*/
|
||||
#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)])
|
||||
#define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)])
|
||||
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE;
|
||||
|
@ -169,7 +169,9 @@ glib_tests = {
|
||||
'tree' : {},
|
||||
'types' : {},
|
||||
'utf8-performance' : {},
|
||||
'utf8-pointer' : {},
|
||||
'utf8-pointer' : {
|
||||
'c_args' : cc.get_id() == 'gcc' ? ['-Werror=cast-qual'] : [],
|
||||
},
|
||||
'utf8-validate' : {},
|
||||
'utf8-misc' : {},
|
||||
'utils' : {
|
||||
|
Loading…
Reference in New Issue
Block a user