From patchwork Wed Oct 9 12:42:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1994841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fGUdiNvG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XNsy82rbQz1xsc for ; Wed, 9 Oct 2024 23:43:44 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8E2F038650F4 for ; Wed, 9 Oct 2024 12:43:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 68D6438650F6 for ; Wed, 9 Oct 2024 12:42:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68D6438650F6 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 68D6438650F6 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728477776; cv=none; b=STp8F3qTOGYdtI31P9EV3v9byrCEjMDdCJzxQSceuGUzHDcf0aF8KTI4GdpiXoiP6w4Q2xUn80xdeSfg4jmfGADssVuHhWzEeTZ1H3TNvekQ3T6BPcfm4755oHRi5GfK2rXHesl+iS2qMxl07Rl+c6jH1+N2604HNld0Xb2DJc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728477776; c=relaxed/simple; bh=m1cBQBxgMNUZ5GQ7zkGJ+iZU5WC1iQGeUTORgaAoBf0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=n2hW3+1v/6+jHpLYg2OjVKuR8xCYeF+VeKJMErkk4SjTxkN+AHMrHbWF66Mzc2h+UId7nPRL0LRqtgdG22VX0Ss1D6b/pQl4sbRtHD5f7+RCPKc8X43wWcw/nIxOsbCY86/shz9aPNnph4BqH8TzrH0YQj3MD5FQs33eeoV1xMw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EJJ4E5MLVc8F575z7FSGj7BEBKwZUyVBwEEcKQF2tTo=; b=fGUdiNvGNO+1M9NAFrJpJDougERtuWOdZL8tPYTqmAN58N0F8A91MfTVSjF6UZJq28M+M1 1ZJ3EwfzZUdmX+ZMgQyccBCYHY3yoHYMNqw0uMM3mouIPeY02iME4iKP93oauSjIotAngn kSGX/9TseGh2IEI3VB1Qy1yFdHt8C1s= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-0cNXWSEjNIyCa7-AsQliBQ-1; Wed, 09 Oct 2024 08:42:51 -0400 X-MC-Unique: 0cNXWSEjNIyCa7-AsQliBQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9D8391955F3E; Wed, 9 Oct 2024 12:42:50 +0000 (UTC) Received: from localhost (unknown [10.42.28.136]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DFDC719560A3; Wed, 9 Oct 2024 12:42:49 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Ignore _GLIBCXX_USE_POSIX_SEMAPHORE if not supported [PR116992] Date: Wed, 9 Oct 2024 13:42:40 +0100 Message-ID: <20241009124248.579260-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 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_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-linux. Pushed to trunk. -- >8 -- If _GLIBCXX_HAVE_POSIX_SEMAPHRE is undefined then users get an error when defining _GLIBCXX_USE_POSIX_SEMAPHORE. We can just ignore it instead (and warn them it's being ignored). This fixes a testsuite failure on hppa64-hp-hpux11.11 (and probably some other targets): FAIL: 30_threads/semaphore/platform_try_acquire_for.cc -std=gnu++20 (test for excess errors) Excess errors: semaphore:49: error: '__semaphore_impl' has not been declared libstdc++-v3/ChangeLog: PR libstdc++/116992 * include/bits/semaphore_base.h (_GLIBCXX_USE_POSIX_SEMAPHORE): Undefine and issue a warning if POSIX sem_t is not supported. * testsuite/30_threads/semaphore/platform_try_acquire_for.cc: Prune new warning. --- libstdc++-v3/include/bits/semaphore_base.h | 3 +++ .../testsuite/30_threads/semaphore/platform_try_acquire_for.cc | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h index 9d73b37e60a..dd16d2c9249 100644 --- a/libstdc++-v3/include/bits/semaphore_base.h +++ b/libstdc++-v3/include/bits/semaphore_base.h @@ -45,6 +45,9 @@ # include // errno, EINTR, EAGAIN etc. # include // SEM_VALUE_MAX # include // sem_t, sem_init, sem_wait, sem_post etc. +#elif defined(_GLIBCXX_USE_POSIX_SEMAPHORE) +# warning "POSIX semaphore not available, ignoring _GLIBCXX_USE_POSIX_SEMAPHORE" +# undef _GLIBCXX_USE_POSIX_SEMAPHORE #endif namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc b/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc index bf6cd142bf0..6d90564ea8a 100644 --- a/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc +++ b/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc @@ -5,3 +5,5 @@ // { dg-add-options libatomic } #include "try_acquire_for.cc" + +// { dg-prune-output "ignoring _GLIBCXX_USE_POSIX_SEMAPHORE" }