Opened 8 years ago

Last modified 4 years ago

#7083 new enhancement

Guard gccisms in math.h

Reported by: kate Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/alpha2
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

headers/posix/math.h contains a few non-portable gccsisms. These expand out for various macros. Some have a guard protecting them, for if the macro is already defined.

I propose adding similar guards around the others, so that they made be defined externally, and thus the file will be able to be parsed by a standard C compiler. Like so:

  • /

    old new  
    2929
    3030#define __HUGE_VALF_v  0x7f800000L
    3131#define __huge_valf_t  union { unsigned char __c[4]; long __l; float __f; }
    32 #define HUGE_VALF              (((__huge_valf_t) { __l: __HUGE_VALF_v }).__f)
     32#ifndef HUGE_VALF
     33#      define HUGE_VALF                (((__huge_valf_t) { __l: __HUGE_VALF_v }).__f)
     34#endif
    3335
    3436/* TODO: define HUGE_VALL for long doubles */
    3537

(that's not the only one; it's just an example)

I think they could also be made standard by writing them in the C99 form, {.a = b}, but I don't know if you're targeting C99. If you do, please still add these guards, so the header can be still parsed with a C90 compiler.

Change History (1)

comment:1 Changed 4 years ago by pulkomandy

Milestone: R1Unscheduled

R1 will use gcc, this can be delayed.

Note: See TracTickets for help on using tickets.