diff mbox series

[v2,02/12] arch: simplify i386/x86-64 specifics

Message ID 20191127020643.68629-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series Miscellaneous arch specific fixes | expand

Commit Message

Luc Van Oostenryck Nov. 27, 2019, 2:06 a.m. UTC
The current test for setting wchar on i386 uses a
conditional break and a fallthrough on the x86-64 case.

This is not needed and can be simplified by reversing the
order of the i386 & x86-64 cases.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 target.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ramsay Jones Nov. 27, 2019, 3:58 p.m. UTC | #1
On 27/11/2019 02:06, Luc Van Oostenryck wrote:
> The current test for setting wchar on i386 uses a
> conditional break and a fallthrough on the x86-64 case.
> 
> This is not needed and can be simplified by reversing the
> order of the i386 & x86-64 cases.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  target.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/target.c b/target.c
> index 497ecdc5e..acafbd929 100644
> --- a/target.c
> +++ b/target.c
> @@ -79,11 +79,11 @@ void init_target(void)
>  	}
>  
>  	switch (arch_mach) {
> -	case MACH_X86_64:
> -		if (arch_m64 == ARCH_LP64)
> -			break;
> -		/* fall through */
>  	case MACH_I386:
> +		wchar_ctype = &long_ctype;
> +		/* fall through */
> +	case MACH_X86_64:
> +		break;
>  	case MACH_M68K:
>  	case MACH_SPARC32:
>  	case MACH_PPC32:
> 

Hmm, wouldn't it be easier to simply remove the MACH_X86_64 case
altogether, so that you have:

	switch (arch_mach) {
	case MACH_I386:
	case MACH_M68K:
	...

... since m68k, sparc32 and ppc32 case-s which follow also set
wchar_ctype to 'long'?

If you don't want to remove the MACH_X86_64 case, then have:

	switch (arch_mach) {
	case MACH_X86_64:
		break;
	case MACH_I386:
	case MACH_M68K:
	...

instead?

ATB,
Ramsay Jones
diff mbox series

Patch

diff --git a/target.c b/target.c
index 497ecdc5e..acafbd929 100644
--- a/target.c
+++ b/target.c
@@ -79,11 +79,11 @@  void init_target(void)
 	}
 
 	switch (arch_mach) {
-	case MACH_X86_64:
-		if (arch_m64 == ARCH_LP64)
-			break;
-		/* fall through */
 	case MACH_I386:
+		wchar_ctype = &long_ctype;
+		/* fall through */
+	case MACH_X86_64:
+		break;
 	case MACH_M68K:
 	case MACH_SPARC32:
 	case MACH_PPC32: