public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: devel@edk2.groups.io, pawel.karczewski@solidigm.com
Subject: Re: [edk2-devel] Using ekd2-libc with C++20
Date: Sat, 17 Feb 2024 02:09:47 +0000	[thread overview]
Message-ID: <CAKbZUD1+i9D1NJzjWcrqD=MadCq9V8s47thAhyN2qZRN+O1jKA@mail.gmail.com> (raw)
In-Reply-To: <CAKbZUD2qPgCMnOjjw7fU9f=7SjuvHOWt3kSu+rdykw2oaJpnyw@mail.gmail.com>

On Fri, Feb 16, 2024 at 8:06 PM Pedro Falcato <pedro.falcato@gmail.com> wrote:
>
> On Fri, Feb 16, 2024 at 2:46 PM pawel.karczewski via groups.io
> <pawel.karczewski=solidigm.com@groups.io> wrote:
> >
> > Hi,
> >
> > I'm successfully building C++20 project with edk2 under the GCC compiler.
> > Currently I'm trying to add edk2-libc to this project, but encountered issue with <string.h> header.
> >
> > ```
> > edk2/StdLib/Include/string.h:487:19: error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register] register char **stringp
> > ```
> >
> > Why `strsep(register char **stringp, register const char *delim)` parameters has register storage class-class specifier?
> > C standard states the `register` keyword is only hint for the compiler and the extent to which such
> > suggestions are effective is implementation-defined. Do you see any real performance improvements thanks to this?
>
> Considering the file is Copyright(C) University of California (and the
> SCCS tags suggest 1993, which places it around 4.4BSD), this very much
> looks like a historical artifact (of old UNIX and bad compilers). I
> certainly doubt any compiler capable of building EDK2 changes its
> codegen because of it (and certainly not the calling convention, at
> least in all ABIs I know of).

I was bored and had to check :)

Old 4.4BSD string.h:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/include/string.h

So we can see that it didn't even have the register specifier in the
declaration.

However, in the definition:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/lib/libc/string/strsep.c
We can see that 'register' was present there, for what I assume was
handholding the compiler into keeping the arg variables in registers
on old UNIX (they did that *a lot*, even back in the original UNIX C
versions).

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115564): https://edk2.groups.io/g/devel/message/115564
Mute This Topic: https://groups.io/mt/104393456/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      parent reply	other threads:[~2024-02-17  2:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 10:00 [edk2-devel] Using ekd2-libc with C++20 pawel.karczewski via groups.io
2024-02-16 17:26 ` Michael D Kinney
2024-02-16 20:02   ` Pedro Falcato
2024-02-16 20:06 ` Pedro Falcato
2024-02-16 20:48   ` Michael D Kinney
2024-02-16 21:29     ` Michael D Kinney
2024-02-17  2:09   ` Pedro Falcato [this message]

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-list 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='CAKbZUD1+i9D1NJzjWcrqD=MadCq9V8s47thAhyN2qZRN+O1jKA@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /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