[3/6,AArch64-4.7] Fix warning - aarch64_legitimize_reload_address passes the wrong type to push_reload.

Submitted by James Greenhalgh on Feb. 1, 2013, 5:42 p.m.

Details

Message ID 1359740555-10179-4-git-send-email-james.greenhalgh@arm.com
State New
Headers show

Commit Message

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

push_reload takes an `enum reload_type' as its final argument.

On trunk we just cast the int we have to the correct type,
so we do that here to mirror trunk and correct the warning.
We can't fix this by changing the type of the argument we take
as we would then need to forward declare the enum when giving
the prototype, which is illegal.

This fixes the warning:

config/aarch64/aarch64.c: In function ‘aarch64_legitimize_reload_address’:
config/aarch64/aarch64.c:3641:6: warning: enum conversion when passing argument 11 of ‘push_reload’ is invalid in C++ [-Wc++-compat]

Regression tested 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_legitimize_reload_address): Cast 'type' before
	passing to push_reload.

Comments

Richard Earnshaw Feb. 2, 2013, 2:24 p.m.
On 01/02/13 17:42, James Greenhalgh wrote:
>
> Hi,
>
> push_reload takes an `enum reload_type' as its final argument.
>
> On trunk we just cast the int we have to the correct type,
> so we do that here to mirror trunk and correct the warning.
> We can't fix this by changing the type of the argument we take
> as we would then need to forward declare the enum when giving
> the prototype, which is illegal.
>
> This fixes the warning:
>
> config/aarch64/aarch64.c: In function ‘aarch64_legitimize_reload_address’:
> config/aarch64/aarch64.c:3641:6: warning: enum conversion when passing argument 11 of ‘push_reload’ is invalid in C++ [-Wc++-compat]
>
> Regression tested 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_legitimize_reload_address): Cast 'type' before
> 	passing to push_reload.
>
>

OK.

R.

Patch hide | download patch | download mbox

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 62d0a12..fef2983 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -3701,7 +3701,7 @@  aarch64_legitimize_reload_address (rtx *x_p,
       x = copy_rtx (x);
       push_reload (orig_rtx, NULL_RTX, x_p, NULL,
 		   BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
-		   opnum, type);
+		   opnum, (enum reload_type) type);
       return x;
     }
 
@@ -3714,7 +3714,7 @@  aarch64_legitimize_reload_address (rtx *x_p,
     {
       push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
 		   BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
-		   opnum, type);
+		   opnum, (enum reload_type) type);
       return x;
     }
 
@@ -3778,7 +3778,7 @@  aarch64_legitimize_reload_address (rtx *x_p,
 
       push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
 		   BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
-		   opnum, type);
+		   opnum, (enum reload_type) type);
       return x;
     }