Re: New ARI warning Wed May 23 01:55:03 UTC 2012

Mark Kettenis
2012-06-26T13:15:09Z

> Date: Fri, 22 Jun 2012 10:19:22 -0700
> From: Joel Brobecker <brobecker@adacore.com>
>
> > Mark> So I'd have no objection to requiring C99, except for one
> > Mark> style-related issue. I really, really hate mixing declarations with
> > Mark> code (something that C99 started to allow). So if we switch to
> > Mark> requiring C99, I think we should add a rule to the coding standards
> > Mark> that variables may only be declared at the start of a block.
> >
> > If there is no warning for it, then uses will slip in.
>
> Here is a patch that adds -Wdeclaration-after-statement to the list
> of compiler warnings...

Oh, there *is* a flag for this? I looked for it but didn't find it...

> Tested on x86_64-linux by rebuilding the native compiler with
> --enable-targets=all.
>
> gdb/ChangeLog:
>
> * configure.ac (build_warnings): Add -Wdeclaration-after-statement.
> * configure: Regenerate.
>
> OK to commit?

yes, please