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

Commit 6e2bebd7 authored by Jack He's avatar Jack He
Browse files

Remove extern "C" from header files

Since change 290046, most files in system/bt is compiled as C++ source.
Therefore, there is no longer a need for the extern "C" wrapper around
includes that export symbols from those sources.

The following python script is applied to each file in the directory:

front = '#ifdef\s+__cplusplus\s+extern\s+"C"\s+{\s+#endif\s+'
back = '#ifdef\s+__cplusplus\s+}\s+#endif'
with open(sys.argv[1], "r") as f:
  data = f.read()
  data = re.sub(front, "", data)
  data = re.sub(back, "", data)
  print data

through a shell script:

for file in $(find . -name "*.h"); do
  python remove_cpp_extern_c.py $file > tmp
  cat tmp > $file
  rm tmp
done

with following files not edited:
* stack/include/a2dp_*
* include/bt_trace.h
* embdrv/sbc/*

Bug: 33492510
Test: Code compilation, BtFunhausMetricsTest, BtStressTest
Change-Id: Iac21cdfb1924b50478dd0b82326e092602cbc9d4
parent afd553da
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -113,15 +113,7 @@ typedef uint8_t tA2DP_BITS_PER_SAMPLE;
 *  Functions
 *****************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

// Returns a string representation of |event|.
extern const char* audio_a2dp_hw_dump_ctrl_event(tA2DP_CTRL_CMD event);

#ifdef __cplusplus
}
#endif

#endif /* A2DP_AUDIO_HW_H */
+0 −8
Original line number Diff line number Diff line
@@ -24,10 +24,6 @@
#ifndef BTA_AG_AT_H
#define BTA_AG_AT_H

#ifdef __cplusplus
extern "C" {
#endif

/*****************************************************************************
 *  Constants
 ****************************************************************************/
@@ -121,8 +117,4 @@ extern void bta_ag_at_reinit(tBTA_AG_AT_CB* p_cb);
 ****************************************************************************/
extern void bta_ag_at_parse(tBTA_AG_AT_CB* p_cb, char* p_buf, uint16_t len);

#ifdef __cplusplus
}
#endif

#endif /* BTA_AG_AT_H */
+0 −8
Original line number Diff line number Diff line
@@ -29,10 +29,6 @@
#include "bta_api.h"
#include "bta_sys.h"

#ifdef __cplusplus
extern "C" {
#endif

/*****************************************************************************
 *  Constants
 ****************************************************************************/
@@ -414,8 +410,4 @@ extern void bta_ag_set_esco_param(bool set_reset, tBTM_ESCO_PARAMS* param);
extern void bta_ag_ci_rx_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data);
extern void bta_ag_rcvd_slc_ready(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data);

#ifdef __cplusplus
}
#endif

#endif /* BTA_AG_INT_H */
+0 −8
Original line number Diff line number Diff line
@@ -27,10 +27,6 @@

#include "bta_av_api.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifndef BTA_AR_DEBUG
#define BTA_AR_DEBUG TRUE
#endif
@@ -59,8 +55,4 @@ typedef struct {
/* control block declaration */
extern tBTA_AR_CB bta_ar_cb;

#ifdef __cplusplus
}
#endif

#endif /* BTA_AR_INT_H */
+0 −8
Original line number Diff line number Diff line
@@ -25,18 +25,10 @@
#include "bta_api.h"
#include "include/bt_trace.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Accept bta_sys_register, and bta_sys_sendmsg. Those parameters can be used to
 * override system methods for tests.
 */
void bta_closure_init(tBTA_SYS_REGISTER registerer, tBTA_SYS_SENDMSG sender);
bool bta_closure_execute(BT_HDR* p_msg);

#ifdef __cplusplus
}
#endif

#endif /* BTA_CLOSURE_INT_H */
Loading