From: Pedro Alves <pedro@palves.net>
To: Gary Benson <gbenson@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix testcases using __attribute__((noclone)) with Clang
Date: Fri, 23 Oct 2020 14:29:06 +0100 [thread overview]
Message-ID: <5b045172-9175-e20d-ceff-89c3d44953a0@palves.net> (raw)
In-Reply-To: <1600272360-20954-1-git-send-email-gbenson@redhat.com>
On 9/16/20 5:06 PM, Gary Benson via Gdb-patches 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.
>
> 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
I'd think that if you need to handle one attribute,
you'll soon enough need to handle other attributes.
Thus, I'd call this header something more generic like attributes.h.
> +
> +/* Compatibility macro for __attribute__((noclone)). */
> +
> +#ifndef NOCLONE_H
> +#define NOCLONE_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#if __has_attribute(noclone)
__has_attribute isn't universally available. For GCC, it was
only added on GCC 5:
https://gcc.gnu.org/gcc-5/changes.html
We support building GDB with GCC 4.8. And the set of compilers the
testsuite can be run against is larger than the set of compilers GDB
builds with -- consider cross compilers for embedded targets,
for example.
So we need to handle __has_attribute not being defined. I think
this would work:
#ifdef __has_attribute
# if !__has_attribute (noclone)
# define ATTRIBUTE_NOCLONE
# endif
#endif
#ifndef ATTRIBUTE_NOCLONE
# define ATTRIBUTE_NOCLONE __attribute__((noclone))
#endif
> +# define ATTRIBUTE_NOCLONE __attribute__((noclone))
> +#else
> +# define ATTRIBUTE_NOCLONE
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
next prev parent reply other threads:[~2020-10-23 13:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 16:06 Gary Benson
2020-09-30 10:02 ` [PING][PATCH] " Gary Benson via Gdb-patches
2020-10-14 9:27 ` [PING^2][PATCH] " Gary Benson via Gdb-patches
2020-10-23 13:29 ` Pedro Alves [this message]
2020-11-02 11:58 ` [PATCH] " Gary Benson via Gdb-patches
2020-11-02 12:13 ` [PUSHED] " Gary Benson via Gdb-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b045172-9175-e20d-ceff-89c3d44953a0@palves.net \
--to=pedro@palves.net \
--cc=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox