From: Jeff Sullivan <jps@zk3.dec.com>
Subject: Re: [Help]gcc ignored #pragma pack on DEC/OSF1 4.0B
Date: 1998/01/13 [thread overview]
Message-ID: <34BBE9F2.5BC239F@zk3.dec.com> (raw)
In-Reply-To: 68shad$195@dogbert.cc.ndsu.NoDak.edu
Tim Mooney wrote:
>
> While we're talking about the compiler... :-)
>
> 1) it warns about `__inline', and stdio.h uses `__inline', so one gets
> screenfulls of warnings for any file that includes stdio.h. Is there a
> #pragma to turn off particular warnings (or even warning altogether)?
I have verified that this is fixed in Digital UNIX V4.0D.
To test this:
% cat t.c
#include <stdio.h>
% cc -portable t.c -fast -w0 -c
In this case, -fast expands to (among other things) -D_INTRINSICS
-D_INLINE_INTRINSICS, which will cause the __inline functions to
be enabled in stdio.h.
See http://www.unix.digital.com/
and http://www.unix.digital.com/new/topten.html
for more info on Digital UNIX V4.0D.
> 2) It warns about this:
> GTK_HAS_SHAPE_MASK = 1 << 22
> in an enum:
>
> In this declaration, the enumeration constant GTK_HAS_SHAPE_MASK
> is out of the range -32768 to 32767.
Our project leader wrote:
"
Hmm, I believe Tim Mooney is correct about the enum. The only platforms
to which this enumeration constant would be non-portable (under
ANSI C) would be ones on which the type int had fewer than 23 bits.
If -portable complains about this, then it ought to complain
about every int constant that exceeds 16 bits (since that's the
minimum size for int required by the standard). It might be
the case that some compilers implemented enums as 16 bits
even though they had 32-bit ints, and perhaps that's why this
message exists. But our general basis for portability is ANSI C,
and the only way an ANSI compiler could reject this is on the
basis of the size of int - and we don't complain about other
constructs that assume int is at least 32 bits.
The section you quote "Each enumerated type shall be compatible with an
integer type; the choice of type is implementation-defined." ends with
a comma instead of a period. It goes on to say: "but shall be
capable of representing the values of all the members of the
enumeration". The intent here is to allow the compiler to
look at the list of enum values for a particular enum type,
and choose the integer type with which it will be compatible
based on the values. E.g. for enum bool {TRUE, FALSE} the
compiler could choose char and only allocate a byte. But
for enum x {y = 1<<22}, the compiler must choose a type
large enough to hold 1<<22, unless 1<<22 is not a value
that can be represented by the type int.
"
At your suggestion, with sustaining votes from our group, the change
will be in the DEC C compiler in Digital UNIX V5.0.
Thanks for your comments on DEC C.
-Jeff
--
Jeff Sullivan | Digital Equipment Corp | sullivan@decc.enet.dec.com
DEC C and C++ | Nashua, NH ZK3-2/2X09 | or jps@zk3.dec.com
next prev parent reply other threads:[~1998-01-13 5:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-30 5:00 [Help]gcc ignored #pragma pack on DEC/OSF1 4.0B Ming-Yen Hsu
1997-12-30 5:00 ` Jeff Sullivan
1997-12-31 5:00 ` John Kohl
1998-01-05 5:00 ` Jeff Sullivan
1998-01-05 5:00 ` Joe Mario
1998-01-06 5:00 ` Tim Mooney
1998-01-06 5:00 ` Kevin Jacobs
1998-01-08 5:00 ` Jeff Sullivan
1998-01-08 5:00 ` Jeff Sullivan
1998-01-13 5:00 ` Jeff Sullivan [this message]
1998-01-16 5:00 ` Tim Mooney
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox