diff options
author | Zack Middleton <zturtleman@gmail.com> | 2015-07-12 18:56:15 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2016-04-07 11:02:30 +0100 |
commit | fbcc2c5f397b8933be620221a266cb963df9b61e (patch) | |
tree | 47670876743b111815dbbad0c5f9462c32a2979c | |
parent | cc17bca3ad04ab60cfc66c9a4b8f1188878ae802 (diff) |
Make more vm_x86 macros use braces so they work with if blah run macro
MASK_REG in EmitMovEDXStack would incorrectly emit asm if 'andit' was 0.
'andit' would never be 0 though so it wasn't causing issues.
Found by Coverity.
-rw-r--r-- | src/qcommon/vm_x86.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/qcommon/vm_x86.c b/src/qcommon/vm_x86.c index 2056785d..cdf8ad56 100644 --- a/src/qcommon/vm_x86.c +++ b/src/qcommon/vm_x86.c @@ -204,19 +204,25 @@ static void EmitRexString(byte rex, const char *string) #define MASK_REG(modrm, mask) \ - EmitString("81"); \ - EmitString((modrm)); \ - Emit4((mask)) + do { \ + EmitString("81"); \ + EmitString((modrm)); \ + Emit4((mask)); \ + } while(0) // add bl, bytes #define STACK_PUSH(bytes) \ - EmitString("80 C3"); \ - Emit1(bytes) + do { \ + EmitString("80 C3"); \ + Emit1(bytes); \ + } while(0) // sub bl, bytes #define STACK_POP(bytes) \ - EmitString("80 EB"); \ - Emit1(bytes) + do { \ + EmitString("80 EB"); \ + Emit1(bytes); \ + } while(0) static void EmitCommand(ELastCommand command) { |