This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Silence gcc-8 warnings
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: "Alan Modra" <amodra at gmail dot com>
- Cc: <binutils at sourceware dot org>
- Date: Mon, 23 Apr 2018 02:54:42 -0600
- Subject: Re: Silence gcc-8 warnings
- References: <20180423084836.GA18288@bubble.grove.modra.org>
>>> On 23.04.18 at 10:48, <amodra@gmail.com> wrote:
> --- a/bfd/elf-linux-core.h
> +++ b/bfd/elf-linux-core.h
> @@ -69,8 +69,12 @@ swap_linux_prpsinfo32_ugid32_out
> bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
> bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
> bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wpragmas"
> +#pragma GCC diagnostic ignored "-Wstringop-truncation"
> strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
> strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
> +#pragma GCC diagnostic pop
> }
We've tried to use this approach in the Xen hypervisor sources too in at least
one place: Older gcc isn't happy about such #pragma-s inside functions. Sadly
we haven't found a neat alternative (yet).
Jan