* c99 elfxx-riscv.c fix
@ 2020-02-19 3:19 Alan Modra
2020-03-05 20:27 ` Palmer Dabbelt
0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2020-02-19 3:19 UTC (permalink / raw)
To: binutils
I'm not against using c99, but we can't use c99 without enabling c99
support for older compilers that don't enable c99 by default. So if
you want to use c99 contructs in binutils you'll need to first arrange
for -std=c99 to be passed to older compilers.
* elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99.
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 0a0711ef8d..dc6db0c307 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1401,11 +1401,11 @@ static bfd_boolean
riscv_multi_letter_ext_valid_p (const char *ext,
const char *const *known_exts)
{
- for (size_t i = 0; known_exts[i]; ++i)
- {
- if (!strcmp (ext, known_exts[i]))
- return TRUE;
- }
+ size_t i;
+
+ for (i = 0; known_exts[i]; ++i)
+ if (!strcmp (ext, known_exts[i]))
+ return TRUE;
return FALSE;
}
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c99 elfxx-riscv.c fix
2020-02-19 3:19 c99 elfxx-riscv.c fix Alan Modra
@ 2020-03-05 20:27 ` Palmer Dabbelt
0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2020-03-05 20:27 UTC (permalink / raw)
To: amodra; +Cc: binutils
On Tue, 18 Feb 2020 19:19:46 PST (-0800), amodra@gmail.com wrote:
> I'm not against using c99, but we can't use c99 without enabling c99
> support for older compilers that don't enable c99 by default. So if
> you want to use c99 contructs in binutils you'll need to first arrange
> for -std=c99 to be passed to older compilers.
>
> * elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99.
>
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index 0a0711ef8d..dc6db0c307 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -1401,11 +1401,11 @@ static bfd_boolean
> riscv_multi_letter_ext_valid_p (const char *ext,
> const char *const *known_exts)
> {
> - for (size_t i = 0; known_exts[i]; ++i)
> - {
> - if (!strcmp (ext, known_exts[i]))
> - return TRUE;
> - }
> + size_t i;
> +
> + for (i = 0; known_exts[i]; ++i)
> + if (!strcmp (ext, known_exts[i]))
> + return TRUE;
>
> return FALSE;
> }
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-05 20:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 3:19 c99 elfxx-riscv.c fix Alan Modra
2020-03-05 20:27 ` Palmer Dabbelt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).