-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Jim Meyering on 3/19/2009 3:58 PM: > * src/dd.c (O_FULLBLOCK): Compute its value via cpp macros that > expand to less than 3KB of rather than to 180KB(!).
Why use a macro at all? All we have to do is come up with a value that is bitwise distinct from all the others. In other words, much smaller than 3KB, let alone 180KB. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknDHKsACgkQ84KuGfSFAYB3lgCfbx2n5N/CXsplvWITgci+Eejl t9oAoMvoOEN5z2bhJyxJwU6JSF0ua+BS =ySAQ -----END PGP SIGNATURE-----
>From d6a83c9d49c2737a9a0ef9ca7fc4bb9f469e9576 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Thu, 19 Mar 2009 22:31:16 -0600 Subject: [PATCH] dd: use a more portable definition of O_FULLBLOCK * src/dd.c (O_FULLBLOCK): Compute its value without using a 180KB macro. This avoids triggering a compilation failure with HP-UX's cc. Reported by Matthew Woehlke. --- src/dd.c | 35 +++++++++++++++-------------------- 1 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/dd.c b/src/dd.c index 9a1c875..ecbcaf5 100644 --- a/src/dd.c +++ b/src/dd.c @@ -265,30 +265,25 @@ static struct symbol_value const conversions[] = enum { - /* Use a value that is larger than that of any other O_ symbol. */ - O_FULLBLOCK = ((MAX (O_APPEND, - MAX (O_BINARY, - MAX (O_CIO, - MAX (O_DIRECT, - MAX (O_DIRECTORY, - MAX (O_DSYNC, - MAX (O_NOATIME, - MAX (O_NOCTTY, - MAX (O_NOFOLLOW, - MAX (O_NOLINKS, - MAX (O_NONBLOCK, - MAX (O_SYNC, - MAX (O_TEXT, 0)))))))))))))) << 1) + /* Use a value that is bitwise distinct from any other O_ symbol. */ + O_FULLBLOCK = ~(O_APPEND + | O_BINARY + | O_CIO + | O_DIRECT + | O_DIRECTORY + | O_DSYNC + | O_NOATIME + | O_NOCTTY + | O_NOFOLLOW + | O_NOLINKS + | O_NONBLOCK + | O_SYNC + | O_TEXT) }; -/* Ensure that we didn't shift it off the end. */ +/* Ensure that we got something. */ verify (O_FULLBLOCK != 0); -#define MULTIPLE_BITS_SET(i) (((i) & ((i) - 1)) != 0) - -/* Ensure that this is a single-bit value. */ -verify ( ! MULTIPLE_BITS_SET (O_FULLBLOCK)); - /* Flags, for iflag="..." and oflag="...". */ static struct symbol_value const flags[] = { -- 1.6.1.2
_______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils