about summary refs log tree commit diff
path: root/absl/time/internal/cctz/src/zone_info_source.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/time/internal/cctz/src/zone_info_source.cc')
-rw-r--r--absl/time/internal/cctz/src/zone_info_source.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/absl/time/internal/cctz/src/zone_info_source.cc b/absl/time/internal/cctz/src/zone_info_source.cc
index b77c0a585a12..ee7500b64f28 100644
--- a/absl/time/internal/cctz/src/zone_info_source.cc
+++ b/absl/time/internal/cctz/src/zone_info_source.cc
@@ -60,9 +60,17 @@ ZoneInfoSourceFactory default_factory = DefaultFactory;
 #else
 #error Unsupported MSVC platform
 #endif
-#else
+#else  // _MSC_VER
+#if !defined(__has_attribute)
+#define __has_attribute(x) 0
+#endif
+#if __has_attribute(weak) || defined(__GNUC__)
 ZoneInfoSourceFactory zone_info_source_factory
     __attribute__((weak)) = DefaultFactory;
+#else
+// Make it a "strong" definition if we have no other choice.
+ZoneInfoSourceFactory zone_info_source_factory = DefaultFactory;
+#endif
 #endif  // _MSC_VER
 
 }  // namespace cctz_extension