diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-12-24 21:33:18 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-12-24 21:49:01 -0800 |
commit | d411aa6ffa127d2707958a364896a0fd7d500b1b (patch) | |
tree | 05b136a85ad73d1916f72c1e5a15735e6028f1d1 /lib/canonicalize.c | |
parent | 1504c11f8a5cca19eae97afb71644a4123c343ab (diff) | |
download | gnulib-d411aa6ffa127d2707958a364896a0fd7d500b1b.tar.gz |
canonicalize, canonicalize-lgpl: remove lint
Pacify GCC. Some of these problems were reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-12/msg00217.html
* lib/canonicalize-lgpl.c, lib/canonicalize.c:
Sort shared include directives, for consistency.
(IF_LINT): New macro.
(suffix_requires_dir_check): Mark with _GL_ATTRIBUTE_PURE.
* lib/canonicalize-lgpl.c (GCC_LINT, _GL_ATTRIBUTE_PURE) [_LIBC]:
New macros.
(realpath_stk): Suppress bogus -Wmaybe-uninitialized warning.
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Omit unused local. Suppress bogus -Wmaybe-uninitialized warning.
Diffstat (limited to 'lib/canonicalize.c')
-rw-r--r-- | lib/canonicalize.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/canonicalize.c b/lib/canonicalize.c index 2c88335bf4..e8b74d855a 100644 --- a/lib/canonicalize.c +++ b/lib/canonicalize.c @@ -27,14 +27,21 @@ #include <sys/stat.h> #include <unistd.h> +#include <filename.h> +#include <idx.h> #include <scratch_buffer.h> #include "attribute.h" #include "file-set.h" -#include "idx.h" #include "hash-triple.h" #include "xalloc.h" -#include "filename.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 @@ -72,7 +79,7 @@ file_accessible (char const *file) component within END. END must either be empty, or start with a slash. */ -static bool +static bool _GL_ATTRIBUTE_PURE suffix_requires_dir_check (char const *end) { /* If END does not start with a slash, the suffix is OK. */ @@ -334,7 +341,6 @@ canonicalize_filename_mode_stk (const char *name, canonicalize_mode_t can_mode, dest = mempcpy (dest, start, startlen); *dest = '\0'; - char discard; char *buf; ssize_t n = -1; if (!logical) @@ -386,7 +392,7 @@ canonicalize_filename_mode_stk (const char *name, canonicalize_mode_t can_mode, buf[n] = '\0'; char *extra_buf = extra_buffer.data; - idx_t end_idx; + idx_t end_idx IF_LINT (= 0); if (end_in_extra_buffer) end_idx = end - extra_buf; idx_t len = strlen (end); |