Regenerate newlib/newlib.hin?

Message ID 687108d5-4350-4833-8bd4-2e3ff458c498@embedded-brains.de
State New
Headers
Series Regenerate newlib/newlib.hin? |

Commit Message

Sebastian Huber Sept. 11, 2023, 7:12 a.m. UTC
  Hello,

when I run "autoreconf" in "newlib", I get the following local changes:


Are these changes due to a local configuration or tooling issue or 
should we check in these changes?
  

Comments

Hans-Bernhard Bröker Sept. 12, 2023, 6:54 p.m. UTC | #1
Am 11.09.2023 um 09:12 schrieb Sebastian Huber:
> Hello,
> 
> when I run "autoreconf" in "newlib", I get the following local changes:
[...]
> Are these changes due to a local configuration or tooling issue or 
> should we check in these changes?

You almost certainly should not check in those changes.  In fact, you 
probably have to revert to the checked-in copy, or remove those changes 
manually.

They result from the very unusual way newlib handles configuration 
headers.  You'll find that those 4 elements are instead defined in the 
_other_ checked-in *.hin file: _newlib_version.hin.  We artificially 
split the autoheader definitions into these two separate files, and then 
#include the configure-generated _newlib_version.h into the generated 
newlib.h.

Unfortunately autoreconf does not really understand this rather 
convoluted scheme. While it allows for more than one call to 
AC_CONFIG_HEADER, to configure more than one *.hin file, it does not 
recognize the idea that autoheader should put any less than all of the 
AC_DEFINE()d entries into its output file (newlib.hin).

So this needs some extra, manual post-processing after running 
autoreconf, to remove the duplicate definitions.
  
Mike Frysinger Oct. 15, 2023, 9:21 a.m. UTC | #2
On 12 Sep 2023 20:54, Hans-Bernhard Bröker wrote:
> Am 11.09.2023 um 09:12 schrieb Sebastian Huber:
> > Hello,
> > 
> > when I run "autoreconf" in "newlib", I get the following local changes:
> [...]
> > Are these changes due to a local configuration or tooling issue or 
> > should we check in these changes?
> 
> You almost certainly should not check in those changes.  In fact, you 
> probably have to revert to the checked-in copy, or remove those changes 
> manually.
> 
> They result from the very unusual way newlib handles configuration 
> headers.  You'll find that those 4 elements are instead defined in the 
> _other_ checked-in *.hin file: _newlib_version.hin.  We artificially 
> split the autoheader definitions into these two separate files, and then 
> #include the configure-generated _newlib_version.h into the generated 
> newlib.h.
> 
> Unfortunately autoreconf does not really understand this rather 
> convoluted scheme. While it allows for more than one call to 
> AC_CONFIG_HEADER, to configure more than one *.hin file, it does not 
> recognize the idea that autoheader should put any less than all of the 
> AC_DEFINE()d entries into its output file (newlib.hin).
> 
> So this needs some extra, manual post-processing after running 
> autoreconf, to remove the duplicate definitions.

we already process newlib.h when generating it in configure to filter out
some content.  we could easily add these specific defines to the filter
to avoid confusion/mistakes during autoreconf.  i'll send a patch.
-mike
  

Patch

diff --git a/newlib/newlib.hin b/newlib/newlib.hin
index e87a5eabbb..7a1d921d6e 100644
--- a/newlib/newlib.hin
+++ b/newlib/newlib.hin
@@ -375,6 +375,9 @@ 
  /* nano version of malloc is used. */
  #undef _NANO_MALLOC

+/* "The newlib version in string format." */
+#undef _NEWLIB_VERSION
+
  /* Verify _REENT_CHECK macros allocate memory successfully. */
  #undef _REENT_CHECK_VERIFY

@@ -422,4 +425,13 @@ 
  /* Define if wide char orientation is supported. */
  #undef _WIDE_ORIENT

+/* "The newlib minor version number." */
+#undef __NEWLIB_MINOR__
+
+/* "The newlib patch level." */
+#undef __NEWLIB_PATCHLEVEL__
+
+/* "The newlib major version number." */
+#undef __NEWLIB__
+
  #endif /* !__NEWLIB_H__ */