about summary refs log tree commit diff
path: root/absl/copts
diff options
context:
space:
mode:
Diffstat (limited to 'absl/copts')
-rw-r--r--absl/copts/AbseilConfigureCopts.cmake3
-rw-r--r--absl/copts/GENERATED_AbseilCopts.cmake4
-rw-r--r--absl/copts/GENERATED_copts.bzl4
-rw-r--r--absl/copts/configure_copts.bzl6
-rw-r--r--absl/copts/copts.py45
5 files changed, 46 insertions, 16 deletions
diff --git a/absl/copts/AbseilConfigureCopts.cmake b/absl/copts/AbseilConfigureCopts.cmake
index 5084958c3581..b2b3f88d5055 100644
--- a/absl/copts/AbseilConfigureCopts.cmake
+++ b/absl/copts/AbseilConfigureCopts.cmake
@@ -3,6 +3,7 @@ include(GENERATED_AbseilCopts)
 
 set(ABSL_LSAN_LINKOPTS "")
 set(ABSL_HAVE_LSAN OFF)
+set(ABSL_DEFAULT_LINKOPTS "")
 
 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
   set(ABSL_DEFAULT_COPTS "${ABSL_GCC_FLAGS}")
@@ -19,6 +20,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
     set(ABSL_DEFAULT_COPTS "${ABSL_LLVM_FLAGS}")
     set(ABSL_TEST_COPTS "${ABSL_LLVM_FLAGS};${ABSL_LLVM_TEST_FLAGS}")
     set(ABSL_EXCEPTIONS_FLAG "${ABSL_LLVM_EXCEPTIONS_FLAGS}")
+    set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
     if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
       # AppleClang doesn't have lsan
       # https://developer.apple.com/documentation/code_diagnostics
@@ -32,6 +34,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
   set(ABSL_DEFAULT_COPTS "${ABSL_MSVC_FLAGS}")
   set(ABSL_TEST_COPTS "${ABSL_MSVC_FLAGS};${ABSL_MSVC_TEST_FLAGS}")
   set(ABSL_EXCEPTIONS_FLAG "${ABSL_MSVC_EXCEPTIONS_FLAGS}")
+  set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
 else()
   message(WARNING "Unknown compiler: ${CMAKE_CXX_COMPILER}.  Building with no default flags")
   set(ABSL_DEFAULT_COPTS "")
diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake
index 9031bfa5daf7..043c88a2f576 100644
--- a/absl/copts/GENERATED_AbseilCopts.cmake
+++ b/absl/copts/GENERATED_AbseilCopts.cmake
@@ -201,6 +201,10 @@ list(APPEND ABSL_MSVC_FLAGS
     "/wd4800"
 )
 
+list(APPEND ABSL_MSVC_LINKOPTS
+    "-ignore:4221"
+)
+
 list(APPEND ABSL_MSVC_TEST_FLAGS
     "/wd4018"
     "/wd4101"
diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl
index e05a58e39b40..d40380b86057 100644
--- a/absl/copts/GENERATED_copts.bzl
+++ b/absl/copts/GENERATED_copts.bzl
@@ -202,6 +202,10 @@ ABSL_MSVC_FLAGS = [
     "/wd4800",
 ]
 
+ABSL_MSVC_LINKOPTS = [
+    "-ignore:4221",
+]
+
 ABSL_MSVC_TEST_FLAGS = [
     "/wd4018",
     "/wd4101",
diff --git a/absl/copts/configure_copts.bzl b/absl/copts/configure_copts.bzl
index 1655addd2461..0015931762a4 100644
--- a/absl/copts/configure_copts.bzl
+++ b/absl/copts/configure_copts.bzl
@@ -14,6 +14,7 @@ load(
     "ABSL_LLVM_TEST_FLAGS",
     "ABSL_MSVC_EXCEPTIONS_FLAGS",
     "ABSL_MSVC_FLAGS",
+    "ABSL_MSVC_LINKOPTS",
     "ABSL_MSVC_TEST_FLAGS",
 )
 
@@ -40,3 +41,8 @@ ABSL_EXCEPTIONS_FLAG = select({
 ABSL_EXCEPTIONS_FLAG_LINKOPTS = select({
     "//conditions:default": [],
 })
+
+ABSL_DEFAULT_LINKOPTS = select({
+    "//absl:windows": ABSL_MSVC_LINKOPTS,
+    "//conditions:default": [],
+})
diff --git a/absl/copts/copts.py b/absl/copts/copts.py
index 3c9d42945f1b..608d7c0edeee 100644
--- a/absl/copts/copts.py
+++ b/absl/copts/copts.py
@@ -153,26 +153,39 @@ COPT_VARS = {
         "-Wno-unused-private-field",
     ],
     "ABSL_GCC_EXCEPTIONS_FLAGS": ["-fexceptions"],
-    "ABSL_LLVM_FLAGS": LLVM_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS,
-    "ABSL_LLVM_TEST_FLAGS": LLVM_TEST_DISABLE_WARNINGS_FLAGS,
+    "ABSL_LLVM_FLAGS":
+        LLVM_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS,
+    "ABSL_LLVM_TEST_FLAGS":
+        LLVM_TEST_DISABLE_WARNINGS_FLAGS,
     "ABSL_LLVM_EXCEPTIONS_FLAGS": ["-fexceptions"],
-    "ABSL_CLANG_CL_FLAGS": (MSVC_BIG_WARNING_FLAGS +
-                            LLVM_DISABLE_WARNINGS_FLAGS + MSVC_DEFINES),
-    "ABSL_CLANG_CL_TEST_FLAGS": LLVM_TEST_DISABLE_WARNINGS_FLAGS,
-    "ABSL_CLANG_CL_EXCEPTIONS_FLAGS": MSVC_STYLE_EXCEPTIONS_FLAGS,
-    "ABSL_MSVC_FLAGS": MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES + [
-        "/wd4005",  # macro-redefinition
-        "/wd4068",  # unknown pragma
-        "/wd4180",  # qualifier applied to function type has no meaning; ignored
-        "/wd4244",  # conversion from 'type1' to 'type2', possible loss of data
-        "/wd4267",  # conversion from 'size_t' to 'type', possible loss of data
-        # forcing value to bool 'true' or 'false' (performance warning)
-        "/wd4800",
-    ],
+    "ABSL_CLANG_CL_FLAGS": (
+        MSVC_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS + MSVC_DEFINES),
+    "ABSL_CLANG_CL_TEST_FLAGS":
+        LLVM_TEST_DISABLE_WARNINGS_FLAGS,
+    "ABSL_CLANG_CL_EXCEPTIONS_FLAGS":
+        MSVC_STYLE_EXCEPTIONS_FLAGS,
+    "ABSL_MSVC_FLAGS":
+        MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES + [
+            "/wd4005",  # macro-redefinition
+            "/wd4068",  # unknown pragma
+            # qualifier applied to function type has no meaning; ignored
+            "/wd4180",
+            # conversion from 'type1' to 'type2', possible loss of data
+            "/wd4244",
+            # conversion from 'size_t' to 'type', possible loss of data
+            "/wd4267",
+            # forcing value to bool 'true' or 'false' (performance warning)
+            "/wd4800",
+        ],
     "ABSL_MSVC_TEST_FLAGS": [
         "/wd4018",  # signed/unsigned mismatch
         "/wd4101",  # unreferenced local variable
         "/wd4503",  # decorated name length exceeded, name was truncated
     ],
-    "ABSL_MSVC_EXCEPTIONS_FLAGS": MSVC_STYLE_EXCEPTIONS_FLAGS,
+    "ABSL_MSVC_EXCEPTIONS_FLAGS":
+        MSVC_STYLE_EXCEPTIONS_FLAGS,
+    "ABSL_MSVC_LINKOPTS": [
+        # Object file doesn't export any previously undefined symbols
+        "/ignore:4221",
+    ],
 }