Skip to content

Commit

Permalink
Fix issue #834 (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
owent authored Jun 9, 2021
1 parent 01837f5 commit 1060f88
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ common:tsan --copt -fsanitize=thread
common:tsan --copt -DTHREAD_SANITIZER
common:tsan --linkopt -fsanitize=thread
common:tsan --cc_output_directory_tag=tsan
# This is needed to address false positive problem with abseil.The same setting as gRPC
# https://github.com/google/sanitizers/issues/953
common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ option(WITH_STL "Whether to use Standard Library for C++latest features" OFF)
option(WITH_ABSEIL "Whether to use Abseil for C++latest features" OFF)

if(WITH_ABSEIL)
add_definitions(-DHAVE_ABSEIL)
find_package(absl CONFIG REQUIRED)

set(CORE_RUNTIME_LIBS absl::any absl::base absl::bits absl::city)
set(CORE_RUNTIME_LIBS absl::bad_variant_access absl::any absl::base
absl::bits absl::city)

# target_link_libraries(main PRIVATE absl::any absl::base absl::bits
# absl::city)
Expand Down
4 changes: 4 additions & 0 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ if(BUILD_TESTING)
add_subdirectory(test)
endif()

if(WITH_ABSEIL)
target_compile_definitions(opentelemetry_api INTERFACE HAVE_ABSEIL)
endif()

if(WITH_STL)
message("Building with standard library types...")
target_compile_definitions(opentelemetry_api INTERFACE HAVE_CPP_STDLIB
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/nostd/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ OPENTELEMETRY_END_NAMESPACE
# endif

# ifdef HAVE_ABSEIL
# include "absl/types/variant.h"
# include <absl/types/variant.h>
# else
# include "./absl/types/variant.h"
# endif
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/multi_span_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class MultiSpanProcessor : public SpanProcessor
ProcessorNode(std::unique_ptr<SpanProcessor> &&value,
ProcessorNode *prev = nullptr,
ProcessorNode *next = nullptr)
: value_(std::move(value)), prev_(prev), next_(next)
: value_(std::move(value)), next_(next), prev_(prev)
{}
};

Expand Down
28 changes: 0 additions & 28 deletions sdk/src/common/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,3 @@
#include "opentelemetry/version.h"
#include "opentelemetry/nostd/variant.h"
// clang-format on

#if defined(HAVE_ABSEIL)
/* The option of building and linking with Abseil library implies that Abseil
* may already provide the ThrowBadVariantAccess implementation if its own.
* Reconsider the implementation below: we are potentially introducing
* a function that is already implemented in the Abseil. Most likely the code
* below needs to be removed entirely.
*/
# if defined(__GNUC__) || defined(__GNUG__)
# ifndef __cdecl
// see https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html
// Intel x86 architecture specific calling conventions
# ifdef _M_IX86
# define __cdecl __attribute__((__cdecl__))
# else
# define __cdecl
# endif
# endif
# endif

namespace absl
{
namespace variant_internal
{
void __cdecl ThrowBadVariantAccess(){/* TODO: std::terminate or re-throw? */};
}
} // namespace absl
#endif

0 comments on commit 1060f88

Please sign in to comment.