cValidAssemblers -> const set

Added assembler validity check
This commit is contained in:
rku 2015-08-10 12:02:49 +03:00
commit 6a7a44bbf2
2 changed files with 7 additions and 1 deletions

View file

@ -368,7 +368,9 @@ var
cIncludes*: seq[string] = @[] # directories to search for included files cIncludes*: seq[string] = @[] # directories to search for included files
cLibs*: seq[string] = @[] # directories to search for lib files cLibs*: seq[string] = @[] # directories to search for lib files
cLinkedLibs*: seq[string] = @[] # libraries to link cLinkedLibs*: seq[string] = @[] # libraries to link
cValidAssemblers* = @[asmFasm]
const
cValidAssemblers* = {asmFasm}
# implementation # implementation
@ -567,6 +569,8 @@ proc getCompileCFileCmd*(cfilename: string, isExternal = false): string =
if c == ccNone: if c == ccNone:
rawMessage(errExternalAssemblerNotFound, "") rawMessage(errExternalAssemblerNotFound, "")
elif c notin cValidAssemblers:
rawMessage(errExternalAssemblerNotValid, customAssembler)
var options = cFileSpecificOptions(cfilename) var options = cFileSpecificOptions(cfilename)
var exe = getConfigVar(c, ".exe") var exe = getConfigVar(c, ".exe")

View file

@ -109,6 +109,7 @@ type
errGenericLambdaNotAllowed, errGenericLambdaNotAllowed,
errCompilerDoesntSupportTarget, errCompilerDoesntSupportTarget,
errExternalAssemblerNotFound, errExternalAssemblerNotFound,
errExternalAssemblerNotValid,
errUser, errUser,
warnCannotOpenFile, warnCannotOpenFile,
warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit, warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit,
@ -372,6 +373,7 @@ const
"of the generic paramers can be inferred from the expected signature.", "of the generic paramers can be inferred from the expected signature.",
errCompilerDoesntSupportTarget: "The current compiler \'$1\' doesn't support the requested compilation target", errCompilerDoesntSupportTarget: "The current compiler \'$1\' doesn't support the requested compilation target",
errExternalAssemblerNotFound: "External assembler not found", errExternalAssemblerNotFound: "External assembler not found",
errExternalAssemblerNotValid: "External assembler '$1' is not a valid assembler",
errUser: "$1", errUser: "$1",
warnCannotOpenFile: "cannot open \'$1\'", warnCannotOpenFile: "cannot open \'$1\'",
warnOctalEscape: "octal escape sequences do not exist; leading zero is ignored", warnOctalEscape: "octal escape sequences do not exist; leading zero is ignored",