public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Define _C99 in libstdc++ vxworks/os_defines.h
@ 2021-12-10 15:06 Olivier Hainque
  2021-12-10 15:15 ` Rasmus Villemoes
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier Hainque @ 2021-12-10 15:06 UTC (permalink / raw)
  To: libstdc++, gcc-patches; +Cc: Olivier Hainque, Rasmus Villemoes

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

Hello,

The attached patch for libstdc++ / VxWorks helps building
the library for old versions of the OS, as witnessed with
VxWorks 6.9 in particular.

It explicitly requests C99 features from old system headers,
on which libstc++ relies since at least c++98. The specific
issue that exposed this was a failure to compile

  libstdc++-v3/src/c++17/floating_to_chars.cc

for VxWorks 6.9 with a batch of errors such as:

  error: 'FP_NAN' was not declared in this scope

The missing definitions are provided by the
system headers with guards on _HAS_C9X, which gets
internally defined when _C99 is.

Ok to commit?

Thanks in advance!

2021-12-07  Olivier Hainque  <hainque@adacore.com>

libstdc++-v3/

	* config/os/vxworks/os_defines.h: #define _C99.

Olivier


[-- Attachment #2: 0001-Define-_C99-in-libstdc-vxworks-os_defines.h.patch --]
[-- Type: application/octet-stream, Size: 1391 bytes --]

From f1051d0a9f2687fdf313b916d73b9b2d50e13ac2 Mon Sep 17 00:00:00 2001
From: Olivier Hainque <hainque@adacore.com>
Date: Fri, 19 Nov 2021 14:59:42 +0000
Subject: [PATCH] Define _C99 in libstdc++ vxworks/os_defines.h

To request C99 features from old system headers, on which
libstc++ relies since at least c++98. The specific issue that
exposed this was a failure to compile

  libstdc++-v3/src/c++17/floating_to_chars.cc

for VxWorks 6.9 with a batch of errors such as:

  error: 'FP_NAN' was not declared in this scope

The missing definitions are provided by the
system headers with guards on _HAS_C9X, which gets
internally defined when _C99 is.

2021-12-07  Olivier Hainque  <hainque@adacore.com>

libstdc++-v3/

	* config/os/vxworks/os_defines.h: #define _C99.
---
 libstdc++-v3/config/os/vxworks/os_defines.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libstdc++-v3/config/os/vxworks/os_defines.h b/libstdc++-v3/config/os/vxworks/os_defines.h
index 75a68bc605b..78392dec30a 100644
--- a/libstdc++-v3/config/os/vxworks/os_defines.h
+++ b/libstdc++-v3/config/os/vxworks/os_defines.h
@@ -100,4 +100,9 @@
 #undef _NO_CPP_INLINES
 #define _NO_CPP_INLINES 1
 
+// libstdc++ relies on C99 features for virtually all versions of C++,
+// up to at least C++98.
+#undef _C99
+#define _C99 1
+
 #endif // _GLIBCXX_OS_DEFINES
-- 
2.25.1


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

* Re: [PATCH] Define _C99 in libstdc++ vxworks/os_defines.h
  2021-12-10 15:06 [PATCH] Define _C99 in libstdc++ vxworks/os_defines.h Olivier Hainque
@ 2021-12-10 15:15 ` Rasmus Villemoes
  2021-12-10 15:42   ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus Villemoes @ 2021-12-10 15:15 UTC (permalink / raw)
  To: Olivier Hainque, libstdc++, gcc-patches

On 10/12/2021 16.06, Olivier Hainque wrote:
> Hello,
> 
> The attached patch for libstdc++ / VxWorks helps building
> the library for old versions of the OS, as witnessed with
> VxWorks 6.9 in particular.
> 
> It explicitly requests C99 features from old system headers,
> on which libstc++ relies since at least c++98. The specific
> issue that exposed this was a failure to compile
> 
>   libstdc++-v3/src/c++17/floating_to_chars.cc
> 
> for VxWorks 6.9 with a batch of errors such as:
> 
>   error: 'FP_NAN' was not declared in this scope
> 
> The missing definitions are provided by the
> system headers with guards on _HAS_C9X, which gets
> internally defined when _C99 is.
> 
> Ok to commit?

Yes, we've observed that error as well. We have just patched our vxworks
5.5 headers to provide FP_NAN et al. There's no test of definedness or
other uses of a _C99 macro anywhere, so ok by me, as it shouldn't change
anything on our end.

Rasmus

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

* Re: [PATCH] Define _C99 in libstdc++ vxworks/os_defines.h
  2021-12-10 15:15 ` Rasmus Villemoes
@ 2021-12-10 15:42   ` Jonathan Wakely
  2021-12-10 16:15     ` Olivier Hainque
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2021-12-10 15:42 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Olivier Hainque, libstdc++, gcc-patches

On Fri, 10 Dec 2021 at 15:16, Rasmus Villemoes via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> On 10/12/2021 16.06, Olivier Hainque wrote:
> > Hello,
> >
> > The attached patch for libstdc++ / VxWorks helps building
> > the library for old versions of the OS, as witnessed with
> > VxWorks 6.9 in particular.
> >
> > It explicitly requests C99 features from old system headers,
> > on which libstc++ relies since at least c++98. The specific
> > issue that exposed this was a failure to compile
> >
> >   libstdc++-v3/src/c++17/floating_to_chars.cc
> >
> > for VxWorks 6.9 with a batch of errors such as:
> >
> >   error: 'FP_NAN' was not declared in this scope
> >
> > The missing definitions are provided by the
> > system headers with guards on _HAS_C9X, which gets
> > internally defined when _C99 is.
> >
> > Ok to commit?
>
> Yes, we've observed that error as well. We have just patched our vxworks
> 5.5 headers to provide FP_NAN et al. There's no test of definedness or
> other uses of a _C99 macro anywhere, so ok by me, as it shouldn't change
> anything on our end.
>
> Rasmus

OK to commit then, thanks.

The comment is a bit misleading though:

+// libstdc++ relies on C99 features for virtually all versions of C++,
+// up to at least C++98.
+#undef _C99
+#define _C99 1

The "up to" seems backwards, I'd expect it to say "down to" or "as far
back as at least C++98".

But there's nothing older than C++98 anyway, so this just means "all
versions", there's no "virtually" about it.

Please just say "libstdc++ relies on C99 features for all versions of C++".

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

* Re: [PATCH] Define _C99 in libstdc++ vxworks/os_defines.h
  2021-12-10 15:42   ` Jonathan Wakely
@ 2021-12-10 16:15     ` Olivier Hainque
  0 siblings, 0 replies; 4+ messages in thread
From: Olivier Hainque @ 2021-12-10 16:15 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Olivier Hainque, Rasmus Villemoes, libstdc++, gcc-patches



> On 10 Dec 2021, at 16:42, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> 
> 
> OK to commit then, thanks.
> 
> The comment is a bit misleading though:
> 
> +// libstdc++ relies on C99 features for virtually all versions of C++,
> +// up to at least C++98.
> +#undef _C99
> +#define _C99 1
> 
> The "up to" seems backwards, I'd expect it to say "down to" or "as far
> back as at least C++98".
> 
> But there's nothing older than C++98 anyway, so this just means "all
> versions", there's no "virtually" about it.
> 
> Please just say "libstdc++ relies on C99 features for all versions of C++".

Sure, thanks Jonathan. Yes, I agree the comment is confused.
I hesitated between a couple of perspectives and just mixed
things up.

Thanks for your prompt review!

Olivier

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

end of thread, other threads:[~2021-12-10 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 15:06 [PATCH] Define _C99 in libstdc++ vxworks/os_defines.h Olivier Hainque
2021-12-10 15:15 ` Rasmus Villemoes
2021-12-10 15:42   ` Jonathan Wakely
2021-12-10 16:15     ` Olivier Hainque

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).