diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 15:26:46 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 15:26:46 +0000 |
commit | df6d86d8822458cf787b5f5620490d6a962da3b8 (patch) | |
tree | 8d499fa24a32a195bd6e384dfb70639c45c4a9bb /locale/weightwc.h | |
parent | 2c7242b971fd7b63fa842df15ec6fa3d0ff8aeb0 (diff) | |
parent | 1949a12d5da678a8532359a95717d8e63910d93b (diff) |
Merge commit 'refs/top-bases/t/____longjmp_chk' into t/____longjmp_chkt/____longjmp_chk
Diffstat (limited to 'locale/weightwc.h')
-rw-r--r-- | locale/weightwc.h | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/locale/weightwc.h b/locale/weightwc.h index ab26482996..7ee335dc9a 100644 --- a/locale/weightwc.h +++ b/locale/weightwc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. +/* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper, <drepper@cygnus.com>. @@ -19,6 +19,8 @@ #ifndef _WEIGHTWC_H_ #define _WEIGHTWC_H_ 1 +#include <libc-diag.h> + /* Find index of weight. */ static inline int32_t __attribute__ ((always_inline)) findidx (const int32_t *table, @@ -26,7 +28,15 @@ findidx (const int32_t *table, const wint_t *extra, const wint_t **cpp, size_t len) { + /* With GCC 7 when compiling with -Os the compiler warns that + seq1.back_us and seq2.back_us, which become *cpp, might be used + uninitialized. This is impossible as this function cannot be + called except in cases where those fields have been + initialized. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized"); wint_t ch = *(*cpp)++; + DIAG_POP_NEEDS_COMMENT; int32_t i = __collidx_table_lookup ((const char *) table, ch); if (i >= 0) @@ -59,9 +69,17 @@ findidx (const int32_t *table, already. */ size_t cnt; + /* With GCC 5.3 when compiling with -Os the compiler warns + that seq2.back_us, which becomes usrc, might be used + uninitialized. This can't be true because we pass a length + of -1 for len at the same time which means that this loop + never executes. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); for (cnt = 0; cnt < nhere && cnt < len; ++cnt) if (cp[cnt] != usrc[cnt]) break; + DIAG_POP_NEEDS_COMMENT; if (cnt == nhere) { @@ -80,23 +98,37 @@ findidx (const int32_t *table, size_t cnt; size_t offset; + /* With GCC 7 when compiling with -Os the compiler warns + that seq1.back_us and seq2.back_us, which become usrc, + might be used uninitialized. This is impossible for the + same reason as described above. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized"); for (cnt = 0; cnt < nhere - 1 && cnt < len; ++cnt) if (cp[cnt] != usrc[cnt]) break; + DIAG_POP_NEEDS_COMMENT; - if (cnt < nhere - 1) + if (cnt < nhere - 1 || cnt == len) { cp += 2 * nhere; continue; } - if (cp[nhere - 1] > usrc[nhere -1]) + /* With GCC 7 when compiling with -Os the compiler warns + that seq1.back_us and seq2.back_us, which become usrc, + might be used uninitialized. This is impossible for the + same reason as described above. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized"); + if (cp[nhere - 1] > usrc[nhere - 1]) { cp += 2 * nhere; continue; } + DIAG_POP_NEEDS_COMMENT; - if (cp[2 * nhere - 1] < usrc[nhere -1]) + if (cp[2 * nhere - 1] < usrc[nhere - 1]) { cp += 2 * nhere; continue; |