pspp-dev
[Top][All Lists]
Advanced

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

RE: Solaris 9: Progress and new issue for pspp 0.4.0rc3


From: Marshall DeBerry
Subject: RE: Solaris 9: Progress and new issue for pspp 0.4.0rc3
Date: Sat, 23 Jul 2005 08:44:52 -0400

This may be a bit long with C #defines, but hopefully helpful.  I'm using
gcc 3.4.2 for Solaris 9.  Note that in pspp, flip.c does a define of off_t
if it's not present, ie,

#ifndef HAVE_OFF_T
#define off_t long int
#endif

This box is a Sun V240, with a SPARC V9 (UltraSPARC IIIi)chip, which is a 64
bit chip.  Now, under Solaris, here are some things when looking at the
various <include> files:

  First, how does off_t get typed in <sys/types.h> under Solaris:

/*
 * The size of off_t and related types depends on the setting of
 * _FILE_OFFSET_BITS.  (Note that other system headers define other types
 * related to those defined here.)
 *
 * If _LARGEFILE64_SOURCE is defined, variants of these types that are
 * explicitly 64 bits wide become available.
 */
#ifndef _OFF_T
#define _OFF_T
 
#if defined(_LP64) || _FILE_OFFSET_BITS == 32
typedef long            off_t;          /* offsets within files */
#elif _FILE_OFFSET_BITS == 64
typedef longlong_t      off_t;          /* offsets within files */
#endif
#if defined(_LARGEFILE64_SOURCE)
#ifdef _LP64
typedef off_t           off64_t;        /* offsets within files */
#else
typedef longlong_t      off64_t;        /* offsets within files */
#endif
#endif  /* _LARGEFILE64_SOURCE */
 
#endif /* _OFF_T */



Second, where does longlong_t get typed in <sys/types.h>:


/*
 * The following protects users who use other than Sun compilers
 * (eg, GNU C) that don't support long long, and need to include
 * this header file.
 */
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
typedef long long               longlong_t;
typedef unsigned long long      u_longlong_t;
#else
/* used to reserve space and generate alignment */
typedef union {
        double  _d;
        int32_t _l[2];
} longlong_t;
typedef union {
        double          _d;
        uint32_t        _l[2];
} u_longlong_t;
#endif  /* __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) */



So where does _LP64 get set?  Here's some info from <sys/isa_defs.h>
(__sparcv8 is for a 32 bit system, __sparcv9 is for 64 bits):

/*
 * The following set of definitions characterize the implementation of
 * 32-bit Solaris on SPARC V8 systems.
 */
#if defined(__sparcv8)
 
/*
 * Define the appropriate "processor characteristics"
 */
#define _LONG_ALIGNMENT         4
#define _LONG_DOUBLE_ALIGNMENT  8
#define _POINTER_ALIGNMENT      4
#define _MAX_ALIGNMENT          8
 
/*
 * Define the appropriate "implementation choices"
 */
#define _ILP32
 
#if !defined(_I32LPx) && defined(_KERNEL)
#define _I32LPx
#endif
/*
 * The following set of definitions characterize the implementation of
 * 64-bit Solaris on SPARC V9 systems.
 */
#elif defined(__sparcv9)
 
/*
 * Define the appropriate "processor characteristics"
 */
#define _LONG_ALIGNMENT         8
#define _LONG_DOUBLE_ALIGNMENT  16
#define _POINTER_ALIGNMENT      8
#define _MAX_ALIGNMENT          16
 
/*
 * Define the appropriate "implementation choices"
 */
#define _LP64
#if !defined(_I32LPx)
#define _I32LPx
#endif
#define _MULTI_DATAMODEL
 
#else
#error  "unknown SPARC version"
#endif


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Ben Pfaff
Sent: Saturday, July 23, 2005 2:29 AM
To: John Darrington
Cc: address@hidden; DeBerry, Marshall
Subject: Re: Solaris 9: Progress and new issue for pspp 0.4.0rc3

John Darrington <address@hidden> writes:

> On Fri, Jul 22, 2005 at 03:31:24PM -0400, DeBerry, Marshall wrote:
>      
>      So, now configure runs ok and generates its files.  Now, when I do
the
>      make I get the following:
>      
>      casefile.c: In function `reader_open_file':
>      casefile.c:556: error: cast to union type from type not present in
union
>      casefile.c:562: error: incompatible types in assignment
>      casefile.c:563: error: invalid operands to binary !=
>      make[3]: *** [casefile.o] Error 1
>
> Wierd.  Whoever said that a cast to a union has to be from a member type?

The C standard does not allow any casts to union type at all.
GCC has an extension that allows a cast from a union's member
type to the union type.

This implies that `off_t' is a union under Solaris.  That's
seriously misguided: SUSv3 requires that off_t be a signed
integer type.

> What compiler is this?

I'm pretty sure it has to be GCC.

> and can you see where it's finding the definition of off_t  and how
> it's defined?  Maybe it's a name clash from some unrelated header.

That's the real question.  Why is off_t a union and where is that
coming from?
-- 
Ben Pfaff 
email: address@hidden
web: http://benpfaff.org


_______________________________________________
pspp-dev mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/pspp-dev





reply via email to

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