* lib/bitset.c (bitset_print): Don't assume size_t can be printed
with %d format.
* lib/ebitset.c (min, max): Undef before defining.
* lib/vbitset.c (min, max): Likewise.
* lib/subpipe.c (create_subpipe): Save local variables in case
vfork clobbers them.
* tests/synclines.at (AT_SYNCLINES_COMPILE): Add support for the
error message syntax used by gcc-4.0.
+2005-05-25 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix BeOS, FreeBSD, MacOS porting problems reported by Bruno Haible.
+ * lib/bitset.c (bitset_print): Don't assume size_t can be printed
+ with %d format.
+ * lib/ebitset.c (min, max): Undef before defining.
+ * lib/vbitset.c (min, max): Likewise.
+ * lib/subpipe.c (create_subpipe): Save local variables in case
+ vfork clobbers them.
+
+2005-05-24 Bruno Haible <bruno@clisp.org>
+
+ * tests/synclines.at (AT_SYNCLINES_COMPILE): Add support for the
+ error message syntax used by gcc-4.0.
+
2005-05-23 Paul Eggert <eggert@cs.ucla.edu>
* README: Mention m4 1.4.3. Remove obsolete advice about
2005-05-23 Paul Eggert <eggert@cs.ucla.edu>
* README: Mention m4 1.4.3. Remove obsolete advice about
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
/* Choose the type of bitset. Note that sometimes we will be asked
for a zero length fixed size bitset. */
/* Choose the type of bitset. Note that sometimes we will be asked
for a zero length fixed size bitset. */
/* If no attributes selected, choose a good compromise. */
if (!attr)
return BITSET_VARRAY;
/* If no attributes selected, choose a good compromise. */
if (!attr)
return BITSET_VARRAY;
- fprintf (file, "%d ", i);
+ fprintf (file, "%lu ", (unsigned long int) i);
pos += 1 + (i >= 10) + (i >= 100);
};
pos += 1 + (i >= 10) + (i >= 100);
};
/* Functions to support expandable bitsets.
/* Functions to support expandable bitsets.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \
(BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX]))
((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \
(BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX]))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
static bitset_bindex
ebitset_resize (bitset src, bitset_bindex n_bits)
{
static bitset_bindex
ebitset_resize (bitset src, bitset_bindex n_bits)
{
- /* The bitset needs to grow. If we already have enough memory
+ /* The bitset needs to grow. If we already have enough memory
allocated, then just zero what we need. */
if (newsize > EBITSET_ASIZE (src))
{
allocated, then just zero what we need. */
if (newsize > EBITSET_ASIZE (src))
{
size = newsize;
else
size = newsize + newsize / 4;
size = newsize;
else
size = newsize + newsize / 4;
EBITSET_ELTS (src)
= realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *));
EBITSET_ASIZE (src) = size;
}
EBITSET_ELTS (src)
= realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *));
EBITSET_ASIZE (src) = size;
}
- memset (EBITSET_ELTS (src) + oldsize, 0,
+ memset (EBITSET_ELTS (src) + oldsize, 0,
(newsize - oldsize) * sizeof (ebitset_elt *));
}
else
(newsize - oldsize) * sizeof (ebitset_elt *));
}
else
{
unsigned int last_bit;
bitset_bindex n_bits;
{
unsigned int last_bit;
bitset_bindex n_bits;
n_bits = BITSET_NBITS_ (dst);
last_bit = n_bits % EBITSET_ELT_BITS;
n_bits = BITSET_NBITS_ (dst);
last_bit = n_bits % EBITSET_ELT_BITS;
if (last_bit)
{
bitset_windex eindex;
if (last_bit)
{
bitset_windex eindex;
ebitset_elt *elt;
elts = EBITSET_ELTS (dst);
ebitset_elt *elt;
elts = EBITSET_ELTS (dst);
eindex = n_bits / EBITSET_ELT_BITS;
eindex = n_bits / EBITSET_ELT_BITS;
elt = elts[eindex];
if (elt)
{
bitset_windex windex;
bitset_windex woffset;
bitset_word *srcp = EBITSET_WORDS (elt);
elt = elts[eindex];
if (elt)
{
bitset_windex windex;
bitset_windex woffset;
bitset_word *srcp = EBITSET_WORDS (elt);
windex = n_bits / BITSET_WORD_BITS;
woffset = eindex * EBITSET_ELT_WORDS;
windex = n_bits / BITSET_WORD_BITS;
woffset = eindex * EBITSET_ELT_WORDS;
-
- srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
+
+ srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
windex++;
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
srcp[windex - woffset] = 0;
windex++;
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
srcp[windex - woffset] = 0;
|| (from_out_fd = fd_safer (pipe_fd[1])) < 0)
error (EXIT_FAILURE, errno, "pipe");
|| (from_out_fd = fd_safer (pipe_fd[1])) < 0)
error (EXIT_FAILURE, errno, "pipe");
+ /* Save the local variables in the parent now, in case vfork
+ clobbers them. */
+ fd[0] = to_out_fd;
+ fd[1] = from_in_fd;
+ pipe_fd[0] = to_in_fd;
+ pipe_fd[1] = from_out_fd;
+
pid = vfork ();
if (pid < 0)
error (EXIT_FAILURE, errno, "fork");
pid = vfork ();
if (pid < 0)
error (EXIT_FAILURE, errno, "fork");
- close (to_in_fd);
- close (from_out_fd);
- fd[0] = to_out_fd;
- fd[1] = from_in_fd;
+ close (pipe_fd[0]);
+ close (pipe_fd[1]);
/* Variable array bitsets.
/* Variable array bitsets.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/* This file implements variable size bitsets stored as a variable
length array of words. Any unused bits in the last word must be
/* This file implements variable size bitsets stored as a variable
length array of words. Any unused bits in the last word must be
Note that binary or ternary operations assume that each bitset operand
has the same size.
Note that binary or ternary operations assume that each bitset operand
has the same size.
static void vbitset_set (bitset, bitset_bindex);
static void vbitset_reset (bitset, bitset_bindex);
static bool vbitset_test (bitset, bitset_bindex);
static void vbitset_set (bitset, bitset_bindex);
static void vbitset_reset (bitset, bitset_bindex);
static bool vbitset_test (bitset, bitset_bindex);
-static bitset_bindex vbitset_list (bitset, bitset_bindex *,
+static bitset_bindex vbitset_list (bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *);
static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *);
bitset_bindex, bitset_bindex *);
static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *);
#define VBITSET_SIZE(X) ((X)->b.csize)
#define VBITSET_ASIZE(X) ((X)->v.size)
#define VBITSET_SIZE(X) ((X)->b.csize)
#define VBITSET_ASIZE(X) ((X)->v.size)
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
- /* The bitset needs to grow. If we already have enough memory
+ /* The bitset needs to grow. If we already have enough memory
allocated, then just zero what we need. */
if (newsize > VBITSET_ASIZE (src))
{
allocated, then just zero what we need. */
if (newsize > VBITSET_ASIZE (src))
{
size = newsize;
else
size = newsize + newsize / 4;
size = newsize;
else
size = newsize + newsize / 4;
VBITSET_WORDS (src)
= realloc (VBITSET_WORDS (src), size * sizeof (bitset_word));
VBITSET_ASIZE (src) = size;
}
VBITSET_WORDS (src)
= realloc (VBITSET_WORDS (src), size * sizeof (bitset_word));
VBITSET_ASIZE (src) = size;
}
- memset (VBITSET_WORDS (src) + oldsize, 0,
+ memset (VBITSET_WORDS (src) + oldsize, 0,
(newsize - oldsize) * sizeof (bitset_word));
VBITSET_SIZE (src) = newsize;
}
(newsize - oldsize) * sizeof (bitset_word));
VBITSET_SIZE (src) = newsize;
}
sizeof (bitset_word) * (dsize - ssize));
}
sizeof (bitset_word) * (dsize - ssize));
}
static bool
vbitset_equal_p (bitset dst, bitset src)
{
static bool
vbitset_equal_p (bitset dst, bitset src)
{
bitset_word *dstp = VBITSET_WORDS (dst);
bitset_windex ssize = VBITSET_SIZE (src);
bitset_windex dsize = VBITSET_SIZE (dst);
bitset_word *dstp = VBITSET_WORDS (dst);
bitset_windex ssize = VBITSET_SIZE (src);
bitset_windex dsize = VBITSET_SIZE (dst);
for (i = 0; i < min (ssize, dsize); i++, dstp++, srcp++)
if (*dstp != (*srcp | *dstp))
return 0;
for (i = 0; i < min (ssize, dsize); i++, dstp++, srcp++)
if (*dstp != (*srcp | *dstp))
return 0;
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & *src2p++;
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & *src2p++;
memset (dstp, 0, sizeof (bitset_word) * (dsize - min (ssize1, ssize2)));
}
memset (dstp, 0, sizeof (bitset_word) * (dsize - min (ssize1, ssize2)));
}
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & *src2p++;
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
if (ssize2 > ssize1)
{
src1p = src2p;
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & ~(*src2p++);
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & ~(*src2p++);
if (ssize2 > ssize1)
{
for (; i < ssize2; i++)
if (ssize2 > ssize1)
{
for (; i < ssize2; i++)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & ~(*src2p++);
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & ~(*src2p++);
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
for (; i < ssize2; i++, dstp++)
if (ssize2 > ssize1)
{
for (; i < ssize2; i++, dstp++)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
if (*dstp != tmp)
{
changed = 1;
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ | *src2p++;
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ | *src2p++;
if (ssize2 > ssize1)
{
src1p = src2p;
if (ssize2 > ssize1)
{
src1p = src2p;
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ | *src2p++;
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ | *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
if (ssize2 > ssize1)
{
src1p = src2p;
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
if (*dstp != tmp)
{
changed = 1;
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ ^ *src2p++;
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ ^ *src2p++;
if (ssize2 > ssize1)
{
src1p = src2p;
if (ssize2 > ssize1)
{
src1p = src2p;
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ ^ *src2p++;
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ ^ *src2p++;
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
changed = 1;
*dstp = tmp;
}
}
if (ssize2 > ssize1)
{
src1p = src2p;
if (ssize2 > ssize1)
{
src1p = src2p;
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
if (*dstp != tmp)
{
changed = 1;
if (*dstp != tmp)
{
changed = 1;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_and_or_cmp_ (dst, src1, src2, src3);
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_and_or_cmp_ (dst, src1, src2, src3);
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
if (*dstp != tmp)
{
changed = 1;
if (*dstp != tmp)
{
changed = 1;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_andn_or_cmp_ (dst, src1, src2, src3);
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_andn_or_cmp_ (dst, src1, src2, src3);
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
if (*dstp != tmp)
{
changed = 1;
if (*dstp != tmp)
{
changed = 1;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++)
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
}
for (i = 0; i < size; i++)
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
}
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_or_and_cmp_ (dst, src1, src2, src3);
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_or_and_cmp_ (dst, src1, src2, src3);
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
if (*dstp != tmp)
{
changed = 1;
if (*dstp != tmp)
{
changed = 1;
# Executing Actions. -*- Autotest -*-
# Executing Actions. -*- Autotest -*-
-# Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
[AT_CHECK([$CC $CFLAGS $CPPFLAGS -c $1], [ignore], [], [stderr])
# In case GCC displays column information, strip it down.
#
[AT_CHECK([$CC $CFLAGS $CPPFLAGS -c $1], [ignore], [], [stderr])
# In case GCC displays column information, strip it down.
#
-# input.y:4:2: #error "4" or input.y:4.2: #error "4"
+# input.y:4:2: #error "4" or
+# input.y:4.2: #error "4" or
+# input.y:4:2: error: #error "4"
# =>
# input.y:4: #error "4"
#
# =>
# input.y:4: #error "4"
#
-AT_CHECK([[sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr]], 0, [stdout])
+AT_CHECK([[sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^@%:@]*\( @%:@error\)/\1\2/' stderr]], 0, [stdout])
])
# AT_TEST_SYNCLINE(TITLE, INPUT, ERROR-MSG)
])
# AT_TEST_SYNCLINE(TITLE, INPUT, ERROR-MSG)