include/bluetooth: rearrange for standard use of extern "C"
Consistently place C++ use of extern "C" after all include directives, within the negative branch of _ASMLANGUAGE if used. Background from issue #17997: Declarations that use C linkage should be placed within extern "C" so the language linkage is correct when the header is included by a C++ compiler. Similarly #include directives should be outside the extern "C" to ensure the language-specific default linkage is applied to any declarations provided by the included header. See: https://en.cppreference.com/w/cpp/language/language_linkage Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
754d1274a7
commit
5412409781
9 changed files with 26 additions and 27 deletions
|
@ -10,12 +10,12 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_A2DP_H_
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_A2DP_H_
|
||||||
#define ZEPHYR_INCLUDE_BLUETOOTH_A2DP_H_
|
#define ZEPHYR_INCLUDE_BLUETOOTH_A2DP_H_
|
||||||
|
|
||||||
|
#include <bluetooth/avdtp.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <bluetooth/avdtp.h>
|
|
||||||
|
|
||||||
/** @brief Stream Structure */
|
/** @brief Stream Structure */
|
||||||
struct bt_a2dp_stream {
|
struct bt_a2dp_stream {
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_
|
||||||
#define ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_
|
#define ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_
|
||||||
|
|
||||||
|
#include <sys/slist.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/slist.h>
|
|
||||||
|
|
||||||
/* Error codes for Error response PDU */
|
/* Error codes for Error response PDU */
|
||||||
#define BT_ATT_ERR_INVALID_HANDLE 0x01
|
#define BT_ATT_ERR_INVALID_HANDLE 0x01
|
||||||
#define BT_ATT_ERR_READ_NOT_PERMITTED 0x02
|
#define BT_ATT_ERR_READ_NOT_PERMITTED 0x02
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
#include <bluetooth/hci.h>
|
#include <bluetooth/hci.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Opaque type representing a connection to a remote device */
|
/** Opaque type representing a connection to a remote device */
|
||||||
struct bt_conn;
|
struct bt_conn;
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/util.h>
|
#include <sys/util.h>
|
||||||
|
@ -28,6 +24,10 @@ extern "C" {
|
||||||
#include <bluetooth/uuid.h>
|
#include <bluetooth/uuid.h>
|
||||||
#include <bluetooth/att.h>
|
#include <bluetooth/att.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* GATT attribute permission bit field values */
|
/* GATT attribute permission bit field values */
|
||||||
enum {
|
enum {
|
||||||
/** No operations supported, e.g. for notify-only */
|
/** No operations supported, e.g. for notify-only */
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <bluetooth/buf.h>
|
#include <bluetooth/buf.h>
|
||||||
#include <bluetooth/conn.h>
|
#include <bluetooth/conn.h>
|
||||||
#include <bluetooth/hci.h>
|
#include <bluetooth/hci.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* L2CAP header size, used for buffer size calculations */
|
/* L2CAP header size, used for buffer size calculations */
|
||||||
#define BT_L2CAP_HDR_SIZE 4
|
#define BT_L2CAP_HDR_SIZE 4
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <bluetooth/buf.h>
|
||||||
|
#include <bluetooth/conn.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <bluetooth/buf.h>
|
|
||||||
#include <bluetooth/conn.h>
|
|
||||||
|
|
||||||
/* RFCOMM channels (1-30): pre-allocated for profiles to avoid conflicts */
|
/* RFCOMM channels (1-30): pre-allocated for profiles to avoid conflicts */
|
||||||
enum {
|
enum {
|
||||||
BT_RFCOMM_CHAN_HFP_HF = 1,
|
BT_RFCOMM_CHAN_HFP_HF = 1,
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <bluetooth/uuid.h>
|
||||||
|
#include <bluetooth/conn.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <bluetooth/uuid.h>
|
|
||||||
#include <bluetooth/conn.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All definitions are based on Bluetooth Assigned Numbers
|
* All definitions are based on Bluetooth Assigned Numbers
|
||||||
* of the Bluetooth Specification
|
* of the Bluetooth Specification
|
||||||
|
@ -601,6 +601,7 @@ int bt_sdp_get_profile_version(const struct net_buf *buf, u16_t profile,
|
||||||
* @return 0 on success if feature found and valid, negative in case any error
|
* @return 0 on success if feature found and valid, negative in case any error
|
||||||
*/
|
*/
|
||||||
int bt_sdp_get_features(const struct net_buf *buf, u16_t *features);
|
int bt_sdp_get_features(const struct net_buf *buf, u16_t *features);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
* as a part of ongoing development.
|
* as a part of ongoing development.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <zephyr/types.h>
|
|
||||||
|
|
||||||
/** @brief Read battery level value.
|
/** @brief Read battery level value.
|
||||||
*
|
*
|
||||||
* Read the characteristic value of the battery level
|
* Read the characteristic value of the battery level
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <linker/sections.h>
|
#include <linker/sections.h>
|
||||||
#include <offsets.h>
|
#include <offsets.h>
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
|
#include <logging/log.h>
|
||||||
|
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
#include <bluetooth/hci.h>
|
#include <bluetooth/hci.h>
|
||||||
|
@ -32,8 +33,6 @@ extern "C" {
|
||||||
#define LOG_LEVEL CONFIG_BT_LOG_LEVEL
|
#define LOG_LEVEL CONFIG_BT_LOG_LEVEL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <logging/log.h>
|
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||||
|
|
||||||
#define BT_DBG(fmt, ...) LOG_DBG(fmt, ##__VA_ARGS__)
|
#define BT_DBG(fmt, ...) LOG_DBG(fmt, ##__VA_ARGS__)
|
||||||
|
@ -62,4 +61,3 @@ const char *bt_addr_le_str_real(const bt_addr_le_t *addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __BT_LOG_H */
|
#endif /* __BT_LOG_H */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue