Recently I had noticed a significant change in the handling of Locales and Newlib v2.5.0, and this has been address in recent patches to the head revision of CLang.
But I have come across a more subtle change in the handling of ‘<stdint.h>’ and the ‘<inttypes.h>’ header with Newlib v2.5.0 versus v2.2.0.
In this case the “portable” formatting macros such as ‘PRIx64’ suddenly stopped working when I switched to Newlib v2.5.0 from Newlib v2.2.0 for our “free-standing” target.
Most of the ISO C headers we use come from Newlib, but the ‘<stdint.h>’ that we use comes from CLang (‘clang/lib/Headers/stdint.h’), and this has a subtle incompatibility with the other headers from Newlib v2.5.0 such as ‘<inttypes.h>’, in that the macro ‘__int64_t_defined’ is no longer defined as a consequence of other changes in Newlib, but which is defined if I use the Newlib version of ‘<stdint.h>’. However, I find the CLang version of this header more reliable and prefer to use it.
There is a very simple change which can be made to CLang’s ‘<stdint.h>’ that works with Newlib v2.5.0 and which is also backward compatible with older versions of Newlib, and that is to add the following to CLang’s ‘<stdint.h>’ in the ‘#else’ clause for the Free-standing vs Hosted check (Line 104 in the CLang v4.0.0 release sources):
# include <sys/_stdint.h>
#endif /* __NEWLIB__ */
I have tested this with Newlib v2.2.0 and v2.5.0, and after visual inspection I see no reason that it will not work for all versions of Newlib in between. I have not checked older versions of Newlib. Also, since I am not building a Hosted compiler, I have not checked if a similar change is necessary for the hosted case.