Re: [coreutils] [PATCH] maint: suppress some clang scan-build warnings (original) (raw)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: | Jim Meyering |
---|---|
Subject: | Re: [coreutils] [PATCH] maint: suppress some clang scan-build warnings |
Date: | Fri, 07 Jan 2011 08:38:48 +0100 |
Pádraig Brady wrote:
maint: suppress some clang scan-build warnings
* src/pr.c (chartoclump): Remove a dead store. * src/remove.c (ftsskiptree): Likewise. * src/sort.c (keywarnings): Likewise. (sort): Suppress an uninitialized pointer warning.
Thanks! That is fine, with one correction below.
I hope clang's analysis improves to the point that we can make coreutils warning-free without too much effort. I noticed that this warning about ln.c is bogus:
203 && (backup_type == no_backups || !symbolic_link)
204 && (!symbolic_link || stat (source, &source_stats) == 0)
205 && SAME_INODE (source_stats, dest_stats)
Within the expansion of the macro 'SAME_INODE':
The left operand of '==' is a garbage value
Here's the expansion: ((source_stats).st_ino == (dest_stats).st_ino && (source_stats).st_dev == (dest_stats).st_dev)
The problem is that clang made the assumption, a few lines above, that "symbolic_link" was true, yet doesn't deduce the consequence: whenever SAME_INODE is reached, the just-prior call to stat has succeeded, and hence has defined "source_stats".
...
diff --git a/src/sort.c b/src/sort.c ... @@ -3770,6 +3770,7 @@ sort (char *const *files, sizet nfiles, char const *outputfile, sizet nthreads) { struct buffer buf; + IFLINT (buf.buf == NULL);
ETOOLATE ;-) You must mean this:
IF_LINT (buf.buf = NULL);
- [coreutils] [PATCH] maint: suppress some clang scan-build warnings, Pádraig Brady, 2011/01/06
- Re: [coreutils] [PATCH] maint: suppress some clang scan-build warnings,Jim Meyering <=
- Prev by Date:[coreutils] [PATCH] coreutils new feature: split --filter
- Next by Date:[coreutils] RFC for adding file creation mode feature into touch utility.
- Previous by thread:[coreutils] [PATCH] maint: suppress some clang scan-build warnings
- Next by thread:[coreutils] [PATCH] coreutils new feature: split --filter
- Index(es):