This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Automated the generation of the __NEWLIB__, __NEWLIB_MINOR__ and __NEWLIB_PATCHLEVEL__ macros.

On Fri, Jan 29, 2016 at 10:11:25AM -0500, Jeff Johnston wrote:
> This idea could be modified to do something like glibc does for bringing in particular macros
> from a header file (e.g. __need_size_t to bring in just size_t from stddef.h).  Thus, you
> set __need_version_macros and include newlib.h in <sys/features.h> and modify
> accordingly.  This restores the current behaviour.  What do you think?

Thanks Jeff. So, if I understand you correctly, we should do the

In <sys/features.h>:
#define __need_newlib_version_macros 1
#include <newlib.h>

In the generated newlib.h: 
#if defined(__need_newlib_version_macros)
  #undef __need_newlib_version_macros
  #define __NEWLIB__ 2
  #define __NEWLIB_MINOR__ 2
  #define __NEWLIB_PATCHLEVEL__ 0

This however means that <sys/features.h> will now get all the rest of
the defines in newlib.h as well. Would this harm? To work around this
cleanly, one would have to do this __need_newlib_<def_group> trick for
all currently generated #defines in newlib.h.

I can offer one of the either A or B:

A: The following two patches:
  1. A __need_newlib_<def_group> trick for all generated #defines in newlib.h
  2. Move definition of the newlib version macros to newlib.h

B: Just a simple patch, as you suggested, but with the downside that
<sys/features.h> will get all the rest of the generated #defines in
newlib.h as well.

What would you suggest?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]