Re: [PATCH 2/2] ctype: use less short names in public header
Mike Frysinger <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <YZ28Y9KNqkpB1dfJ@vapier> |
On 23 Nov 2021 15:09, Richard Earnshaw wrote: > This is wrong and breaks all old versions of C++. this is a bit vague. it would help if you provided details as to what broke. i doubt this broke all old versions of C++ everywhere. i'm guessing you're referring to the GNU C++ (libstdc++) library specifically and its hardcoding of newlib's internal ctype define names. https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/config/os/newlib/ctype_base.h;hb=releases/gcc-11.2.0 if you're talking about something else, please state so clearly. > The GNU sim code should not be using reserved names (those starting _) > in normal source code. Such names are reserved to the implementation. that's not really a good reason to go pooping all over the namespace. we can maintain backwards compat here for C++ code fairly easily: --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -71,6 +71,16 @@ enum /* For C++ backward-compatibility only. */ extern __IMPORT const char _ctype_[]; +#ifdef __cplusplus +# define _U _ISupper +# define _L _ISlower +# define _N _ISdigit +# define _S _ISspace +# define _P _ISpunct +# define _C _IScntrl +# define _X _ISxdigit +# define _B _ISblank +#endif #ifdef __HAVE_LOCALE_INFO__ const char *__locale_ctype_ptr (void); considering the numerical value is part of the ABI, not the name, libstdc++ could have inlined the constant values instead. i wonder how long of a version skew is reasonable if we wanted to transition it to the new names to match what glibc uses. -mike
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmGdvGMACgkQQWM7n+g3 9YGS1w//YDIXWwLbx3lqBGTfkSXmQtjauGVXWEKYh+St4eXVj1rgZySnn+tZ8lrn qymlzl6sA0FCn0UHxP2LQyysco3Tv/Z6m1aOyXb8QuL8spuqkN+8nLDhQps42MH9 v2Rk+YoQrC1HNSer3vYhquNhqM0OH2iDGc8cpmJ0x0Vlyzi/XomMh4JDzMLBSDT8 BoGfJcqXHcAF9APY84JVjFM5LVX5hT3uStTHn7ZbPcKlloVNknk21nahR/wrmqhr tmXhmshiWEe36yTdxrks1j6IIYWskK1M1XfJ051kjag+0Ql/0rEbZLkoBgVHmHP2 Z1uvK0DlI6Bing8UzKdTV4IlAK5rwJcQ9hrVNak5y+z8L4MhDXPAbyFZh5jdhJ7n salEyKBsz3Px8q52t9R0oJlFUy3Xq5W2QXX4weIv2cYlemoxzUPa6hUtb0PwtJB+ gjI/JSnoHanwf8WrnTh3r/9bX/hQVW9/lqTh3w3MHTHAApqC6zWXYbpD76awJ+EC 5Q+JdAk806UpxHMcp3MGmR1bkRJNoxwERMN5QR0QDoEtI4gLP1d57IvqPm5V5ixh Z66iKkc5OgkdufkasGnaueFG8NDA9KmczlEWwO14bmHdFLR4f9V09OZlbQLFbNDh cVy0jqfi87KvsS9QCBV86ApPz39mnRn+Jq8x28fZKpwpY3oIH6s= =1c0T -----END PGP SIGNATURE-----