arc: 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. Remove extern "C" support from files that don't declare objects or functions. In arch/arc/arch.h the extern "C" in the including context is left active during an include to avoid more complex restructuring. 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
20bb672266
commit
4a470114fa
|
@ -20,10 +20,6 @@
|
|||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_DATA_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_DATA_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <linker/sections.h>
|
||||
#include <arch/cpu.h>
|
||||
|
@ -36,9 +32,11 @@ extern "C" {
|
|||
#include <zephyr/types.h>
|
||||
#include <sys/util.h>
|
||||
#include <sys/dlist.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
struct _irq_stack_frame {
|
||||
u32_t lp_end;
|
||||
|
@ -170,6 +168,10 @@ struct _callee_saved_stack {
|
|||
|
||||
typedef struct _callee_saved_stack _callee_saved_stack_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
/* stacks */
|
||||
|
@ -179,8 +181,5 @@ typedef struct _callee_saved_stack _callee_saved_stack_t;
|
|||
#define STACK_ROUND_UP(x) ROUND_UP(x, STACK_ALIGN_SIZE)
|
||||
#define STACK_ROUND_DOWN(x) ROUND_DOWN(x, STACK_ALIGN_SIZE)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_DATA_H_ */
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_FUNC_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_FUNC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(_ASMLANGUAGE)
|
||||
|
||||
#ifdef CONFIG_CPU_ARCV2
|
||||
|
@ -31,6 +27,10 @@ extern "C" {
|
|||
#include <v2/irq.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static ALWAYS_INLINE _cpu_t *z_arch_curr_cpu(void)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
|
@ -80,10 +80,10 @@ extern void z_arc_fatal_error(unsigned int reason, const z_arch_esf_t *esf);
|
|||
|
||||
extern void z_arch_sched_ipi(void);
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_FUNC_H_ */
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
#ifndef _ASMLANGUAGE
|
||||
#include <zephyr/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _callee_saved {
|
||||
u32_t sp; /* r28 */
|
||||
};
|
||||
|
@ -60,6 +64,11 @@ struct _thread_arch {
|
|||
|
||||
typedef struct _thread_arch _thread_arch_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_THREAD_H_ */
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
#include <toolchain.h>
|
||||
#include <arch/cpu.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _ASMLANGUAGE
|
||||
|
||||
/* entering this macro, current is in r2 */
|
||||
|
@ -338,8 +334,4 @@ extern "C" {
|
|||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_SWAP_MACROS_H_ */
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
#include <arch/cpu.h>
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
/* i-cache defines for IC_CTRL register */
|
||||
#define IC_CACHE_ENABLE 0x00
|
||||
#define IC_CACHE_DISABLE 0x01
|
||||
|
@ -50,10 +50,10 @@ static ALWAYS_INLINE void z_icache_setup(void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_V2_CACHE_H_ */
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_VECTOR_TABLE_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_VECTOR_TABLE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define EXC_EV_TRAP 0x9
|
||||
|
||||
#ifdef _ASMLANGUAGE
|
||||
|
@ -55,6 +51,10 @@ GTEXT(_isr_wrapper)
|
|||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void __reset(void);
|
||||
extern void __memory_error(void);
|
||||
extern void __instruction_error(void);
|
||||
|
@ -70,10 +70,10 @@ extern void __ev_div_zero(void);
|
|||
extern void __ev_dc_error(void);
|
||||
extern void __ev_maligned(void);
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_VECTOR_TABLE_H_ */
|
||||
|
|
|
@ -160,6 +160,8 @@ extern "C" {
|
|||
|
||||
#ifdef CONFIG_ARC_MPU
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
/* Legacy case: retain containing extern "C" with C++ */
|
||||
#include <arch/arc/v2/mpu/arc_mpu.h>
|
||||
|
||||
#define K_MEM_PARTITION_P_NA_U_NA AUX_MPU_ATTR_N
|
||||
|
|
|
@ -14,14 +14,13 @@
|
|||
#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_ARC_CONNECT_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_ARC_V2_ARC_CONNECT_H_
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
#include <zephyr/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
#include <zephyr/types.h>
|
||||
|
||||
#define _ARC_V2_CONNECT_BCR 0x0d0
|
||||
#define _ARC_V2_CONNECT_IDU_BCR 0x0d5
|
||||
#define _ARC_V2_CONNECT_GFRC_BCR 0x0d6
|
||||
|
@ -227,9 +226,10 @@ extern void z_arc_connect_idu_set_mask(u32_t irq_num, u32_t mask);
|
|||
extern u32_t z_arc_connect_idu_read_mask(u32_t irq_num);
|
||||
extern u32_t z_arc_connect_idu_check_first(u32_t irq_num);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_ARC_CONNECT_H_ */
|
||||
|
|
|
@ -9,26 +9,25 @@
|
|||
#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_ASM_INLINE_GCC_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_ARC_V2_ASM_INLINE_GCC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief read timestamp register (CPU frequency)
|
||||
*/
|
||||
extern u64_t z_tsc_read(void);
|
||||
|
||||
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_ASM_INLINE_GCC_H_ */
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_AUX_REGS_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_ARC_V2_AUX_REGS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _ARC_V2_LP_START 0x002
|
||||
#define _ARC_V2_LP_END 0x003
|
||||
#define _ARC_V2_IDENTITY 0x004
|
||||
|
@ -201,8 +197,4 @@ extern "C" {
|
|||
__ret; \
|
||||
})
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_AUX_REGS_H_ */
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_FFS_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_ARC_V2_FFS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
#include <zephyr/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief find most significant bit set in a 32-bit word
|
||||
|
@ -81,10 +81,10 @@ static ALWAYS_INLINE unsigned int find_lsb_set(u32_t op)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_FFS_H_ */
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_SYS_IO_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_ARC_V2_SYS_IO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
#include <sys/sys_io.h>
|
||||
|
@ -18,6 +14,11 @@ extern "C" {
|
|||
|
||||
#include <zephyr/types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Implementation of sys_io.h's documented functions */
|
||||
|
||||
static ALWAYS_INLINE
|
||||
|
@ -300,10 +301,10 @@ static ALWAYS_INLINE
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_SYS_IO_H_ */
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
#ifndef _ARC_IOT_SYSCONF_H_
|
||||
#define _ARC_IOT_SYSCONF_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct sysconf_reg {
|
||||
volatile uint32_t reserved1; /* 0x0 */
|
||||
volatile uint32_t AHBCLKDIV; /* AHB clock divisor */
|
||||
|
@ -164,4 +164,4 @@ extern void arc_iot_eflash_clk_div(uint8_t div);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ARC_IOT_SYSCONF_H_ */
|
||||
#endif /* _ARC_IOT_SYSCONF_H_ */
|
||||
|
|
Loading…
Reference in a new issue