Skip to content

Commit

Permalink
Move likely into macros.h
Browse files Browse the repository at this point in the history
Signed-off-by: owent <admin@owent.net>
  • Loading branch information
owent committed May 11, 2022
1 parent 68d726d commit 809e1eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 8 additions & 0 deletions api/include/opentelemetry/common/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

#include "opentelemetry/version.h"

#ifndef likely
# ifdef __GNUC__
# define likely(x) __builtin_expect(!!(x), 1)
# else
# define likely(x) !!(x)
# endif
#endif

/// \brief Declare variable as maybe unused
/// usage:
/// OPENTELEMETRY_MAYBE_UNUSED int a;
Expand Down
10 changes: 2 additions & 8 deletions exporters/otlp/src/otlp_log_recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@

#ifdef ENABLE_LOGS_PREVIEW

# include "opentelemetry/common/macros.h"

# include "opentelemetry/exporters/otlp/otlp_log_recordable.h"

# include "opentelemetry/exporters/otlp/otlp_recordable_utils.h"

# ifndef likely
# ifdef __GNUC__
# define likely(x) __builtin_expect(!!(x), 1)
# else
# define likely(x) !!(x)
# endif
# endif

namespace nostd = opentelemetry::nostd;

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down

0 comments on commit 809e1eb

Please sign in to comment.