glibc/glibc-ld-ctype-gcc5.patch

73 lines
2.7 KiB
Diff
Raw Permalink Normal View History

Index: glibc-2.22-193-g315267a/locale/programs/ld-ctype.c
===================================================================
--- glibc-2.22-193-g315267a.orig/locale/programs/ld-ctype.c
+++ glibc-2.22-193-g315267a/locale/programs/ld-ctype.c
@@ -31,6 +31,7 @@
#include <wctype.h>
#include <stdint.h>
#include <sys/uio.h>
+#include <libc-internal.h>
#include "localedef.h"
#include "charmap.h"
@@ -2534,9 +2535,19 @@ with character code range values one mus
{
size_t cnt;
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not possible since ctype_map_new prevents
+ map_collection_nr from being greater than MAX_NR_CHARMP which
+ is the size of mapnames. This is likely PR/59124 which is still
+ not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (cnt = 2; cnt < ctype->map_collection_nr; ++cnt)
if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0)
break;
+ DIAG_POP_NEEDS_COMMENT
if (cnt < ctype->map_collection_nr)
free (now->val.str.startmb);
@@ -2807,9 +2818,19 @@ previous definition was here")));
/* This could mean one of several things. First test whether
it's a character class name. */
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not possible since ctype_class_new prevents
+ nr_charclass from being greater than MAX_NR_CHARCLASS which
+ is the size of classnames. This is likely PR/59124 which is still
+ not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (cnt = 0; cnt < ctype->nr_charclass; ++cnt)
if (strcmp (now->val.str.startmb, ctype->classnames[cnt]) == 0)
break;
+ DIAG_POP_NEEDS_COMMENT
if (cnt < ctype->nr_charclass)
{
class_bit = _ISwbit (cnt);
@@ -2817,9 +2838,19 @@ previous definition was here")));
free (now->val.str.startmb);
goto read_charclass;
}
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not possible since ctype_map_new prevents
+ map_collection_nr from being greater than MAX_NR_CHARMP which
+ is the size of mapnames. This is likely PR/59124 which is still
+ not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0)
break;
+ DIAG_POP_NEEDS_COMMENT
if (cnt < ctype->map_collection_nr)
{
mapidx = cnt;