LogicLib: Don't add a EndSelect label when only one Case is used to avoid a unused label warning (bug #1126)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6650 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2015-12-01 21:02:56 +00:00
parent e65ac172c1
commit efc4cfccea

View file

@ -98,10 +98,7 @@
!macroend
!macro _IncreaseCounter
!define _LOGICLIB_COUNTER ${LOGICLIB_COUNTER}
!undef LOGICLIB_COUNTER
!define /math LOGICLIB_COUNTER ${_LOGICLIB_COUNTER} + 1
!undef _LOGICLIB_COUNTER
!define /redef /math LOGICLIB_COUNTER `${LOGICLIB_COUNTER}` + 1
!macroend
!macro _PushLogic
@ -356,7 +353,7 @@
!verbose ${LOGICLIB_VERBOSITY}
!insertmacro _PushLogic
!define ${_Logic}If
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the Else
!define ${_Logic}Else _LogicLib_ElseLabel_${LOGICLIB_COUNTER} ; Get a label for the Else
!insertmacro _IncreaseCounter
!define _c=${_c}
!ifdef _c=true ; If is true
@ -407,7 +404,7 @@
Goto ${_label} ; have a successful result
${${_Logic}Else}: ; Place the Else label
!undef ${_Logic}Else ; and remove it
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If
!define ${_Logic}Else _LogicLib_ElseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If
!insertmacro _IncreaseCounter
!define _c=${_c}
!ifdef _c=true ; If is true
@ -434,7 +431,7 @@
!error "Cannot use Else following an Else"
!endif
!ifndef ${_Logic}EndIf ; First Else for this If?
!define ${_Logic}EndIf _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the EndIf
!define ${_Logic}EndIf _LogicLib_EndIfLabel_${LOGICLIB_COUNTER} ; Get a label for the EndIf
!insertmacro _IncreaseCounter
!endif
Goto ${${_Logic}EndIf} ; Go to the EndIf
@ -448,7 +445,7 @@
!verbose push
!verbose ${LOGICLIB_VERBOSITY}
${Else} ; Perform the Else
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If
!define ${_Logic}Else _LogicLib_ElseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If
!insertmacro _IncreaseCounter
!define _c=${_c}
!ifdef _c=true ; If is true
@ -645,11 +642,12 @@
!ifndef ${_Logic}Else
!error "Cannot use Case following a CaseElse"
!endif
Goto ${${_Logic}EndSelect} ; Go to the EndSelect
Goto ${${_Logic}EndSelect} ; Go to EndSelect (Ends the previous Case)
!define _LogicLib_EndSelectLabelUsed
${${_Logic}Else}: ; Place the Else label
!undef ${_Logic}Else ; and remove it
!else
!define ${_Logic}EndSelect _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the EndSelect
!define ${_Logic}EndSelect _LogicLib_EndSelectLabel_${LOGICLIB_COUNTER} ; Get a label for the EndSelect
!insertmacro _IncreaseCounter
!endif
!verbose pop
@ -662,7 +660,7 @@
!verbose push
!verbose ${LOGICLIB_VERBOSITY}
${CaseElse} ; Perform the CaseElse
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!insertmacro _IncreaseCounter
!insertmacro _== `${${_Logic}Select}` `${_a}` "" ${${_Logic}Else}
!verbose pop
@ -673,7 +671,7 @@
!verbose push
!verbose ${LOGICLIB_VERBOSITY}
${CaseElse} ; Perform the CaseElse
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!insertmacro _IncreaseCounter
!insertmacro _== `${${_Logic}Select}` `${_a}` +2 ""
!insertmacro _== `${${_Logic}Select}` `${_b}` "" ${${_Logic}Else}
@ -685,7 +683,7 @@
!verbose push
!verbose ${LOGICLIB_VERBOSITY}
${CaseElse} ; Perform the CaseElse
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!insertmacro _IncreaseCounter
!insertmacro _== `${${_Logic}Select}` `${_a}` +3 ""
!insertmacro _== `${${_Logic}Select}` `${_b}` +2 ""
@ -698,7 +696,7 @@
!verbose push
!verbose ${LOGICLIB_VERBOSITY}
${CaseElse} ; Perform the CaseElse
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!insertmacro _IncreaseCounter
!insertmacro _== `${${_Logic}Select}` `${_a}` +4 ""
!insertmacro _== `${${_Logic}Select}` `${_b}` +3 ""
@ -712,7 +710,7 @@
!verbose push
!verbose ${LOGICLIB_VERBOSITY}
${CaseElse} ; Perform the CaseElse
!define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case
!insertmacro _IncreaseCounter
!insertmacro _== `${${_Logic}Select}` `${_a}` +5 ""
!insertmacro _== `${${_Logic}Select}` `${_b}` +4 ""
@ -734,7 +732,10 @@
!undef ${_Logic}Else ; and remove it
!endif
!ifdef ${_Logic}EndSelect ; This won't be set if there weren't any cases
!ifdef _LogicLib_EndSelectLabelUsed ; There is no jump to ${${_Logic}EndSelect}: if there is only one Case
${${_Logic}EndSelect}: ; Place the EndSelect
!undef _LogicLib_EndSelectLabelUsed
!endif
!undef ${_Logic}EndSelect ; and remove it
!endif
!undef ${_Logic}Select