Skip to content

Commit

Permalink
Add #ifdef __cplusplus extern "C" { guards to all headers.
Browse files Browse the repository at this point in the history
This commit adds them to every header, except a couple:

    libs\baselibc\src\baselibc_test\unittests.h
    libs\shell\include\shell\shell_prompt.h

Because the hack I used looks for normal #include guards for its place to put the C++ ones, and those files don't have any.

Also there are some files that maaaybe shouldn't have guards, e.g. the ones in libs/baselibc/include/klibc, but it doesn't look like they would hurt either.

I haven't compiled anything to test this.
  • Loading branch information
Timmmm committed Sep 11, 2016
1 parent e993ac5 commit fec88d1
Show file tree
Hide file tree
Showing 226 changed files with 1,808 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/blecent/src/blecent.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef H_BLECENT_
#define H_BLECENT_

#ifdef __cplusplus
extern "C" {
#endif

#include "os/queue.h"
#include "log/log.h"
struct ble_hs_adv_fields;
Expand Down Expand Up @@ -114,4 +118,8 @@ int peer_delete(uint16_t conn_handle);
int peer_add(uint16_t conn_handle);
int peer_init(int max_peers, int max_svcs, int max_chrs, int max_dscs);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions apps/bleprph/src/bleprph.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef H_BLEPRPH_
#define H_BLEPRPH_

#ifdef __cplusplus
extern "C" {
#endif

#include "log/log.h"
struct ble_hs_cfg;
struct ble_gatt_register_ctxt;
Expand Down Expand Up @@ -48,4 +52,8 @@ int gatt_svr_init(struct ble_hs_cfg *cfg);
void print_bytes(const uint8_t *bytes, int len);
void print_addr(const void *addr);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions apps/bletest/src/bletest_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef H_BLETEST_PRIV_
#define H_BLETEST_PRIV_

#ifdef __cplusplus
extern "C" {
#endif

void bletest_send_conn_update(uint16_t handle);

#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
Expand Down Expand Up @@ -63,4 +67,8 @@ int bletest_hci_le_add_resolv_list(uint8_t *local_irk, uint8_t *peer_irk,
int bletest_hci_le_enable_resolv_list(uint8_t enable);


#ifdef __cplusplus
}
#endif

#endif /* H_BLETEST_PRIV_*/
8 changes: 8 additions & 0 deletions apps/bletiny/src/bletiny.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef H_BLETINY_PRIV_
#define H_BLETINY_PRIV_

#ifdef __cplusplus
extern "C" {
#endif

#include <inttypes.h>
#include "nimble/nimble_opt.h"
#include "log/log.h"
Expand Down Expand Up @@ -204,4 +208,8 @@ uint16_t chr_end_handle(const struct bletiny_svc *svc,
int chr_is_empty(const struct bletiny_svc *svc, const struct bletiny_chr *chr);
void print_conn_desc(const struct ble_gap_conn_desc *desc);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions drivers/uart_bitbang/include/uart_bitbang/uart_bitbang.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
#ifndef __UART_BITBANG_H__
#define __UART_BITBANG_H__

#ifdef __cplusplus
extern "C" {
#endif

int uart_bitbang_init(int rxpin, int txpin, uint32_t cputimer_freq);

#ifdef __cplusplus
}
#endif

#endif /* __UART_BITBANG_H__ */
8 changes: 8 additions & 0 deletions drivers/uart_bitbang/include/uart_bitbang/uart_bitbang_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef __UART_BITBANG_API_H__
#define __UART_BITBANG_API_H__

#ifdef __cplusplus
extern "C" {
#endif

int uart_bitbang_config(int port, int32_t baudrate, uint8_t databits,
uint8_t stopbits, enum hal_uart_parity parity,
enum hal_uart_flow_ctl flow_ctl);
Expand All @@ -30,4 +34,8 @@ void uart_bitbang_start_tx(int port);
void uart_bitbang_blocking_tx(int port, uint8_t data);
int uart_bitbang_close(int port);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/fs/include/fs/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef __FS_H__
#define __FS_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include <inttypes.h>

Expand Down Expand Up @@ -75,4 +79,8 @@ int fs_dirent_is_dir(const struct fs_dirent *);
#define FS_EACCESS 12 /* Operation prohibited by file open mode */
#define FS_EUNINIT 13 /* File system not initialized */

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/fs/include/fs/fs_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef __FS_IF_H__
#define __FS_IF_H__

#ifdef __cplusplus
extern "C" {
#endif

/*
* Common interface filesystem(s) provide.
*/
Expand Down Expand Up @@ -55,4 +59,8 @@ struct fs_ops {
*/
int fs_register(const struct fs_ops *);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/fs/include/fs/fsutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@
#ifndef H_FSUTIL_
#define H_FSUTIL_

#ifdef __cplusplus
extern "C" {
#endif

#include <inttypes.h>

int fsutil_read_file(const char *path, uint32_t offset, uint32_t len,
void *dst, uint32_t *out_len);
int fsutil_write_file(const char *path, const void *data, uint32_t len);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/fs/src/fs_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
#ifndef __FS_PRIV_H__
#define __FS_PRIV_H__

#ifdef __cplusplus
extern "C" {
#endif

struct fs_ops;
extern const struct fs_ops *fs_root_ops;

#ifdef SHELL_PRESENT
void fs_cli_init(void);
#endif /* SHELL_PRESENT */

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/nffs/include/nffs/nffs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef H_NFFS_
#define H_NFFS_

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include <inttypes.h>

Expand Down Expand Up @@ -58,4 +62,8 @@ int nffs_init(void);
int nffs_detect(const struct nffs_area_desc *area_descs);
int nffs_format(const struct nffs_area_desc *area_descs);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/nffs/include/nffs/nffs_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
#ifndef H_NFFS_TEST_
#define H_NFFS_TEST_

#ifdef __cplusplus
extern "C" {
#endif

int nffs_test_all(void);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/nffs/src/nffs_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef H_NFFS_PRIV_
#define H_NFFS_PRIV_

#ifdef __cplusplus
extern "C" {
#endif

#include <inttypes.h>
#include "log/log.h"
#include "os/queue.h"
Expand Down Expand Up @@ -513,4 +517,8 @@ int nffs_write_to_file(struct nffs_file *file, const void *data, int len);
LOG_ ## lvl(&nffs_log, LOG_MODULE_NFFS, __VA_ARGS__)
#endif

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fs/nffs/src/test/arch/sim/nffs_test_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef H_NFFS_TEST_PRIV_
#define H_NFFS_TEST_PRIV_

#ifdef __cplusplus
extern "C" {
#endif

struct nffs_test_block_desc {
const char *data;
int data_len;
Expand All @@ -38,5 +42,9 @@ int nffs_test(void);
extern const struct nffs_test_file_desc *nffs_test_system_01;
extern const struct nffs_test_file_desc *nffs_test_system_01_rm_1014_mk10;

#ifdef __cplusplus
}
#endif

#endif

8 changes: 8 additions & 0 deletions hw/bsp/native/include/bsp/bsp_sysid.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#ifndef __NATIVE_BSP_SYSID_H
#define __NATIVE_BSP_SYSID_H

#ifdef __cplusplus
extern "C" {
#endif

/* This file defines the system device descriptors for this BSP.
* System device descriptors are any HAL devies */

Expand All @@ -45,4 +49,8 @@ enum system_device_id {
/* TODO -- add other hals here */
};

#ifdef __cplusplus
}
#endif

#endif /* __NATIVE_BSP_SYSID_H */
8 changes: 8 additions & 0 deletions hw/hal/include/hal/hal_watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef _HAL_WATCHDOG_H_
#define _HAL_WATCHDOG_H_

#ifdef __cplusplus
extern "C" {
#endif

/*
* Set a recurring watchdog timer to fire no sooner than in 'expire_secs'
* seconds. Watchdog should be tickled periodically with a frequency
Expand Down Expand Up @@ -52,4 +56,8 @@ int hal_watchdog_stop(void);
*/
void hal_watchdog_tickle(void);

#ifdef __cplusplus
}
#endif

#endif /* _HAL_WATCHDOG_H_ */
8 changes: 8 additions & 0 deletions hw/mcu/native/include/mcu/hal_dac.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef _NATIVE_HAL_DAC_H
#define _NATIVE_HAL_DAC_H

#ifdef __cplusplus
extern "C" {
#endif

enum native_dac_channel
{
NATIVE_MCU_DAC0 = 0,
Expand All @@ -32,5 +36,9 @@ enum native_dac_channel
struct hal_dac *
native_dac_create (enum native_dac_channel);

#ifdef __cplusplus
}
#endif

#endif /* _NATIVE_HAL_PWM_H */

8 changes: 8 additions & 0 deletions hw/mcu/native/include/mcu/mcu_sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
#ifndef __MCU_SIM_H__
#define __MCU_SIM_H__

#ifdef __cplusplus
extern "C" {
#endif

#define OS_TICKS_PER_SEC (1000)

extern char *native_flash_file;
extern char *native_uart_log_file;

void mcu_sim_parse_args(int argc, char **argv);

#ifdef __cplusplus
}
#endif

#endif /* __MCU_SIM_H__ */
8 changes: 8 additions & 0 deletions hw/mcu/native/include/mcu/native_bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
#ifndef H_NATIVE_BSP_
#define H_NATIVE_BSP_

#ifdef __cplusplus
extern "C" {
#endif

extern const struct hal_flash native_flash_dev;

#ifdef __cplusplus
}
#endif

#endif /* H_NATIVE_BSP_ */
8 changes: 8 additions & 0 deletions hw/mcu/nordic/nrf51xxx/include/mcu/compiler_abstraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
*/
#ifndef _COMPILER_ABSTRACTION_H
#define _COMPILER_ABSTRACTION_H

#ifdef __cplusplus
extern "C" {
#endif

/*lint ++flb "Enter library region" */

Expand Down Expand Up @@ -123,4 +127,8 @@

/*lint --flb "Leave library region" */

#ifdef __cplusplus
}
#endif

#endif

0 comments on commit fec88d1

Please sign in to comment.