+2024-08-28 Pádraig Brady <P@draigBrady.com>
+
+ avoid GCC -Wmaybe-uninitialized false positives with LTO
+ Avoids false warnings with GCC 14.2.1 with -flto
+
+ * lib/canonicalize.c: Initialize END_IDX.
+ * lib/getndelim2.c: Initialize C.
+
2024-08-28 Bruno Haible <bruno@clisp.org>
threads-h: Don't override the C++ keyword 'thread_local'.
#include "hash-triple.h"
#include "xalloc.h"
+/* Suppress bogus GCC -Wmaybe-uninitialized warnings. */
+#if defined GCC_LINT || defined lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif
+
#ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
# define DOUBLE_SLASH_IS_DISTINCT_ROOT false
#endif
buf[n] = '\0';
char *extra_buf = bufs->extra.data;
- idx_t end_idx;
+ idx_t end_idx IF_LINT (= 0);
if (end_in_extra_buffer)
end_idx = end - extra_buf;
size_t len = strlen (end);
#include "memchr2.h"
/* Avoid false GCC warning "'c' may be used uninitialized". */
-#if _GL_GNUC_PREREQ (4, 7)
-# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#if defined GCC_LINT || defined lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
#endif
/* The maximum value that getndelim2 can return without suffering from
/* Here always ptr + size == read_pos + nbytes_avail.
Also nbytes_avail > 0 || size < nmax. */
- int c;
+ int c IF_LINT (= EOF);
const char *buffer;
size_t buffer_len;