abseil / abseil-cpp Goto Github PK
View Code? Open in Web Editor NEWAbseil Common Libraries (C++)
Home Page: https://abseil.io
License: Apache License 2.0
Abseil Common Libraries (C++)
Home Page: https://abseil.io
License: Apache License 2.0
In the following location a line continuation mechanism is employed that is only supported by CMake versions > 3.
abseil-cpp/CMake/AbseilHelpers.cmake
Line 77 in 95ddf85
However the CMakeLists only requires:
Line 16 in 95ddf85
In places like here and below, it is marked as v[0] = "a", v[1] = "b", v[3] = "c"
. Should probably be v[2]
.
I understand there is another issue/PR relating to VS 2017 flags and Cmake builds because VS 2017 doesn't recognize the -std=c++11 compiler flag.
The flag /D_SCL_SECURE_NO_WARNINGS
needs to be added to the abseil-cpp\CMakeLists.txt file in order for compilation with VS 2017 to succeed.
add_definitions(/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS)
Otherwise VS considers the call to std::copy at line 544 in malloc_hook.cc to be unsafe (this is one among many).
str_split_internal has an #include <glibcxx_debug_traits.h>
if _GLIBCXX_DEBUG
is enabled.
My system has no glibcxx_debug_traits.h
, and the only references I can find on Google are includes from this project and google/sensei
. Is this a Google-internal file of some sort? Should this include be removed? If not, where can I find a glibcxx_debug_traits.h
?
Issue following the discussions on #8 : should we support install() in the cmake build:
Pro:
Cons:
The insert and emplace methods of InlinedVector don't seem to protect at all against the construction of a new element throwing after existing elements have been moved. If this happens, the vector may be left with uninitialized gaps in the middle of a vector, which will lead to undefined behaviour when e.g. the vector's destructor runs.
Is MinGW support planned ?
On Ubuntu 16.04, g++ 5.4.0, libstdc++6 5.4.0, //absl/time:time_test fails to build; duration_test.cc uses isnan and isinf from the std namespace (from cmath) without std:: qualification.
Currently it appears to be impossible to compile Abseil using VS 2017 without errors.
Adding something like this resolve this problem with windows.h includes.
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# ifndef VC_EXTRALEAN
# define VC_EXTRALEAN
# endif
# ifndef NOMINMAX
# define NOMINMAX
# endif
#include <windows.h>
I understand there is another issue/PR relating to VS 2017 flags and Cmake builds because VS 2017 doesn't recognize the -std=c++11 compiler flag.
static const uintptr_t kHideMask = static_cast<uintptr_t>(0xF03A5F7BF03A5F7Bll);
Currently building abseil into my project with Cmake. I can get around this error by adding /wd4309 to the abseil-cpp\CMakeLists.txt add_compile_options telling the compiler to not treat this warning as an error.
Something like Loki/Alexandrescu's LockingPtr.h (sans the volatile
bits) with additional helpers like a mutexed
class that wraps a value with a mutex and a Lock()
function that returns a locking_ptr
so you get functionality like:
struct X { int i; double d; };
abslEx::mutexed<X> x;
// ...
// assert( x.i == 42 ); // Fails to compile because x is not locked
// Lock for a single statement
assert( abslEx::Lock( x )->i == 42 ); // Ok
// Use for multiple statements
const auto locked = abslEx::Lock( x );
assert( locked->i == 42 );
std::cout << locked->i << " " << locked->d;
Advantages of this approach are a more RAII-style that is harder to misuse (forget to lock/unlock). I prefer this over the sort of macro annotation style of the current Abseil synchronization primitives, but I'm open to being convinced otherwise.
I'd be willing to work on this, but I'm not sure how open Abseil is to accepting contributions of this sort.
Both of abseil-cpp and mini_chromium are from Google, the question is what is the difference and why create another wheel?
Hello,
I can't see any version number / scheme in the library. Does it exist?
It would be nice to have such version numbers reflected via git tags (and probably the cmake file) in order to:
That would probably imply to maintain a changelog file as well. It's a bit of more work but it's very useful for consumers like me.
Aurelien
Line 190 in 95ddf85
Hello, I'm trying to build abseil-cpp on Windows with installed VS 2017. My default code page is 936 (Simplified Chinese) and when build abseil will occur following error.
error C2220: warning treated as error - no 'object' file generated
warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
Here is one solution. Add /utf-8
option to MSVC_FLAGS
in file absl/copts.bzl
index 20c9b61..0052db8 100644
--- a/absl/copts.bzl
+++ b/absl/copts.bzl
@@ -126,6 +126,7 @@ MSVC_FLAGS = [
"/DNOMINMAX", # Don't define min and max macros (windows.h)
"/DWIN32_LEAN_AND_MEAN", # Don't bloat namespace with incompatible winsock versions.
"/D_CRT_SECURE_NO_WARNINGS", # Don't warn about usage of insecure C functions
+ "/utf-8", # Fix C4819 for non-english code page.
]
Abseil provides bunch of operator<<(std::ostream& o, ...)
for various types. Am I not supposed to use them to conform to Abseil Compatibility Guidelines?
E:\Home\dev\ext-repos\abseil-cpp
λ bazel.exe test absl/...:all
____Loading package: @local_config_cc//
____Loading complete. Analyzing...
____Found 40 targets and 54 test targets...
____Building...
ERROR: E:/home/dev/ext-repos/abseil-cpp/absl/numeric/BUILD.bazel:11:1: C++ compilation of rule '//absl/numeric:int128' failed (Exit 2).
cl : Command line error D8021 : invalid numeric argument '/Wextra'
____Elapsed time: 1,210s, Critical Path: 0,07s
//absl/algorithm:algorithm_test NO STATUS
//absl/algorithm:container_test NO STATUS
//absl/base:bit_cast_test NO STATUS
//absl/base:call_once_test NO STATUS
//absl/base:config_test NO STATUS
//absl/base:endian_test NO STATUS
//absl/base:invoke_test NO STATUS
//absl/base:low_level_alloc_test NO STATUS
//absl/base:malloc_extension_system_malloc_test NO STATUS
//absl/base:raw_logging_test NO STATUS
//absl/base:spinlock_test NO STATUS
//absl/base:sysinfo_test NO STATUS
//absl/base:thread_identity_test NO STATUS
//absl/base:throw_delegate_test NO STATUS
//absl/container:fixed_array_test NO STATUS
//absl/container:fixed_array_test_noexceptions NO STATUS
//absl/container:inlined_vector_test NO STATUS
//absl/container:inlined_vector_test_noexceptions NO STATUS
//absl/container:test_instance_tracker_test NO STATUS
//absl/debugging:disabled_leak_check_test NO STATUS
//absl/debugging:leak_check_no_lsan_test NO STATUS
//absl/debugging:leak_check_test NO STATUS
//absl/memory:memory_test NO STATUS
//absl/meta:type_traits_test NO STATUS
//absl/numeric:int128_test NO STATUS
//absl/strings:char_map_test NO STATUS
//absl/strings:escaping_test NO STATUS
//absl/strings:match_test NO STATUS
//absl/strings:memutil_test NO STATUS
//absl/strings:numbers_test NO STATUS
//absl/strings:ostringstream_test NO STATUS
//absl/strings:resize_uninitialized_test NO STATUS
//absl/strings:str_cat_test NO STATUS
//absl/strings:str_join_test NO STATUS
//absl/strings:str_replace_test NO STATUS
//absl/strings:str_split_test NO STATUS
//absl/strings:string_view_test NO STATUS
//absl/strings:strip_test NO STATUS
//absl/strings:substitute_test NO STATUS
//absl/strings:utf8_test NO STATUS
//absl/synchronization:barrier_test NO STATUS
//absl/synchronization:blocking_counter_test NO STATUS
//absl/synchronization:graphcycles_test NO STATUS
//absl/synchronization:mutex_test NO STATUS
//absl/synchronization:notification_test NO STATUS
//absl/synchronization:per_thread_sem_test NO STATUS
//absl/time:time_test NO STATUS
//absl/types:any_test NO STATUS
//absl/types:any_test_noexceptions NO STATUS
//absl/types:optional_test NO STATUS
//absl/types:span_test NO STATUS
//absl/types:span_test_noexceptions NO STATUS
//absl/utility:utility_test NO STATUS
Executed 0 out of 54 tests: 1 fails to build and 53 were skipped.
This is using Visual Studio Community 2017.
It seems that the error "invalid numeric argument /Wextra" comes from the fact that it's a gcc / clang exclusive that's being applied to cl.exe
.
Looking at the code, I can see some identifiers aren't using the absl namespace.
I'm mostly thinking about some defines/macros, not C++ classes/functions.
For example, there is:
Is it a bug or a feature?
Personally, I would expect ABSL_LOCKABLE instead of LOCKABLE.
Line 363 in 2a62fbd
Yes, even C++03. :-)
You can test this thus:
#ifdef __has_include
# if __has_include(<string_view>)
# include <string_view>
# if __cplusplus >= 201703L || defined(_LIBCPP_STRING_VIEW)
# define ABSL_HAVE_STD_STRING_VIEW 1
# endif
# endif
#endif
Hi,
Got a compilation issue here. Any help is much appreciated! Thanks in advance.
I will provide as much information as I can. Let me know if more is needed for people to debug.
OS: Ubuntu 16.04
CPU: x86_64
Compiler: clang-5.0.0 (the clang-based toolchain is fully installed under /opt/clang/5.0.0
on the OS)
branch: master (720c017)
Build using Bazel.
Tweaked the original BUILD.bazel files to build when included as source.
Here is how I produced the problem:
The sandbox command was:
(cd /home/zhongming/.cache/bazel/_bazel_zhongming/252308e7db9d6378926a9d84bb91921c/execroot/torrent && \
exec env - \
PWD=/proc/self/cwd \
/opt/clang/5.0.0/bin/clang -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -fno-omit-frame-pointer -isystem/opt/clang/5.0.0/include/c++/v1 -nostdinc++ '-std=c++17' -MD -MF bazel-out/linux_clang-fastbuild/bin/third_party/abseil-cpp/_objs/strings_string_view_test/third_party/abseil-cpp/absl/strings/string_view_test.pic.d '-frandom-seed=bazel-out/linux_clang-fastbuild/bin/third_party/abseil-cpp/_objs/strings_string_view_test/third_party/abseil-cpp/absl/strings/string_view_test.pic.o' -fPIC -D__CLANG_SUPPORT_DYN_ANNOTATION__ -iquote . -iquote bazel-out/linux_clang-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/linux_clang-fastbuild/genfiles/external/bazel_tools -isystem third_party/abseil-cpp -isystem bazel-out/linux_clang-fastbuild/genfiles/third_party/abseil-cpp -isystem external/bazel_tools/tools/cpp/gcc3 -isystem third_party/gtest/googlemock -isystem bazel-out/linux_clang-fastbuild/genfiles/third_party/gtest/googlemock -isystem third_party/gtest/googlemock/include -isystem bazel-out/linux_clang-fastbuild/genfiles/third_party/gtest/googlemock/include -isystem third_party/gtest/googletest -isystem bazel-out/linux_clang-fastbuild/genfiles/third_party/gtest/googletest -isystem third_party/gtest/googletest/include -isystem bazel-out/linux_clang-fastbuild/genfiles/third_party/gtest/googletest/include -Wall -Wextra -Weverything -Wno-c++98-compat-pedantic -Wno-comma -Wno-conversion -Wno-covered-switch-default -Wno-deprecated -Wno-disabled-macro-expansion -Wno-documentation -Wno-documentation-unknown-command -Wno-double-promotion -Wno-exit-time-destructors -Wno-extra-semi -Wno-float-conversion -Wno-float-equal -Wno-format-nonliteral -Wno-gcc-compat -Wno-global-constructors -Wno-nested-anon-types -Wno-non-modular-include-in-module -Wno-old-style-cast -Wno-packed -Wno-padded -Wno-range-loop-analysis -Wno-reserved-id-macro -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-switch-enum -Wno-thread-safety-negative -Wno-undef -Wno-unknown-warning-option -Wno-unreachable-code -Wno-unused-macros -Wno-weak-vtables -Wbitfield-enum-conversion -Wbool-conversion -Wconstant-conversion -Wenum-conversion -Wint-conversion -Wliteral-conversion -Wnon-literal-null-conversion -Wnull-conversion -Wobjc-literal-conversion -Wstring-conversion -Wno-c99-extensions -Wno-missing-noreturn -Wno-missing-prototypes -Wno-null-conversion -Wno-shadow -Wno-shift-sign-overflow -Wno-sign-compare -Wno-unused-function -Wno-unused-member-function -Wno-unused-parameter -Wno-unused-private-field -Wno-unused-template -Wno-used-but-marked-unused -Wno-zero-as-null-pointer-constant -fexceptions -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c third_party/abseil-cpp/absl/strings/string_view_test.cc -o bazel-out/linux_clang-fastbuild/bin/third_party/abseil-cpp/_objs/strings_string_view_test/third_party/abseil-cpp/absl/strings/string_view_test.pic.o)
The error was:
third_party/abseil-cpp/absl/strings/string_view_test.cc:743:21: warning: unused variable 'b' [-Wunused-variable]
absl::string_view b(s1);
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:882:31: error: constexpr variable 'cstr' must be initialized by a constant expression
constexpr absl::string_view cstr(nullptr);
^~~~~~~~~~~~~
/opt/clang/5.0.0/include/c++/v1/__string:217:53: note: read of dereferenced null pointer is not allowed in a constant expression
length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
^
/opt/clang/5.0.0/include/c++/v1/string_view:229:25: note: in call to 'length(0)'
: __data(__s), __size(_Traits::length(__s)) {}
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:882:31: note: in call to 'basic_string_view(0)'
constexpr absl::string_view cstr(nullptr);
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:926:41: error: constexpr variable 'const_begin_nullptr' must be initialized by a constant expression
constexpr absl::string_view::iterator const_begin_nullptr = cstr.begin();
^ ~~~~~~~~~~~~
/opt/clang/5.0.0/include/c++/v1/string_view:239:51: note: initializer of 'cstr' is not a constant expression
const_iterator cbegin() const _NOEXCEPT { return __data; }
^
/opt/clang/5.0.0/include/c++/v1/string_view:233:51: note: in call to '&cstr->cbegin()'
const_iterator begin() const _NOEXCEPT { return cbegin(); }
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:926:68: note: in call to '&cstr->begin()'
constexpr absl::string_view::iterator const_begin_nullptr = cstr.begin();
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:882:31: note: declared here
constexpr absl::string_view cstr(nullptr);
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:927:41: error: constexpr variable 'const_end_nullptr' must be initialized by a constant expression
constexpr absl::string_view::iterator const_end_nullptr = cstr.end();
^ ~~~~~~~~~~
/opt/clang/5.0.0/include/c++/v1/string_view:242:51: note: initializer of 'cstr' is not a constant expression
const_iterator cend() const _NOEXCEPT { return __data + __size; }
^
/opt/clang/5.0.0/include/c++/v1/string_view:236:51: note: in call to '&cstr->cend()'
const_iterator end() const _NOEXCEPT { return cend(); }
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:927:66: note: in call to '&cstr->end()'
constexpr absl::string_view::iterator const_end_nullptr = cstr.end();
^
third_party/abseil-cpp/absl/strings/string_view_test.cc:882:31: note: declared here
constexpr absl::string_view cstr(nullptr);
^
1 warning and 3 errors generated.
[ RUN ] Split.WorksWithLargeStrings
unknown file: Failure
C++ exception with description "std::bad_alloc" thrown in the test body.
[ FAILED ] Split.WorksWithLargeStrings (1397 ms)
Split.WorksWithLargeStrings attempts to create a 2**31 character std::string; this may throw an exception at construction time if the allocation is too large for the platform. (An Ubuntu 16.04 host with 3.75 GiB of RAM, using libstdc++, was insufficient).
Not sure that there's a better way to test this arc, just raising the issue.
These are just github metadata entries that likely need to be filled out.
It seems that the append, insert, emplace and assign methods of InlinedVector
don't protect against arguments being invalidated when the capacity of the vector has to be increased or existing values have to be moved. For example, vector.insert(vector.begin(), vector[0])
is currently never safe, and vector.push_back(vector[0])
is not safe if vector.size() == vector.capacity()
. If this is the intended behaviour, it should probably be documented, as it deviates from what the C++ standard requires for the standard library (20.5.4.9.1.3).
Similarly, InlinedVector::operator=(const InlinedVector&)
will call std::copy(vector.begin(), vector.end(), vector.begin())
for self-assignments, which technically violates the precondition for the output iterator argument passed to copy (28.6.1.1).
Even ignoring issue #32, InlinedVector
currently can't provide the same strong exception guarantee that the C++ standard requires (26.2.1.11) for some basic container operations like push_back
, because if the construction of a new element throws an exception after the capacity of the vector has been increased, the vector isn't left in the same state as before the call (since the capacity remains changed and all pointers into the vector remain invalidated). This only really matters if you intend to support arguments that could be invalidated by capacity changes, but it may be worth documenting in any case.
Hi,
Is there an absl::inline_string object, much like absl::inline_vector in development? I'm asking because if it is, in the not so distance future or currently in progress, I'll wait, don't want to waiste time doing stuff that already exists.. If not, I would give a try at creating one.
The end goal would also be to add support for all string related functions, StrCat and alike.
Regards,
Mario
meta/BUILD.bazel, numeric/BUILD.bazel, and utility/BUILD.bazel all have
licenses(["unencumbered"]) # Owned by Google
while I assume they are intended to have
licenses(["notice"]) # Apache 2.0
like the other BUILD files.
I'm probably doing something wrong, but following the tutorial, I'm stuck at the bazel test absl/...:all
step failing.
~/S/abseil-cpp (master) $ bazel test absl/...:all INFO: Analysed 94 targets (0 packages loaded). INFO: Found 40 targets and 54 test targets... ERROR: /home/pqg/Source/abseil-cpp/absl/time/BUILD.bazel:67:1: C++ compilation of rule '//absl/time:time_test' failed (Exit 1) In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc: In member function 'virtual void {anonymous}::Duration_InfinityAddition_Test::TestBody()': absl/time/duration_test.cc:463:38: error: 'isinf' was not declared in this scope EXPECT_TRUE(isinf(dbl_inf + dbl_inf)); ^ absl/time/duration_test.cc:463:38: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:621:5: note: 'std::isinf' isinf(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:464:39: error: 'isnan' was not declared in this scope EXPECT_TRUE(isnan(dbl_inf + -dbl_inf)); // We return inf ^ absl/time/duration_test.cc:464:39: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:641:5: note: 'std::isnan' isnan(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:465:39: error: 'isnan' was not declared in this scope EXPECT_TRUE(isnan(-dbl_inf + dbl_inf)); // We return inf ^ absl/time/duration_test.cc:465:39: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:641:5: note: 'std::isnan' isnan(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:466:40: error: 'isinf' was not declared in this scope EXPECT_TRUE(isinf(-dbl_inf + -dbl_inf)); ^ absl/time/duration_test.cc:466:40: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:621:5: note: 'std::isinf' isinf(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc: In member function 'virtual void {anonymous}::Duration_InfinitySubtraction_Test::TestBody()': absl/time/duration_test.cc:500:38: error: 'isnan' was not declared in this scope EXPECT_TRUE(isnan(dbl_inf - dbl_inf)); // We return inf ^ absl/time/duration_test.cc:500:38: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:641:5: note: 'std::isnan' isnan(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:501:39: error: 'isinf' was not declared in this scope EXPECT_TRUE(isinf(dbl_inf - -dbl_inf)); ^ absl/time/duration_test.cc:501:39: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:621:5: note: 'std::isinf' isinf(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:502:39: error: 'isinf' was not declared in this scope EXPECT_TRUE(isinf(-dbl_inf - dbl_inf)); ^ absl/time/duration_test.cc:502:39: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:621:5: note: 'std::isinf' isinf(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:503:40: error: 'isnan' was not declared in this scope EXPECT_TRUE(isnan(-dbl_inf - -dbl_inf)); // We return inf ^ absl/time/duration_test.cc:503:40: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:641:5: note: 'std::isnan' isnan(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc: In member function 'virtual void {anonymous}::Duration_InfinityIDiv_Test::TestBody()': absl/time/duration_test.cc:711:38: error: 'isnan' was not declared in this scope EXPECT_TRUE(isnan(dbl_inf / dbl_inf)); ^ absl/time/duration_test.cc:711:38: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:641:5: note: 'std::isnan' isnan(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:717:34: error: 'isinf' was not declared in this scope EXPECT_TRUE(isinf(dbl_inf / 2.0)); ^ absl/time/duration_test.cc:717:34: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:621:5: note: 'std::isinf' isinf(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc: In member function 'virtual void {anonymous}::Duration_DivisionByZero_Test::TestBody()': absl/time/duration_test.cc:766:28: error: 'isinf' was not declared in this scope EXPECT_TRUE(isinf(two / z)); ^ absl/time/duration_test.cc:766:28: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:621:5: note: 'std::isinf' isinf(_Tp __x) ^ In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0, from external/com_google_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47, from external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:46, from external/com_google_googletest/googlemock/include/gmock/gmock.h:58, from absl/time/duration_test.cc:22: absl/time/duration_test.cc:767:26: error: 'isnan' was not declared in this scope EXPECT_TRUE(isnan(z / z)); // We'll return inf ^ absl/time/duration_test.cc:767:26: note: suggested alternative: In file included from absl/time/duration_test.cc:16:0: /usr/include/c++/5/cmath:641:5: note: 'std::isnan' isnan(_Tp __x) ^ At global scope: cc1plus: warning: unrecognized command line option '-Wno-unused-private-field' INFO: Elapsed time: 1.912s, Critical Path: 1.63s FAILED: Build did NOT complete successfully //absl/algorithm:algorithm_test (cached) PASSED in 0.1s //absl/algorithm:container_test (cached) PASSED in 0.1s //absl/base:bit_cast_test (cached) PASSED in 0.1s //absl/base:call_once_test (cached) PASSED in 0.1s //absl/base:config_test (cached) PASSED in 0.1s //absl/base:endian_test (cached) PASSED in 0.4s //absl/base:invoke_test (cached) PASSED in 0.1s //absl/base:low_level_alloc_test (cached) PASSED in 7.5s //absl/base:malloc_extension_system_malloc_test (cached) PASSED in 0.1s //absl/base:raw_logging_test (cached) PASSED in 0.3s //absl/base:spinlock_test (cached) PASSED in 0.3s //absl/base:sysinfo_test (cached) PASSED in 0.1s //absl/base:thread_identity_test (cached) PASSED in 0.1s //absl/base:throw_delegate_test (cached) PASSED in 0.1s //absl/container:fixed_array_test (cached) PASSED in 2.3s //absl/container:fixed_array_test_noexceptions (cached) PASSED in 2.2s //absl/container:inlined_vector_test (cached) PASSED in 0.2s //absl/container:inlined_vector_test_noexceptions (cached) PASSED in 0.2s //absl/container:test_instance_tracker_test (cached) PASSED in 0.1s //absl/debugging:disabled_leak_check_test (cached) PASSED in 0.1s //absl/debugging:leak_check_no_lsan_test (cached) PASSED in 0.1s //absl/debugging:leak_check_test (cached) PASSED in 0.1s //absl/memory:memory_test (cached) PASSED in 0.1s //absl/meta:type_traits_test (cached) PASSED in 0.1s //absl/numeric:int128_test (cached) PASSED in 0.3s //absl/types:any_test (cached) PASSED in 0.1s //absl/types:any_test_noexceptions (cached) PASSED in 0.1s //absl/types:optional_test (cached) PASSED in 0.1s //absl/types:span_test (cached) PASSED in 0.0s //absl/types:span_test_noexceptions (cached) PASSED in 0.1s //absl/utility:utility_test (cached) PASSED in 0.1s //absl/strings:ascii_test NO STATUS //absl/strings:char_map_test NO STATUS //absl/strings:escaping_test NO STATUS //absl/strings:match_test NO STATUS //absl/strings:memutil_test NO STATUS //absl/strings:numbers_test NO STATUS //absl/strings:ostringstream_test NO STATUS //absl/strings:resize_uninitialized_test NO STATUS //absl/strings:str_cat_test NO STATUS //absl/strings:str_join_test NO STATUS //absl/strings:str_replace_test NO STATUS //absl/strings:str_split_test NO STATUS //absl/strings:string_view_test NO STATUS //absl/strings:strip_test NO STATUS //absl/strings:substitute_test NO STATUS //absl/strings:utf8_test NO STATUS //absl/synchronization:barrier_test NO STATUS //absl/synchronization:blocking_counter_test NO STATUS //absl/synchronization:graphcycles_test NO STATUS //absl/synchronization:mutex_test NO STATUS //absl/synchronization:notification_test NO STATUS //absl/synchronization:per_thread_sem_test NO STATUSExecuted 0 out of 54 tests: 31 tests pass, 1 fails to build and 22 were skipped.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
/S/abseil-cpp (master) $ c++ --version16.04.4) 5.4.0 20160609
c++ (Ubuntu 5.4.0-6ubuntu1
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.~/S/abseil-cpp (master) $
And versions of things:
~/S/abseil-cpp (master) $ bazel version
Build label: 0.5.4
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Aug 25 10:00:00 2017 (1503655200)
Build timestamp: 1503655200
Build timestamp as int: 1503655200
~/S/abseil-cpp (master) $ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Hello,
Apologies if this has been discussed internally and design choice made for reason, I'm not aware of.
While trying to switch our code from using llvm::SmallVector to absl::InlinedVector I hit a snag. LLVM uses a proxy template class SmallVectorImpl.
With this object one can create something like this:
void foo( SmallVectorImpl &obj);
void oof()
{
SmallVector<int,,100> hundred;
SmallVector<int,,1000> thousand;
foo( hundred ); // will compile
foo( thousand); // will compile.
}
Can't do the same thing with InlinedVector. Looking at llvm::SmallVector code it does make the code more complicated, and I can't see from the code if there is a penalty in performance but this seems like a very desirable capability to have.
Regards
I'm trying to use absl::FixedArray as a function's return value and value in hash map, instead of std::vector. The size of the array is not known at compile time, while InlinedVector needs a predefined capacity. The burden of using InlinedVector is that passing InlinedVector<int, 5> to a function expecting InlinedVector<int, 10> is not compatible.
The comment in the fixed array code is "Copy and move construction and assignment are deleted because (1) you can't copy or move an array..." I agree that move construction is not needed, but copy construction is simply a copy of all elements. e.g. absl::FixedArray(other.begin(), other.end())
absl::FixedArray<int> GetIds() {
absl::FixedArray<int> ids(5); // some number decided at runtime, but the size is fixed
return ids;
}
error: use of deleted function 'absl::FixedArray<T, inlined>::FixedArray(const absl::FixedArray<T, inlined>&)'
Google internally doesn't use exceptions in our C++ code. Thus, our claim that Abseil types are battle-tested comes with an asterisk that they haven't been so thoroughly tested in the face of exceptions.
We are working internally on a framework to thoroughly test the exception-safety of our types which care about it, and as it is finished we will begin rolling out exception-safety bugfixes. We are currently aiming for basic exception safety everywhere, and strong exception safety only where reasonable and where it won't affect performance.
This Issue is a catch-all for reports of exception-unsafety of Abseil types.
Configuration the build in ${project root}/.build/Debug
and attempted to build with ninja -C .build/Debug absl_base
C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1411~1.255\bin\HostX64\x64\cl.exe /nologo /TP -I..\..\vendor\abseil -std=c++11 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /Fovendor\abseil\absl\base\CMakeFiles\absl_base.dir\internal\low_level_alloc.cc.obj /Fdvendor\abseil\absl\base\CMakeFiles\absl_base.dir\absl_base.pdb /FS -c ..\..\vendor\abseil\absl\base\internal\low_level_alloc.cc
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
..\..\vendor\abseil\absl\base\internal\low_level_alloc.cc(290): error C2589: '(': illegal token on right side of '::'
..\..\vendor\abseil\absl\base\internal\low_level_alloc.cc(291): error C2062: type 'unknown-type' unexpected
..\..\vendor\abseil\absl\base\internal\low_level_alloc.cc(291): error C2059: syntax error: ')'
Consolidate into a single BUILD file.
Rationale for moving to a single-BUILD-file approach:
1. Easier to reference from other Bazel BUILD files.
As a user of the abseil library, I would like to be able to use the
library by refrencing its modules, i.e., `base`, `strings`, etc. without
being aware of abseil-cpp's internal directory structures.
For example, instead of 'abseil-cpp/absl/strings:strings', I would like
to use 'abseil-cpp:strings'.
2. Easier to include absl as a sub-directory in a larger project.
As a user of the abseil library, I would like to be able to include
the abseil-cpp repository in source format into, say, the `third_party`
directory of my own projects.
Prior to this commit, the BUILD.bazel files are written in a way that is
impossible to use as a sub-directory in my own project due to the
following reason:
Header files are included using the full name such as
#include "absl/strings/strings.h"
The Bazel target `absl/strings:strings` does not have the `includes`
keyword.
Due to the above two facts, Bazel targets under absl/ that are
included by other BUILD files in the project containing abseil-cpp
will not be able to find the header files for absl.
The above described problem can be easily solved by consolidating the
BUILD.bazel files into a single BUILD file.
2. Easier to maintain.
This might be a controversial perspective. But I have found writing
fewer BUILD files to be easier to maintain in the long run. As it
eliminates a lot of the lookups across different BUILD files.
At the very least, using a single BUILD file is not harder to maintain
than using 10+ BUILD files.
Here is how the old Bazel targets are translated into the new BUILD file:
OLD NEW
//absl:<config> :<config>
//absl:<module> :<module>
//absl:<module>:<library> :<module>_<library>
So, as an example, the cc_test target substitute_test
under absl/strings
is
now strings_substitue_test
in the top level directory. This renaming scheme
ensures there is no name conflicts after the conslidation.
As of this commit, all but 2 tests failed. Github issues have been filed for
those two tests:
#63
#64
You can also see those two failed tests in the consolidated BUILD file.
In case you are wondering, I already got a branch locally working at my forked master
branch:
qzmfranklin@3e1a6a8
(Just to set the expectation: This commit has a few hard coded settings that are only relevant to my testing environment. But they are very easy to generalize)
OS: Ubuntu 16.04
CPU: x86_64
Compiler: clang-5.0.0 (the clang-based toolchain is fully installed under /opt/clang/5.0.0 on the OS)
branch: master (720c017)
Build using Bazel.
I tweaked the BUILD files to build when abseil-cpp
is included as a submodule.
Here is the error message for the absl/strings:substitute_test
:
Running main() from gmock_main.cc
[==========] Running 3 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 1 test from SubstituteDeathTest
[ RUN ] SubstituteDeathTest.SubstituteDeath
[ OK ] SubstituteDeathTest.SubstituteDeath (336 ms)
[----------] 1 test from SubstituteDeathTest (336 ms total)
[----------] 2 tests from SubstituteTest
[ RUN ] SubstituteTest.Substitute
Segmentation fault (core dumped)
Is this the correct way of reporting such issues?
std::vector, when resizing, will only use move if it is declared nothrow.
absl's InlinedVector uses move operations for resizing, regardless.
This means that if a resize operation calls the move constructor and it throws, we end up with a situation where the vector is only partially moved to its new location. Moving the data back might also throw, and we end up with an inconsistent InlinedVector.
InlinedVector should either use copy constructors in that case, or insist that the move operator is declared nothrow.
Unlike the bazel build file, CMakeLists doesn't have a build dependency on gtests when building the absl::base library. This dependency is required to compile the source of https://github.com/abseil/abseil-cpp/blob/master/absl/base/internal/exception_safety_testing.h#L28.
I think the CMakeLists file in absl/base should also pull in gtest as an external project similar to what bazel does below:
abseil-cpp/absl/base/BUILD.bazel
Lines 231 to 247 in 4132ce2
It isn't clear from the documentation in mutex.h whether absl::CondVar::Signal
wakes up waiters in FIFO or LIFO order. This comment says FIFO, while this one suggests LIFO.
The underlying implementation looks like it uses a stack, so maybe the first comment just needs to be corrected?
By some reason it's not here. You even refer this function in docs, see here for example
Hello,
I have a bit of trouble using a local Abseil installation, as I dont want to depend on external packages with some fixes URL nor some fixed filesystem paths.
Cmake already HAS the necessary infrastructure to allow building dependend modules.
For using Abseil in your Project, just this would be necessary:
# cctz pulls in some gtest and benchmark suites otherwise
set (BUILD_TESTING OFF)
find_package(Abseil REQUIRED
)
And, given the worst-case that abseil and cctz are in no directory that can be found automatically, configuration would add the respective paths:
cmake -DAbseil_DIR=<local path> -DCctz_DIR=<local path> ...
Basic support would be added by this patch (note that cctz would need to be fixed in a similar fashion):
diff --git a/AbseilConfig.cmake b/AbseilConfig.cmake
new file mode 100644
index 0000000..4476b98
--- /dev/null
+++ b/AbseilConfig.cmake
@@ -0,0 +1,2 @@
+# Macros
+include(${CMAKE_CURRENT_LIST_DIR}/CMake/AbseilMacros.cmake)
diff --git a/CMake/AbseilMacros.cmake b/CMake/AbseilMacros.cmake
new file mode 100644
index 0000000..94c6886
--- /dev/null
+++ b/CMake/AbseilMacros.cmake
@@ -0,0 +1,8 @@
+# TODO: this should be another find_package(Cctz)
+add_subdirectory(${Cctz_DIR} _libcctz
+ EXCLUDE_FROM_ALL
+)
+
+add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/.." _libabseil
+ EXCLUDE_FROM_ALL
+)
Was going through quickstart.
I checked out source.
git clone https://github.com/abseil/abseil-cpp.git
Created directory.
mkdir Source
Entered it.
cd Source
Run tests.
bazel test absl/...:all
They didn't pass:
ERROR: /opt/bmusin/Source/abseil-cpp/absl/debugging/BUILD.bazel:129:1: no such package '@com_google_googletest//': Error downloading [https://github.com/google/googletest/archive/master.zip] to /home/bulat/.cache/bazel/_bazel_bulat/c26b823ebcf2d54bae8cd5b9b6d47d60/external/com_google_googletest/master.zip: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty and referenced by '//absl/debugging:leak_check_test'
ERROR: Analysis of target '//absl/debugging:leak_check_test' failed; build aborted: Loading failed
INFO: Elapsed time: 20.467s
FAILED: Build did NOT complete successfully (23 packages loaded)
ERROR: Couldn't start the build. Unable to run tests
(df3af0d)
Build label: 0.9.0- (@non-git)
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jul 5 09:33:20 +49996 (1515570255200)
Build timestamp: 1515570255200
Build timestamp as int: 1515570255200
openjdk-8-jdk/artful-updates,artful-security,now 8u151-b12-0ubuntu0.17.10.2 amd64 [installed]
openjdk-8-jdk-headless/artful-updates,artful-security,now 8u151-b12-0ubuntu0.17.10.2 amd64 [installed,automatic]
openjdk-8-jre/artful-updates,artful-security,now 8u151-b12-0ubuntu0.17.10.2 amd64 [installed]
openjdk-8-jre-headless/artful-updates,artful-security,now 8u151-b12-0ubuntu0.17.10.2 amd64 [installed,automatic]
Thanks.
This test times out consistently on my system (a 1.8GHz Atom with 4GB RAM, so not super tiny); increasing the size to medium lets it complete.
As we all know std::map
and friend are slow, is there any plan to release a hashmap with abseil?
I'm using http_archive
to add abseil-cpp to my WORKSPACE.
When trying to use //absl/synchronization
, I get the following error:
.../external/com_google_absl/absl/time/BUILD.bazel:27:1: no such package '@com_googlesource_code_cctz//': The repository could not be resolved and referenced by '@com_google_absl//absl/time:time'
Until bazelbuild/bazel#1943 is resolved, recursive WORKSPACE file loading is not supported.
A possible solution to unblock //absl/synchronization
would be to split //absl/time
and time.h
, so that Duration
and Time
are in separate BUILD rules from TimeZone
. Not sure how easy or hard that would be.
This test reliably times out on my platform (1.8GHz Atom with 4GB RAM, so not tiny). Removing the timeout override allows it to pass.
Two files are included in the release that don't seem to fit. (Neither is referenced from the shipped BUILD.bazel files):
synchronization/internal/mutex_nonprod.cc doesn't build (unable to include "base/init_google.h")
strings/strip.cpp doesn't build since StripBrackets()
is used (by StripCurlyBraces()
) before it's defined and there's no forward declaration for it.
I haven't tested (sorry!) but it looks like the iterator_tag should have ()s of {}s after it? It's a type not a value. If I'm right this also suggests this function isn't being exercised. Sorry if I've misread!
Any chance you can also include concurrency libraries which are similar to Go routines/channels? I heard that Google developed similar things for C++ internally.
If I link abseil and tcmalloc together in my program, It will shutdown and say "Check failed: MallocHook::RemoveNewHook(&InitialNewHook):". But if I use abseil only or tcmalloc only, It will run OK, so I think abseil is conflicted with tcmalloc.
Since abseil trys hard to be a general purpose C++ library and there is no (at least I am not aware of) a good, robust and multiplatform file system C++ library with “sane” (thank you for adding CMake) build system, what is your stance on adding file system to abseil?
Is it on the future list? Or you are not going to have file system operation in abseil at all.
I need to port our company’s ndk code base to a newer library. The library which we are using right now is buggy. Because ndk has CMake support, abseil is on top of my list to use.
👋 First off, Thanks for this library.
However after setting up a fairly simple test project using Mutex's from abseil I seem to be getting a build failure on my FreeBSD test boxes. Messing around I haven't been able to figure out what's happening yet, but it's also two in the morning on a test project.
The build failure is:
$ bazel build //span:span --verbose_failures --sandbox_debug
...................
INFO: Analysed target //span:span (20 packages loaded).
INFO: Found 1 target...
ERROR: /usr/home/ec2-user/.cache/bazel/_bazel_ec2-user/3db7863a462abc38a334d1d40287c767/external/com_google_absl/absl/synchronization/BUILD.bazel:47:1: C++ compilation of rule '@com_google_absl//absl/synchronization:synchronization' failed (Exit 1): process-wrapper failed: error executing command
(cd /usr/home/ec2-user/.cache/bazel/_bazel_ec2-user/3db7863a462abc38a334d1d40287c767/execroot/vivian && \
exec env - \
PWD=/proc/self/cwd \
/usr/home/ec2-user/.cache/bazel/_bazel_ec2-user/3db7863a462abc38a334d1d40287c767/execroot/vivian/_bin/process-wrapper '--timeout=0' '--kill_delay=15' /usr/local/bin/clang38 -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/local_freebsd-fastbuild/bin/external/com_google_absl/absl/synchronization/_objs/synchronization/external/com_google_absl/absl/synchronization/blocking_counter.pic.d '-frandom-seed=bazel-out/local_freebsd-fastbuild/bin/external/com_google_absl/absl/synchronization/_objs/synchronization/external/com_google_absl/absl/synchronization/blocking_counter.pic.o' -fPIC -D__CLANG_SUPPORT_DYN_ANNOTATION__ -iquote external/com_google_absl -iquote bazel-out/local_freebsd-fastbuild/genfiles/external/com_google_absl -iquote external/bazel_tools -iquote bazel-out/local_freebsd-fastbuild/genfiles/external/bazel_tools -iquote external/com_googlesource_code_cctz -iquote bazel-out/local_freebsd-fastbuild/genfiles/external/com_googlesource_code_cctz -isystem external/bazel_tools/tools/cpp/gcc3 -isystem external/com_googlesource_code_cctz/include -isystem bazel-out/local_freebsd-fastbuild/genfiles/external/com_googlesource_code_cctz/include -Wall -Wextra -Wcast-qual -Wconversion-null -Wmissing-declarations -Wno-sign-compare -Woverlength-strings -Wpointer-arith -Wunused-local-typedefs -Wunused-result -Wvarargs -Wvla -Wwrite-strings -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_absl/absl/synchronization/blocking_counter.cc -o bazel-out/local_freebsd-fastbuild/bin/external/com_google_absl/absl/synchronization/_objs/synchronization/external/com_google_absl/absl/synchronization/blocking_counter.pic.o)
In file included from external/com_google_absl/absl/synchronization/blocking_counter.cc:15:
In file included from external/com_google_absl/absl/synchronization/blocking_counter.h:24:
In file included from external/com_google_absl/absl/synchronization/mutex.h:79:
external/com_google_absl/absl/synchronization/internal/mutex_nonprod.inc:215:35: error: use of undeclared identifier 'base'
explicit SynchronizationStorage(base::LinkerInitialized) {}
^
1 error generated.
Target //span:span failed to build
INFO: Elapsed time: 9.365s, Critical Path: 2.71s
FAILED: Build did NOT complete successfully
Clang Version Info:
$ /usr/local/bin/clang38 --version
clang version 3.8.1 (tags/RELEASE_381/final)
Target: x86_64-unknown-freebsd11.1
Thread model: posix
InstalledDir: /usr/local/llvm38/bin
Bazel WORKSPACE Inclusion of Abseil:
http_archive(
name = "com_google_absl",
url = "https://github.com/abseil/abseil-cpp/archive/ae0cef3.tar.gz",
strip_prefix = "abseil-cpp-ae0cef35ae5a7bfd873fb87babdd4900cbdb073c",
sha256 = "d0182ae6ecd0b88c65b2fe5e1b1fcd42366d9c0f6ac1636cb141016a153b2b35"
)
And the actual BUILD:
cc_library(
name = "span",
srcs = glob([
"src/**/*.cpp",
]),
hdrs = glob([
"src/**/*.hh",
]),
deps = [
"@com_google_absl//absl/synchronization",
"@glog_repo//:glog",
],
copts = [
"-std=c++14",
],
strip_include_prefix = "src/",
)
It looks like the implementation of string_view
gladly accepts nullptr
in its constructor, but I don't think the string_view from the STL does.
Meaning, when upgrading STL to C++17 for example, the code can start to break because std::string_view
constructor will crash on nullptr
.
Is it the expected behavior?
The documentation recommends to use absl::NullSafeStringView
, suggesting nullptr
is not supported.
abseil-cpp/absl/strings/string_view.h
Lines 173 to 177 in 0271cd3
abseil-cpp/absl/strings/string_view.h
Lines 559 to 566 in 0271cd3
The "culprit" is StrLenInternal()
:
abseil-cpp/absl/strings/string_view.h
Lines 491 to 493 in 0271cd3
As this behavior is actually tested, I'm wondering if it is expected or not:
abseil-cpp/absl/strings/string_view_test.cc
Line 804 in 0271cd3
abseil-cpp/absl/strings/string_view_test.cc
Line 882 in 0271cd3
The documentation seems to provide advice on how to create a null string_view:
abseil-cpp/absl/strings/string_view.h
Lines 113 to 116 in 0271cd3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.