From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 0C8AC385C411 for ; Mon, 9 Aug 2021 14:27:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0C8AC385C411 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-275-wBo9GdE6OdWZ_fhyGw1YIA-1; Mon, 09 Aug 2021 10:27:23 -0400 X-MC-Unique: wBo9GdE6OdWZ_fhyGw1YIA-1 Received: by mail-wm1-f69.google.com with SMTP id n32-20020a05600c3ba0b02902e674c68feeso54370wms.3 for ; Mon, 09 Aug 2021 07:27:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vNpqLimpTjiSob4aZGZRtB4lCXBvmA+opoDGbf4TgfE=; b=E2cmim0OS+9UuLz2yiul9ESRCuH0n/YUCscA/7RsbxBZkQ5x46IHltrJeOEuJtmDqg WPMSnMvCCQeKhl+HKciC924NSisjezsxcCCp63Aph9AeosEhqBKskUQ8E6EUS9GoYRVD Fb4WMkahctbhKA8JPkINX6Ejy/kXoCw/NCdHlm4PS5BHJIm1zJgcMSUt9za8m96cD41h 5v4ZD5km9gGn/sx9YTwT0Gv9e6rqwM5xkimSMyuxWUwOTnbDFYBE8kKkBx+QpirzVaxl M7fckHYzbp9OsxL1LYu2ZFtlymHqX55dZ34hibNbJX+J08u791gp3rH/kStnDx3f8iYj 9P9w== X-Gm-Message-State: AOAM531Dc8PrdRN9AyGAQaoPRuO+nUTpbfXwmdfgGIcpMS1NYZtv0eCV wniX+ag3jMiaVbdcbHskKs/vD2u97iwpFkdDweDS35opyOZ6R4bEpVkacJy3V7hbNEPHZ/1FD1/ SkkmVb5NTbCZhgBzu+aOqoh0cYfcQBts= X-Received: by 2002:a05:600c:4fd1:: with SMTP id o17mr34495762wmq.131.1628519242023; Mon, 09 Aug 2021 07:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt0kpmDjcUFGzyaPkLjOk+zd1th8lh+JAwMcbwcj7IvtKd7NNE49X/HEABApR68ICrHswbClvi6HJOjf891pE= X-Received: by 2002:a05:600c:4fd1:: with SMTP id o17mr34495746wmq.131.1628519241828; Mon, 09 Aug 2021 07:27:21 -0700 (PDT) MIME-Version: 1.0 References: <7f94ec40-6cec-59c1-2281-066e1a15c267@redhat.com> <5ecf624e-a191-0cd2-19bb-cae92a88cdbf@gmail.com> In-Reply-To: <5ecf624e-a191-0cd2-19bb-cae92a88cdbf@gmail.com> From: Jonathan Wakely Date: Mon, 9 Aug 2021 15:27:11 +0100 Message-ID: Subject: Re: trunk -D_GLIBCXX_DEBUG #include fails To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2021 14:27:29 -0000 On Mon, 9 Aug 2021 at 13:05, Fran=C3=A7ois Dumont via Libstdc++ wrote: > > On 09/08/21 12:05 pm, Jonathan Wakely via Libstdc++ wrote: > > On Mon, 9 Aug 2021 at 10:51, Stephan Bergmann via Libstdc++ > > wrote: > >> Not sure why I started to experience this now with a recent > >> GCC/libstdc++ trunk build: > >> > >>> $ cat test.cc > >>> #include > >>> $ gcc/trunk/inst/bin/g++ -D_GLIBCXX_DEBUG -fsyntax-only test.cc > >>> In file included from /home/sbergman/gcc/trunk/inst/include/c++/12.0.= 0/bits/regex_automaton.h:401, > >>> from /home/sbergman/gcc/trunk/inst/include/c++/12.0= .0/regex:60, > >>> from test.cc:1: > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_automaton= .tcc: In member function =E2=80=98std::__detail::_StateSeq<_TraitsT> std::_= _detail::_StateSeq<_TraitsT>::_M_clone()=E2=80=99: > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_automaton= .tcc:197:12: error: =E2=80=98map=E2=80=99 is not a member of =E2=80=98std= =E2=80=99 > >>> 197 | std::map<_StateIdT, _StateIdT> __m; > >>> | ^~~ > >> [...] > >>> In file included from /home/sbergman/gcc/trunk/inst/include/c++/12.0.= 0/regex:62, > >>> from test.cc:1: > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_compiler.= h: At global scope: > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_compiler.= h:541:12: error: =E2=80=98vector=E2=80=99 in namespace =E2=80=98std=E2=80= =99 does not name a template type > >>> 541 | std::vector<_CharT> _M_char_set; > >>> | ^~~~~~ > >> [...] > >> > >> where neither the use of std::map in bits/regex_automaton.tcc nor the > >> use of std::vector in bits/regex_compiler.h are in _GLIBCXX_DEBUG-only > >> code (but compiling without -D_GLIBCXX_DEBUG succeeded). > > With that flag the container implementations are defined in namespace > > __gnu_cxx1998, and std::map is supposed to refer to __gnu_debug::map. > > But the debug map is declared in a header which isn't included by > > since I replaced with . > > > > > > > >> Anyway, what would apparently fix it for me is > >> > >>> diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/st= d/regex > >>> index 04fb8b2d971..29fd2956fd0 100644 > >>> --- a/libstdc++-v3/include/std/regex > >>> +++ b/libstdc++-v3/include/std/regex > >>> @@ -42,6 +42,11 @@ > >>> #include > >>> #include > >>> > >>> +#if defined _GLIBCXX_DEBUG > >>> +#include > >>> +#include > >>> +#endif > >>> + > > I think we can do this instead: > > > > --- a/libstdc++-v3/include/std/regex > > +++ b/libstdc++-v3/include/std/regex > > @@ -63,6 +63,11 @@ > > #include > > #include > > > > +#ifdef _GLIBCXX_DEBUG > > +# include > > +# include > > +#endif > > + > > #if __cplusplus >=3D 201703L && _GLIBCXX_USE_CXX11_ABI > > namespace std _GLIBCXX_VISIBILITY(default) > > { > > > > > > I'll test it, thanks for the report. > > > We are confident about the usage of those containers in the regex > implementation, aren't we ? > > You can normally avoid the includes if you use for example > _GLIBCXX_STD_C::map rather than std::map. Yes, I have a patch to do that.