Skip to content

Commit 1f19e37

Browse files
committed
_
1 parent 496309e commit 1f19e37

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

compiler/extccomp.nim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,17 @@ proc getOptSize(conf: ConfigRef; c: TSystemCC): string =
547547
if result == "":
548548
result = CC[c].optSize # use default settings from this file
549549

550+
proc flagsToNative(flags: string, c: TSystemCC): string =
551+
## replaces ' -X' by ' /X' for VCC; works ok for some common flags.
552+
if c == ccVcc: result = flags.replace(" -", " /")
553+
else: result = flags
554+
550555
proc getWarnings(conf: ConfigRef; c: TSystemCC): string =
551556
result = getConfigVar(conf, c, ".options.warnings")
552-
if not conf.hasWarn(warnBackendWarning): # disable all warnings
553-
case c
554-
of ccVcc: result.add " /w"
555-
else: result.add " -w"
557+
if not conf.hasWarn(warnBackendWarning):
558+
result.add " -w".flagsToNative(c) # disable all warnings
559+
else:
560+
result.add " -DNIM_UNIGNORE_DEFAULT_BACKEND_WARNINGS".flagsToNative(c)
556561

557562
proc noAbsolutePaths(conf: ConfigRef): bool {.inline.} =
558563
# We used to check current OS != specified OS, but this makes no sense

config/config.nims

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ when defined(nimHasCppDefine):
44
cppDefine "errno"
55
cppDefine "unix"
66

7-
when false:
8-
block: # warnings
7+
block: # warnings
98
#[
109
## ignore typical warnings in Nim-generated files
1110
@@ -28,22 +27,7 @@ when false:
2827
]#
2928

3029
let clangWarningsCommon = "-Wno-logical-op-parentheses -Wno-invalid-noreturn -Wno-tautological-constant-out-of-range-compare -Wno-switch-bool"
31-
3230
let clangWarningsC = clangWarningsCommon & " -Wno-incompatible-pointer-types-discards-qualifiers"
33-
3431
let clangWarningsCpp = clangWarningsCommon & " -Wno-writable-strings -Wno-invalid-offsetof"
35-
36-
let gccWarnings = " "
37-
38-
for cc in ["clang"]:
39-
switch(cc & ".options.warnings", clangWarningsC)
40-
switch(cc & ".cpp.options.warnings", clangWarningsCpp)
41-
42-
block: # vcc
43-
let vccWarnings = "/wd4005 /wd4100 /wd4101 /wd4189 /wd4191 /wd4200 /wd4244 /wd4293 /wd4296 /wd4309 /wd4310 /wd4365 /wd4456 /wd4477 /wd4514 /wd4574 /wd4611 /wd4668 /wd4702 /wd4706 /wd4710 /wd4711 /wd4774 /wd4800 /wd4809 /wd4820 /wd4996 /wd4090 /wd4297"
44-
switch("vcc.options.warnings", vccWarnings)
45-
46-
when defined(vcc):
47-
switch("passc", "/w")
48-
else:
49-
switch("passc", "-w")
32+
switch("clang.options.warnings", clangWarningsC)
33+
switch("clang.cpp.options.warnings", clangWarningsCpp)

0 commit comments

Comments
 (0)