]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - locale/weight.h
Define ISO 639-3 "tok" [BZ #28950]
[thirdparty/glibc.git] / locale / weight.h
index b097aaca0b62d05611aa12323430f7ac69df58fd..c49f4e6d9089ca24fec0cc0058be5ef5bb6022e1 100644 (file)
@@ -1,6 +1,5 @@
-/* Copyright (C) 1996-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Written by Ulrich Drepper, <drepper@cygnus.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _WEIGHT_H_
+#define _WEIGHT_H_     1
+
+#include <libc-diag.h>
 
 /* Find index of weight.  */
-auto inline int32_t
-__attribute ((always_inline))
-findidx (const unsigned char **cpp, size_t len)
+static inline int32_t __attribute__ ((always_inline))
+findidx (const int32_t *table,
+        const int32_t *indirect,
+        const unsigned char *extra,
+        const unsigned char **cpp, size_t len)
 {
   int_fast32_t i = table[*(*cpp)++];
   const unsigned char *cp;
@@ -56,9 +62,17 @@ findidx (const unsigned char **cpp, size_t len)
             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)
            {
@@ -117,7 +131,15 @@ findidx (const unsigned char **cpp, size_t len)
              do
                {
                  offset <<= 8;
+                 /* 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");
                  offset += usrc[cnt] - cp[cnt];
+                 DIAG_POP_NEEDS_COMMENT;
                }
              while (++cnt < nhere);
            }
@@ -130,3 +152,5 @@ findidx (const unsigned char **cpp, size_t len)
   /* NOTREACHED */
   return 0x43219876;
 }
+
+#endif /* weight.h */