[11/25] libcpu: Use __asm instead asm that can be recognized by both clang-cl and gcc

Message ID 20221020182603.815-12-luoyonggang@gmail.com
State Superseded
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

Yonggang Luo Oct. 20, 2022, 6:25 p.m. UTC
  Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 libcpu/i386_disasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Mark Wielaard Dec. 12, 2022, 12:42 p.m. UTC | #1
Hi,

On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel
wrote:
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  libcpu/i386_disasm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
> index 599d1654..cc75a7b1 100644
> --- a/libcpu/i386_disasm.c
> +++ b/libcpu/i386_disasm.c
> @@ -480,7 +480,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));
>  	    }

Urgh. Is this really (still) necessary? It is inside an if (0) block.
So it also is never used. Can we just get rid of the whole block?

Thanks,

Mark
  
lilydjwg--- via Elfutils-devel Dec. 16, 2022, 9:36 p.m. UTC | #2
On Mon, Dec 12, 2022 at 8:42 PM Mark Wielaard <mark@klomp.org> wrote:
>
> Hi,
>
> On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel
> wrote:
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > ---
> >  libcpu/i386_disasm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
> > index 599d1654..cc75a7b1 100644
> > --- a/libcpu/i386_disasm.c
> > +++ b/libcpu/i386_disasm.c
> > @@ -480,7 +480,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));
> >           }
>
> Urgh. Is this really (still) necessary? It is inside an if (0) block.
> So it also is never used. Can we just get rid of the whole block?
OK, I'll get rid of it
>
> Thanks,
>
> Mark



--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
  

Patch

diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index 599d1654..cc75a7b1 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -480,7 +480,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));
 	    }