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

Skip Montanaro skip@pobox.com
Mon, 7 Oct 2002 16:54:15 -0500


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

    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?

Skip