public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2] stdlib: Remove attr_write from mbstows if dst is NULL [BZ: 29265]
Date: Thu, 23 Jun 2022 00:06:40 +0200	[thread overview]
Message-ID: <YrOScKeXdivJg1QM@wildebeest.org> (raw)
In-Reply-To: <CAFUsyfL1pkO8kHD1grr_V0rLt7tncy36SNWDa44dMxLfvaknbg@mail.gmail.com>

Hi Noah,

On Wed, Jun 22, 2022 at 02:38:07PM -0700, Noah Goldstein wrote:
> I think it should be just mbstowcs, we don't pass dstlen
> 
> Does:
> 
> ```
> diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h
> index d9c2d822a5..ece553df74 100644
> --- a/stdlib/bits/stdlib.h
> +++ b/stdlib/bits/stdlib.h
> @@ -96,10 +96,10 @@ extern size_t __mbstowcs_chk (wchar_t *__restrict __dst,
>         const char *__restrict __src,
>         size_t __len, size_t __dstlen) __THROW
>      __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2));
> -extern size_t __REDIRECT_NTH (__mbstowcs_chk_nulldst,
> +extern size_t __REDIRECT_NTH (__mbstowcs_nulldst,
>         (wchar_t *__restrict __dst,
>          const char *__restrict __src,
> -        size_t __len), mbstowcs_chk)
> +        size_t __len), mbstowcs)
>      __attr_access ((__read_only__, 2));
>  extern size_t __REDIRECT_NTH (__mbstowcs_alias,
>         (wchar_t *__restrict __dst,
> @@ -118,7 +118,7 @@ __NTH (mbstowcs (wchar_t *__restrict __dst, const
> char *__restrict __src,
>   size_t __len))
>  {
>    if (__builtin_constant_p (__dst == NULL) && __dst == NULL)
> -    return __mbstowcs_chk_nulldst (__dst, __src, __len);
> +    return __mbstowcs_nulldst (__dst, __src, __len);
>    else
>      return __glibc_fortify_n (mbstowcs, __len, sizeof (wchar_t),
>         __glibc_objsize (__dst), __dst, __src, __len);
> ```
> 
> Work?

I hope I applied to correctly, there were some whitespace issues.
But no, that causes:

make[2]: Entering directory '/srv/glibc/glibc/debug'
g++ /srv/glibc/glibc-obj/debug/tst-fortify-cc-default-1.cc -c -I/srv/glibc/glibc-obj/  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common   -fpie -D_FORTIFY_SOURCE=1 -Wno-format -Wno-deprecated-declarations -Wno-error      -I../include -I/srv/glibc/glibc-obj/debug  -I/srv/glibc/glibc-obj  -I../sysdeps/unix/sysv/linux/x86_64/64  -I../sysdeps/unix/sysv/linux/x86_64  -I../sysdeps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch  -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu  -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86/include -I../sysdeps/x86  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include /srv/glibc/glibc-obj/libc-modules.h -DMODULE_NAME=testsuite -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /srv/glibc/glibc-obj/debug/tst-fortify-cc-default-1.o -MD -MP -MF /srv/glibc/glibc-obj/debug/tst-fortify-cc-default-1.o.dt -MT /srv/glibc/glibc-obj/debug/tst-fortify-cc-default-1.o
In file included from ../include/sys/cdefs.h:10,
                 from ../include/features.h:490,
                 from ./tst-fortify.c:20,
                 from /srv/glibc/glibc-obj/debug/tst-fortify-cc-default-1.cc:3:
../misc/sys/cdefs.h:424:26: error: duplicate ‘inline’
  424 | # define __always_inline __inline __attribute__ ((__always_inline__))
      |                          ^~~~~~~~
../misc/sys/cdefs.h:453:10: note: in expansion of macro ‘__always_inline’
  453 |   extern __always_inline __attribute__ ((__gnu_inline__))
      |          ^~~~~~~~~~~~~~~
../misc/sys/cdefs.h:461:29: note: in expansion of macro ‘__extern_always_inline’
  461 | # define __fortify_function __extern_always_inline __attribute_artificial__
      |                             ^~~~~~~~~~~~~~~~~~~~~~
../stdlib/bits/stdlib.h:116:17: note: in expansion of macro ‘__fortify_function’
  116 | __always_inline __fortify_function size_t
      |                 ^~~~~~~~~~~~~~~~~~
make[2]: *** [../o-iterator.mk:9: /srv/glibc/glibc-obj/debug/tst-fortify-cc-default-1.o] Error 1

I am afraid I am a little lost in the macro expansions that cause the
duplicate inline here.

Cheers,

Mark


  reply	other threads:[~2022-06-22 22:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7a0d8978-3774-49d6-a7d5-130c3268a5b6gotplt!org>
2022-06-22 20:56 ` Mark Wielaard
2022-06-22 21:38   ` Noah Goldstein
2022-06-22 22:06     ` Mark Wielaard [this message]
2022-06-22 22:34       ` Noah Goldstein
2022-06-22 22:45         ` Mark Wielaard
2022-06-22 23:02           ` Noah Goldstein
2022-06-22 22:38       ` Noah Goldstein
2022-06-22 23:16         ` Mark Wielaard
2022-06-22 23:30           ` Noah Goldstein
2022-06-21 16:18 [PATCH v1] " Noah Goldstein
2022-06-22 15:24 ` [PATCH v2] " Noah Goldstein
2022-06-22 15:30   ` Siddhesh Poyarekar

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=YrOScKeXdivJg1QM@wildebeest.org \
    --to=mark@klomp.org \
    --cc=goldstein.w.n@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@gotplt.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).