Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75358bb3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use C++11 static assert instead of macro"

parents e40907ac f722740c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include <string.h>

#include "btcore/include/device_class.h"
#include "osi/include/osi.h"

typedef struct _bt_device_class_t {
  uint32_t unused : 2;  // LSBs
@@ -35,7 +34,9 @@ typedef struct _bt_device_class_t {

// Ensure the internal device class implementation and public one
// have equal size.
COMPILE_ASSERT(sizeof(_bt_device_class_t) == sizeof(bt_device_class_t));
static_assert(sizeof(_bt_device_class_t) == sizeof(bt_device_class_t),
              "Internal and external device class implementation should have "
              "the same size");

// [Major Service Classes]
// (https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
+0 −9
Original line number Diff line number Diff line
@@ -35,15 +35,6 @@
#define DUMMY_COUNTER(c) CONCAT(__osi_dummy_, c)
#define DUMMY_PTR DUMMY_COUNTER(__COUNTER__)

// base/macros.h defines a COMPILE_ASSERT macro to the C++11 keyword
// "static_assert" (it undef's COMPILE_ASSERT before redefining it).
// C++ code that includes base and osi/include/osi.h can thus easily default to
// the definition from libbase but we should check here to avoid compile errors.
#ifndef COMPILE_ASSERT
#define COMPILE_ASSERT(COND) \
  typedef int failed_compile_assert[(COND) ? 1 : -1] __attribute__((unused))
#endif  // COMPILE_ASSERT

// Macros for safe integer to pointer conversion. In the C language, data is
// commonly cast to opaque pointer containers and back for generic parameter
// passing in callbacks. These macros should be used sparingly in new code