Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Apr 16, 2020
1 parent 496309e commit 1f19e37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
13 changes: 9 additions & 4 deletions compiler/extccomp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,17 @@ proc getOptSize(conf: ConfigRef; c: TSystemCC): string =
if result == "":
result = CC[c].optSize # use default settings from this file

proc flagsToNative(flags: string, c: TSystemCC): string =
## replaces ' -X' by ' /X' for VCC; works ok for some common flags.
if c == ccVcc: result = flags.replace(" -", " /")
else: result = flags

proc getWarnings(conf: ConfigRef; c: TSystemCC): string =
result = getConfigVar(conf, c, ".options.warnings")
if not conf.hasWarn(warnBackendWarning): # disable all warnings
case c
of ccVcc: result.add " /w"
else: result.add " -w"
if not conf.hasWarn(warnBackendWarning):
result.add " -w".flagsToNative(c) # disable all warnings
else:
result.add " -DNIM_UNIGNORE_DEFAULT_BACKEND_WARNINGS".flagsToNative(c)

proc noAbsolutePaths(conf: ConfigRef): bool {.inline.} =
# We used to check current OS != specified OS, but this makes no sense
Expand Down
22 changes: 3 additions & 19 deletions config/config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ when defined(nimHasCppDefine):
cppDefine "errno"
cppDefine "unix"

when false:
block: # warnings
block: # warnings
#[
## ignore typical warnings in Nim-generated files
Expand All @@ -28,22 +27,7 @@ when false:
]#

let clangWarningsCommon = "-Wno-logical-op-parentheses -Wno-invalid-noreturn -Wno-tautological-constant-out-of-range-compare -Wno-switch-bool"

let clangWarningsC = clangWarningsCommon & " -Wno-incompatible-pointer-types-discards-qualifiers"

let clangWarningsCpp = clangWarningsCommon & " -Wno-writable-strings -Wno-invalid-offsetof"

let gccWarnings = " "

for cc in ["clang"]:
switch(cc & ".options.warnings", clangWarningsC)
switch(cc & ".cpp.options.warnings", clangWarningsCpp)

block: # vcc
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"
switch("vcc.options.warnings", vccWarnings)

when defined(vcc):
switch("passc", "/w")
else:
switch("passc", "-w")
switch("clang.options.warnings", clangWarningsC)
switch("clang.cpp.options.warnings", clangWarningsCpp)

0 comments on commit 1f19e37

Please sign in to comment.