Re: missing isinf declaration on solaris
От | Oskari Saarenmaa |
---|---|
Тема | Re: missing isinf declaration on solaris |
Дата | |
Msg-id | 5422C316.9080901@ohmu.fi обсуждение исходный текст |
Ответ на | Re: missing isinf declaration on solaris (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: missing isinf declaration on solaris
(Tom Lane <tgl@sss.pgh.pa.us>)
|
Список | pgsql-hackers |
24.09.2014, 15:25, Tom Lane kirjoitti: > Oskari Saarenmaa <os@ohmu.fi> writes: >> GCC 4.9 build on Solaris 10 shows these warnings about isinf: >> float.c: In function 'is_infinite': >> float.c:178:2: warning: implicit declaration of function 'isinf' > > Ugh. > >> isinf declaration is in <iso/math_c99.h> which is included by <math.h>, >> but it's surrounded by #if defined(_STDC_C99) || _XOPEN_SOURCE - 0 >= >> 600 || defined(__C99FEATURES__). A couple of quick Google searches >> suggests that some other projects have worked around this by always >> defining __C99FEATURES__ even if compiling in C89 mode. __C99FEATURES__ >> is only used by math.h and fenv.h in /usr/include. > >> Should we just add -D__C99FEATURES__ to CPPFLAGS in >> src/template/solaris, add our own declaration of isinf() or do something >> else about the warning? > > I'm worried that __C99FEATURES__ might do other, not-so-C89-compatible > things in later Solaris releases. Possibly that risk could be addressed > by having src/template/solaris make an OS version check before adding the > switch, but it'd be a bit painful probably. > > Based on the #if you show, I'd be more inclined to think about defining > _XOPEN_SOURCE to get the result. There is precedent for that in > src/template/hpux which does > CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" > I forget what-all _XOPEN_SOURCE_EXTENDED enables exactly, but if memory > serves there were a nontrivial number of now-considered-standard features > turned on by that in ancient HPUX releases. If you want to pursue this > route, you'd need to do a bit of digging to see what else _XOPEN_SOURCE > controls in Solaris and if there is some front-end feature macro (like > _XOPEN_SOURCE_EXTENDED) that you're supposed to set instead of touching > it directly. Looking at standards(5) and /usr/include/sys/feature_tests.h it looks like _XOPEN_SOURCE_EXTENDED enables XPG4v2 environment. _XOPEN_SOURCE=600 enables XPG6, but feature_tests.h also has this bit: /* * It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application * using c99. The same is true for POSIX.1-1990,POSIX.2-1992, POSIX.1b, * and POSIX.1c applications. Likewise, it is invalid to compile an XPG6 * or a POSIX.1-2001application with anything other than a c99 or later * compiler. Therefore, we force an error in both cases.*/ so to enable XPG6 we'd need to use C99 mode anyway. Could we just use -std=gnu99 (with -fgnu89-inline if required) with GCC on Solaris? ISTM it would be cleaner to just properly enable c99 mode rather than define an undocumented macro to use a couple of c99 declarations. / Oskari
В списке pgsql-hackers по дате отправления: