John E. Malmberg wrote: > This is a patch to work around that OpenVMS defines NAN in <fp.h> > instead of <math.h>
Looks halfway reasonable, but here are a few hints to provide better patches: > +@item > +The macros @code{NAN}, @code{HUGE_VALL} and @code{INFINITY} are defined > +in @code{<fp.h>} instead of @code{<math.h>} on some platforms: OpenVMS When writing the doc about a problem, you don't need to go into the details about what the workaround is that gnulib implements. Just mention the problem itself. > +/* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are fp.h */ Please write complete sentences. Terminate sentences with a period. > +#if defined __VMS && ! defined NAN > +# include <fp.h> > +#endif If <math.h> gets included twice, there is no need to include <fp.h> twice. Include it once should be sufficient. So, put these 3 lines after the double-inclusion guard. Like it's done e.g. in gnulib's <wchar.h> substitute. > * lib/math.in.h : OpenVMS has NAN in <fp.h> instead of <math.h>. > * m4/getdtablesize.m4 : OpenVMS allows users to create file descriptors ... Statements about facts belong in comments, not in the ChangeLog entry. In the ChangeLog entry, you should answer the question: "What is the difference between the new code and the previous code?" Here's what I'm committing in your name: 2017-07-15 John E. Malmberg <wb8...@gmail.com> Bruno Haible <br...@clisp.org> math: Add support for OpenVMS. * lib/math.in.h [__VMS]: Include <fp.h>. * doc/posix-headers/math.texi: Mention OpenVMS issues. diff --git a/doc/posix-headers/math.texi b/doc/posix-headers/math.texi index e640663..0cf56a0 100644 --- a/doc/posix-headers/math.texi +++ b/doc/posix-headers/math.texi @@ -35,13 +35,18 @@ glibc/HPPA, glibc/SPARC, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9. The macros @code{FP_ILOGB0} and @code{FP_ILOGBNAN} are not defined on some platforms: NetBSD 5.1, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9. + +@item +The macros @code{NAN}, @code{HUGE_VALL}, and @code{INFINITY} are not +defined on some platforms: +OpenVMS. @end itemize Portability problems not fixed by Gnulib: @itemize @item @code{NAN} is not a compile time constant with some compilers: -OSF/1 with Compaq (ex-DEC) C 6.4. +OSF/1 with Compaq (ex-DEC) C 6.4, OpenVMS. @item The macro or variable @code{math_errhandling} is not defined on some platforms: glibc 2.11, OpenBSD 4.9, NetBSD 5.1, UP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.7.9, mingw, MSVC 9. diff --git a/lib/math.in.h b/lib/math.in.h index c76b997..9e59278 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -28,6 +28,11 @@ #ifndef _@GUARD_PREFIX@_MATH_H #define _@GUARD_PREFIX@_MATH_H +/* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in <fp.h>. */ +#if defined __VMS && ! defined NAN +# include <fp.h> +#endif + #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif