summary refs log tree commit diff stats
path: root/compiler/commands.nim
diff options
context:
space:
mode:
authorTomohiro <gpuppur@gmail.com>2019-11-02 16:21:49 +0900
committerAndreas Rumpf <rumpf_a@web.de>2019-11-02 08:21:49 +0100
commit4e0f12092ebb64047dc0ecfc86e348e4d93eab4c (patch)
treebb1294a07134fc46b11681f97186ff9df3f90f52 /compiler/commands.nim
parent44a27ccfe1cd56f2e77979eba4814d94eec47b41 (diff)
downloadNim-4e0f12092ebb64047dc0ecfc86e348e4d93eab4c.tar.gz
Fixes #12536 (#12568) [backport]
Diffstat (limited to 'compiler/commands.nim')
-rw-r--r--compiler/commands.nim26
1 files changed, 12 insertions, 14 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 249312f50..068fcbc92 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -627,22 +627,20 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
     processOnOffSwitchG(conf, {optGenMapping}, arg, pass, info)
   of "os":
     expectArg(conf, switch, arg, pass, info)
-    if pass in {passCmd1, passPP}:
-      let theOS = platform.nameToOS(arg)
-      if theOS == osNone:
-        let osList = platform.listOSnames().join(", ")
-        localError(conf, info, "unknown OS: '$1'. Available options are: $2" % [arg, $osList])
-      elif theOS != conf.target.hostOS:
-        setTarget(conf.target, theOS, conf.target.targetCPU)
+    let theOS = platform.nameToOS(arg)
+    if theOS == osNone:
+      let osList = platform.listOSnames().join(", ")
+      localError(conf, info, "unknown OS: '$1'. Available options are: $2" % [arg, $osList])
+    else:
+      setTarget(conf.target, theOS, conf.target.targetCPU)
   of "cpu":
     expectArg(conf, switch, arg, pass, info)
-    if pass in {passCmd1, passPP}:
-      let cpu = platform.nameToCPU(arg)
-      if cpu == cpuNone:
-        let cpuList = platform.listCPUnames().join(", ")
-        localError(conf, info, "unknown CPU: '$1'. Available options are: $2" % [ arg, cpuList])
-      elif cpu != conf.target.hostCPU:
-        setTarget(conf.target, conf.target.targetOS, cpu)
+    let cpu = platform.nameToCPU(arg)
+    if cpu == cpuNone:
+      let cpuList = platform.listCPUnames().join(", ")
+      localError(conf, info, "unknown CPU: '$1'. Available options are: $2" % [ arg, cpuList])
+    else:
+      setTarget(conf.target, conf.target.targetOS, cpu)
   of "run", "r":
     processOnOffSwitchG(conf, {optRun}, arg, pass, info)
   of "errormax":