From patchwork Mon Jan 7 16:55:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1021450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-493551-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GyxTTn65"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43YM301dSMz9sCX for ; Tue, 8 Jan 2019 03:55:39 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; q=dns; s=default; b=n8CIwzqjoqqWIZEuuKs7 rgVFEVOis16YpCRkiwcHW+Qbc8PgKsNDkdGABNcrL2aK8Pm+c4blpDq2TY6/P/NN CK0SYaV3zY5fj3+kL+cIhl/KYtrxMX/Cd7hZpu1ymydCBhVCRmAwpzNLXzZBKPym Dgd2y/HAQ13pl7O54T4uWhg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; s=default; bh=Z1op5nbOskf7QY+ndwNFW58TqI E=; b=GyxTTn65lR0vCYRKqhVvCn6x79rnOqzcfsAvGf1KJRMM17AxEouTiljiI6 Ekc8EdVdEv7U6vDJrJMkQ3x43u+THw/tRy4/jAbkuVc307X1BYSeIwst/uTmh4rd UXiOucDFRp5b/e5ATvDTNTGz4+O59/nnnHoIMQFCsCbRn2sFw= Received: (qmail 126929 invoked by alias); 7 Jan 2019 16:55:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 126913 invoked by uid 89); 7 Jan 2019 16:55:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?iso-8859-1?q?No=2C_score=3D-25=2E1_required=3D5=2E?= =?iso-8859-1?q?0_tests=BAYES_00=2CGIT_PATCH_0=2CGIT_PATCH_1=2CGIT_?= =?iso-8859-1?q?PATCH_2=2CGIT_PATCH_3=2CKAM_COUK=2CKAM_LAZY_DOMAIN_?= =?iso-8859-1?q?SECURITY_autolearn=3Dham_version=3D3=2E3=2E2_spammy?= =?iso-8859-1?q?=3Ddoesn=E2=2C_doesn=2C_b3=2C_guilty?= X-HELO: smtp1.wavenetuk.net Received: from smtp.wavenetuk.net (HELO smtp1.wavenetuk.net) (195.26.36.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Jan 2019 16:55:28 +0000 Received: from euterpe-sie.home (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp1.wavenetuk.net (Postfix) with ESMTPA id ECA12120181B; Mon, 7 Jan 2019 16:55:25 +0000 (GMT) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH, testsuite] Allow builtin-has-attribute-* to run as far as possible on targets without alias support. Message-Id: Date: Mon, 7 Jan 2019 16:55:20 +0000 Cc: Mike Stump , GCC-patches To: Martin Sebor Hi Martin, A) Some of the builtin-has-attribute tests fail because a sub-set of them need symbol alias support. Darwin has only support for weak aliases and therefore we need to skip these. However, the sub-set is small, and I am reluctant to throw out the entire set for the sake of a small number, so I propose to wrap that small number in #ifndef that can be enabled by targets without the necessary support (Darwin is not the only one, just the most frequently tested and therefore often “guilty” of finding the problem ;) ) It’s a tricky trade-off between having too many test-cases and having test cases that try to cover too many circumstances... B) [builtin-has-attribute-4.c] I am concerned by the diagnostics for the lack of support for the “protected” mode (Darwin doesn’t have this, at least at present). B.1 the reported diagnostic appears on the closing brace of the function, rather than on the statement that triggers it (line 233). B.2 I think you’re perhaps missing a %< %> pair - there’s no ‘’ around “protected". B.3. there are a bunch of other lines with the “protected” visibility marking, but no diagnostic (perhaps that’s intended, I am not sure). Addressing B is a separate issue from making the current tests pass, it might not be appropriate at this stage .. it’s more of a “head’s up”. as for the test fixes, OK for trunk? Iain gcc/testsuite/ * c-c++-common/builtin-has-attribute-3.c: Skip tests requiring symbol alias support. * c-c++-common/builtin-has-attribute-4.c: Likewise. Append match for warning that ‘protected’ attribute is not supported. diff --git a/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c b/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c index f048059..5b2e5c7 100644 --- a/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c +++ b/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c @@ -1,7 +1,9 @@ /* Verify __builtin_has_attribute return value for functions. { dg-do compile } { dg-options "-Wall -ftrack-macro-expansion=0" } - { dg-options "-Wall -Wno-narrowing -Wno-unused-local-typedefs -ftrack-macro-expansion=0" { target c++ } } */ + { dg-options "-Wall -Wno-narrowing -Wno-unused-local-typedefs -ftrack-macro-expansion=0" { target c++ } } + { dg-additional-options "-DSKIP_ALIAS" { target *-*-darwin* } } +*/ #define ATTR(...) __attribute__ ((__VA_ARGS__)) @@ -27,7 +29,9 @@ extern "C" #endif ATTR (noreturn) void fnoreturn (void) { __builtin_abort (); } +#ifndef SKIP_ALIAS ATTR (alias ("fnoreturn")) void falias (void); +#endif #define A(expect, sym, attr) \ typedef int Assert [1 - 2 * !(__builtin_has_attribute (sym, attr) == expect)] @@ -114,7 +118,7 @@ void test_alloc_size_malloc (void) A (1, fmalloc_size_3, malloc); } - +#ifndef SKIP_ALIAS void test_alias (void) { A (0, fnoreturn, alias); @@ -123,7 +127,7 @@ void test_alias (void) A (0, falias, alias ("falias")); A (0, falias, alias ("fnone")); } - +#endif void test_cold_hot (void) { diff --git a/gcc/testsuite/c-c++-common/builtin-has-attribute-4.c b/gcc/testsuite/c-c++-common/builtin-has-attribute-4.c index d56ef6b..0c36cfc 100644 --- a/gcc/testsuite/c-c++-common/builtin-has-attribute-4.c +++ b/gcc/testsuite/c-c++-common/builtin-has-attribute-4.c @@ -1,7 +1,9 @@ /* Verify __builtin_has_attribute return value for variables. { dg-do compile } { dg-options "-Wall -ftrack-macro-expansion=0" } - { dg-options "-Wall -Wno-narrowing -Wno-unused -ftrack-macro-expansion=0" { target c++ } } */ + { dg-options "-Wall -Wno-narrowing -Wno-unused -ftrack-macro-expansion=0" { target c++ } } + { dg-additional-options "-DSKIP_ALIAS" { target *-*-darwin* } } +*/ #define ATTR(...) __attribute__ ((__VA_ARGS__)) @@ -45,6 +47,7 @@ void test_aligned (void) } +#ifndef SKIP_ALIAS int vtarget; extern ATTR (alias ("vtarget")) int valias; @@ -55,7 +58,7 @@ void test_alias (void) A (1, valias, alias ("vtarget")); A (0, valias, alias ("vnone")); } - +#endif void test_cleanup (void) { @@ -227,7 +230,7 @@ void test_vector_size (void) ATTR (visibility ("default")) int vdefault; ATTR (visibility ("hidden")) int vhidden; ATTR (visibility ("internal")) int vinternal; -ATTR (visibility ("protected")) int vprotected; +ATTR (visibility ("protected")) int vprotected; void test_visibility (void) { @@ -280,6 +283,6 @@ void test_weak (void) A (1, var_init_weak, weak); A (1, var_uninit_weak, weak); -} +} /* { dg-warning "protected visibility attribute not supported" "" { target { *-*-darwin* } } } */ /* { dg-prune-output "specifies less restrictive attribute" } */