Patchwork [5/6,AArch64-4.7] Fix warning - Mixed code and declarations in aarch64_simd_const_bounds.

login
register
mail settings
Submitter James Greenhalgh
Date Feb. 1, 2013, 5:42 p.m.
Message ID <1359740555-10179-6-git-send-email-james.greenhalgh@arm.com>
Download mbox | patch
Permalink /patch/217548/
State New
Headers show

Comments

James Greenhalgh - Feb. 1, 2013, 5:42 p.m.
Hi,

aarch64_simd_const_bounds declares `lane' after an assert. This
patch moves the declaration above the assert.

This patch fixes the warning:

config/aarch64/aarch64.c: In function ‘aarch64_simd_const_bounds’:
config/aarch64/aarch64.c:6412:3: 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_simd_const_bounds): Move declaration of 'lane' above code.
Richard Earnshaw - Feb. 2, 2013, 2:25 p.m.
On 01/02/13 17:42, James Greenhalgh wrote:
>
> Hi,
>
> aarch64_simd_const_bounds declares `lane' after an assert. This
> patch moves the declaration above the assert.
>
> This patch fixes the warning:
>
> config/aarch64/aarch64.c: In function ‘aarch64_simd_const_bounds’:
> config/aarch64/aarch64.c:6412:3: 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_simd_const_bounds): Move declaration of 'lane' above code.
>
>
> 0005-AArch64-4.7-Fix-warning-Mixed-code-and-declarations-.patch
>
>
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index 434ccd7..a3c482b 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -6406,8 +6406,9 @@ aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high)
>   void
>   aarch64_simd_const_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high)
>   {
> +  HOST_WIDE_INT lane;
>     gcc_assert (GET_CODE (operand) == CONST_INT);

Blank line after declaration.

OK with that change.

R.

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 434ccd7..a3c482b 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6406,8 +6406,9 @@  aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high)
 void
 aarch64_simd_const_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high)
 {
+  HOST_WIDE_INT lane;
   gcc_assert (GET_CODE (operand) == CONST_INT);
-  HOST_WIDE_INT lane = INTVAL (operand);
+  lane = INTVAL (operand);
 
   if (lane < low || lane >= high)
     error ("constant out of range");