From: Nick Desaulniers <ndesaulniers@google.com>
To: Joe Perches <joe@perches.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Dávid Bolvanský" <david.bolvansky@gmail.com>,
"Eli Friedman" <efriedma@quicinc.com>,
"# 3.4.x" <stable@vger.kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Tony Luck" <tony.luck@intel.com>,
"Yury Norov" <yury.norov@gmail.com>,
"Daniel Axtens" <dja@axtens.net>,
"Arvind Sankar" <nivedita@alum.mit.edu>,
"Dan Williams" <dan.j.williams@intel.com>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Kees Cook" <keescook@chromium.org>,
"Alexandru Ardelean" <alexandru.ardelean@analog.com>,
LKML <linux-kernel@vger.kernel.org>,
clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH] lib/string.c: implement stpcpy
Date: Fri, 14 Aug 2020 19:00:22 -0700 [thread overview]
Message-ID: <CAKwvOdn8PdK-3Xhm-JFG-=1djoPPEMcANjXarGpLUTkahJoFJw@mail.gmail.com> (raw)
In-Reply-To: <562003af51ca0b08f2108147b8d6e75cec18f3fd.camel@perches.com>
On Fri, Aug 14, 2020 at 5:52 PM Joe Perches <joe@perches.com> wrote:
>
> On Fri, 2020-08-14 at 17:24 -0700, Nick Desaulniers wrote:
> > LLVM implemented a recent "libcall optimization" that lowers calls to
> > `sprintf(dest, "%s", str)` where the return value is used to
> > `stpcpy(dest, str) - dest`. This generally avoids the machinery involved
> > in parsing format strings.
> []
> > diff --git a/include/linux/string.h b/include/linux/string.h
> []
> > @@ -31,6 +31,9 @@ size_t strlcpy(char *, const char *, size_t);
> > #ifndef __HAVE_ARCH_STRSCPY
> > ssize_t strscpy(char *, const char *, size_t);
> > #endif
> > +#ifndef __HAVE_ARCH_STPCPY
> > +extern char *stpcpy(char *__restrict, const char *__restrict__);
>
> Why use two different forms for __restrict and __restrict__?
> Any real reason to use __restrict__ at all?
Bah, sorry, I recently enabled some setting in my ~/.vimrc to help me
find my cursor better:
" highlight cursor
set cursorline
set cursorcolumn
Turns out this makes it pretty difficult to see underscores, or the
lack thereof. Will fix up.
>
> It's used nowhere else in the kernel.
>
> $ git grep -w -P '__restrict_{0,2}'
> scripts/genksyms/keywords.c: // According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict". KAO
> scripts/genksyms/keywords.c: { "__restrict__", RESTRICT_KEYW },
>
>
--
Thanks,
~Nick Desaulniers
next prev parent reply other threads:[~2020-08-15 22:01 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-15 0:24 [PATCH] lib/string.c: implement stpcpy Nick Desaulniers
2020-08-15 0:52 ` Joe Perches
2020-08-15 2:00 ` Nick Desaulniers [this message]
2020-08-15 0:53 ` Sami Tolvanen
2020-08-15 1:33 ` Arvind Sankar
2020-08-15 1:40 ` Arvind Sankar
2020-08-15 2:09 ` [PATCH v2] " Nick Desaulniers
2020-08-15 2:58 ` Arvind Sankar
2020-08-15 3:42 ` Joe Perches
2020-08-15 16:34 ` Kees Cook
2020-08-15 17:38 ` Dávid Bolvanský
2020-08-15 20:47 ` Nick Desaulniers
2020-08-15 21:23 ` Joe Perches
2020-08-15 21:27 ` Dávid Bolvanský
2020-08-15 21:28 ` Nick Desaulniers
2020-08-15 21:31 ` Joe Perches
2020-08-15 22:17 ` Nick Desaulniers
2020-08-16 0:19 ` Fangrui Song
2020-08-16 5:22 ` Sedat Dilek
2020-08-16 15:02 ` Arvind Sankar
2020-08-17 17:14 ` Sami Tolvanen
2020-08-17 18:36 ` Nick Desaulniers
2020-08-17 19:15 ` Kees Cook
2020-08-17 20:13 ` Arvind Sankar
2020-08-17 21:45 ` Nick Desaulniers
[not found] ` <77557c29286140dea726cc334b4f59fc@AcuMS.aculab.com>
2020-08-18 8:32 ` Joe Perches
2020-08-17 19:16 ` Kees Cook
2020-08-15 2:00 ` [PATCH] " Nick Desaulniers
2020-08-15 22:17 ` David Laight
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='CAKwvOdn8PdK-3Xhm-JFG-=1djoPPEMcANjXarGpLUTkahJoFJw@mail.gmail.com' \
--to=ndesaulniers@google.com \
--cc=akpm@linux-foundation.org \
--cc=alexandru.ardelean@analog.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=dan.j.williams@intel.com \
--cc=david.bolvansky@gmail.com \
--cc=dja@axtens.net \
--cc=efriedma@quicinc.com \
--cc=joe@perches.com \
--cc=joel@joelfernandes.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nivedita@alum.mit.edu \
--cc=samitolvanen@google.com \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=yury.norov@gmail.com \
/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 NNTP newsgroup(s).