Opened 14 years ago
Last modified 10 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: | ||
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 29 29 30 30 #define __HUGE_VALF_v 0x7f800000L 31 31 #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 33 35 34 36 /* TODO: define HUGE_VALL for long doubles */ 35 37
(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.
R1 will use gcc, this can be delayed.