Jim Meyering wrote: > Matthew Woehlke wrote: >> Jim Meyering wrote: >>> Matthew Woehlke wrote: >>>> Jim Meyering wrote: ... >> MAX ( >> MAX (O_NONBLOCK, O_SYNC), >> MAX (O_TEXT, 0) >> ) >> ) >> ) >> >> ...expands to a measly 2 kb. > > Better, indeed. > Would you like to prepare the patch?
Oh, if you can't arrange for copyright assignments, ... So I've done this: >From 3f1b8ff867da0ec2be6b286aa5372ddcd9c30b78 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Thu, 19 Mar 2009 20:14:26 +0100 Subject: [PATCH] dd: use a more portable definition of O_FULLBLOCK * src/dd.c (O_FULLBLOCK): Compute its value via cpp macros that expand to less than 3KB of rather than to 180KB(!). This avoids triggering a compilation failure with HP-UX's cc. Reported by, and based on a suggestion from Matthew Woehlke. --- src/dd.c | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/dd.c b/src/dd.c index 9a1c875..32a64ca 100644 --- a/src/dd.c +++ b/src/dd.c @@ -263,22 +263,28 @@ static struct symbol_value const conversions[] = {"", 0} }; +#define MAX4(a, b, c, d) MAX (MAX (a, b), MAX (c, d)) +#define MAX8(a, b, c, d, e, f, g, h) \ + MAX (MAX4 (a, b, c, d), MAX4 (e, f, g, h)) +#define MAX12(a, b, c, d, e, f, g, h, i, j, k, l) \ + MAX (MAX8 (a, b, c, d, e, f, g, h), MAX4 (i, j, k, l)) + 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) + O_FULLBLOCK = MAX ( MAX12 ( + 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. */ -- 1.6.2.rc1.285.gc5f54 _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils