Message ID | ebc5b615-b75a-443e-94be-7be27b95888d@gmail.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1875782vqb; Sun, 29 Oct 2023 15:15:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHr+yUv0E6CBYMsdsDqWdranYiMThoo8C0qvNDwjtJIcCwGojql6YUAgiZX9Q4A/pFOhAzF X-Received: by 2002:a05:620a:454b:b0:767:f178:b571 with SMTP id u11-20020a05620a454b00b00767f178b571mr17918452qkp.10.1698617731744; Sun, 29 Oct 2023 15:15:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698617731; cv=pass; d=google.com; s=arc-20160816; b=STpqAi1ULq9VwlozIiSWfodO4zZx7+yh/CI7HcXs5fnVBpyPGOzZcTQw3QrAks7eEo cNGLtBS66WPU3kuqamCb4RLStYfeJ/bsZjSsx+BhYh7Mta1Sq2PYBqqUeRqTio3lSQU2 zLZ5fUsqYfwpliRzC7rKwZVfkuOx4lsll1g96GeWwMnI6+tne19YKxH8RQFmzva9bohA 6kupRZOSAQcK8a4A2ET6odXEKRJ+X68obKr+Z3mysIttwAc4/hZhx45tsVmgcMItP8c2 AaqvHMr5uZy6LS3ByiOdRVgTHPr8yDfZw7sSZv12f0eiKDlG7S0tvlEBTEmClgrmTDLg ZGKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=AosM2T8yx9Sw4Baa8BazXHu+j3s0zX623FbNei7gOJU=; fh=hkNCFrDbuz5Wm4FQHPXCqeNb7VvLMjF0pNEQQEeeYIs=; b=JmxT9ii3V/6r3On5qaYI3Ihk7l4uhbw/fw9AXY4trycL7NuXS6c7H1pj9zmru5wsEm OgS78SCdga9Xm5X1prv1aQXDLyyCv8hJCwxudtna8nfNwD0aD6lWhivuBiGVbNSgMNsv a7ljFObF+Cd1yryjDvO4YPX2+n/f6NxZyQY/+6H1H9I87z3wTT+6ZpNbmMuN24wtPn3y Of6TDOWVVqXrHnFN3/h0ZgFWrsLdO4bIwp282S8Sk0vsxg9avOEXzmafUcScmgw/eJef xLnRJj7gSbtng4AaxvZP1LxSLRY5+0/0+J9Jk0ignV4I1obJ3+BRXxElHbHDP4k2c21r 67SA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Xr15UIaq; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u7-20020a05620a0c4700b007759afd289bsi4831312qki.133.2023.10.29.15.15.31 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:15:31 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Xr15UIaq; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E07C3870918 for <ouuuleilei@gmail.com>; Sun, 29 Oct 2023 21:11:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id A005C385828D; Sun, 29 Oct 2023 21:11:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A005C385828D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A005C385828D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698613881; cv=none; b=G1xra5J/3ouD5FEjJ2tLRyqnARdZXN8IA3g7y/nL0D0DkB463TuJUw9FkoFBDtc1PzLvkVqwUHqIc3U4N3xD7xuBwNFyJtlxH6CL6iL4YxapVsiscuZ7YYFn1YcRLoUmskIoVH0U47PQgvb8/qjRdnVYaYZbc1vsmQloWgMdb+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698613881; c=relaxed/simple; bh=gOUBqabgU3WFa3/Q9or8cPYkmAUCftdquM40voKzYBA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=hGqnRLtN3vzAxX9Ef6EIQbScPDRZDV1gZcovS2Mb19/fZFdps2lao9QdJILQe9Iw1t4Q7BuFQhp2fCHJ/5L8gjc57L8ipkn0qeFXhQm/hbg/TdzSTVs3pLbPCgDTq6EDQCwiYyj3vBSHlUbtID35vgFnsc5D7zqN24hC6fobuvk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40836ea8cbaso29571465e9.0; Sun, 29 Oct 2023 14:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698613877; x=1699218677; darn=gcc.gnu.org; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=AosM2T8yx9Sw4Baa8BazXHu+j3s0zX623FbNei7gOJU=; b=Xr15UIaq3LSpWDH7CAVI8nfM7vh+cqpw5s5+tQgmvTeZf+lHPtF6OwyciH+KLmRV1p NSzhM2lylXiwAvxHFAJ5aR0PCc5FJH0hVGwlNUuY+7AlnRdeyO4OqcgGj3XD7hVhXmM+ ULFg3i89PlDqsKoRPJEYd7lcHL0X9We47riUW/ZF8x9ZtG2V/xPE5tWV6piQ/rBYGGB2 siKbr+CfmlXoMg236871R2bC1bdGy/4IayHGqAyhtZgXn0ehFdSMnXcY6eC5dOpmhidg ClJWta7X8jEP+wMEIa+fpznpfuPtwOhfvJg9whgN8hM+D8DH/KgkiavKozE4whDSZTWv x7Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698613877; x=1699218677; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AosM2T8yx9Sw4Baa8BazXHu+j3s0zX623FbNei7gOJU=; b=Ra7azeaPL7+xJvM2hLoSAAtZTPEDDE/Pscrv/bgJQhIEb8Fi469RL1HCX+1YqKyKv9 XtFpqKKtBNbI2OSNeVXooQ9tARl6F/c/ktAD4bhgyzWeoe+jZkU+rH4sBIv3FPXv9TKZ G8CuVMwMeSIofM+3RBCPnfO7GtBKdJN7jYAvW+QS0c3bgDhc82QU4vFN64R65cgjmKp7 f+1saf7rOXQE9pKBngXM1YMeg9b5X7MF5nF/Uov5sfNlIpFB42I+udX40iNu8iXgJ9D7 9dpN//+UHAG99/xsgnuygUgsBJCF7L4Z1bTMcLiH/PTbjVTUVoUJGdHggdX0VlrJ2yM+ VDVg== X-Gm-Message-State: AOJu0Yy97PuX07oYIJ8F4ir+vmZzdmMk7tAroABofsrDBG+Ia3ftESYQ 7sgRloX9ny9mYzrKL1iSqBbDryhdXF4= X-Received: by 2002:a05:600c:1c90:b0:405:37bb:d942 with SMTP id k16-20020a05600c1c9000b0040537bbd942mr6852029wms.4.1698613876679; Sun, 29 Oct 2023 14:11:16 -0700 (PDT) Received: from ?IPV6:2a01:e0a:1dc:b1c0:1b3f:1348:b8b5:6b0? ([2a01:e0a:1dc:b1c0:1b3f:1348:b8b5:6b0]) by smtp.gmail.com with ESMTPSA id f7-20020a7bcd07000000b003fee567235bsm10865013wmj.1.2023.10.29.14.11.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Oct 2023 14:11:15 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------zehojayVtLXHNyAsxroF9eVy" Message-ID: <ebc5b615-b75a-443e-94be-7be27b95888d@gmail.com> Date: Sun, 29 Oct 2023 22:11:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: libstdc++ <libstdc++@gcc.gnu.org> Cc: gcc-patches <gcc-patches@gcc.gnu.org> From: =?utf-8?q?Fran=C3=A7ois_Dumont?= <frs.dumont@gmail.com> Subject: [committed][_GLIBCXX_INLINE_VERSION] Fix constract violation X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781129786912594805 X-GMAIL-MSGID: 1781129786912594805 |
Series |
[committed,_GLIBCXX_INLINE_VERSION] Fix constract violation
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
François Dumont
Oct. 29, 2023, 9:11 p.m. UTC
This fixes handle_contract_violation under versioned namespace mode. Tested under Linux x64 and confirmed to also fix Darwin build. libstdc++: [_GLIBCXX_INLINE_VERSION] Provide handle_contract_violation symbol libstdc++-v3/ChangeLog: * src/experimental/contract.cc [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide symbol without version namespace decoration for gcc. François
Comments
On Sun, 29 Oct 2023 at 21:11, François Dumont <frs.dumont@gmail.com> wrote: > > This fixes handle_contract_violation under versioned namespace mode. > > Tested under Linux x64 and confirmed to also fix Darwin build. > > libstdc++: [_GLIBCXX_INLINE_VERSION] Provide handle_contract_violation > symbol > > libstdc++-v3/ChangeLog: > > * src/experimental/contract.cc > [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide > symbol > without version namespace decoration for gcc. >+#if _GLIBCXX_INLINE_VERSION >+// Provide symbol without version namespace decoration for gcc. For the comment in the code, I think this would be better: // The compiler expects the contract_violation class to be in an unversioned // namespace, so provide a forwarding function with the expected symbol name. Do we want the forwarding function to be a weak symbol? The main handler function is weak because we want users to be able to override it with their own handler. But for this new forwarding function, they can't even declare it (because it has a reserved name that doesn't demangle to a valid type for the versioned namespace build).
On 30/10/2023 14:45, Jonathan Wakely wrote: > On Sun, 29 Oct 2023 at 21:11, François Dumont <frs.dumont@gmail.com> wrote: >> This fixes handle_contract_violation under versioned namespace mode. >> >> Tested under Linux x64 and confirmed to also fix Darwin build. >> >> libstdc++: [_GLIBCXX_INLINE_VERSION] Provide handle_contract_violation >> symbol >> >> libstdc++-v3/ChangeLog: >> >> * src/experimental/contract.cc >> [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide >> symbol >> without version namespace decoration for gcc. >> +#if _GLIBCXX_INLINE_VERSION >> +// Provide symbol without version namespace decoration for gcc. > For the comment in the code, I think this would be better: > > // The compiler expects the contract_violation class to be in an unversioned > // namespace, so provide a forwarding function with the expected symbol name. Sure, I'll update it. > Do we want the forwarding function to be a weak symbol? The main > handler function is weak because we want users to be able to override > it with their own handler. But for this new forwarding function, they > can't even declare it (because it has a reserved name that doesn't > demangle to a valid type for the versioned namespace build). > Good point, I see no reason neither so I'll remove it.
On Mon, 30 Oct 2023, 18:31 François Dumont, <frs.dumont@gmail.com> wrote: > > On 30/10/2023 14:45, Jonathan Wakely wrote: > > On Sun, 29 Oct 2023 at 21:11, François Dumont <frs.dumont@gmail.com> > wrote: > >> This fixes handle_contract_violation under versioned namespace mode. > >> > >> Tested under Linux x64 and confirmed to also fix Darwin build. > >> > >> libstdc++: [_GLIBCXX_INLINE_VERSION] Provide handle_contract_violation > >> symbol > >> > >> libstdc++-v3/ChangeLog: > >> > >> * src/experimental/contract.cc > >> [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide > >> symbol > >> without version namespace decoration for gcc. > >> +#if _GLIBCXX_INLINE_VERSION > >> +// Provide symbol without version namespace decoration for gcc. > > For the comment in the code, I think this would be better: > > > > // The compiler expects the contract_violation class to be in an > unversioned > > // namespace, so provide a forwarding function with the expected symbol > name. > Sure, I'll update it. > > Do we want the forwarding function to be a weak symbol? The main > > handler function is weak because we want users to be able to override > > it with their own handler. But for this new forwarding function, they > > can't even declare it (because it has a reserved name that doesn't > > demangle to a valid type for the versioned namespace build). > > > Good point, I see no reason neither so I'll remove it. > Thanks, looks good for trunk (and gcc-13 maybe?) with that change. >
diff --git a/libstdc++-v3/src/experimental/contract.cc b/libstdc++-v3/src/experimental/contract.cc index 504a6c041f1..d550b49c4eb 100644 --- a/libstdc++-v3/src/experimental/contract.cc +++ b/libstdc++-v3/src/experimental/contract.cc @@ -67,3 +67,11 @@ handle_contract_violation (const std::experimental::contract_violation &violatio std::cerr << std::endl; #endif } + +#if _GLIBCXX_INLINE_VERSION +// Provide symbol without version namespace decoration for gcc. +extern "C" __attribute__ ((weak)) void +_Z25handle_contract_violationRKNSt12experimental18contract_violationE +(const std::experimental::contract_violation &violation) +{ handle_contract_violation(violation); } +#endif