bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils 7.1.49-ebb9 FTB risc/HP-UX


From: Eric Blake
Subject: Re: coreutils 7.1.49-ebb9 FTB risc/HP-UX
Date: Thu, 19 Mar 2009 22:33:47 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----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             address@hidden
-----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 <address@hidden>
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]