summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorPetr Písař <ppisar@redhat.com>2016-11-28 13:06:24 +0100
committerTony Cook <tony@develop-help.com>2016-12-01 10:13:30 +1100
commitde97954862ed37d913c4b9a48758aba578a8cf0c (patch)
treef91707d66d14d90126e2dd84b641609b9129578d /inline.h
parent9f2eed981068e7abbcc52267863529bc59e9c8c0 (diff)
downloadperl-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.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/inline.h b/inline.h
index 346dcdc4cf..acd19e5fb6 100644
--- a/inline.h
+++ b/inline.h
@@ -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;
}
/*