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

Commit b38ea0d7 authored by Jack He's avatar Jack He
Browse files

GD-LOGGING: Do not allow LOG_TAG to be NULL

* Check if it is null in log.h during compilation

Bug: 170163727
Test: atest bluetooth_test_gd
Tag: #gd-refactor
Change-Id: I6a7f1f7c827d1c944e11ae1baee2558e59069a9c
parent 6a221619
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#define LOG_TAG "a2dp_encoding"

#include "a2dp_encoding.h"
#include "client_interface.h"
@@ -22,6 +23,7 @@
#include "btif_av.h"
#include "btif_av_co.h"
#include "btif_hf.h"
#include "osi/include/log.h"
#include "osi/include/properties.h"

namespace {
+1 −2
Original line number Diff line number Diff line
@@ -21,11 +21,10 @@
 *  BTA AG AT command interpreter.
 *
 ******************************************************************************/
#define LOG_TAG "bta_ag_at"

#include "bta_ag_at.h"

#include <log/log.h>

#include <cstring>

#include "bt_common.h"
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
#define LOG_TAG "bluetooth"
#endif

static_assert(LOG_TAG != nullptr, "LOG_TAG should never be NULL");

#if defined(OS_ANDROID)

#include <log/log.h>
@@ -39,6 +41,9 @@
#define LOG_INFO(...)
#define LOG_WARN(...)
#else

static_assert(LOG_TAG != nullptr, "LOG_TAG is null after header inclusion");

#define LOG_VERBOSE(fmt, args...)                                             \
  do {                                                                        \
    if (bluetooth::common::InitFlags::IsDebugLoggingEnabledForTag(LOG_TAG)) { \
+4 −1
Original line number Diff line number Diff line
@@ -22,8 +22,11 @@
 *
 ******************************************************************************/

#define LOG_TAG "l2c_ble"

#include <base/logging.h>
#include <base/strings/stringprintf.h>

#include "bt_target.h"
#include "bta_hearing_aid_api.h"
#include "device/include/controller.h"
@@ -31,8 +34,8 @@
#include "l2c_api.h"
#include "l2c_int.h"
#include "l2cdefs.h"
#include "log/log.h"
#include "main/shim/shim.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
+2 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
 *
 ******************************************************************************/

#define LOG_TAG "sdp_discovery"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -33,7 +35,6 @@
#include "hcidefs.h"
#include "hcimsgs.h"
#include "l2cdefs.h"
#include "log/log.h"
#include "osi/include/log.h"
#include "sdp_api.h"
#include "sdpint.h"
Loading