[libcxx] [test] Avoid conflicting definitions of _CRT_SECURE_NO_WARNINGS
authorMartin Storsjö <martin@martin.st>
Tue, 4 Feb 2020 20:51:06 +0000 (22:51 +0200)
committerMartin Storsjö <martin@martin.st>
Tue, 20 Oct 2020 16:44:21 +0000 (19:44 +0300)
This is defined both by libcxx/utils/libcxx/test/config.py (for
any windows target) and msvc_stdlib_force_include.h (when testing
specifically the MSVC C++ library).

The command line define (-D_CRT_SECURE_NO_WARNINGS) defines it to the
value 1; change the header define to match that.

Keeping both instances, to keep the fix for cases when not building
in cases that don't use config.py.

Also remove a comment about whether this can be removed; it can't at
least be removed altogether - doing that breaks a number of tests that
otherwise succeed.

Differential Revision: https://reviews.llvm.org/D89588

libcxx/test/support/msvc_stdlib_force_include.h
libcxx/utils/libcxx/test/config.py

index 0869be3..bd83bee 100644 (file)
@@ -14,7 +14,7 @@
 
 #ifndef _LIBCXX_IN_DEVCRT
     // Silence warnings about CRT machinery.
-    #define _CRT_SECURE_NO_WARNINGS
+    #define _CRT_SECURE_NO_WARNINGS 1
 
     // Avoid assertion dialogs.
     #define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
index d32b0ee..0d21aa1 100644 (file)
@@ -272,7 +272,6 @@ class Configuration(object):
         compile_flags_str = self.get_lit_conf('compile_flags', '')
         self.cxx.compile_flags += shlex.split(compile_flags_str)
         if self.target_info.is_windows():
-            # FIXME: Can we remove this?
             self.cxx.compile_flags += ['-D_CRT_SECURE_NO_WARNINGS']
             # Don't warn about using common but nonstandard unprefixed functions
             # like chdir, fileno.