Re: Suppressing warning
Re: Suppressing warning
- Subject: Re: Suppressing warning
- From: Jonas Maebe <email@hidden>
- Date: Fri, 18 Apr 2008 10:42:37 +0200
On 18 Apr 2008, at 07:12, Fred Leboucher wrote:
In this particular case, it is indeed a nice way to suppress the
warning, but what if the function is looking that way :
int foo()
{
_asm {
// do something complicated...
mov eax, something
}
}
Then my last mov is indeed the return, but gcc doesn't identify it
that way, and putting a return after that would just override my
actual return value...
The way you'd do that is to move something into a virtual location
mapped to a local variable, and then return this variable. GCC should
optimize everything so no redundant code is generated. I'm not sure
whether this is possible with _asm{} statements though, but for
regular GCC assembler blocks the procedure is explained here: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
This example from that page is probably most appropriate:
int a=10, b;
asm ("movl %1, %êx;
movl %êx, %0;"
:"=r"(b) /* output */
:"r"(a) /* input */
:"êx" /* clobbered register */
);
(so in this way a is mapped to to %1 and b to %0).
Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden