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

Commit 358dd11b authored by Jack He's avatar Jack He
Browse files

Replace assert with CHECK from base/logging.h

* Replace assert with CHECK
* Remove all NDEBUG definitions
* Remove hacks for BT_LIBCHROME_NDEBUG
* Removed some removed directories from Makefile such as hcis, brcm, rpc

Coccinelle-assisted:

@@
@@

- #include "base/logging.h"
+ #include <base/logging.h>

@ assert_included @
@@

@ base_logging_included @
@@

@ depends on (assert_included && !(base_logging_included)) @
@@

- #include <assert.h>
+ #include <base/logging.h>

@ depends on (assert_included && base_logging_included) @
@@

- #include <assert.h>

@@
expression E;
@@

- assert(E);
+ CHECK(E);

And a bash script:

for file in $(find . -name "*.cc"); do
  spatch --sp-file replace_assert_with_CHECK.cocci --in-place $file
done

The following files are maually edited:
	btif/src/btif_config.cc
	btif/src/btif_avrcp_audio_track.cc
	btif/src/btif_gatt_client.cc
	osi/src/data_dispatcher.cc
	osi/src/reactor.cc
	osi/src/thread.cc
	osi/src/fixed_queue.cc
	osi/src/list.cc
	osi/src/allocation_tracker.cc
	osi/src/alarm.cc
	osi/test/wakelock_test.cc

Bug: 31781465
Test: Code compilation, Unit Tests, BtStressTest, BtFunhausMetricsTest
Change-Id: I21dc10a45be31665e41441b75b0515ed87523988
parent 56f33628
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ bluetooth_CFLAGS += \
  -Wno-gnu-variable-sized-type-not-at-end \
  -Wno-typedef-redefinition \
  -Wno-unused-parameter \
  -UNDEBUG \
  -DLOG_NDEBUG=1

bluetooth_CONLYFLAGS += -std=c99
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ LOCAL_C_INCLUDES := \
LOCAL_MODULE := audio.a2dp.default
LOCAL_MODULE_RELATIVE_PATH := hw

LOCAL_SHARED_LIBRARIES := liblog
LOCAL_SHARED_LIBRARIES := liblog libchrome
LOCAL_STATIC_LIBRARIES := libosi

LOCAL_MODULE_TAGS := optional
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@

#include "bt_target.h"

#include <assert.h>
#include <base/logging.h>
#include <string.h>

#include "avdt_api.h"
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
 *
 ******************************************************************************/

#include <assert.h>
#include <base/logging.h>

#include "bt_target.h"

+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@

#define LOG_TAG "bt_bta_av"

#include <assert.h>
#include <base/logging.h>
#include <string.h>

#include "bt_target.h"
Loading