mirror of
git://git.sv.gnu.org/findutils.git
synced 2026-01-30 13:18:59 +01:00
Enable more syntax checks, eliminate useless C preprocessor parentheses
* find/defs.h: Eliminate useless parentheses in #if. * find/find.c (safely_chdir): Likewise. * find/pred.c: Likewise. * lib/buildcmd.c: Likewise. * lib/fdleak.c: Likewise * xargs/xargs.c: Likewise. * find/parser.c: Likewise. (ISDIGIT): Simplify, and avoid undefining isascii. * cfg.mk (local-checks-to-skip): Remove sc_prohibit_cvs_keyword, since the test produces no hits anyway. Explain why we avoid sc_two_space_separator_in_usage. Enable the sc_useless_cpp_parens check.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -17,6 +17,20 @@
|
||||
|
||||
2011-06-11 James Youngman <jay@gnu.org>
|
||||
|
||||
Enable more syntax checks, eliminate useless C preprocessor parentheses
|
||||
* find/defs.h: Eliminate useless parentheses in #if.
|
||||
* find/find.c (safely_chdir): Likewise.
|
||||
* find/pred.c: Likewise.
|
||||
* lib/buildcmd.c: Likewise.
|
||||
* lib/fdleak.c: Likewise
|
||||
* xargs/xargs.c: Likewise.
|
||||
* find/parser.c: Likewise.
|
||||
(ISDIGIT): Simplify, and avoid undefining isascii.
|
||||
* cfg.mk (local-checks-to-skip): Remove sc_prohibit_cvs_keyword,
|
||||
since the test produces no hits anyway. Explain why we avoid
|
||||
sc_two_space_separator_in_usage. Enable the sc_useless_cpp_parens
|
||||
check.
|
||||
|
||||
Use stat-size macros in pred.c also.
|
||||
* find/pred.c: Include stat-size. Eliminate definitions of
|
||||
DEV_BSIZE, ST_BLKSIZE, ST_NBLOCKS, ST_NBLOCKSIZE macros which are
|
||||
|
||||
13
cfg.mk
13
cfg.mk
@@ -26,17 +26,20 @@ local-checks-to-skip += sc_makefile_at_at_check
|
||||
# False positives I don't have a workaround for yet.
|
||||
# sc_space_tab: several .xo test output files contain this sequence
|
||||
# for testing xargs's handling of white space.
|
||||
local-checks-to-skip += sc_obsolete_symbols sc_prohibit_cvs_keyword \
|
||||
sc_two_space_separator_in_usage \
|
||||
local-checks-to-skip += sc_obsolete_symbols \
|
||||
sc_space_tab
|
||||
|
||||
|
||||
|
||||
# Skip sc_two_space_separator_in_usage because it reflects the requirements
|
||||
# of help2man. It gets run on files that are not help2man inputs, and in
|
||||
# any case we don't use help2man at all.
|
||||
local-checks-to-skip += sc_two_space_separator_in_usage
|
||||
|
||||
# Problems that have some false positives and some real ones; tease
|
||||
# apart later.
|
||||
local-checks-to-skip += sc_trailing_blank
|
||||
|
||||
# Problems partly fixed in other patches which aren't merged yet.
|
||||
local-checks-to-skip += sc_useless_cpp_parens
|
||||
|
||||
# Problems we can't esaily fixed because they apply to files which we need
|
||||
# to keep in sync, so can't easily make a local change to.
|
||||
# sc_texinfo_acronym: perms.texi from coreutils uses @acronym{GNU}.
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
#ifndef INC_DEFS_H
|
||||
#define INC_DEFS_H 1
|
||||
|
||||
#if !defined(ALREADY_INCLUDED_CONFIG_H)
|
||||
#if !defined ALREADY_INCLUDED_CONFIG_H
|
||||
/*
|
||||
* Savannah bug #20128: if we include some system header and it
|
||||
* includes some othersecond system header, the second system header
|
||||
* includes some other second system header, the second system header
|
||||
* may in fact turn out to be a file provided by gnulib. For that
|
||||
* situation, we need to have already included <config.h> so that the
|
||||
* Gnulib files have access to the information probed by their
|
||||
|
||||
@@ -878,7 +878,7 @@ safely_chdir (const char *dest,
|
||||
*/
|
||||
complete_pending_execdirs ();
|
||||
|
||||
#if !defined(O_NOFOLLOW)
|
||||
#if !defined O_NOFOLLOW
|
||||
options.open_nofollow_available = false;
|
||||
#endif
|
||||
if (options.open_nofollow_available)
|
||||
|
||||
@@ -70,14 +70,11 @@
|
||||
# define N_(String) String
|
||||
#endif
|
||||
|
||||
#if !defined (isascii) || defined (STDC_HEADERS)
|
||||
#ifdef isascii
|
||||
#undef isascii
|
||||
#if defined STDC_HEADERS
|
||||
# define ISDIGIT(c) isdigit ((unsigned char)c)
|
||||
#else
|
||||
# define ISDIGIT(c) (isascii ((unsigned char)c) && isdigit ((unsigned char)c))
|
||||
#endif
|
||||
#define isascii(c) 1
|
||||
#endif
|
||||
|
||||
#define ISDIGIT(c) (isascii ((unsigned char)c) && isdigit ((unsigned char)c))
|
||||
|
||||
#ifndef HAVE_ENDGRENT
|
||||
#define endgrent ()
|
||||
@@ -1606,7 +1603,7 @@ parse_newerXY (const struct parser_table* entry, char **argv, int *arg_ptr)
|
||||
y = argv[*arg_ptr][7];
|
||||
|
||||
|
||||
#if !defined(HAVE_STRUCT_STAT_ST_BIRTHTIME) && !defined(HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) && !defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) && !defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
|
||||
#if !defined HAVE_STRUCT_STAT_ST_BIRTHTIME && !defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC && !defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC && !defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
|
||||
if ('B' == x || 'B' == y)
|
||||
{
|
||||
error (0, 0,
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
# define N_(String) String
|
||||
#endif
|
||||
|
||||
#if !defined(SIGCHLD) && defined(SIGCLD)
|
||||
#define SIGCHLD SIGCLD
|
||||
#if defined SIGCLD && !defined SIGCHLD
|
||||
# define SIGCHLD SIGCLD
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#ifndef _POSIX_SOURCE
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#if !defined(ARG_MAX) && defined(NCARGS)
|
||||
#if defined NCARGS && !defined ARG_MAX
|
||||
/* We include sys/param.h in order to detect this case. */
|
||||
#error "You have an unusual system. Once you remove this error message from buildcmd.c, it should work, but please make sure that DejaGnu is installed on your system and that 'make check' passes before using the findutils programs. Please mail bug-findutils@gnu.org to tell us about your system."
|
||||
#define ARG_MAX NCARGS
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
#include <fcntl.h>
|
||||
#if defined (HAVE_SYS_RESOURCE_H)
|
||||
#if defined HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
@@ -114,7 +114,7 @@ get_max_fd (void)
|
||||
open_max = _POSIX_OPEN_MAX; /* underestimate */
|
||||
|
||||
/* We assume if RLIMIT_NOFILE is defined, all the related macros are, too. */
|
||||
#if defined (HAVE_GETRUSAGE) && defined (RLIMIT_NOFILE)
|
||||
#if defined HAVE_GETRUSAGE && defined RLIMIT_NOFILE
|
||||
if (0 == getrlimit (RLIMIT_NOFILE, &fd_limit))
|
||||
{
|
||||
if (fd_limit.rlim_cur == RLIM_INFINITY)
|
||||
|
||||
16
lib/qmark.c
16
lib/qmark.c
@@ -51,21 +51,21 @@
|
||||
outside the range -1 <= c <= 255. One is tempted to write isupper(c)
|
||||
with c being of type `char', but this is wrong if c is an 8-bit
|
||||
character >= 128 which gets sign-extended to a negative value.
|
||||
The macro ISUPPER protects against this as well." */
|
||||
The macro ISUPPER protects against this as well."
|
||||
|
||||
(Actually that rule of ISUPPER is now taken by to_uchar).
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* ISPRINT is defined in <sys/euc.h> on at least Solaris2.6 systems. */
|
||||
#undef ISPRINT
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||
|
||||
#if STDC_HEADERS || (!defined (isascii) && !HAVE_ISASCII)
|
||||
#if STDC_HEADERS
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#endif
|
||||
|
||||
/* ISPRINT is defined in <sys/euc.h> on at least Solaris2.6 systems. */
|
||||
#undef ISPRINT
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#include <wchar.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(SIGCHLD) && defined(SIGCLD)
|
||||
#if defined SIGCLD && !defined SIGCHLD
|
||||
#define SIGCHLD SIGCLD
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user