[v2,06/16] libcpu: Use __asm instead asm that can be recognized by both clang-cl and gcc

Message ID 20221217165213.152-7-luoyonggang@gmail.com
State Committed
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

Yonggang Luo Dec. 17, 2022, 4:52 p.m. UTC
  This block of code can not be removed. As it's contains a goto label
enomem that been used elsewhere

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 libcpu/i386_disasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Mark Wielaard Dec. 21, 2022, 6:07 p.m. UTC | #1
On Sun, 2022-12-18 at 00:52 +0800, Yonggang Luo via Elfutils-devel
wrote:
> This block of code can not be removed. As it's contains a goto label
> enomem that been used elsewhere

aha, that certainly explains why gcc gets confused about whether those
variables are used. It is slightly ugly code :{

But added a ChangeLog entry and pushed as attached.

Thanks,

Mark
  

Patch

diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index c34f03d6..44bf7d37 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -468,7 +468,7 @@  i386_disasm (Ebl *ebl __attribute__((unused)),
 
 	      /* gcc is not clever enough to see the following variables
 		 are not used uninitialized.  */
-	      asm (""
+	      __asm (""
 		   : "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep),
 		     "=mr" (next_curr), "=mr" (len));
 	    }