From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 3Zk8CnHEhl8fJQAAWB0awg (envelope-from ) for ; Wed, 14 Oct 2020 05:27:13 -0400 Received: by simark.ca (Postfix, from userid 112) id 1DE741EF6F; Wed, 14 Oct 2020 05:27:13 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 simark.ca (Postfix) with ESMTPS id A2F841E58C for ; Wed, 14 Oct 2020 05:27:11 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 238AA389443E; Wed, 14 Oct 2020 09:27:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 238AA389443E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1602667631; bh=XY4H1vtjxG4+kNNNAbq8AzZVee6gkey+SljsqerYMHw=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=aAoccdUJuWWjaMtWXPiI2/JxyYyMxEeOJzs8MyjDHh5mLs34dEbq1EJubxPV/66oi L48v+LzQLvNXXUHRo8GnNWF8j0mNEazsy6UZfKsQzSUuPkDGsa8juzdT5gz2fMC6ev 3QSKD2CfpQrhqWK/d3UBUPrCvwb9jQuJFqKIJcZk= 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 9D5213840C18 for ; Wed, 14 Oct 2020 09:27:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9D5213840C18 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-167-M5belSpsMlidocI33u1PNw-1; Wed, 14 Oct 2020 05:27:05 -0400 X-MC-Unique: M5belSpsMlidocI33u1PNw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1DE161006707 for ; Wed, 14 Oct 2020 09:27:04 +0000 (UTC) Received: from blade.nx (ovpn-115-72.ams2.redhat.com [10.36.115.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 861FA10027AA for ; Wed, 14 Oct 2020 09:27:03 +0000 (UTC) Received: by blade.nx (Postfix, from userid 1000) id BFCC9816CD2E; Wed, 14 Oct 2020 10:27:02 +0100 (BST) Date: Wed, 14 Oct 2020 10:27:02 +0100 To: gdb-patches@sourceware.org Subject: [PING^2][PATCH] Fix testcases using __attribute__((noclone)) with Clang Message-ID: <20201014092702.GA6568@blade.nx> References: <1600272360-20954-1-git-send-email-gbenson@redhat.com> MIME-Version: 1.0 In-Reply-To: <1600272360-20954-1-git-send-email-gbenson@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Gary Benson via Gdb-patches Reply-To: Gary Benson Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Gary Benson wrote: > Hi all, > > Clang fails to compile a number of files with the following warning: > unknown attribute 'noclone' ignored [-Wunknown-attributes]. This > commit adds a new header, lib/noclone.h, which defines the macro > ATTRIBUTE_NOCLONE accordingly, and updates the relevant testcases > to use it. > > Checked on Fedora 32 x86_64, GCC and clang. Is this ok to commit? > > Cheers, > Gary > > -- > gdb/testsuite/ChangeLog: > > * lib/noclone.h: New header. > * gdb.base/backtrace.c: Include the above. Replace > __attribute__(noclone)) with ATTRIBUTE_NOCLONE. > * gdb.base/infcall-nested-structs.c: Likewise. > * gdb.base/vla-optimized-out.c: Likewise. > --- > gdb/testsuite/ChangeLog | 8 +++ > gdb/testsuite/lib/noclone.h | 37 ++++++++++++++ > gdb/testsuite/gdb.base/backtrace.c | 8 +-- > gdb/testsuite/gdb.base/infcall-nested-structs.c | 65 +++++++++++++------------ > gdb/testsuite/gdb.base/vla-optimized-out.c | 4 +- > 5 files changed, 86 insertions(+), 36 deletions(-) > create mode 100644 gdb/testsuite/lib/noclone.h > > diff --git a/gdb/testsuite/lib/noclone.h b/gdb/testsuite/lib/noclone.h > new file mode 100644 > index 0000000..b6a4aa7 > --- /dev/null > +++ b/gdb/testsuite/lib/noclone.h > @@ -0,0 +1,37 @@ > +/* This file is part of GDB, the GNU debugger. > + > + Copyright (C) 2020 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +/* Compatibility macro for __attribute__((noclone)). */ > + > +#ifndef NOCLONE_H > +#define NOCLONE_H > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#if __has_attribute(noclone) > +# define ATTRIBUTE_NOCLONE __attribute__((noclone)) > +#else > +# define ATTRIBUTE_NOCLONE > +#endif > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* NOCLONE_H */ > diff --git a/gdb/testsuite/gdb.base/backtrace.c b/gdb/testsuite/gdb.base/backtrace.c > index bae8b1a..310a481 100644 > --- a/gdb/testsuite/gdb.base/backtrace.c > +++ b/gdb/testsuite/gdb.base/backtrace.c > @@ -15,19 +15,21 @@ > You should have received a copy of the GNU General Public License > along with this program. If not, see . */ > > -int __attribute__((noinline,noclone)) > +#include "../lib/noclone.h" > + > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > baz () > { > return 0; /* Break here. */ > } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > bar () > { > return baz (); > } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > foo () > { > return bar (); > diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.c b/gdb/testsuite/gdb.base/infcall-nested-structs.c > index c0c8e19..73f417d 100644 > --- a/gdb/testsuite/gdb.base/infcall-nested-structs.c > +++ b/gdb/testsuite/gdb.base/infcall-nested-structs.c > @@ -33,6 +33,7 @@ > in the structs.exp test script. */ > > #include > +#include "../lib/noclone.h" > > /* Useful abreviations. */ > typedef char tc; > @@ -51,13 +52,13 @@ > #endif /* TEST_COMPLEX */ > > #define MAKE_CHECK_FUNCS(TYPE) \ > - int __attribute__((noinline,noclone)) \ > + int __attribute__((noinline)) ATTRIBUTE_NOCLONE \ > check_arg_ ## TYPE (struct TYPE arg) \ > { \ > return cmp_ ## TYPE (arg, ref_val_ ## TYPE); \ > } \ > \ > - struct TYPE __attribute__((noinline,noclone)) \ > + struct TYPE __attribute__((noinline)) ATTRIBUTE_NOCLONE \ > rtn_str_ ## TYPE (void) \ > { \ > return (ref_val_ ## TYPE); \ > @@ -128,141 +129,141 @@ > > #endif > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_01_01 (struct struct_01_01 a, struct struct_01_01 b) > { return a.s2.s1.a == b.s2.s1.a; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_01_02 (struct struct_01_02 a, struct struct_01_02 b) > { return a.a == b.a; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_01_03 (struct struct_01_03 a, struct struct_01_03 b) > { return a.s4.s3.a == b.s4.s3.a; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_01_04 (struct struct_01_04 a, struct struct_01_04 b) > { return a.a == b.a; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_02_01 (struct struct_02_01 a, struct struct_02_01 b) > { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_02_02 (struct struct_02_02 a, struct struct_02_02 b) > { return a.a == b.a && a.b == b.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_02_03 (struct struct_02_03 a, struct struct_02_03 b) > { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_02_04 (struct struct_02_04 a, struct struct_02_04 b) > { return a.a == b.a && a.b == b.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_04_01 (struct struct_04_01 a, struct struct_04_01 b) > { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b > && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_04_02 (struct struct_04_02 a, struct struct_04_02 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_04_03 (struct struct_04_03 a, struct struct_04_03 b) > { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b > && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_04_04 (struct struct_04_04 a, struct struct_04_04 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_05_01 (struct struct_05_01 a, struct struct_05_01 b) > { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b > && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d > && a.s2.s1.e == b.s2.s1.e; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_05_02 (struct struct_05_02 a, struct struct_05_02 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_05_03 (struct struct_05_03 a, struct struct_05_03 b) > { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b > && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d > && a.s12.s11.e == b.s12.s11.e; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_05_04 (struct struct_05_04 a, struct struct_05_04 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e; } > > #ifdef __cplusplus > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_02_01 (struct struct_static_02_01 a, > struct struct_static_02_01 b) > { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_02_02 (struct struct_static_02_02 a, > struct struct_static_02_02 b) > { return a.a == b.a && a.b == b.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_02_03 (struct struct_static_02_03 a, > struct struct_static_02_03 b) > { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_02_04 (struct struct_static_02_04 a, > struct struct_static_02_04 b) > { return a.a == b.a && a.b == b.b; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_04_01 (struct struct_static_04_01 a, > struct struct_static_04_01 b) > { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b > && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_04_02 (struct struct_static_04_02 a, > struct struct_static_04_02 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_04_03 (struct struct_static_04_03 a, > struct struct_static_04_03 b) > { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b > && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_04_04 (struct struct_static_04_04 a, > struct struct_static_04_04 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_06_01 (struct struct_static_06_01 a, > struct struct_static_06_01 b) > { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b > && a.s2.s1.c == b.s2.s1.c && a.s2.s1.d == b.s2.s1.d > && a.s2.s1.e == b.s2.s1.e && a.f == b.f; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_06_02 (struct struct_static_06_02 a, > struct struct_static_06_02 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e > && a.f == b.f; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_06_03 (struct struct_static_06_03 a, > struct struct_static_06_03 b) > { return a.s4.s3.a == b.s4.s3.a && a.s6.s5.b == b.s6.s5.b > && a.s8.s7.c == b.s8.s7.c && a.s10.s9.d == b.s10.s9.d > && a.s12.s11.e == b.s12.s11.e && a.s12.s11.f == b.s12.s11.f; } > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > cmp_struct_static_06_04 (struct struct_static_06_04 a, > struct struct_static_06_04 b) > { return a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e > @@ -366,7 +367,7 @@ int __attribute__((noinline,noclone)) > > #define CALL_LINE(NAME) val += check_arg_ ## NAME (rtn_str_ ## NAME ()) > > -int __attribute__((noinline,noclone)) > +int __attribute__((noinline)) ATTRIBUTE_NOCLONE > call_all () > { > int val = 0; > @@ -407,7 +408,7 @@ int __attribute__((noinline,noclone)) > > int volatile v = 1; > > -void __attribute__((noinline, noclone)) > +void __attribute__((noinline)) ATTRIBUTE_NOCLONE > breakpt (void) > { > v++; > diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.c b/gdb/testsuite/gdb.base/vla-optimized-out.c > index edc2b5e..4520f98 100644 > --- a/gdb/testsuite/gdb.base/vla-optimized-out.c > +++ b/gdb/testsuite/gdb.base/vla-optimized-out.c > @@ -18,9 +18,11 @@ > /* The version of this test-case with f1 tagged with noinline only is equivalent > to gcc/testsuite/gcc.dg/guality/vla-1.c. */ > > +#include "../lib/noclone.h" > + > int > #ifdef NOCLONE > -__attribute__((noinline, noclone)) > +__attribute__((noinline)) ATTRIBUTE_NOCLONE > #else > __attribute__((noinline)) > #endif > -- > 1.8.3.1 > -- Gary Benson - he / him / his Principal Software Engineer, Red Hat