Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-10-20 Thread Paul M. Bendixen
Updated patch, added the requested files, hopefully wrote the commit better.



Den tors. 7. sep. 2023 kl. 18.28 skrev Jonathan Wakely :

> On Fri, 18 Aug 2023 at 20:14, Paul M. Bendixen 
> wrote:
> >
> > Hi
> > Jonathan, I just went over the proposal again as well as [compliance],
> which Arsen mentioned ( https://wg21.link/compliance ) don't seem to
> mention either  or .
>
> Those headers were freestanding in C++17. They're not present in C++20
> and C++23, but we support C++17 and earlier standards.
>
> In GCC 12  and  were both installed when you
> built the library with --disable-hosted-libstdcxx, so the fact they're
> no longer installed for a freestanding build in GC 13 is a regression.
> Please do include them.
>
>
> >
> > Shouldn't I just stick to the ones we know are in?
> >
> > (Still working on figuring out how to do the change log thing)
> >
> > Best regards
> > Paul
> >
> > Den ons. 16. aug. 2023 kl. 18.50 skrev Paul M. Bendixen <
> paulbendi...@gmail.com>:
> >>
> >> Yes, the other files are in another committee proposal, and I'm working
> my way through the proposals one by one.
> >> Thank you for the feedback, I'll update and resend
> >> /Paul
> >>
> >> Den ons. 16. aug. 2023 kl. 15.51 skrev Arsen Arsenović  >:
> >>>
> >>>
> >>> Jonathan Wakely  writes:
> >>>
> >>> > On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++
> >>> >  wrote:
> >>> >>
> >>> >> P1642 includes the header cstdarg to the freestanding
> implementation.
> >>> >> This was probably left out by accident, this patch puts it in.
> >>> >> Since this is one of the headers that go in whole cloth, there
> should be no
> >>> >> further actions needed.
> >>> >
> >>> > Thanks for the patch. I agree that  should be freestanding,
> >>> > but I think  and  were also missed from the
> >>> > change. Arsen?
> >>>
> >>> Indeed, we should include all three, and according to [compliance],
> >>> there's a couple more headers that we should provide (cwchar, cstring,
> >>> cerrno, and cmath, but these are probably significantly more involved,
> >>> so we can handle them separately).
> >>>
> >>> As guessed, the omission was not intentional.
> >>>
> >>> If you could, add those two to the patch as well, edit Makefile.am and
> >>> regenerate using automake 1.15.1, and see
> >>> https://gcc.gnu.org/contribute.html wrt. changelogs in commit
> messages.
> >>>
> >>> Thank you!  Have a lovely day :-)
> >>>
> >>> [compliance]: https://eel.is/c++draft/compliance
> >>>
> >>> > Also, the patch should change include/Makefile.am as well (the .in
> >>> > file is autogenerated from that one).
> >>> >
> >>> >
> >>> >> This might be related to PR106953, but since that one touches the
> partial
> >>> >> headers I'm not sure
> >>>
> >>> The headers mentioned in this PR are provided in freestanding,
> >>> partially, in 13 already, indeed.
> >>>
> >>> >> /Paul M. Bendixen
> >>> >>
> >>> >> --
> >>> >> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• −
> − •−
> >>> >> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
> >>>
> >>>
> >>> --
> >>> Arsen Arsenović
> >>
> >>
> >>
> >> --
> >> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − −
> •− •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
> >
> >
> >
> > --
> > • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
>
>

-- 
• − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
•/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
From db59c3e2e54744a490e146c208dd4013c5c581f5 Mon Sep 17 00:00:00 2001
From: "Paul M. Bendixen" 
Date: Fri, 21 Jul 2023 23:35:25 +0200
Subject: [PATCH] libstdc++: Include cstdarg in freestanding

P1642 includes cstdarg in the full headers to include.
This commit includes it along with cstdaling andcstdbool that were
left out when updating in an earlier commit.

Signed-off-by: Paul M. Bendixen 

libstdc++/C

Re: [PATCH] Freestanding proposal P0829

2019-12-10 Thread Paul M. Bendixen
Den ons. 4. dec. 2019 kl. 22.43 skrev Jonathan Wakely :
>
> On 03/12/19 23:38 +0100, Paul M. Bendixen wrote:
> >Hello
> >I've made an implementation of P0829 and tested it with gcc for avr.
>
> This is great, thanks!
>
> What's the status of libstdc++ for AVR? If I understand correctly, it
> doesn't build by default when GCC is configured for AVR. Are you
> overriding that, or just copying the headers somewhere and including
> them in your programs?
>
The status is that it isn't built by default for AVR. I use the method described
in "Real time C++" by Christopher Kormanyos and modified it a bit.

I have a docker image that is built as part of CI at
https://gitlab.com/avr-libstdcxx/avr-libstdcxx-docker that describes
the build process.
I use avrlibc instead of newlib and it seems to work well.

> >I've included the patch and I believe it might need some modification.
> >Should I rather just maintain my own fork until P0829 is a bit
> >further? (It is currently being split into smaller proposals).
>
> Yes, I think it's too early to actually make this change. Our current
> !_GLIBCXX_HOSTED build conforms to the requirements of a freestanding
> implementation (for anything from C++98 to C++17) so I'd prefer not to
> mess with that drastically until the P0829 work has made more
> progress. Despite that, I'm very happy to see somebody take on the
> task, and will be glad to apply a patch like this when the time is
> right.
>
I also considered using another macro ( such as _P0829_FREESTANDING )
so that it might be added directly. I will try to keep the branch up to date
with regards to the current proposal.
If anyone else is interested, the code is at:
https://gitlab.com/avr-libstdcxx/

> >I have not included further tests, nor actually run the tests since
> >everything is in header files is only includes of already existing
> >libstdc++ code.
>
> If we were serious about improving our freestanding support, we'd need
> to partition the testsuite into the parts that should pass for
> freestanding, and mark all the other tests UNSUPPORTED. That would
> mean we could run tests for a freestanding build and not get thousands
> of failures for tests that are not expected to work for freestanding.
> That would be a big project though.
>
> Your patch is mostly just adding #if in various places, not adding new
> code, and so I'm not sure it needs a copyright assignment (the changes
> probably aren't copyrightable anyway). But if you plan to contribute
> to GCC it would be good to get an assignment in place (if you don't
> have one already). See https://gcc.gnu.org/contribute.html#legal for
> more information, and feel free to contact me directly if you have any
> questions or if you want to start the process.
>
> Thanks again for the patch. Please do keep working on it as the P0829
> work evolves, so that we can integrate it with libstdc++ at some
> point.
>

Thank you, I will


-- 
• − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − −
•− •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//


[PATCH] Freestanding proposal P0829

2019-12-03 Thread Paul M. Bendixen
Hello
I've made an implementation of P0829 and tested it with gcc for avr.
I've included the patch and I believe it might need some modification.
Should I rather just maintain my own fork until P0829 is a bit
further? (It is currently being split into smaller proposals).
I have not included further tests, nor actually run the tests since
everything is in header files is only includes of already existing
libstdc++ code.

Best regards

Paul M. Bendixen
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index bc475c6dd90..3feed5b3bff 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1886,18 +1886,62 @@ install-freestanding-headers:
 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/bits
 	for file in c++0x_warning.h atomic_base.h concept_check.h move.h; do \
 	  $(INSTALL_DATA) ${glibcxx_srcdir}/include/bits/$${file} $(DESTDIR)${gxx_include_dir}/bits; done
+	# P0829 headers
+	for file in algorithmfwd.h alloc_traits.h boost_concept_check.h char_traits.h \
+  concept_check.h cpp_type_traits.h functexcept.h functional_hash.h \
+  hash_byte.h invoke.h memoryfwd.h parse_numbers.h postypes.h predefined_ops.h \
+	  ptr_traits.h random.h random.tcc range_access.h refwrap.h std_abs.h stl_algo.h \
+	  stl_algobase.h stl_construct.h stl_function.h stl_heap.h stl_iterator.h \
+	  stl_iterator_base_funcs.h  stl_iterator_base_types.h \
+	  stl_numeric.h stl_pair.h stl_relops.h stl_uninitialized.h unique_ptr.h \
+  uniform_int_dist.h uses_allocator.h ; do \
+	  $(INSTALL_DATA) ${glibcxx_srcdir}/include/bits/$${file} $(DESTDIR)${gxx_include_dir}/bits; done
 	$(mkinstalldirs) $(DESTDIR)${host_installdir}
 	for file in ${host_srcdir}/os_defines.h ${host_builddir}/c++config.h \
 	  ${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
+	  ${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
 	  ${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h; do \
 	  $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir}
 	for file in limits type_traits atomic bit version; do \
 	  $(INSTALL_DATA) ${std_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done
+	#P0829 headers
+	# Remaining headers:
+	#	cwchar memory ranges variant
+	# Will not be implemented:
+	#	cinttypes 
+	for file in algorithm array bitset chrono charconv functional iterator \
+  memory numeric optional random ratio string string_view system_error \
+  utility tuple ; do \
+	  $(INSTALL_DATA) ${std_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done
 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir}
 	for file in ciso646 cstddef cfloat climits cstdint cstdlib \
 	  cstdalign cstdarg cstdbool; do \
 	  $(INSTALL_DATA) ${c_base_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
+	#P0829 headers
+	for file in csetjmp cwchar cerrno cmath ctime cctype cstring; do \
+	  $(INSTALL_DATA) ${c_base_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
+	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${ext_builddir}
+	for file in type_traits.h numeric_traits.h; do \
+	  $(INSTALL_DATA) ${ext_srcdir}/$${file} $(DESTDIR)${gxx_include_dir}/${ext_builddir}; done
+	#P0829 headers ext
+	for file in alloc_traits.h; do \
+	  $(INSTALL_DATA) ${ext_srcdir}/$${file} $(DESTDIR)${gxx_include_dir}/${ext_builddir}; done
+	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${debug_builddir}
+	for file in array debug.h assertions.h; do \
+	  $(INSTALL_DATA) ${debug_srcdir}/$${file} $(DESTDIR)${gxx_include_dir}/${debug_builddir}; done
+	#P0829
+	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${backward_builddir}
+	for file in binders.h ; do \
+	  $(INSTALL_DATA) ${backward_srcdir}/$${file} $(DESTDIR)${gxx_include_dir}/${backward_builddir}; done
+	$(mkinstalldirs) $(DESTDIR)${host_installdir}
+	for file in ${host_headers} ${bits_host_headers} ${host_headers_extra} \
+	 ${thread_host_headers}; do \
+	  $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
+	$(mkinstalldirs) $(DESTDIR)${host_installdir}/../ext
+	for file in ${ext_host_headers}; do \
+	  $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}/../ext; done
+
 
 # The real deal.
 install-headers:
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index 40e051aa9e3..ebf6bd5610d 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -289,6 +289,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 bool
 includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
 
+#if _GLIBCXX_HOSTED
   template
 void
 inplace_merge(_BIter, _BIter, _BIter);
@@ -296,6 +297,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template
 void
 inplace_merge(_BIter, _BIter, _BIter, _Compare);
+#endif // _GLIBCXX_HOSTED
 
 #if __cplusplus >= 201103L
   template
@@ -

[PATCH] libstdc++ Add cstdarg to freestanding

2023-07-21 Thread Paul M. Bendixen via Gcc-patches
P1642 includes the header cstdarg to the freestanding implementation.
This was probably left out by accident, this patch puts it in.
Since this is one of the headers that go in whole cloth, there should be no
further actions needed.
This might be related to PR106953, but since that one touches the partial
headers I'm not sure

/Paul M. Bendixen

-- 
• − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
•/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
From 5584c194927678067e412aeb19f10b9662e398a6 Mon Sep 17 00:00:00 2001
From: "Paul M. Bendixen" 
Date: Fri, 21 Jul 2023 22:04:23 +0200
Subject: [PATCH] libstdc++: Include cstdarg in freestanding

P1642 includes cstdarg in the full headers to include. Include it.

Signed-off-by: Paul M. Bendixen 
---
 libstdc++-v3/include/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 0ff875b280b..f09f97e2f6b 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1194,6 +1194,7 @@ c_base_builddir = .
 c_base_freestanding = \
 	${c_base_srcdir}/cfloat \
 	${c_base_srcdir}/climits \
+	${c_base_srcdir}/cstdarg \
 	${c_base_srcdir}/cstddef \
 	${c_base_srcdir}/cstdint \
 	${c_base_srcdir}/cstdlib
@@ -1213,7 +1214,6 @@ c_base_freestanding = \
 @GLIBCXX_HOSTED_TRUE@	${c_base_srcdir}/csetjmp \
 @GLIBCXX_HOSTED_TRUE@	${c_base_srcdir}/csignal \
 @GLIBCXX_HOSTED_TRUE@	${c_base_srcdir}/cstdalign \
-@GLIBCXX_HOSTED_TRUE@	${c_base_srcdir}/cstdarg \
 @GLIBCXX_HOSTED_TRUE@	${c_base_srcdir}/cstdbool \
 @GLIBCXX_HOSTED_TRUE@	${c_base_srcdir}/cstdio \
 @GLIBCXX_HOSTED_TRUE@	${c_base_srcdir}/cstring \
-- 
2.34.1



Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-08-16 Thread Paul M. Bendixen via Gcc-patches
Yes, the other files are in another committee proposal, and I'm working my
way through the proposals one by one.
Thank you for the feedback, I'll update and resend
/Paul

Den ons. 16. aug. 2023 kl. 15.51 skrev Arsen Arsenović :

>
> Jonathan Wakely  writes:
>
> > On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++
> >  wrote:
> >>
> >> P1642 includes the header cstdarg to the freestanding implementation.
> >> This was probably left out by accident, this patch puts it in.
> >> Since this is one of the headers that go in whole cloth, there should
> be no
> >> further actions needed.
> >
> > Thanks for the patch. I agree that  should be freestanding,
> > but I think  and  were also missed from the
> > change. Arsen?
>
> Indeed, we should include all three, and according to [compliance],
> there's a couple more headers that we should provide (cwchar, cstring,
> cerrno, and cmath, but these are probably significantly more involved,
> so we can handle them separately).
>
> As guessed, the omission was not intentional.
>
> If you could, add those two to the patch as well, edit Makefile.am and
> regenerate using automake 1.15.1, and see
> https://gcc.gnu.org/contribute.html wrt. changelogs in commit messages.
>
> Thank you!  Have a lovely day :-)
>
> [compliance]: https://eel.is/c++draft/compliance
>
> > Also, the patch should change include/Makefile.am as well (the .in
> > file is autogenerated from that one).
> >
> >
> >> This might be related to PR106953, but since that one touches the
> partial
> >> headers I'm not sure
>
> The headers mentioned in this PR are provided in freestanding,
> partially, in 13 already, indeed.
>
> >> /Paul M. Bendixen
> >>
> >> --
> >> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
> >> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
>
>
> --
> Arsen Arsenović
>


-- 
• − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
•/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//


Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-08-18 Thread Paul M. Bendixen via Gcc-patches
Hi
Jonathan, I just went over the proposal again as well as [compliance],
which Arsen mentioned ( https://wg21.link/compliance ) don't seem to
mention either  or .

Shouldn't I just stick to the ones we know are in?

(Still working on figuring out how to do the change log thing)

Best regards
Paul

Den ons. 16. aug. 2023 kl. 18.50 skrev Paul M. Bendixen <
paulbendi...@gmail.com>:

> Yes, the other files are in another committee proposal, and I'm working my
> way through the proposals one by one.
> Thank you for the feedback, I'll update and resend
> /Paul
>
> Den ons. 16. aug. 2023 kl. 15.51 skrev Arsen Arsenović :
>
>>
>> Jonathan Wakely  writes:
>>
>> > On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++
>> >  wrote:
>> >>
>> >> P1642 includes the header cstdarg to the freestanding implementation.
>> >> This was probably left out by accident, this patch puts it in.
>> >> Since this is one of the headers that go in whole cloth, there should
>> be no
>> >> further actions needed.
>> >
>> > Thanks for the patch. I agree that  should be freestanding,
>> > but I think  and  were also missed from the
>> > change. Arsen?
>>
>> Indeed, we should include all three, and according to [compliance],
>> there's a couple more headers that we should provide (cwchar, cstring,
>> cerrno, and cmath, but these are probably significantly more involved,
>> so we can handle them separately).
>>
>> As guessed, the omission was not intentional.
>>
>> If you could, add those two to the patch as well, edit Makefile.am and
>> regenerate using automake 1.15.1, and see
>> https://gcc.gnu.org/contribute.html wrt. changelogs in commit messages.
>>
>> Thank you!  Have a lovely day :-)
>>
>> [compliance]: https://eel.is/c++draft/compliance
>>
>> > Also, the patch should change include/Makefile.am as well (the .in
>> > file is autogenerated from that one).
>> >
>> >
>> >> This might be related to PR106953, but since that one touches the
>> partial
>> >> headers I'm not sure
>>
>> The headers mentioned in this PR are provided in freestanding,
>> partially, in 13 already, indeed.
>>
>> >> /Paul M. Bendixen
>> >>
>> >> --
>> >> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − −
>> •−
>> >> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
>>
>>
>> --
>> Arsen Arsenović
>>
>
>
> --
> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
>


-- 
• − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
•/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//