public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] x86: re-order update_code_flag()
@ 2023-09-15  7:57 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2023-09-15  7:57 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b44fef84a9696d3e571f79aea3e0adea0b4ae02d

commit b44fef84a9696d3e571f79aea3e0adea0b4ae02d
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Sep 15 09:55:34 2023 +0200

    x86: re-order update_code_flag()
    
    Do checks before updating state, and bail upon failure of either of the
    checks. While moving the code, eliminate some redundancy.

Diff:
---
 gas/config/tc-i386.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index e8ec2966406..1208e30abe8 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2609,7 +2609,21 @@ add_prefix (unsigned int prefix)
 static void
 update_code_flag (int value, int check)
 {
-  PRINTF_LIKE ((*as_error));
+  PRINTF_LIKE ((*as_error)) = check ? as_fatal : as_bad;
+
+  if (value == CODE_64BIT && !cpu_arch_flags.bitfield.cpulm )
+    {
+      as_error (_("64bit mode not supported on `%s'."),
+		cpu_arch_name ? cpu_arch_name : default_arch);
+      return;
+    }
+
+  if (value == CODE_32BIT && !cpu_arch_flags.bitfield.cpui386)
+    {
+      as_error (_("32bit mode not supported on `%s'."),
+		cpu_arch_name ? cpu_arch_name : default_arch);
+      return;
+    }
 
   flag_code = (enum flag_code) value;
   if (flag_code == CODE_64BIT)
@@ -2622,24 +2636,7 @@ update_code_flag (int value, int check)
       cpu_arch_flags.bitfield.cpu64 = 0;
       cpu_arch_flags.bitfield.cpuno64 = 1;
     }
-  if (value == CODE_64BIT && !cpu_arch_flags.bitfield.cpulm )
-    {
-      if (check)
-	as_error = as_fatal;
-      else
-	as_error = as_bad;
-      (*as_error) (_("64bit mode not supported on `%s'."),
-		   cpu_arch_name ? cpu_arch_name : default_arch);
-    }
-  if (value == CODE_32BIT && !cpu_arch_flags.bitfield.cpui386)
-    {
-      if (check)
-	as_error = as_fatal;
-      else
-	as_error = as_bad;
-      (*as_error) (_("32bit mode not supported on `%s'."),
-		   cpu_arch_name ? cpu_arch_name : default_arch);
-    }
+
   stackop_size = '\0';
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-15  7:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15  7:57 [binutils-gdb] x86: re-order update_code_flag() Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).