[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed new module intprops-test
From: |
Bruno Haible |
Subject: |
Re: proposed new module intprops-test |
Date: |
Fri, 20 May 2011 13:43:56 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Paul,
> Here's what I committed:
With these patches, the test compiles and passes now also on HP-UX 11.23 with
cc and IRIX 6.5 with cc.
With just the first 2 out of 3 commits (partial revert and work around IRIX 6.5
cc bug), IRIX 6.5 cc would still have complained ("The indicated constant value
is not known.") about a combination of signed and unsigned integers, this time
with '|', not '+':
===============================================================================
#include <config.h>
#include "intprops.h"
#include "verify.h"
#include <stdbool.h>
#include <inttypes.h>
#include "macros.h"
#define check_sum(a, b, overflow) \
verify (INT_ADD_OVERFLOW (a, b) == (overflow)); \
verify (INT_ADD_OVERFLOW (b, a) == (overflow))
/* Error */
check_sum (-1, UINT_MAX, false);
/* Error */
verify (!INT_ADD_OVERFLOW (-1, UINT_MAX));
/* Error */
verify (!INT_ADD_OVERFLOW (UINT_MAX, -1));
/* Error */
verify (!_GL_BINARY_OP_OVERFLOW (-1, UINT_MAX, _GL_ADD_OVERFLOW));
/* Error */
verify (!_GL_ADD_OVERFLOW (-1, UINT_MAX, _GL_INT_MINIMUM (-1 | UINT_MAX),
_GL_INT_MAXIMUM (-1 | UINT_MAX)));
/* Error */
verify (!(_GL_INT_MINIMUM (-1 | UINT_MAX) < 0 ? INT_ADD_RANGE_OVERFLOW (-1,
UINT_MAX, _GL_INT_MINIMUM (-1 | UINT_MAX), _GL_INT_MAXIMUM (-1 | UINT_MAX)) :
-1 < 0 ? UINT_MAX <= -1 + UINT_MAX : UINT_MAX < 0 ? -1 <= -1 + UINT_MAX : -1 +
UINT_MAX < UINT_MAX));
/* OK */
verify (_GL_INT_MINIMUM (-1 | UINT_MAX) >= 0);
/* OK */
verify (!(UINT_MAX <= -1 + UINT_MAX));
/* OK */
verify (!(-1 < 0 ? UINT_MAX <= -1 + UINT_MAX : UINT_MAX < 0 ? -1 <= -1 +
UINT_MAX : -1 + UINT_MAX < UINT_MAX));
/* Error */
verify (!(0 ? INT_ADD_RANGE_OVERFLOW (-1, UINT_MAX, _GL_INT_MINIMUM (-1 |
UINT_MAX), _GL_INT_MAXIMUM (-1 | UINT_MAX)) : 0));
/* Error */
verify (!(0 ? (UINT_MAX < 0 ? -1 < _GL_INT_MINIMUM (-1 | UINT_MAX) - UINT_MAX :
_GL_INT_MAXIMUM (-1 | UINT_MAX) - UINT_MAX < -1) : 0));
/* Error */
verify (!(0 ? _GL_INT_MAXIMUM (-1 | UINT_MAX) - UINT_MAX < -1 : 0));
/* Error */
verify (!(0 ? _GL_INT_MAXIMUM (-1 | UINT_MAX) > 0 : 0));
/* Error */
verify (!(0 ? (_GL_INT_SIGNED (-1 | UINT_MAX) ? _GL_SIGNED_INT_MAXIMUM (-1 |
UINT_MAX) : _GL_INT_NEGATE_CONVERT (-1 | UINT_MAX, 1)) > 0 : 0));
/* OK */
verify (!(0 ? _GL_INT_SIGNED (-1 | UINT_MAX) : 0));
/* OK */
verify (!(0 ? _GL_SIGNED_INT_MAXIMUM (-1 | UINT_MAX) > 0 : 0));
/* OK */
verify (!(0 ? _GL_INT_NEGATE_CONVERT (-1 | UINT_MAX, 1) > 0 : 0));
/* Error */
verify (!(0 ? (_GL_INT_NEGATE_CONVERT (-1 | UINT_MAX, 1) < 0 ?
_GL_SIGNED_INT_MAXIMUM (-1 | UINT_MAX) : _GL_INT_NEGATE_CONVERT (-1 | UINT_MAX,
1)) > 0 : 0));
/* Error */
verify (!(0 ? ((-1 | UINT_MAX) - (-1 | UINT_MAX) - 1 < 0 ?
_GL_SIGNED_INT_MAXIMUM (-1 | UINT_MAX) : (-1 | UINT_MAX) - (-1 | UINT_MAX) - 1)
> 0 : 0));
/* OK */
verify (!(0 ? (0 ? _GL_SIGNED_INT_MAXIMUM (-1 | UINT_MAX) : (-1 | UINT_MAX) -
(-1 | UINT_MAX) - 1) > 0 : 0));
/* OK */
verify (!(0 ? (1 ? _GL_SIGNED_INT_MAXIMUM (-1 | UINT_MAX) : (-1 | UINT_MAX) -
(-1 | UINT_MAX) - 1) > 0 : 0));
/* Error */
verify (!(0 ? ((-1 | UINT_MAX) - (-1 | UINT_MAX) - 1 < 0 ? 0u : 0u) > 0 : 0));
/* OK */
verify (!(0 ? (0u - 1 < 0 ? 0u : 0u) > 0 : 0));
/* OK */
verify (!(0 ? (UINT_MAX - UINT_MAX - 1 < 0 ? 0u : 0u) > 0 : 0));
===============================================================================
and HP-UX cc would still complain:
cc -Ae -O -DHAVE_CONFIG_H -I. -DGNULIB_STRICT_CHECKING=1 -I. -I. -I.. -I./..
-I../gllib -I./../gllib -g -c test-intprops.c
[ignoring the warnings]
cc: "test-intprops.c", line 103: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 103: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 104: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 104: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 110: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 110: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 111: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 111: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 117: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 117: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 118: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 118: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 119: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 119: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 133: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 133: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 139: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 139: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 142: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 142: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 143: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 143: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 144: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 144: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 151: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 151: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 151: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 151: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 153: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 153: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 153: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 153: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 154: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 154: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 154: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 154: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 155: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 155: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 155: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 155: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 157: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 157: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 157: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 157: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 159: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 159: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 159: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 159: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 160: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 160: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 160: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 160: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 162: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 162: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 163: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 163: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 164: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 164: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 165: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 165: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 166: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 166: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 167: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 167: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 173: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 173: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 173: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 173: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 175: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 175: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 175: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 175: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 180: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 180: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 180: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 180: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 184: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 184: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 184: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 184: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 185: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 185: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 185: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 185: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 186: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 186: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 186: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 186: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 187: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 187: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 187: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 187: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 188: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 188: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 188: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 188: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 189: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 189: error 1613: Zero-sized struct.
cc: "test-intprops.c", line 189: error 1511: Bit-field size must be a constant.
cc: "test-intprops.c", line 189: error 1613: Zero-sized struct.
cc: panic 2161: Maximum allowed number of errors exceeded.
*** Error exit code 1
So the third patch [3/3] was necessary for both HP-UX cc and IRIX cc.
Bruno
--
In memoriam Jan Bula <http://en.wikipedia.org/wiki/Jan_Bula>
- proposed new module intprops-test, Paul Eggert, 2011/05/10
- Re: proposed new module intprops-test, Eric Blake, 2011/05/10
- Re: proposed new module intprops-test, Paul Eggert, 2011/05/10
- Re: proposed new module intprops-test, Bruno Haible, 2011/05/18
- Re: proposed new module intprops-test, Paul Eggert, 2011/05/19
- Re: proposed new module intprops-test, Bruno Haible, 2011/05/19
- Re: proposed new module intprops-test, Paul Eggert, 2011/05/19
- Re: proposed new module intprops-test,
Bruno Haible <=
- Re: proposed new module intprops-test, Paul Eggert, 2011/05/20