Discussion:
OpenVMS todo list:
(too old to reply)
John E. Malmberg
2017-07-03 23:22:32 UTC
Permalink
Raw Message
Hello,

This is some of the things that I still need to do to get gnulib to the
point of compiling on OpenVMS.

* Config.h
OpenVMS needs __UNIX_PUTC macro defined for putc_unlocked
and friends to be visible.

* lib/passfd.c

This needs "_X_OPEN_SOURCE_EXTENDED" for the XPG4 V2 features
in the code to compile on OpenVMS. Specifically the "msg_control"
and "msg_controllen" members of struct msghdr.

This would need to be defined before any system header files are
included.

OpenVMS provides _CMSG_SPACE and _CMSG_LEN macros instead of
CMSG_SPACE and CMSG_LEN. This looks like I would need to
find out how gllib/sys/socket.h got generated.

For the OpenVMS header files, enabling _X_OPEN_SOURCE_EXTENDED
causes macros and symbols not defined by the applicable
standard to be hidden from the compiler. There currently
is no way to make them visible and have XPG4 V2 features enabled.

So I either need to have lib/passfd.c for OpenVMS define the
_X_OPEN_SOURCE_EXTENDED macro as such:

#ifdef __VMS /* OpenVMS enable XPG4 V2 */
# define _X_OPEN_SOURCE_EXTENDED
#endif
#include <config.h>

Or I need to have my build procedure create a file named
lib/gnv$passfd.c_first that contains that macro definition.

The cc emulation program in OpenVMS GNV will automatically treat
such files as a "first_include".

* The OpenVMS iconv.h header file has a bug where it does not
include sys/types.h.

* The OpenVMS math.h header file has a bug where it is missing
NAN and INFINITY, these are found in the fp.h header file.

* In gl_sublist.c, the OpenVMS compiler is generating a
"MISSINGRETURN" warning because it does not realize that there
is no return from an abort() call.
This should fix that:

#ifdef __DECC
# pragma message disable missingreturn
#endif

So would adding a useless return statement, but that may cause some
compilers to complain about unreachable code.

I do see GCC specific pragmas in the source code.

* The OpenVMS stropts.h header file definition for ioctl() is
non-standard, which causes problems when it is wrapped
in ioctl.h

* OpenVMS sys/resource does not define RUSAGE_SELF or
RUSAGE_CHILDREN. Comments say ru_stime member of rusage
is present, but not implemented.

* Because the replacement C99 routines are not prefixed
with "RPL_" or another prefix, the OpenVMS C Compiler is
generating a warning when encountering them:

%CC-W-NOTINCRTL, Identifier "strtoumax" is reserved by the C99 standard
and will be mapped to "DECC$STRTOUMAX" although it is not available in
the CRTL available to the compiler.

These appear to be routines that the compiler would inline when the
optimization level allows it.

It looks like something in the configure tests determine if the
prefix is generated for a replacement routine or not. OpenVMS
generally always will need the prefix on a replacement routine.

* Work out the how to patch the configure test for getdtablesize()
to pass on OpenVMS.

* The configure test for the real directory for OpenVMS system
supplied header file fails because they are not in a real directory.
They are in a library file. If OpenVMS does not find a header
file in supplied paths header files or in the source, it junks
the directory portion the the header file path, and just looks
up the filename in the text library.

I export some symbols to cause Configure on VMS to skip the test.

export gl_cv_next_errno_h="<vms_fake_path/errno.h>"

It looks like for some of these I need to find the appropriate m4 macros
and others I need to find the templates for generating the local header
files.

Any suggestions on the preferred way to implement patches for these
would be appreciated.

Regards,
-John
Bruno Haible
2017-07-04 00:07:32 UTC
Permalink
Raw Message
Hello John,
Post by John E. Malmberg
* Config.h
OpenVMS needs __UNIX_PUTC macro defined for putc_unlocked
and friends to be visible.
The right place to do this (for a macro that affects multiple
gnulib modules) is the 'extensions' module.
Post by John E. Malmberg
* lib/passfd.c
This needs "_X_OPEN_SOURCE_EXTENDED" for the XPG4 V2 features
in the code to compile on OpenVMS. Specifically the "msg_control"
and "msg_controllen" members of struct msghdr.
This would need to be defined before any system header files are
included.
This too is best done in the 'extensions' module.
Post by John E. Malmberg
For the OpenVMS header files, enabling _X_OPEN_SOURCE_EXTENDED
causes macros and symbols not defined by the applicable
standard to be hidden from the compiler. There currently
is no way to make them visible and have XPG4 V2 features enabled.
?? I don't understand the last sentence. What features get disabled
when you define _X_OPEN_SOURCE_EXTENDED?
Post by John E. Malmberg
Or I need to have my build procedure create a file named
lib/gnv$passfd.c_first that contains that macro definition.
The cc emulation program in OpenVMS GNV will automatically treat
such files as a "first_include".
This is a non-standard way of operation that would cause maintenance
problems; I would therefore prefer if we can avoid it.
Post by John E. Malmberg
* The OpenVMS iconv.h header file has a bug where it does not
include sys/types.h.
Gnulib has an idiom to cope for this situation. Do
$ grep -rl 'not self-contained' doc/posix-headers/
Post by John E. Malmberg
* The OpenVMS math.h header file has a bug where it is missing
NAN and INFINITY, these are found in the fp.h header file.
To be handled in the 'math' module.
Post by John E. Malmberg
* In gl_sublist.c, the OpenVMS compiler is generating a
"MISSINGRETURN" warning because it does not realize that there
is no return from an abort() call.
#ifdef __DECC
# pragma message disable missingreturn
#endif
So would adding a useless return statement, but that may cause some
compilers to complain about unreachable code.
I do see GCC specific pragmas in the source code.
Adding a return statement after abort() is not something I could accept,
because - as you say - other compilers may warn then.

A __DECC specific pragma is acceptable, but I don't like it nevertheless:
Most people use GCC or clang when they want to check the code quality;
that's the reason for the GCC specific pragmas. If you have a warning
that occurs once or 5 times, it's something you can easily ignore.
Things would be different for a line of code that produces, say, 500
lines of warnings; these warnings are too much clutter and we should
use a compiler specific pragma to get rid of it.
Post by John E. Malmberg
* OpenVMS sys/resource does not define RUSAGE_SELF or
RUSAGE_CHILDREN. Comments say ru_stime member of rusage
is present, but not implemented.
Yes, for 'struct rusage' the common approach is to define the fields
and set them to 0, on platforms where no reasonable value can be computed.
Post by John E. Malmberg
* Because the replacement C99 routines are not prefixed
with "RPL_" or another prefix, the OpenVMS C Compiler is
%CC-W-NOTINCRTL, Identifier "strtoumax" is reserved by the C99 standard
and will be mapped to "DECC$STRTOUMAX" although it is not available in
the CRTL available to the compiler.
These appear to be routines that the compiler would inline when the
optimization level allows it.
It looks like something in the configure tests determine if the
prefix is generated for a replacement routine or not. OpenVMS
generally always will need the prefix on a replacement routine.
In this case, you need to arrange for REPLACE_STRTOUMAX to be 1.
But please limit these changes to OpenVMS, because it makes debugging
with gdb simpler when the 'rpl_' prefix is omitted when possible.
Post by John E. Malmberg
* The configure test for the real directory for OpenVMS system
supplied header file fails because they are not in a real directory.
They are in a library file. If OpenVMS does not find a header
file in supplied paths header files or in the source, it junks
the directory portion the the header file path, and just looks
up the filename in the text library.
I export some symbols to cause Configure on VMS to skip the test.
export gl_cv_next_errno_h="<vms_fake_path/errno.h>"
You need to find a way to make the
#include "/usr/include/foo.h"
or
#include_next "foo.h"
idiom to work, one way or the other. Gnulib relies heavily on it.

Bruno
John E. Malmberg
2017-07-04 00:58:52 UTC
Permalink
Raw Message
Post by Bruno Haible
Hello John,
Post by John E. Malmberg
* Config.h
OpenVMS needs __UNIX_PUTC macro defined for putc_unlocked
and friends to be visible.
The right place to do this (for a macro that affects multiple
gnulib modules) is the 'extensions' module.
Post by John E. Malmberg
* lib/passfd.c
This needs "_X_OPEN_SOURCE_EXTENDED" for the XPG4 V2 features
in the code to compile on OpenVMS. Specifically the "msg_control"
and "msg_controllen" members of struct msghdr.
This would need to be defined before any system header files are
included.
This too is best done in the 'extensions' module.
Post by John E. Malmberg
For the OpenVMS header files, enabling _X_OPEN_SOURCE_EXTENDED
causes macros and symbols not defined by the applicable
standard to be hidden from the compiler. There currently
is no way to make them visible and have XPG4 V2 features enabled.
?? I don't understand the last sentence. What features get disabled
when you define _X_OPEN_SOURCE_EXTENDED?
Anything that is not specified in XPG4 V2. XPG4 V2 compliance requires
that several extensions be disabled by default.

XPG4 V2 compliance allows extensions to be enabled. The OpenVMS
supplied header files do not provide a way to enable these extensions
when XPG4 V2 is requested, which is an odd omission.

All BSD extensions are disabled.

struct tm no longer has: tm_gmtoff tm_zone

The u_char, u_short, u_long typedefs are gone from types.h

/* And also makes these STDIO macros not defined */
#define _IOREAD 0x01
#define _IOWRT 0x02
#define _IOMYBUF 0x08
#define _IOSTRG 0x40
#define _IORW 0x80

The bcmp,bcopy,bzero,ffs, strcasecmp, strncasecmp, index, and rindex are
only in <strings.h> not <string.h> and gnulib is not including string.h.

The setenv, unsetenv, strtoll prototypes are gone.

It exposes a bug in the OpenVMS if.h header file is missing an include
of <times.h> because that is now the only place "timeval" is supplied.

It exposes a bug where the OpenVMS iconv header file is not testing the
_XOPEN_SOURCE macro properly.

And I am not sure that I have a complete list of what is disabled. It
just got too painful trying to get the other gnulib modules to build in
strict XPG4 V2 mode.
Post by Bruno Haible
In this case, you need to arrange for REPLACE_STRTOUMAX to be 1.
But please limit these changes to OpenVMS, because it makes debugging
with gdb simpler when the 'rpl_' prefix is omitted when possible.
The reverse is the case with VMS because the compiler adds prefixes to
all C library known built-in routines/symbols. There are supposed to
ways to control that, I have not been able to get them to work reliably.
Post by Bruno Haible
Post by John E. Malmberg
* The configure test for the real directory for OpenVMS system
supplied header file fails because they are not in a real directory.
They are in a library file. If OpenVMS does not find a header
file in supplied paths header files or in the source, it junks
the directory portion the the header file path, and just looks
up the filename in the text library.
I export some symbols to cause Configure on VMS to skip the test.
export gl_cv_next_errno_h="<vms_fake_path/errno.h>"
You need to find a way to make the
#include "/usr/include/foo.h"
or
#include_next "foo.h"
idiom to work, one way or the other. Gnulib relies heavily on it.
The #include "vms_fake_path/foo.h" is the way to make sure that the
system supplied foo.h header is used as long as "vms_fake_path" does not
exist.

The include_next is not available.

However I could have headers /usr/include as we get libraries ported.

So what I need is for configure to look in /usr/include or the Unix
expected path first and if the header is not found to use the
"vms_fake_path" as the path.

As far as doing things non-standard on OpenVMS:

There are currently an estimated less than 5 OpenVMS developers that are
using the supplied configure scripts and related makefiles for building.

The rest are rolling their own makefiles and manually creating config.h
files, and manually editing files until they get something building.

I am trying to get things so that the OpenVMS ports have less manual
steps in them.

Regards,
-John
Bruno Haible
2017-07-07 08:08:31 UTC
Permalink
Raw Message
Post by John E. Malmberg
Post by Bruno Haible
Post by John E. Malmberg
* lib/passfd.c
This needs "_X_OPEN_SOURCE_EXTENDED" for the XPG4 V2 features
in the code to compile on OpenVMS. Specifically the "msg_control"
and "msg_controllen" members of struct msghdr.
This would need to be defined before any system header files are
included.
This too is best done in the 'extensions' module.
Post by John E. Malmberg
For the OpenVMS header files, enabling _X_OPEN_SOURCE_EXTENDED
causes macros and symbols not defined by the applicable
standard to be hidden from the compiler. There currently
is no way to make them visible and have XPG4 V2 features enabled.
?? I don't understand the last sentence. What features get disabled
when you define _X_OPEN_SOURCE_EXTENDED?
Anything that is not specified in XPG4 V2. XPG4 V2 compliance requires
that several extensions be disabled by default.
XPG4 V2 compliance allows extensions to be enabled. The OpenVMS
supplied header files do not provide a way to enable these extensions
when XPG4 V2 is requested, which is an odd omission.
All BSD extensions are disabled.
struct tm no longer has: tm_gmtoff tm_zone
The u_char, u_short, u_long typedefs are gone from types.h
/* And also makes these STDIO macros not defined */
#define _IOREAD 0x01
#define _IOWRT 0x02
#define _IOMYBUF 0x08
#define _IOSTRG 0x40
#define _IORW 0x80
The bcmp,bcopy,bzero,ffs, strcasecmp, strncasecmp, index, and rindex are
only in <strings.h> not <string.h> and gnulib is not including string.h.
The setenv, unsetenv, strtoll prototypes are gone.
It exposes a bug in the OpenVMS if.h header file is missing an include
of <times.h> because that is now the only place "timeval" is supplied.
It exposes a bug where the OpenVMS iconv header file is not testing the
_XOPEN_SOURCE macro properly.
And I am not sure that I have a complete list of what is disabled. It
just got too painful trying to get the other gnulib modules to build in
strict XPG4 V2 mode.
Thanks for the write-up of these collisions. In this case, you can not
define _X_OPEN_SOURCE_EXTENDED in config.h. So, define it for a single
compilation unit only. If necessary, you can even create a new .c file
just for OpenVMS (like we have stat-w32.c which is only for native Windows).
Post by John E. Malmberg
Post by Bruno Haible
In this case, you need to arrange for REPLACE_STRTOUMAX to be 1.
But please limit these changes to OpenVMS, because it makes debugging
with gdb simpler when the 'rpl_' prefix is omitted when possible.
The reverse is the case with VMS because the compiler adds prefixes to
all C library known built-in routines/symbols.
You are thinking about the effect of your changes to OpenVMS. What I meant
is to think also at the effect of your changes to the other platforms.
Please make sure that your changes don't cause some REPLACE_* variables
to become 1 when they were 0 before your changes.
Post by John E. Malmberg
Post by Bruno Haible
Post by John E. Malmberg
* The configure test for the real directory for OpenVMS system
supplied header file fails because they are not in a real directory.
They are in a library file. If OpenVMS does not find a header
file in supplied paths header files or in the source, it junks
the directory portion the the header file path, and just looks
up the filename in the text library.
I export some symbols to cause Configure on VMS to skip the test.
export gl_cv_next_errno_h="<vms_fake_path/errno.h>"
You need to find a way to make the
#include "/usr/include/foo.h"
or
#include_next "foo.h"
idiom to work, one way or the other. Gnulib relies heavily on it.
The #include "vms_fake_path/foo.h" is the way to make sure that the
system supplied foo.h header is used as long as "vms_fake_path" does not
exist.
Good.

Bruno
Bruno Haible
2017-07-07 08:21:06 UTC
Permalink
Raw Message
Post by John E. Malmberg
There are currently an estimated less than 5 OpenVMS developers that are
using the supplied configure scripts and related makefiles for building.
The rest are rolling their own makefiles and manually creating config.h
files, and manually editing files until they get something building.
I am trying to get things so that the OpenVMS ports have less manual
steps in them.
Absolutely, this is the way to go. I've got the same experience with
native Windows ports. Previously, it required a specially crafted Makefile
for every package. Nowadays, we do it by using configure and wrapper
scripts for the compiler ('compile' and 'ar-lib'). It reduced the maintenance
effort *a lot*.

Bruno

Loading...