• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Suppressing warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Suppressing warning (From: Jeff LaMarche <email@hidden>)
 >Re: Suppressing warning (From: "B.J. Buchalter" <email@hidden>)
 >Re: Suppressing warning (From: Fred Leboucher <email@hidden>)

  • Prev by Date: Re: Unable to debug custom executable
  • Next by Date: Re: Forcing Xcode to prefer a specific dylib
  • Previous by thread: Re: Suppressing warning
  • Next by thread: property-level locking (was Re: Suppressing warning)
  • Index(es):
    • Date
    • Thread