public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
Cc: newlib@sourceware.org
Subject: Re: [PATCH 2/2] ctype: use less short names in public header
Date: Tue, 23 Nov 2021 23:15:31 -0500	[thread overview]
Message-ID: <YZ28Y9KNqkpB1dfJ@vapier> (raw)
In-Reply-To: <43a8b21c-ac4e-fd33-d7ad-ae7738329d16@foss.arm.com>

[-- Attachment #1: Type: text/plain, Size: 1591 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-11-24  4:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07  0:21 what's up with _COMPILING_NEWLIB Mike Frysinger
2021-11-08 10:05 ` Corinna Vinschen
2021-11-08 11:46   ` Mike Frysinger
2021-11-08 15:05     ` Corinna Vinschen
2021-11-08 18:14       ` Mike Frysinger
2021-11-09  1:24 ` [PATCH 1/2] define _COMPILING_NEWLIB for all targets when compiling Mike Frysinger
2021-11-09  1:24   ` [PATCH 2/2] ctype: use less short names in public header Mike Frysinger
2021-11-09 11:38     ` Corinna Vinschen
2021-11-10  0:18       ` Mike Frysinger
2021-11-10 10:56         ` Corinna Vinschen
2021-11-30 12:18         ` Jonathan Wakely
2021-11-11  1:37     ` [PATCH v2] " Mike Frysinger
2021-11-11 10:35       ` Corinna Vinschen
2021-11-11 22:28         ` Mike Frysinger
2021-11-12 10:27           ` Corinna Vinschen
2021-11-20 20:08             ` Brian Inglis
2021-11-23 15:09     ` [PATCH 2/2] " Richard Earnshaw
2021-11-24  4:15       ` Mike Frysinger [this message]
2021-11-24 10:58         ` Richard Earnshaw
2021-11-24 11:01           ` Richard Earnshaw
2021-11-30 12:01         ` Jonathan Wakely
2021-11-30 15:14           ` Corinna Vinschen
2021-11-30 17:12             ` Jonathan Wakely
2021-11-30 17:15               ` Jonathan Wakely
2021-11-30 17:52                 ` Richard Earnshaw
2021-12-02 10:27                   ` Corinna Vinschen
2021-12-03  9:56                     ` Corinna Vinschen
2021-12-05  9:42                   ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZ28Y9KNqkpB1dfJ@vapier \
    --to=vapier@gentoo.org \
    --cc=Richard.Earnshaw@foss.arm.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).