[PATCH 2/6] [AArch64-4.7] Fix warning - aarch64_add_constant mixed code and declarations.

Richard Earnshaw rearnsha@arm.com
Sat Feb 2 14:24:00 GMT 2013


On 01/02/13 17:42, James Greenhalgh wrote:
>
> Hi,
>
> In config/aarch64/aarch64.c::aarch64_add_constant `shift' was
> declared after we started writing code. C90 doesn't like this,
> so split the declaration and the assignment.
>
> This fixes the warning:
>
> config/aarch64/aarch64.c: In function ‘aarch64_add_constant’:
> config/aarch64/aarch64.c:2249:4: warning: ISO C90 forbids mixed declarations and code [-pedantic]
>
> Regression tested on aarch64-none-elf with no regressions.
>
> OK for aarch64-4.7-branch?
>
> Thanks,
> James
>
> ---
> gcc/
>
> 2013-02-01  James Greenhalgh  <james.greenhalgh@arm.com>
>
> 	* config/aarch64/aarch64.c
>    	(aarch64_add_constant): Move declaration of 'shift' above code.
>
>
> 0002-AArch64-4.7-Fix-warning-aarch64_add_constant-mixed-c.patch
>
>
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index 59124eb..62d0a12 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -2307,8 +2307,9 @@ aarch64_add_constant (int regnum, int scratchreg, HOST_WIDE_INT delta)
>       {
>         if (mdelta >= 4096)
>   	{
> +	  rtx shift;
>   	  emit_insn (gen_rtx_SET (Pmode, scratch_rtx, GEN_INT (mdelta / 4096)));

Blank line between declarations and code.

OK with that change.

R.




More information about the Gcc-patches mailing list