Re: [PATCH v4 2/3] Add default implementation of fenv.h and all methods
Joel Sherrill <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAF9ehCW8m9xcxZN_2f=EJuWLs-L4r8h3rwPnPx_x_mV1MnhcBA@mail.gmail.com> |
I am sending a patch which I think addresses all of these. I am not bothering to send the regeneration patch again. And no one has explained why some files under libc change when I regenerate. --joel On Wed, Aug 7, 2019 at 11:12 PM Howland, Craig D. - US via newlib < [email protected]> wrote: > I think I have identified all of the individual places where return values > should be 0 as Joseph Myers noted in general, as well as some other small > items. > Craig > > > From: [email protected] <[email protected]> on > behalf of Joel Sherrill <[email protected]> > > Sent: Wednesday, August 7, 2019 12:14 PM > > To: [email protected] > > Cc: Joel Sherrill > > Subject: [PATCH v4 2/3] Add default implementation of fenv.h and all > methods > > > > The default implementation of the fenv.h methods return > > -EOPNOTSUPP. > [typo:] -ENOTSUP > > > > The intention of the new fenv.h is that it be portable > > and that architectures provide their own implementation > > of sys/fenv.h. > > --- > > ... > > > diff --git a/newlib/libm/fenv/feclearexcept.c > b/newlib/libm/fenv/feclearexcept.c > > new file mode 100644 > > +int feclearexcept(int excepts) > > +{ > > + return -ENOTSUP; > return (excepts ? -ENOTSUP : 0); > > ... > > > diff --git a/newlib/libm/fenv/fegetround.c > b/newlib/libm/fenv/fegetround.c > > ... > > +FUNCTION > > +<<fegetround>>---get current rounding direction > > + > > +INDEX > > + feclearexcept > [typo, not feclearexcept:] fegetround > > +SYNOPSIS > > + #include <fenv.h> > > + int fegetround(void); > > + > > + Link with -lm. > > + > > +DESCRIPTION > > +This method returns the current rounding direction. > > + > > +RETURNS > > +This method returns the rounding direction. If the current rounding > > +direction cannot be determined, then a negative value is returned. > [Small edit, pointing out macro value needed:] > This method returns the rounding direction, corresponding to the value > of the respective rounding macro. If the current rounding > direction cannot be determined, then a negative value is returned. > > ... > > > diff --git a/newlib/libm/fenv/feraiseexcept.c > b/newlib/libm/fenv/feraiseexcept.c > > ... > > +int feraiseexcept(int excepts) > > +{ > > + return -ENOTSUP; > return (excepts ? -ENOTSUP : 0); > > +} > > ... > > > diff --git a/newlib/libm/fenv/fesetenv.c b/newlib/libm/fenv/fesetenv.c > > ... > > +SYNOPSIS > > + #include <fenv.h> > > + int fesetenv(const fenv_t *[<envp>]); > > + > > + Link with -lm. > > + > > +DESCRIPTION > > +This method attempts to establish the floating-point environment > > +pointed to by <[envp]>. The argument [<envp>] must point to a > > +floating-point environment obtained via <<fegetenv>> or <<feholdexcept>> > > +or a floating-point environment macro such as <<FE_DFL_ENV>>. > [Add:] > It only sets the states of the flags as recorded in its argument, and > does not actually raise the associated floating-point exceptions. > > ... > > > diff --git a/newlib/libm/fenv/fesetround.c > b/newlib/libm/fenv/fesetround.c > > ... > > +SYNOPSIS > > + #include <fenv.h> > > + int fesetround(int <[round]>); > > + > > + Link with -lm. > > + > > +DESCRIPTION > > +This method attempts to set the current rounding direction represented > > +by <[round]>. > [Add:] > <[round]> must be the value of one of the rounding-direction macros. > > ... > > > diff --git a/newlib/libm/fenv/fetestexcept.c > b/newlib/libm/fenv/fetestexcept.c > > ... > > +int fetestexcept(int excepts) > > +{ > > + return -ENOTSUP; > return 0; > > ... >