Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1109,9 +1109,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
of "goto": conf.exc = excGoto
else: localError(conf, info, errInvalidExceptionSystem % arg)
of "cppdefine":
expectArg(conf, switch, arg, pass, info)
if conf != nil:
conf.cppDefine(arg)
warningDeprecated(conf, info, "cppdefine is deprecated and ignored")
of "newruntime":
warningDeprecated(conf, info, "newruntime is deprecated, use arc/orc instead!")
expectNoArg(conf, switch, arg, pass, info)
Expand Down
2 changes: 0 additions & 2 deletions compiler/ic/replayer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ proc replayStateChanges*(module: PSym; g: ModuleGraph) =
extccomp.addCompileOption(g.config, n[1].strVal)
of "localpassc":
extccomp.addLocalCompileOption(g.config, n[1].strVal, toFullPathConsiderDirty(g.config, module.info.fileIndex))
of "cppdefine":
options.cppDefine(g.config, n[1].strVal)
of "inc":
let destKey = n[1].strVal
let by = n[2].intVal
Expand Down
6 changes: 0 additions & 6 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ type
symbolFiles*: SymbolFilesOption
spellSuggestMax*: int # max number of spelling suggestions for typos

cppDefines*: HashSet[string] # (*)
headerFile*: string
nimbasePattern*: string # pattern to find nimbase.h
features*: set[Feature]
Expand Down Expand Up @@ -415,7 +414,6 @@ type
command*: string # the main command (e.g. cc, check, scan, etc)
commandArgs*: seq[string] # any arguments after the main command
commandLine*: string
extraCmds*: seq[string] # for writeJsonBuildInstructions
implicitImports*: seq[string] # modules that are to be implicitly imported
implicitIncludes*: seq[string] # modules that are to be implicitly included
docSeeSrcUrl*: string # if empty, no seeSrc will be generated. \
Expand Down Expand Up @@ -567,7 +565,6 @@ proc newConfigRef*(): ConfigRef =
macrosToExpand: newStringTable(modeStyleInsensitive),
arcToExpand: newStringTable(modeStyleInsensitive),
m: initMsgConfig(),
cppDefines: initHashSet[string](),
headerFile: "", features: {}, legacyFeatures: {},
configVars: newStringTable(modeStyleInsensitive),
symbols: newStringTable(modeStyleInsensitive),
Expand Down Expand Up @@ -628,9 +625,6 @@ proc newPartialConfigRef*(): ConfigRef =
result = ConfigRef()
initConfigRefCommon(result)

proc cppDefine*(c: ConfigRef; define: string) =
c.cppDefines.incl define

proc isDefined*(conf: ConfigRef; symbol: string): bool =
if conf.symbols.hasKey(symbol):
result = true
Expand Down
6 changes: 0 additions & 6 deletions compiler/pragmas.nim
Original file line number Diff line number Diff line change
Expand Up @@ -911,13 +911,9 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
incl(sym.flagsImpl, sfUsed) # avoid wrong hints
of wImportc:
let name = getOptionalStr(c, it, "$1")
cppDefine(c.config, name)
recordPragma(c, it, "cppdefine", name)
makeExternImport(c, sym, name, it.info)
of wImportCompilerProc:
let name = getOptionalStr(c, it, "$1")
cppDefine(c.config, name)
recordPragma(c, it, "cppdefine", name)
processImportCompilerProc(c, sym, name, it.info)
of wExtern: setExternName(c, sym, expectStrLit(c, it), it.info)
of wDirty:
Expand Down Expand Up @@ -1048,8 +1044,6 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
processDynLib(c, it, sym)
of wCompilerProc, wCore:
noVal(c, it) # compilerproc may not get a string!
cppDefine(c.graph.config, sym.name.s)
recordPragma(c, it, "cppdefine", sym.name.s)
if sfFromGeneric notin sym.flags: markCompilerProc(c, sym)
of wNonReloadable:
sym.incl sfNonReloadable
Expand Down
4 changes: 2 additions & 2 deletions compiler/scriptconfig.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import
ast, modules, idents, condsyms,
options, llstream, vm, vmdef, commands,
options, msgs, llstream, vm, vmdef, commands,
wordrecg, modulegraphs,
pathutils, pipelines

Expand Down Expand Up @@ -181,7 +181,7 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
cbconf selfExe:
setResult(a, os.getAppFilename())
cbconf cppDefine:
options.cppDefine(conf, a.getString(0))
echo graph.config.toFileLineCol(a.currentLineInfo), " cppDefine is deprecated and no longer need to call"
cbexc stdinReadLine, EOFError:
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
setResult(a, "")
Expand Down
8 changes: 0 additions & 8 deletions config/config.nims
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# this config.nims also needs to exist to prevent future regressions, see #9990

cppDefine "errno"
cppDefine "unix"

# mangle the macro names in nimbase.h
cppDefine "NAN_INFINITY"
cppDefine "INF"
cppDefine "NAN"

when defined(nimStrictMode):
# xxx add more flags here, and use `-d:nimStrictMode` in more contexts in CI.

Expand Down
2 changes: 1 addition & 1 deletion lib/system/nimscript.nim
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ proc writeTask(name, desc: string) =
for i in 0 ..< 20 - name.len: spaces.add ' '
echo name, spaces, desc

proc cppDefine*(define: string) =
proc cppDefine*(define: string) {.deprecated: "No longer need to call".} =
## tell Nim that `define` is a C preprocessor `#define` and so always
## needs to be mangled.
builtin
Expand Down