This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Silence gcc-8 warnings


>>> 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]