[lumped builds] Only define _CRT_SECURE_NO_WARNINGS if it’s not defined yet.
authorAras Pranckevicius <aras@unity3d.com>
Wed, 10 May 2017 13:52:50 +0000 (16:52 +0300)
committerAras Pranckevicius <aras@unity3d.com>
Wed, 10 May 2017 13:52:50 +0000 (16:52 +0300)
When glslang is built with some other build system and lumped/unity builds are used,
without the checks this would get “macro is being redefined” warnings/errors.

StandAlone/StandAlone.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
glslang/MachineIndependent/preprocessor/PpAtom.cpp
glslang/MachineIndependent/preprocessor/PpScanner.cpp
glslang/MachineIndependent/preprocessor/PpTokens.cpp

index 3faadecfc35df4f3f483f7ff0aaffa21f5253138..76af8fe3372ec2a22a83449d230d15c091909a45 100644 (file)
@@ -35,7 +35,9 @@
 //
 
 // this only applies to the standalone wrapper, not the front end in general
+#ifndef _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
+#endif
 
 #include "ResourceLimits.h"
 #include "Worklist.h"
index e71e79c4ce0de3e382315017899e06f2c17e70d2..293ada6cecbf0a326ad2e7a6a104575ef1cbc507 100644 (file)
@@ -76,7 +76,9 @@ TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
 NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 \****************************************************************************/
 
+#ifndef _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
+#endif
 
 #include <sstream>
 #include <cstdlib>
index 52df3b025dea8ffa52e50393b54d1e3a20cd781e..06c2333ef1048a7a008b0a2dcbb85d9a37021a12 100644 (file)
@@ -76,7 +76,9 @@ TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
 NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 \****************************************************************************/
 
+#ifndef _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
+#endif
 
 #include <cassert>
 #include <cstdlib>
index e72efc048838bf749fcd44a2133e32f16f8295fd..cee45ce749d5401f6113d34aa265ca9e71b32d94 100644 (file)
@@ -76,7 +76,9 @@ TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
 NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 \****************************************************************************/
 
+#ifndef _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
+#endif
 
 #include <cstdlib>
 #include <cstring>
index 7fa06a5a4a896dc35d266be51f56e02b2b02a71f..4baf99e01ecd5ccb40b8433603b0f5bdef7bd47c 100644 (file)
@@ -80,8 +80,10 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 // For recording and playing back the stream of tokens in a macro definition.
 //
 
-#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
+#ifndef _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
+#endif
+#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
 #define snprintf sprintf_s
 #endif