On Fri, 12 Jul 2013 12:13:58 -0500 Scot Hetzel <swhetzel_at_gmail.com> wrote: > On Fri, Jul 12, 2013 at 11:16 AM, Scot Hetzel <swhetzel_at_gmail.com> > wrote: > > On Thu, Jul 11, 2013 at 9:33 AM, David Chisnall > > <theraven_at_freebsd.org> wrote: > >> On 11 Jul 2013, at 13:11, Bruce Evans <brde_at_optusnet.com.au> wrote: > >> > >>> The error message for the __builtin_isnan() version is slightly > >>> better up to where it says more. > >>> > >>> The less-unportable macro can do more classification and detect > >>> problems at compile time using __typeof(). > >> > >> The attached patch fixes the related test cases in the libc++ test > >> suite. Please review. > >> > > > > #define fpclassify(x) \ > > - ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \ > > - : (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \ > > - : __fpclassifyl(x)) > > + __fp_type_select(x, __fpclassifyf, __fpclassifyd, > > __fpclassifyd) > > > > The last __fpclassifyd should be __fpclassifyl. > > > I see it has already been fixed. > > Obviously not really fixed, but even worse: if I use in C code (C99, using clang 3.3 on FreeBSD 10.0-CURRENT/amd64 revision 253287) isnan(x) where x is a "const double", I receive now the following error (which doesn't appear on previous versions): [...] Making all in scaling /bin/sh ../../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I../.. -I. -I../ -I/usr/local/include -O0 -march=native -g -pipe -DHAVE_INLINE -g -O2 -MT libscaling_la-scalingTransientCroft.lo -MD -MP -MF .deps/libscaling_la-scalingTransientCroft.Tpo -c -o libscaling_la-scalingTransientCroft.lo `test -f 'scalingTransientCroft.c' || echo './'`scalingTransientCroft.c libtool: compile: cc -DHAVE_CONFIG_H -I. -I../.. -I. -I../ -I/usr/local/include -O0 -march=native -g -pipe -DHAVE_INLINE -g -O2 -MT libscaling_la-scalingTransientCroft.lo -MD -MP -MF .deps/libscaling_la-scalingTransientCroft.Tpo -c scalingTransientCroft.c -o libscaling_la-scalingTransientCroft.o scalingTransientCroft.c:48:12: error: controlling expression type 'const double' not compatible with any generic association type if (isnan(Dsg) || isnan(Dsc)) ^~~ /usr/include/math.h:109:19: note: expanded from macro 'isnan' __fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl) ^ /usr/include/math.h:86:49: note: expanded from macro '__fp_type_select' #define __fp_type_select(x, f, d, ld) _Generic((x), [...] The variables in question (Dsg and Dsc) are of type "const double".
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:39 UTC