On Sun, 13 Oct 2024 at 23:23, Sam James <s...@gentoo.org> wrote:
>
> Otherwise we get failures with toolchains that have _FORTIFY_SOURCE
> defined already to a different value like 3.

I was going to say we could do:

#ifndef _FORTIFY_SOURCE
#define _FORTIFY_SOURCE 2
#endif

But I realised that the original names.cc test will already run with
whatever default value the toolchain uses. So this looks fine, thanks.

>
> libstdc++-v3/ChangeLog:
>
>         * testsuite/17_intro/names_fortify.cc: Undefine _FORTIFY_SOURCE.
> ---
> I'll commit later if no objections.
>
>  libstdc++-v3/testsuite/17_intro/names_fortify.cc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libstdc++-v3/testsuite/17_intro/names_fortify.cc 
> b/libstdc++-v3/testsuite/17_intro/names_fortify.cc
> index c975412074be..f24af21f8a70 100644
> --- a/libstdc++-v3/testsuite/17_intro/names_fortify.cc
> +++ b/libstdc++-v3/testsuite/17_intro/names_fortify.cc
> @@ -1,6 +1,7 @@
>  // { dg-do compile { target *-*-linux* } }
>  // { dg-add-options no_pch }
>
> +#undef _FORTIFY_SOURCE
>  #define _FORTIFY_SOURCE 2
>  // Now we can define the macros to poison uses of non-reserved names:
>  #include "names.cc"
> --
> 2.47.0
>

Reply via email to