diff options
author | Petr Písař <ppisar@redhat.com> | 2016-11-28 13:06:24 +0100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2016-12-01 10:13:30 +1100 |
commit | de97954862ed37d913c4b9a48758aba578a8cf0c (patch) | |
tree | f91707d66d14d90126e2dd84b641609b9129578d /inline.h | |
parent | 9f2eed981068e7abbcc52267863529bc59e9c8c0 (diff) | |
download | perl-de97954862ed37d913c4b9a48758aba578a8cf0c.tar.gz |
Silent const correctnes warnings in utf8_hop functions
GCC -Wcast-qual option reports a const violation in utf8_hop
functions. They take a pointer to constant data but returns pointer to
non-constant data.
It's impossible to fix this without changing their prototype.
Therefore this patch asks a compiler to ignore the violations.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Diffstat (limited to 'inline.h')
-rw-r--r-- | inline.h | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -916,7 +916,9 @@ Perl_utf8_hop(const U8 *s, SSize_t off) s--; } } + GCC_DIAG_IGNORE(-Wcast-qual); return (U8 *)s; + GCC_DIAG_RESTORE; } /* @@ -950,12 +952,17 @@ Perl_utf8_hop_forward(const U8 *s, SSize_t off, const U8 *end) while (off--) { STRLEN skip = UTF8SKIP(s); - if ((STRLEN)(end - s) <= skip) + if ((STRLEN)(end - s) <= skip) { + GCC_DIAG_IGNORE(-Wcast-qual); return (U8 *)end; + GCC_DIAG_RESTORE; + } s += skip; } + GCC_DIAG_IGNORE(-Wcast-qual); return (U8 *)s; + GCC_DIAG_RESTORE; } /* @@ -993,7 +1000,9 @@ Perl_utf8_hop_back(const U8 *s, SSize_t off, const U8 *start) s--; } + GCC_DIAG_IGNORE(-Wcast-qual); return (U8 *)s; + GCC_DIAG_RESTORE; } /* |