bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* OpenVMS needs __UNIX_PUTC macro defined for configure tests.
@ 2017-07-06 12:47 John E. Malmberg
  2017-07-06 14:33 ` Bruno Haible
  0 siblings, 1 reply; 6+ messages in thread
From: John E. Malmberg @ 2017-07-06 12:47 UTC (permalink / raw
  To: bug-gnulib

On 7/3/2017 7:07 PM, Bruno Haible wrote:
 > Hello John,
 >
 >> * 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.

This makes it visible to the modules being built, but not to the tests 
in the configure script.

Which means that configure does not detect that OpenVMS provides 
declarations and macros for "fputc_unlocked", "putc_unlocked", and 
"putchar_unlocked"

Since configure did not detect them, this causes unlocked-io.h to 
redefine the macros above for them with different enough definitions 
that the OpenVMS C compiler emits a diagnostic.

Also on OpenVMS __UNIX_PUTC macro can not be used currently with the C++ 
compiler which defines "__cplusplus) due to an issue in that compiler 
according to the stdio.h header file comments.

So would the fix be to just put all the logic in unlocked-io.h for it to 
make visible the OpenVMS unlocked IO routines for C only?

Then it mostly does not matter if configure detects them, since they are 
not available to the OpenVMS c++ compiler.

Regards,
-John


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OpenVMS needs __UNIX_PUTC macro defined for configure tests.
  2017-07-06 12:47 OpenVMS needs __UNIX_PUTC macro defined for configure tests John E. Malmberg
@ 2017-07-06 14:33 ` Bruno Haible
  2017-07-06 22:04   ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2017-07-06 14:33 UTC (permalink / raw
  To: bug-gnulib; +Cc: John E. Malmberg

John E. Malmberg wrote:
>  >> * 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.
> 
> This makes it visible to the modules being built, but not to the tests 
> in the configure script.

No, m4/extensions.m4 is written in such a way that all definitions
inside AC_USE_SYSTEM_EXTENSIONS become active before the first test
in the configure script gets run.

> Also on OpenVMS __UNIX_PUTC macro can not be used currently with the C++ 
> compiler

Then how about
#ifndef __cplusplus
# define __UNIX_PUTC 1
#endif
?

> So would the fix be to just put all the logic in unlocked-io.h for it to 
> make visible the OpenVMS unlocked IO routines for C only?

I guess that this would not work:
  #include <stdio.h>
  #include "unlocked-io.h"
would not make the unlocked IO routines visible, because <stdio.h> gets skipped
when it gets included a second time. Right?

Bruno



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OpenVMS needs __UNIX_PUTC macro defined for configure tests.
  2017-07-06 14:33 ` Bruno Haible
@ 2017-07-06 22:04   ` Paul Eggert
  2017-07-07  1:00     ` John E. Malmberg
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2017-07-06 22:04 UTC (permalink / raw
  To: Bruno Haible, bug-gnulib; +Cc: John E. Malmberg

Bruno Haible wrote:
> I guess that this would not work:
>    #include <stdio.h>
>    #include "unlocked-io.h"
> would not make the unlocked IO routines visible, because <stdio.h> gets skipped
> when it gets included a second time. Right?

If we treat __UNIX_PUTC like we treat _GNU_SOURCE then we should be OK, since 
__UNIX_PUTC will be defined in config.h and thus the first <stdio.h> will see it.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OpenVMS needs __UNIX_PUTC macro defined for configure tests.
  2017-07-06 22:04   ` Paul Eggert
@ 2017-07-07  1:00     ` John E. Malmberg
  2017-07-07  7:43       ` Bruno Haible
  0 siblings, 1 reply; 6+ messages in thread
From: John E. Malmberg @ 2017-07-07  1:00 UTC (permalink / raw
  To: bug-gnulib

On 7/6/2017 5:04 PM, Paul Eggert wrote:
> Bruno Haible wrote:
>> I guess that this would not work:
>>    #include <stdio.h>
>>    #include "unlocked-io.h"
>> would not make the unlocked IO routines visible, because <stdio.h> 
>> gets skipped
>> when it gets included a second time. Right?
> 
> If we treat __UNIX_PUTC like we treat _GNU_SOURCE then we should be OK, 
> since __UNIX_PUTC will be defined in config.h and thus the first 
> <stdio.h> will see it.

I found out what the issue is.  The OpenVMS stdio.h file makes the 
unlocked IO routines only available as macros.  There is no declaration.

Configure detects the macros, and that there is no declaration of them.

The unlocked-io.h since the HAVE_DECL_FPUTS_UNLOCKED is not defined, 
redefines the "fputc_unlocked" to not work.

So unlocked-io.h would need to be modified to not replace the OpenVMS 
stdio.h macros if they exist.

Regards,
-John


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OpenVMS needs __UNIX_PUTC macro defined for configure tests.
  2017-07-07  1:00     ` John E. Malmberg
@ 2017-07-07  7:43       ` Bruno Haible
  2017-07-19 13:15         ` John E. Malmberg
  0 siblings, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2017-07-07  7:43 UTC (permalink / raw
  To: bug-gnulib; +Cc: John E. Malmberg

John E. Malmberg wrote:
> I found out what the issue is.  The OpenVMS stdio.h file makes the 
> unlocked IO routines only available as macros.  There is no declaration.
> 
> Configure detects the macros, and that there is no declaration of them.
> 
> The unlocked-io.h since the HAVE_DECL_FPUTS_UNLOCKED is not defined, 
> redefines the "fputc_unlocked" to not work.
> 
> So unlocked-io.h would need to be modified to not replace the OpenVMS 
> stdio.h macros if they exist.

OK, can you provide a patch to m4/unlocked-io.m4 and/or lib/unlocked-io.h?

Bruno



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OpenVMS needs __UNIX_PUTC macro defined for configure tests.
  2017-07-07  7:43       ` Bruno Haible
@ 2017-07-19 13:15         ` John E. Malmberg
  0 siblings, 0 replies; 6+ messages in thread
From: John E. Malmberg @ 2017-07-19 13:15 UTC (permalink / raw
  To: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

On 7/7/2017 2:43 AM, Bruno Haible wrote:
> John E. Malmberg wrote:
>> I found out what the issue is.  The OpenVMS stdio.h file makes the
>> unlocked IO routines only available as macros.  There is no declaration.
>>
>> Configure detects the macros, and that there is no declaration of them.
>>
>> The unlocked-io.h since the HAVE_DECL_FPUTS_UNLOCKED is not defined,
>> redefines the "fputc_unlocked" to not work.
>>
>> So unlocked-io.h would need to be modified to not replace the OpenVMS
>> stdio.h macros if they exist.
> 
> OK, can you provide a patch to m4/unlocked-io.m4 and/or lib/unlocked-io.h?

Here is a patch that modifies m4/extensions to enable the unlocked 
functions on OpenVMS.

I then modified lib/argp-namefrob.h and lib/unlocked-io.h to not replace 
the OpenVMS macros.

I assume that there is a reason that lib/arg-namefrob.h is not just 
including lib/unlocked-io.h.

I was not sure if mentioning that the unlocked functions currently are 
not available for OpenVMS C++ programs due to an issue with the current 
C++ compiler in the posix-functions documentation.

Regards,
-John


[-- Attachment #2: 0001-stdio-OpenVMS-port-of-putc_unlocked.patch.gz --]
[-- Type: application/x-gzip, Size: 1181 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-19 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 12:47 OpenVMS needs __UNIX_PUTC macro defined for configure tests John E. Malmberg
2017-07-06 14:33 ` Bruno Haible
2017-07-06 22:04   ` Paul Eggert
2017-07-07  1:00     ` John E. Malmberg
2017-07-07  7:43       ` Bruno Haible
2017-07-19 13:15         ` John E. Malmberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).