Message ID | 3d54f47a-983d-8900-7ebd-64ab55ed406c@linux.ibm.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e252:0:0:0:0:0 with SMTP id bl18csp842254wrb; Wed, 20 Jul 2022 02:32:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uDOrxEgJprbTVct0Cbg8p1tGRrnj+3LYkquEBUULVfkFz/cm3rZcaOoKA+dxwRLx3PkBs3 X-Received: by 2002:a05:6402:500b:b0:431:78d0:bf9d with SMTP id p11-20020a056402500b00b0043178d0bf9dmr48884339eda.184.1658309575442; Wed, 20 Jul 2022 02:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658309575; cv=none; d=google.com; s=arc-20160816; b=CddvvY7dzC2UI9WbSNNIep+xXyPizJBMe2y35o3t7tIVi+vTRQNVWlTqkwmyU7gZ2P z/b6CayaCpkkHqnJK6YYEMEArU8rKaQj1DyFZNAhE9NKFgNe247yMALGGM9yBUEFLSdJ nPxfxvqtDrbEfEDleDUXZV8o7DriAAFiEV1RF5zlmyevi/ssz2nW+qJ8LUa+pE/vFFJ6 BUVB3nxOY4Rht3S+GRFUxOVOuDhSudryab1Ny9HjOcjah6bra7Ev9OAWqZAGS8u6PqOc ubzcsgmmVTamvVDhGVdfKXRQz0lWX3d83JYuqWkOKEXlOmcyKR87xdoSMTEMtILMc6Un I+xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=BrU184u1WCLP0RIdFx+cv2T2T3mT9951CwUX3YGUpiA=; b=LQ/3CvuhzxyXTcB2Wl6/hc9tblvORBEefoVWfAdh8YkRGx4Iqts5mRrKkan4/GKfuA 2qh3tKZSPoyzPoZRmxnJOqeNV7v/QUlHgby7dy/Iq6mhiOsEG3QC7Wgq8xjT6mauNiBa Twi4aZKaUPSsQlVbMLbYlDoexrC+UKoRBslHKtUvF+lJVzRWJvfih0xnkeu/LsWUFqXz UkL429UPuzbthXwFUzcZoh2MmHsRZAkqpNkay5XhA9+A80bHztyDA3EbsPLGiYGj8C0c hW7v9yNN0YuABOFOT7o8u6xZUEWeW8WGJbwK654PcT9yUtwBEcKZs5QPg4PF1mji07Hz fBwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="g/f4By/N"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id t6-20020a056402240600b0043bb7a6477csi2442560eda.527.2022.07.20.02.32.55 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 02:32:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="g/f4By/N"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 73F2038582A6 for <ouuuleilei@gmail.com>; Wed, 20 Jul 2022 09:32:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73F2038582A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658309574; bh=BrU184u1WCLP0RIdFx+cv2T2T3mT9951CwUX3YGUpiA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=g/f4By/NbyuLxo509GWm1iAiFOxDqdxFLFJ+S6U1OshVgBiO+q46QSTNyvJFcwuRX lJk2rsLCV0BbiurDwz+mv/lzvJetYP2B5OTDKy0TAqKfKDTQSdV0O6YOjBK7fqgMNF igjgKGbNJYIisDumJZk33eiCR18sYvILeN4B3Z+Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 483BD3858D37 for <gcc-patches@gcc.gnu.org>; Wed, 20 Jul 2022 09:32:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 483BD3858D37 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26K9LUvt011798; Wed, 20 Jul 2022 09:32:09 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hef0nr8f9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 09:32:08 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26K9MPhv013962; Wed, 20 Jul 2022 09:32:08 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hef0nr8dt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 09:32:08 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26K9Mr2b002092; Wed, 20 Jul 2022 09:32:06 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03ams.nl.ibm.com with ESMTP id 3hbmy8wd0k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 09:32:05 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26K9W34u9437678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jul 2022 09:32:03 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA553AE045; Wed, 20 Jul 2022 09:32:03 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F96CAE04D; Wed, 20 Jul 2022 09:32:02 +0000 (GMT) Received: from [9.197.246.191] (unknown [9.197.246.191]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 20 Jul 2022 09:32:01 +0000 (GMT) Message-ID: <3d54f47a-983d-8900-7ebd-64ab55ed406c@linux.ibm.com> Date: Wed, 20 Jul 2022 17:32:01 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches <gcc-patches@gcc.gnu.org> Subject: [PATCH] rs6000/test: Fix empty TU in some cases of effective targets Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: biXkAacPgaCZiixQv4YntarRW34ZDpyQ X-Proofpoint-GUID: g2If-4FpNnI2uoygZX4x391DVa-xzU2B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-20_04,2022-07-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 adultscore=0 priorityscore=1501 mlxlogscore=989 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207200039 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, 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.29 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> From: "Kewen.Lin via Gcc-patches" <gcc-patches@gcc.gnu.org> Reply-To: "Kewen.Lin" <linkw@linux.ibm.com> Cc: Peter Bergner <bergner@linux.ibm.com>, David Edelsohn <dje.gcc@gmail.com>, Segher Boessenkool <segher@kernel.crashing.org> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1738863621162968823?= X-GMAIL-MSGID: =?utf-8?q?1738863621162968823?= |
Series |
rs6000/test: Fix empty TU in some cases of effective targets
|
|
Commit Message
Li, Pan2 via Gcc-patches
July 20, 2022, 9:32 a.m. UTC
Hi, As the failure of test case gcc.target/powerpc/pr92398.p9-.c in PR106345 shows, some test sources for some powerpc effective targets use empty translation unit wrongly. The test sources could go with options like "-ansi -pedantic-errors", then those effective target checkings will fail unexpectedly with the error messages like: error: ISO C forbids an empty translation unit [-Wpedantic] This patch is to fix empty TUs with one dummy variable definition accordingly. Tested on powerpc64-linux-gnu P7 and P8 and powerpc64le-linux-gnu P9 and P10. Excepting for the failures on gcc.target/powerpc/pr92398.p9-.c fixed, I can see it helps to bring back some testing coverage like: NA->PASS: gcc.target/powerpc/pr92398.p9+.c NA->PASS: gcc.target/powerpc/pr93453-1.c I'll push this soon if no objections. BR, Kewen ----- PR testsuite/106345 gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_powerpc_sqrt): Add a variable definition to avoid pedwarn about empty translation unit. (check_effective_target_has_arch_pwr5): Likewise. (check_effective_target_has_arch_pwr6): Likewise. (check_effective_target_has_arch_pwr7): Likewise. (check_effective_target_has_arch_pwr8): Likewise. (check_effective_target_has_arch_pwr9): Likewise. (check_effective_target_has_arch_pwr10): Likewise. (check_effective_target_has_arch_ppc64): Likewise. (check_effective_target_ppc_float128): Likewise. (check_effective_target_ppc_float128_insns): Likewise. (check_effective_target_powerpc_vsx): Likewise. --- gcc/testsuite/lib/target-supports.exp | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.27.0
Comments
On Wed, Jul 20, 2022 at 05:32:01PM +0800, Kewen.Lin wrote: > As the failure of test case gcc.target/powerpc/pr92398.p9-.c in > PR106345 shows, some test sources for some powerpc effective > targets use empty translation unit wrongly. The test sources > could go with options like "-ansi -pedantic-errors", then those > effective target checkings will fail unexpectedly with the > error messages like: > > error: ISO C forbids an empty translation unit [-Wpedantic] > > This patch is to fix empty TUs with one dummy variable definition > accordingly. You can also use enum{a}; which is shorter, but more importantly does not generate any code. You can also do extern int dummy; of course -- same idea, no definitions, only declarations. > I'll push this soon if no objections. > @@ -6523,6 +6531,7 @@ proc check_effective_target_ppc_float128 { } { > #ifndef __FLOAT128__ > nope no good > #endif > + int dummy; At least put it in #else then? Or just do things a bit more elegantly (do a dummy function around this for example). Segher
Hi Segher, Thanks for the comments! on 2022/7/22 06:09, Segher Boessenkool wrote: > On Wed, Jul 20, 2022 at 05:32:01PM +0800, Kewen.Lin wrote: >> As the failure of test case gcc.target/powerpc/pr92398.p9-.c in >> PR106345 shows, some test sources for some powerpc effective >> targets use empty translation unit wrongly. The test sources >> could go with options like "-ansi -pedantic-errors", then those >> effective target checkings will fail unexpectedly with the >> error messages like: >> >> error: ISO C forbids an empty translation unit [-Wpedantic] >> >> This patch is to fix empty TUs with one dummy variable definition >> accordingly. > > You can also use > enum{a}; > which is shorter, but more importantly does not generate any code. > You can also do > extern int dummy; > of course -- same idea, no definitions, only declarations. > The used "int dummy" follows some existing practices, IMHO in this context it doesn't matter that it will generate code or not, any of these alternatives still generates an assembly or object file, but the generated file gets removed after the checking. May I still keep this "int dummy" to align with existing practices? >> I'll push this soon if no objections. > >> @@ -6523,6 +6531,7 @@ proc check_effective_target_ppc_float128 { } { >> #ifndef __FLOAT128__ >> nope no good >> #endif >> + int dummy; > > At least put it in #else then? Or just do things a bit more elegantly > (do a dummy function around this for example). > OK, since it can still emit error even without "#else", I didn't bother to add it. I will add it, and update the "nope no good" to "#error doesn't have float128 support". BR, Kewen
Hi! On Fri, Jul 22, 2022 at 08:41:43AM +0800, Kewen.Lin wrote: > Hi Segher, > > Thanks for the comments! Always. > >> This patch is to fix empty TUs with one dummy variable definition > >> accordingly. > > > > You can also use > > enum{a}; > > which is shorter, but more importantly does not generate any code. > > You can also do > > extern int dummy; > > of course -- same idea, no definitions, only declarations. > > The used "int dummy" follows some existing practices, IMHO in this > context it doesn't matter that it will generate code or not, any of > these alternatives still generates an assembly or object file, but > the generated file gets removed after the checking. It doesn't matter here, sure. But it is certainly simple enough to make it "extern int dummy" instead, not giving a bad example for future cases where it may matter :-) > May I still keep this "int dummy" to align with existing practices? Of course, it was just advice. If things are wrong (in my opinion that is!), I'll say so. > > At least put it in #else then? Or just do things a bit more elegantly > > (do a dummy function around this for example). > > OK, since it can still emit error even without "#else", I didn't bother > to add it. I will add it, and update the "nope no good" to "#error > doesn't have float128 support". Just say === void nope (void) { #ifndef __FLOAT128__ nope no good #endif } === which works in all cases? Less maintenance is a good thing :-) Segher
Hi! on 2022/7/22 09:02, Segher Boessenkool wrote: > Hi! > > On Fri, Jul 22, 2022 at 08:41:43AM +0800, Kewen.Lin wrote: >> Hi Segher, >> >> Thanks for the comments! > > Always. > >>>> This patch is to fix empty TUs with one dummy variable definition >>>> accordingly. >>> >>> You can also use >>> enum{a}; >>> which is shorter, but more importantly does not generate any code. >>> You can also do >>> extern int dummy; >>> of course -- same idea, no definitions, only declarations. >> >> The used "int dummy" follows some existing practices, IMHO in this >> context it doesn't matter that it will generate code or not, any of >> these alternatives still generates an assembly or object file, but >> the generated file gets removed after the checking. > > It doesn't matter here, sure. But it is certainly simple enough to make > it "extern int dummy" instead, not giving a bad example for future cases > where it may matter :-) > OK. >> May I still keep this "int dummy" to align with existing practices? > > Of course, it was just advice. If things are wrong (in my opinion that > is!), I'll say so. > Got it, thanks! :) >>> At least put it in #else then? Or just do things a bit more elegantly >>> (do a dummy function around this for example). >> >> OK, since it can still emit error even without "#else", I didn't bother >> to add it. I will add it, and update the "nope no good" to "#error >> doesn't have float128 support". > > Just say > > === > void nope (void) > { > #ifndef __FLOAT128__ > nope no good > #endif > } > === > > which works in all cases? Yeah, good idea, I'll make a new version of patch based on this. Thanks again! BR, Kewen > > Less maintenance is a good thing :-) > > > Segher
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 4ed7b25b9a4..aac2a557f5d 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -6262,6 +6262,7 @@ proc check_effective_target_powerpc_sqrt { } { #ifndef _ARCH_PPCSQ #error _ARCH_PPCSQ is not defined #endif + int dummy; } {}] } @@ -6373,6 +6374,7 @@ proc check_effective_target_has_arch_pwr5 { } { #error does not have power5 support. #else /* "has power5 support" */ + int dummy; #endif } [current_compiler_flags]] } @@ -6383,6 +6385,7 @@ proc check_effective_target_has_arch_pwr6 { } { #error does not have power6 support. #else /* "has power6 support" */ + int dummy; #endif } [current_compiler_flags]] } @@ -6393,6 +6396,7 @@ proc check_effective_target_has_arch_pwr7 { } { #error does not have power7 support. #else /* "has power7 support" */ + int dummy; #endif } [current_compiler_flags]] } @@ -6403,6 +6407,7 @@ proc check_effective_target_has_arch_pwr8 { } { #error does not have power8 support. #else /* "has power8 support" */ + int dummy; #endif } [current_compiler_flags]] } @@ -6413,6 +6418,7 @@ proc check_effective_target_has_arch_pwr9 { } { #error does not have power9 support. #else /* "has power9 support" */ + int dummy; #endif } [current_compiler_flags]] } @@ -6423,6 +6429,7 @@ proc check_effective_target_has_arch_pwr10 { } { #error does not have power10 support. #else /* "has power10 support" */ + int dummy; #endif } [current_compiler_flags]] } @@ -6433,6 +6440,7 @@ proc check_effective_target_has_arch_ppc64 { } { #error does not have ppc64 support. #else /* "has ppc64 support" */ + int dummy; #endif } [current_compiler_flags]] } @@ -6523,6 +6531,7 @@ proc check_effective_target_ppc_float128 { } { #ifndef __FLOAT128__ nope no good #endif + int dummy; }] } @@ -6533,6 +6542,7 @@ proc check_effective_target_ppc_float128_insns { } { #ifndef __FLOAT128_HARDWARE__ nope no good #endif + int dummy; }] } @@ -6543,6 +6553,7 @@ proc check_effective_target_powerpc_vsx { } { #ifndef __VSX__ nope no vsx #endif + int dummy; }] }