Add judgement of cplusplus in all header files of include

This commit is contained in:
Parker Liu
2021-08-30 14:32:48 +08:00
parent 7bb6562b19
commit e1eeb63e1a
11 changed files with 83 additions and 2 deletions
+8
View File
@@ -20,6 +20,10 @@
#ifndef __NEU_IDHASH_H__
#define __NEU_IDHASH_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <string.h>
@@ -57,4 +61,8 @@ extern int neu_id_set(neu_id_map *, uint32_t, void *);
extern int neu_id_alloc(neu_id_map *, uint32_t *, void *);
extern int neu_id_remove(neu_id_map *, uint32_t);
#ifdef __cplusplus
}
#endif
#endif // __NEU_IDHASH_H__
+9 -1
View File
@@ -23,6 +23,10 @@
#include "neu_panic.h"
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NEU_ARG_UNUSED(x) ((void) x)
void *neu_alloc(size_t sz);
@@ -34,4 +38,8 @@ void neu_free(void *b, size_t z);
#define NEU_ALLOC_STRUCTS(s, n) neu_zalloc(sizeof(*s) * n)
#define NEU_FREE_STRUCTS(s, n) neu_free(s, sizeof(*s) * n)
#endif
#ifdef __cplusplus
}
#endif
#endif
+8
View File
@@ -20,6 +20,10 @@
#ifndef NEURON_ATOMIC_H_
#define NEURON_ATOMIC_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdatomic.h>
#include <stdbool.h>
@@ -71,4 +75,8 @@ extern void neu_atomic_inc(neu_atomic_int *);
// true if the value was set.
extern bool neu_atomic_cas(neu_atomic_int *, int, int);
#ifdef __cplusplus
}
#endif
#endif
+1
View File
@@ -40,4 +40,5 @@ datatag_id_t neu_datatag_tbl_add(neu_datatag_table_t *, neu_datatag_t *);
#ifdef __cplusplus
}
#endif
#endif //__DATATAG_TABLE_H__
+9 -1
View File
@@ -20,6 +20,10 @@
#ifndef __NEU_LIST_H__
#define __NEU_LIST_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
// In order to make life easy, we just define the list structures
@@ -61,4 +65,8 @@ extern void neu_list_node_remove(neu_list_node *);
#define NEU_LIST_FOREACH(l, it) \
for (it = neu_list_first(l); it != NULL; it = neu_list_next(l, it))
#endif // __NEU_LIST_H__
#ifdef __cplusplus
}
#endif
#endif // __NEU_LIST_H__
+8
View File
@@ -20,6 +20,10 @@
#ifndef NEURON_LOG_H
#define NEURON_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
@@ -74,4 +78,8 @@ extern void log_log(int level, const char *file, int line, const char *func,
#define log_fatal(...) \
log_log(LOG_FATAL, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif
+8
View File
@@ -20,6 +20,10 @@
#ifndef NEURON_PANIC_H
#define NEURON_PANIC_H
#ifdef __cplusplus
extern "C" {
#endif
#include "neu_log.h"
#include <stdarg.h>
@@ -34,4 +38,8 @@ void neu_panic(const char *fmt, ...);
#define NEU_ASSERT(x) (0)
#endif
#ifdef __cplusplus
}
#endif
#endif
+8
View File
@@ -20,6 +20,10 @@
#ifndef NEURON_PLUGIN_H
#define NEURON_PLUGIN_H
#ifdef __cplusplus
extern "C" {
#endif
#include "neu_adapter.h"
#define NEURON_PLUGIN_VER_1_0 100
@@ -57,4 +61,8 @@ typedef struct neu_plugin_module {
const neu_plugin_intf_funs_t *intf_funs;
} neu_plugin_module_t;
#ifdef __cplusplus
}
#endif
#endif
+8
View File
@@ -20,6 +20,10 @@
#ifndef NEURON_TAG_GROUP_CONFIG_H
#define NEURON_TAG_GROUP_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "neu_vector.h"
typedef struct neu_taggrp_config neu_taggrp_config_t;
@@ -38,4 +42,8 @@ const vector_t *neu_taggrp_cfg_ref_subpipes(neu_taggrp_config_t *grp_config);
vector_t * neu_taggrp_cfg_get_datatag_ids(neu_taggrp_config_t *grp_config);
const vector_t *neu_taggrp_cfg_ref_datatag_ids(neu_taggrp_config_t *grp_config);
#ifdef __cplusplus
}
#endif
#endif
+8
View File
@@ -20,6 +20,10 @@
#ifndef NEU_VECTOR_H
#define NEU_VECTOR_H
#ifdef __cplusplus
extern "C" {
#endif
#include "vector.h"
typedef struct Vector vector_t;
@@ -49,4 +53,8 @@ static inline void vector_free(vector_t *vec)
return;
}
#ifdef __cplusplus
}
#endif
#endif
+8
View File
@@ -20,6 +20,10 @@
#ifndef _NEURON_H_
#define _NEURON_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "neu_adapter.h"
#include "neu_list.h"
#include "neu_log.h"
@@ -28,4 +32,8 @@
#include "neu_types.h"
#include "neu_vector.h"
#ifdef __cplusplus
}
#endif
#endif