MCPcopy Create free account
hub / github.com/nodejs/node / _EscapeCppDefineForMSVS

Function _EscapeCppDefineForMSVS

tools/gyp/pylib/gyp/generator/msvs.py:842–850  ·  view source on GitHub ↗

Escapes a CPP define so that it will reach the compiler unaltered.

(s)

Source from the content-addressed store, hash-verified

840
841
842def _EscapeCppDefineForMSVS(s):
843 """Escapes a CPP define so that it will reach the compiler unaltered."""
844 s = _EscapeEnvironmentVariableExpansion(s)
845 s = _EscapeCommandLineArgumentForMSVS(s)
846 s = _EscapeVCProjCommandLineArgListItem(s)
847 # cl.exe replaces literal # characters with = in preprocessor definitions for
848 # some reason. Octal-encode to work around that.
849 s = s.replace("#", "\\%03o" % ord("#"))
850 return s
851
852
853quote_replacer_regex2 = re.compile(r'(\\+)"')

Callers 1

Tested by

no test coverage detected