Commit 2622e27d authored by brucedawson's avatar brucedawson Committed by Commit bot

Don't #define snprintf in VS 2015 builds.

The function snprintf is not available in Visual Studio prior to VS
2015. In some places this omission is dealt with with a #define to map
snprintf to _snprintf. This was never a good idea (_snprintf doesn't
guarantee null-termination) and with VS 2015 it is not even legal.

This change conditionally disables one instance of this remapping.

The build errors that occur without this change are:

stdio.h(1926): warning C4005: 'snprintf': macro redefinition
stdio.h(1926): note: command-line arguments:  see previous
definition of 'snprintf'
stdio.h(1929): fatal error C1189: #error:  Macro definition of
snprintf conflicts with Standard Library function declaration

R=scottmg@chromium.org
BUG=440500

Review URL: https://codereview.chromium.org/1069433002

Cr-Commit-Position: refs/heads/master@{#324157}
parent 3b3e16c4
......@@ -743,9 +743,14 @@
'dependencies': [ '../build/linux/system.gyp:x11' ],
}],
['OS=="win"', {
'defines': [
# This seems like a hack, but this is what Safari Win does.
'snprintf=_snprintf',
'conditions': [
['MSVS_VERSION < "2015"', {
'defines': [
# This seems like a hack, but this is what Safari Win does.
# Luckily it is no longer needed/allowed with VS 2015.
'snprintf=_snprintf',
],
}],
],
'sources': [
'shell/tools/plugin/win/TestNetscapePlugin.def',
......
......@@ -83,9 +83,16 @@
'sources': [
'libexif.def',
],
'conditions': [
['MSVS_VERSION < "2015"', {
'defines': [
# This seems like a hack, but this is what Safari Win does.
# Luckily it is no longer needed/allowed with VS 2015.
'snprintf=_snprintf',
],
}],
],
'defines': [
# This seems like a hack, but this is what WebKit Win does.
'snprintf=_snprintf',
'inline=__inline',
],
'msvs_disabled_warnings': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment