summaryrefslogtreecommitdiffstats
path: root/lib/canonicalize.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/canonicalize.c')
-rw-r--r--lib/canonicalize.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/canonicalize.c b/lib/canonicalize.c
index 010190d..52e9b3b 100644
--- a/lib/canonicalize.c
+++ b/lib/canonicalize.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2023 Free Software Foundation, Inc.
+ Copyright (C) 1996-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,13 +34,6 @@
#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
@@ -51,6 +44,11 @@
# define SLASHES "/"
#endif
+/* Avoid false GCC warning "'end_idx' may be used uninitialized". */
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+
/* Return true if FILE's existence can be shown, false (setting errno)
otherwise. Follow symbolic links. */
static bool
@@ -369,7 +367,7 @@ canonicalize_filename_mode_stk (const char *name, canonicalize_mode_t can_mode,
buf[n] = '\0';
char *extra_buf = bufs->extra.data;
- idx_t end_idx IF_LINT (= 0);
+ idx_t end_idx;
if (end_in_extra_buffer)
end_idx = end - extra_buf;
size_t len = strlen (end);