[Python-Dev] Warning about use of long double - what's the correct approach?

Michael Hudson mwh@python.net
08 Oct 2002 10:58:26 +0100


Skip Montanaro <skip@pobox.com> writes:

> When building from CVS head, I get this warning for each file compiled:

On Mac OS X, right?

>     gcc -c -DNDEBUG -g -I. -I../Include  -DPy_BUILD_CORE -o Objects/rangeobject.o ../Objects/rangeobject.c
>     In file included from ../Include/Python.h:70,
>                      from ../Objects/rangeobject.c:3:
>     ../Include/objimpl.h:252: warning: use of `long double' type; its size may change in a future release
>     ../Include/objimpl.h:252: warning: (Long double usage is reported only once for each file.
>     ../Include/objimpl.h:252: warning: To disable this warning, use -Wno-long-double.)
> 
> The culprit is the long double alignment field in:
> 
>     /* GC information is stored BEFORE the object structure. */
>     typedef union _gc_head {
>             struct {
>                     union _gc_head *gc_next;
>                     union _gc_head *gc_prev;
>                     int gc_refs;
>             } gc;
>             long double dummy;  /* force worst-case alignment */
>     } PyGC_Head;
> 
> I don't know what the best way to fix this is.  Should I look at making
> configure add -Wno-long-double in the proper situations or should that
> alignment field be something else in situations where the use of long double
> would generate a warning?

I thought that's what configure already did:

    case $ac_sys_system in
    Darwin*)
        OPT="$OPT -Wno-long-double -no-cpp-precomp";;
    esac

If I've guessed wrong and you're not on OS X, give us some help :)

Cheers,
M.

-- 
  I'm sorry, was my bias showing again? :-)
                                      -- William Tanksley, 13 May 2000