[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] Enable more syntax checks, eliminate useless C preproces
From: |
Eric Blake |
Subject: |
Re: [PATCH 1/2] Enable more syntax checks, eliminate useless C preprocessor parentheses |
Date: |
Mon, 13 Jun 2011 09:28:01 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110419 Red Hat/3.1.10-1.el6_0 Mnenhy/0.8.3 Thunderbird/3.1.10 |
On 06/11/2011 07:42 PM, James Youngman wrote:
> +++ b/find/find.c
> @@ -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
I prefer #ifndef over #if !defined, when there is only a single
condition in the #if. Furthermore, gnulib's <fcntl.h> guarantees that
O_NOFOLLOW is always defined, but sometimes to 0. So to be correct,
this would be better written as:
options.open_nofollow_available = !!O_NOFOLLOW;
and lose the preprocessor probing altogether.
> +++ b/find/pred.c
> @@ -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
Gnulib should be taking care of that for you. I know that mingw still
lacks SIGCHLD (of any spelling), but are there any modern systems that
lack SIGCHLD but have SIGCLD?
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature