OTOH, checking if a multiline macro is called after an .elseif seems not too difficult.
That's indeed very good news! Since it is obviously a child's play, could you please tell me how to do it? With detailed source code, if you don't mind!
It's not child's play, of course, but IMHO a pretty basic exercise (sorry, can't help you with C code....):
include \masm32\MasmBasic\
MasmBasic.inc ;
download.data
MacTable dd m1, m2, 0
; see CreateMacTablem1 dd 100
; line count of macro db "Instr_", 0
m2 dd 1
db "Instr1", 0
SetGlobals posL, mac$
Init SetGlobals Recall "TestElseIfDummyCode.asm", L
$() ; call CreateMacTable ; JWasm certainly has something like this, right?
For_ ct=0 To eax-1
mov edi, L$(ct)
.if
Instr_(edi, ".elseif", 1)
add edx, 7
mov posL, edx
.if
Instr_(edx, edi, "(")
sub edx, posL
Let mac$=
Trim$(
Mid$(edi, posL, edx))
mov esi, offset MacTable
.While 1
lodsd
.Break .if !eax
mov ecx, [eax]
add eax, DWORD
.if !
StringsDiffer(eax, mac$)
.if ecx>1
PrintLine "WARNING: ", mac$, " should not be used after .elseif!!"
.else
PrintLine "Congrats, using ", mac$, " is OK"
.endif
.endif
.Endw
.endif
.endif
Next Inkey "ok"
Exitend start
TestElseIf.asm:
include \masm32\MasmBasic\MasmBasic.inc ; download
Instr1 MACRO spos, src, match ; a one-liner
EXITM <ecx==12345678h>
ENDM
Init
mov ecx, 12345678h
Let esi="This is a stupid test"
.if Instr_(esi, "stuupid")
PrintLine "stuupid found"
.elseif Instr_(esi, "test") ; useless, will expand before the jump label
PrintLine "test found"
.elseif Instr1(esi, "test") ; will expand at the jump label
PrintLine "Instr1 found it: ", Hex$(ecx)
.endif
Inkey CrLf$, "Found something??", CrLf$
Exit
end start