This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 2f3f37525aee21919fffbcd9b4c618112829ca5b Author: Marco Casaroli <[email protected]> AuthorDate: Tue Oct 27 17:17:42 2026 +0100 drivers, fs, libs, net, sched: Declare the global data with extern. As in include/, arch/ and boards/: 36 internal headers of binfmt/, drivers/, fs/, libs/, net/ and sched/ declared global data with EXTERN. The declarations are inside the extern "C" block of the header, so plain extern gives them C linkage in C++ too. Declare them with extern and remove the definitions of EXTERN. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- binfmt/binfmt.h | 7 +--- drivers/bch/bch.h | 11 ++---- drivers/mmcsd/mmcsd.h | 7 +--- drivers/power/pm/pm.h | 7 +--- drivers/syslog/syslog.h | 6 +-- drivers/usbdev/usbmsc.h | 19 ++++------ drivers/usbhost/usbhost_registry.h | 9 +---- drivers/video/vnc/vnc_server.h | 8 +--- fs/aio/aio.h | 7 +--- fs/fat/fs_fat32.h | 77 ++++++++++++++++++-------------------- fs/inode/inode.h | 7 +--- fs/nfs/nfs.h | 15 +++----- fs/tmpfs/fs_tmpfs.h | 7 +--- fs/xipfs/xipfs.h | 7 +--- libs/libc/grp/lib_grp.h | 8 +--- libs/libc/netdb/lib_dns.h | 9 +---- libs/libc/netdb/lib_netdb.h | 10 ++--- libs/libc/pwd/lib_pwd.h | 12 ++---- libs/libc/syslog/syslog.h | 7 +--- libs/libnx/nxfonts/nxfonts.h | 11 ++---- libs/libnx/nxtk/nxtk.h | 13 ++----- net/bluetooth/bluetooth.h | 6 +-- net/can/can.h | 6 +-- net/icmp/icmp.h | 6 +-- net/icmpv6/icmpv6.h | 6 +-- net/ieee802154/ieee802154.h | 6 +-- net/igmp/igmp.h | 8 +--- net/inet/inet.h | 21 ++++------- net/local/local.h | 6 +-- net/netdev/netdev.h | 11 ++---- net/netlink/netlink.h | 6 +-- net/pkt/pkt.h | 6 +-- net/rpmsg/rpmsg.h | 6 +-- net/usrsock/usrsock.h | 6 +-- sched/mqueue/mqueue.h | 10 ++--- sched/mqueue/msg.h | 6 +-- 36 files changed, 109 insertions(+), 271 deletions(-) diff --git a/binfmt/binfmt.h b/binfmt/binfmt.h index ca2c6bb1efe..27f76755ea1 100644 --- a/binfmt/binfmt.h +++ b/binfmt/binfmt.h @@ -39,13 +39,9 @@ * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* This is a list of registered handlers for different binary formats. @@ -54,7 +50,7 @@ extern "C" * list. */ -EXTERN FAR struct binfmt_s *g_binfmts; +extern FAR struct binfmt_s *g_binfmts; /**************************************************************************** * Public Function Prototypes @@ -341,7 +337,6 @@ int nxflat_initialize(void); void nxflat_uninitialize(void); #endif -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/drivers/bch/bch.h b/drivers/bch/bch.h index 2d31a007ee4..bb4fa623e50 100644 --- a/drivers/bch/bch.h +++ b/drivers/bch/bch.h @@ -68,25 +68,20 @@ struct bchlib_s * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif -EXTERN const struct file_operations g_bch_fops; +extern const struct file_operations g_bch_fops; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -EXTERN int bchlib_flushsector(FAR struct bchlib_s *bch, bool discard); -EXTERN int bchlib_readsector(FAR struct bchlib_s *bch, size_t sector); +extern int bchlib_flushsector(FAR struct bchlib_s *bch, bool discard); +extern int bchlib_readsector(FAR struct bchlib_s *bch, size_t sector); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/drivers/mmcsd/mmcsd.h b/drivers/mmcsd/mmcsd.h index df47982a5f4..4c2cddd910f 100644 --- a/drivers/mmcsd/mmcsd.h +++ b/drivers/mmcsd/mmcsd.h @@ -119,13 +119,9 @@ struct mmcsd_state_s * Public Functions Definitions ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif #ifdef CONFIG_MMCSD_PROCFS @@ -139,12 +135,11 @@ void mmcsd_initialize_procfs(void); #endif #if defined(CONFIG_DEBUG_INFO) && defined(CONFIG_DEBUG_FS) -EXTERN void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype); +extern void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype); #else # define mmcsd_dmpcsd(csd,cadtype) #endif -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/drivers/power/pm/pm.h b/drivers/power/pm/pm.h index 37d12cc365c..11c840fcbb7 100644 --- a/drivers/power/pm/pm.h +++ b/drivers/power/pm/pm.h @@ -99,18 +99,14 @@ struct pm_domain_s * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* All PM global data: */ -EXTERN struct pm_domain_s g_pmdomains[CONFIG_PM_NDOMAINS]; +extern struct pm_domain_s g_pmdomains[CONFIG_PM_NDOMAINS]; /**************************************************************************** * Public Function Prototypes @@ -164,7 +160,6 @@ void pm_domain_unlock(int domain, irqstate_t flags); void pm_wakelock_global_init(void); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/drivers/syslog/syslog.h b/drivers/syslog/syslog.h index af32be328a4..6b6b7ac616a 100644 --- a/drivers/syslog/syslog.h +++ b/drivers/syslog/syslog.h @@ -38,11 +38,8 @@ #ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* This is the current syslog channel in use. It initially points to @@ -50,7 +47,7 @@ extern "C" */ #ifdef CONFIG_SYSLOG -EXTERN FAR syslog_channel_t * +extern FAR syslog_channel_t * #ifndef CONFIG_SYSLOG_REGISTER const #endif @@ -252,7 +249,6 @@ ssize_t syslog_write_foreach(FAR const char *buffer, size_t buflen, bool force); #endif /* CONFIG_SYSLOG */ -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/drivers/usbdev/usbmsc.h b/drivers/usbdev/usbmsc.h index 4afb0dda7b4..3c241e2c1c4 100644 --- a/drivers/usbdev/usbmsc.h +++ b/drivers/usbdev/usbmsc.h @@ -444,13 +444,9 @@ struct usbmsc_dev_s * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* String *******************************************************************/ @@ -458,10 +454,10 @@ extern "C" /* Mass storage class vendor/product/serial number strings */ #ifndef CONFIG_USBMSC_COMPOSITE -EXTERN const char g_mscvendorstr[]; -EXTERN const char g_mscproductstr[]; +extern const char g_mscvendorstr[]; +extern const char g_mscproductstr[]; #ifndef CONFIG_BOARD_USBDEV_SERIALSTR -EXTERN const char g_mscserialstr[]; +extern const char g_mscserialstr[]; #endif /* If we are using a composite device, then vendor/product/serial number @@ -469,10 +465,10 @@ EXTERN const char g_mscserialstr[]; */ #else -EXTERN const char g_compvendorstr[]; -EXTERN const char g_compproductstr[]; +extern const char g_compvendorstr[]; +extern const char g_compproductstr[]; #ifndef CONFIG_BOARD_USBDEV_SERIALSTR -EXTERN const char g_compserialstr[]; +extern const char g_compserialstr[]; #endif #define g_mscvendorstr g_compvendorstr @@ -486,7 +482,7 @@ EXTERN const char g_compserialstr[]; * started */ -EXTERN FAR struct usbmsc_dev_s *g_usbmsc_handoff; +extern FAR struct usbmsc_dev_s *g_usbmsc_handoff; /**************************************************************************** * Public Function Prototypes @@ -653,7 +649,6 @@ void usbmsc_rdcomplete(FAR struct usbdev_ep_s *ep, void usbmsc_deferredresponse(FAR struct usbmsc_dev_s *priv, bool failed); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/drivers/usbhost/usbhost_registry.h b/drivers/usbhost/usbhost_registry.h index 18569304542..1af66517853 100644 --- a/drivers/usbhost/usbhost_registry.h +++ b/drivers/usbhost/usbhost_registry.h @@ -46,13 +46,9 @@ * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* g_classregistry is a singly-linked list of class ID information added by @@ -61,14 +57,13 @@ extern "C" * protected by disabling interrupts. */ -EXTERN struct usbhost_registry_s *g_classregistry; -EXTERN spinlock_t g_classregistry_lock; +extern struct usbhost_registry_s *g_classregistry; +extern spinlock_t g_classregistry_lock; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/drivers/video/vnc/vnc_server.h b/drivers/video/vnc/vnc_server.h index ac4a5c4f025..7a0ec5c825a 100644 --- a/drivers/video/vnc/vnc_server.h +++ b/drivers/video/vnc/vnc_server.h @@ -282,22 +282,19 @@ typedef CODE uint32_t (*vnc_convert32_t)(lfb_color_t rgb); ****************************************************************************/ #ifdef __cplusplus -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* Given a display number as an index, the following array can be used to * look-up the session structure for that display. */ -EXTERN FAR struct vnc_session_s *g_vnc_sessions[RFB_MAX_DISPLAYS]; +extern FAR struct vnc_session_s *g_vnc_sessions[RFB_MAX_DISPLAYS]; /* Used to synchronize the server thread with the framebuffer driver. */ -EXTERN struct fb_startup_s g_fbstartup[RFB_MAX_DISPLAYS]; +extern struct fb_startup_s g_fbstartup[RFB_MAX_DISPLAYS]; /**************************************************************************** * Public Function Prototypes @@ -641,7 +638,6 @@ int vnc_colors(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect, unsigned int maxcolors, FAR lfb_color_t *colors); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/fs/aio/aio.h b/fs/aio/aio.h index b0caf9e0cf8..769cd7015eb 100644 --- a/fs/aio/aio.h +++ b/fs/aio/aio.h @@ -74,20 +74,16 @@ struct aio_container_s * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* This is a list of pending asynchronous I/O. The user must hold the * lock on this list in order to access the list. */ -EXTERN dq_queue_t g_aio_pending; +extern dq_queue_t g_aio_pending; /**************************************************************************** * Public Function Prototypes @@ -242,7 +238,6 @@ int aio_signal(pid_t pid, FAR struct aiocb *aiocbp); int aio_read_internal(FAR struct aiocb *aiocbp); int aio_write_internal(FAR struct aiocb *aiocbp); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/fs/fat/fs_fat32.h b/fs/fat/fs_fat32.h index 2f07d347f09..b630c77759b 100644 --- a/fs/fat/fs_fat32.h +++ b/fs/fat/fs_fat32.h @@ -1041,109 +1041,104 @@ struct fat_dirinfo_s * Public Function Prototypes ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* Utitilies to handle unaligned or byte swapped accesses */ -EXTERN uint16_t fat_getuint16(FAR uint8_t *ptr); -EXTERN uint32_t fat_getuint32(FAR uint8_t *ptr); -EXTERN void fat_putuint16(FAR uint8_t *ptr, uint16_t value16); -EXTERN void fat_putuint32(FAR uint8_t *ptr, uint32_t value32); +extern uint16_t fat_getuint16(FAR uint8_t *ptr); +extern uint32_t fat_getuint32(FAR uint8_t *ptr); +extern void fat_putuint16(FAR uint8_t *ptr, uint16_t value16); +extern void fat_putuint32(FAR uint8_t *ptr, uint32_t value32); /* Get the current time for FAT creation and write times */ -EXTERN uint32_t fat_systime2fattime(void); -EXTERN time_t fat_fattime2systime(uint16_t fattime, uint16_t fatdate); +extern uint32_t fat_systime2fattime(void); +extern time_t fat_fattime2systime(uint16_t fattime, uint16_t fatdate); /* Handle hardware interactions for mounting */ -EXTERN int fat_mount(FAR struct fat_mountpt_s *fs, bool writeable); -EXTERN int fat_checkmount(FAR struct fat_mountpt_s *fs); +extern int fat_mount(FAR struct fat_mountpt_s *fs, bool writeable); +extern int fat_checkmount(FAR struct fat_mountpt_s *fs); /* low-level hardware access */ -EXTERN int fat_hwread(FAR struct fat_mountpt_s *fs, FAR uint8_t *buffer, +extern int fat_hwread(FAR struct fat_mountpt_s *fs, FAR uint8_t *buffer, off_t sector, unsigned int nsectors); -EXTERN int fat_hwwrite(FAR struct fat_mountpt_s *fs, FAR uint8_t *buffer, +extern int fat_hwwrite(FAR struct fat_mountpt_s *fs, FAR uint8_t *buffer, off_t sector, unsigned int nsectors); /* Cluster / cluster chain access helpers */ -EXTERN off_t fat_cluster2sector(FAR struct fat_mountpt_s *fs, +extern off_t fat_cluster2sector(FAR struct fat_mountpt_s *fs, uint32_t cluster); -EXTERN off_t fat_getcluster(FAR struct fat_mountpt_s *fs, +extern off_t fat_getcluster(FAR struct fat_mountpt_s *fs, uint32_t clusterno); -EXTERN int fat_putcluster(FAR struct fat_mountpt_s *fs, +extern int fat_putcluster(FAR struct fat_mountpt_s *fs, uint32_t clusterno, off_t startsector); -EXTERN int fat_removechain(FAR struct fat_mountpt_s *fs, +extern int fat_removechain(FAR struct fat_mountpt_s *fs, uint32_t cluster); -EXTERN int32_t fat_extendchain(FAR struct fat_mountpt_s *fs, +extern int32_t fat_extendchain(FAR struct fat_mountpt_s *fs, uint32_t cluster); #define fat_createchain(fs) fat_extendchain(fs, 0) /* Help for traversing directory trees and accessing directory entries */ -EXTERN int fat_nextdirentry(FAR struct fat_mountpt_s *fs, +extern int fat_nextdirentry(FAR struct fat_mountpt_s *fs, FAR struct fs_fatdir_s *dir); -EXTERN int fat_finddirentry(FAR struct fat_mountpt_s *fs, +extern int fat_finddirentry(FAR struct fat_mountpt_s *fs, FAR struct fat_dirinfo_s *dirinfo, FAR const char *path); -EXTERN int fat_dirnamewrite(FAR struct fat_mountpt_s *fs, +extern int fat_dirnamewrite(FAR struct fat_mountpt_s *fs, FAR struct fat_dirinfo_s *dirinfo); -EXTERN int fat_dirwrite(FAR struct fat_mountpt_s *fs, +extern int fat_dirwrite(FAR struct fat_mountpt_s *fs, FAR struct fat_dirinfo_s *dirinfo, uint8_t attributes, uint32_t fattime); -EXTERN int fat_allocatedirentry(FAR struct fat_mountpt_s *fs, +extern int fat_allocatedirentry(FAR struct fat_mountpt_s *fs, FAR struct fat_dirinfo_s *dirinfo); -EXTERN int fat_freedirentry(FAR struct fat_mountpt_s *fs, +extern int fat_freedirentry(FAR struct fat_mountpt_s *fs, FAR struct fat_dirseq_s *seq); -EXTERN int fat_dirname2path(FAR struct fat_mountpt_s *fs, +extern int fat_dirname2path(FAR struct fat_mountpt_s *fs, FAR struct fs_dirent_s *dir, FAR struct dirent *entry); /* File creation and removal helpers */ -EXTERN int fat_dirtruncate(FAR struct fat_mountpt_s *fs, +extern int fat_dirtruncate(FAR struct fat_mountpt_s *fs, FAR uint8_t *direntry); -EXTERN int fat_dirshrink(FAR struct fat_mountpt_s *fs, +extern int fat_dirshrink(FAR struct fat_mountpt_s *fs, FAR uint8_t *direntry, off_t length); -EXTERN int fat_dirextend(FAR struct fat_mountpt_s *fs, +extern int fat_dirextend(FAR struct fat_mountpt_s *fs, FAR struct fat_file_s *ff, off_t length); -EXTERN int fat_dircreate(FAR struct fat_mountpt_s *fs, +extern int fat_dircreate(FAR struct fat_mountpt_s *fs, FAR struct fat_dirinfo_s *dirinfo); -EXTERN int fat_remove(FAR struct fat_mountpt_s *fs, +extern int fat_remove(FAR struct fat_mountpt_s *fs, FAR const char *relpath, bool directory); /* Mountpoint and file buffer cache (for partial sector accesses) */ -EXTERN int fat_fscacheflush(FAR struct fat_mountpt_s *fs); -EXTERN int fat_fscacheread(FAR struct fat_mountpt_s *fs, off_t sector); -EXTERN int fat_ffcacheflush(FAR struct fat_mountpt_s *fs, +extern int fat_fscacheflush(FAR struct fat_mountpt_s *fs); +extern int fat_fscacheread(FAR struct fat_mountpt_s *fs, off_t sector); +extern int fat_ffcacheflush(FAR struct fat_mountpt_s *fs, FAR struct fat_file_s *ff); -EXTERN int fat_ffcacheread(FAR struct fat_mountpt_s *fs, +extern int fat_ffcacheread(FAR struct fat_mountpt_s *fs, FAR struct fat_file_s *ff, off_t sector); -EXTERN int fat_ffcacheinvalidate(FAR struct fat_mountpt_s *fs, +extern int fat_ffcacheinvalidate(FAR struct fat_mountpt_s *fs, FAR struct fat_file_s *ff); /* FSINFO sector support */ -EXTERN int fat_updatefsinfo(FAR struct fat_mountpt_s *fs); -EXTERN int fat_computefreeclusters(FAR struct fat_mountpt_s *fs); -EXTERN int fat_nfreeclusters(FAR struct fat_mountpt_s *fs, +extern int fat_updatefsinfo(FAR struct fat_mountpt_s *fs); +extern int fat_computefreeclusters(FAR struct fat_mountpt_s *fs); +extern int fat_nfreeclusters(FAR struct fat_mountpt_s *fs, FAR fsblkcnt_t *pfreeclusters); -EXTERN int fat_currentsector(FAR struct fat_mountpt_s *fs, +extern int fat_currentsector(FAR struct fat_mountpt_s *fs, FAR struct fat_file_s *ff, off_t position); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/fs/inode/inode.h b/fs/inode/inode.h index acc59284f26..4b9db5b66d3 100644 --- a/fs/inode/inode.h +++ b/fs/inode/inode.h @@ -131,16 +131,12 @@ typedef int (*foreach_inode_t)(FAR struct inode *inode, * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif -EXTERN FAR struct inode *g_root_inode; +extern FAR struct inode *g_root_inode; /**************************************************************************** * Public Function Prototypes @@ -577,7 +573,6 @@ int pseudofile_create(FAR struct inode **node, FAR const char *path, bool inode_is_pseudofile(FAR struct inode *inode); #endif -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h index f7228ea5578..4f10d25cbf1 100644 --- a/fs/nfs/nfs.h +++ b/fs/nfs/nfs.h @@ -101,33 +101,28 @@ struct nfsstats * Public Function Prototypes ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif -EXTERN int nfs_request(FAR struct nfsmount *nmp, int procnum, +extern int nfs_request(FAR struct nfsmount *nmp, int procnum, FAR void *request, size_t reqlen, FAR void *response, size_t resplen); -EXTERN int nfs_lookup(FAR struct nfsmount *nmp, FAR const char *filename, +extern int nfs_lookup(FAR struct nfsmount *nmp, FAR const char *filename, FAR struct file_handle *fhandle, FAR struct nfs_fattr *obj_attributes, FAR struct nfs_fattr *dir_attributes); -EXTERN int nfs_findnode(FAR struct nfsmount *nmp, FAR const char *relpath, +extern int nfs_findnode(FAR struct nfsmount *nmp, FAR const char *relpath, FAR struct file_handle *fhandle, FAR struct nfs_fattr *obj_attributes, FAR struct nfs_fattr *dir_attributes); -EXTERN int nfs_finddir(FAR struct nfsmount *nmp, FAR const char *relpath, +extern int nfs_finddir(FAR struct nfsmount *nmp, FAR const char *relpath, FAR struct file_handle *fhandle, FAR struct nfs_fattr *attributes, FAR char *filename); -EXTERN void nfs_attrupdate(FAR struct nfsnode *np, +extern void nfs_attrupdate(FAR struct nfsnode *np, FAR struct nfs_fattr *attributes); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/fs/tmpfs/fs_tmpfs.h b/fs/tmpfs/fs_tmpfs.h index b04b62628ca..dce67da1cb6 100644 --- a/fs/tmpfs/fs_tmpfs.h +++ b/fs/tmpfs/fs_tmpfs.h @@ -179,22 +179,17 @@ typedef int (*tmpfs_foreach_t)(FAR struct tmpfs_directory_s *tdo, * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif -EXTERN const struct mountpt_operations g_tmpfs_operations; +extern const struct mountpt_operations g_tmpfs_operations; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/fs/xipfs/xipfs.h b/fs/xipfs/xipfs.h index 4e93738ffe1..6dd9c587dd2 100644 --- a/fs/xipfs/xipfs.h +++ b/fs/xipfs/xipfs.h @@ -293,16 +293,12 @@ struct xipfs_dir_s * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif -EXTERN const struct mountpt_operations g_xipfs_operations; +extern const struct mountpt_operations g_xipfs_operations; /**************************************************************************** * Public Function Prototypes @@ -384,7 +380,6 @@ static inline void xipfs_unlock(FAR struct xipfs_mount_s *fs) nxrmutex_unlock(&fs->lock); } -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/libs/libc/grp/lib_grp.h b/libs/libc/grp/lib_grp.h index b70831d2a2b..69da0e15197 100644 --- a/libs/libc/grp/lib_grp.h +++ b/libs/libc/grp/lib_grp.h @@ -54,18 +54,15 @@ ****************************************************************************/ #ifdef __cplusplus -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif #ifdef CONFIG_LIBC_GROUP_FILE /* Data for non-reentrant group functions */ -EXTERN struct group g_group; -EXTERN char g_group_buffer[GRPBUF_RESERVE_SIZE]; +extern struct group g_group; +extern char g_group_buffer[GRPBUF_RESERVE_SIZE]; #endif /**************************************************************************** @@ -89,7 +86,6 @@ int grp_findby_user(FAR const char *user, gid_t group, FAR gid_t *grouplist, int maxgroups, FAR int *count); #endif -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/libs/libc/netdb/lib_dns.h b/libs/libc/netdb/lib_dns.h index 30ae6a742a3..67de11e9416 100644 --- a/libs/libc/netdb/lib_dns.h +++ b/libs/libc/netdb/lib_dns.h @@ -94,20 +94,16 @@ union dns_addr_u * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif #ifndef CONFIG_NETDB_RESOLVCONF /* The DNS server addresses */ -EXTERN union dns_addr_u g_dns_servers[]; -EXTERN uint8_t g_dns_nservers; +extern union dns_addr_u g_dns_servers[]; +extern uint8_t g_dns_nservers; #endif /**************************************************************************** @@ -286,7 +282,6 @@ int dns_find_answer(FAR const char *hostname, FAR union dns_addr_u *addr, void dns_notify_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/libs/libc/netdb/lib_netdb.h b/libs/libc/netdb/lib_netdb.h index 815e8035059..48da805da7f 100644 --- a/libs/libc/netdb/lib_netdb.h +++ b/libs/libc/netdb/lib_netdb.h @@ -100,16 +100,13 @@ struct services_db_s ****************************************************************************/ #ifdef __cplusplus -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif -EXTERN struct hostent g_hostent; -EXTERN char g_hostbuffer[CONFIG_NETDB_BUFSIZE]; -EXTERN const struct services_db_s g_services_db[]; +extern struct hostent g_hostent; +extern char g_hostbuffer[CONFIG_NETDB_BUFSIZE]; +extern const struct services_db_s g_services_db[]; /**************************************************************************** * Public Function Prototypes @@ -125,7 +122,6 @@ int gethostentbyname_r(FAR const char *name, FAR struct hostent_s *host, FAR char *buf, size_t buflen, FAR int *h_errnop, int flags); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/libs/libc/pwd/lib_pwd.h b/libs/libc/pwd/lib_pwd.h index f7f50077a7a..4681dd2d0e9 100644 --- a/libs/libc/pwd/lib_pwd.h +++ b/libs/libc/pwd/lib_pwd.h @@ -54,19 +54,16 @@ ****************************************************************************/ #ifdef __cplusplus -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* Data for non-reentrant group functions */ -EXTERN int g_passwd_index; -EXTERN struct passwd g_passwd; -EXTERN struct spwd g_spwd; -EXTERN char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE]; +extern int g_passwd_index; +extern struct passwd g_passwd; +extern struct spwd g_spwd; +extern char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE]; /**************************************************************************** * Public Function Prototypes @@ -90,7 +87,6 @@ int pwd_findby_index(int index, FAR struct passwd *entry, FAR char *buffer, size_t buflen); #endif -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/libs/libc/syslog/syslog.h b/libs/libc/syslog/syslog.h index c13c87b6eed..038c8754eef 100644 --- a/libs/libc/syslog/syslog.h +++ b/libs/libc/syslog/syslog.h @@ -33,24 +33,19 @@ * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* The currently enabled set of syslog priorities */ -EXTERN uint8_t g_syslog_mask; +extern uint8_t g_syslog_mask; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/libs/libnx/nxfonts/nxfonts.h b/libs/libnx/nxfonts/nxfonts.h index 52aa2c0be9b..26a534de879 100644 --- a/libs/libnx/nxfonts/nxfonts.h +++ b/libs/libnx/nxfonts/nxfonts.h @@ -45,26 +45,21 @@ * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif -EXTERN struct nx_fontset_s g_7bitfonts; +extern struct nx_fontset_s g_7bitfonts; #if CONFIG_NXFONTS_CHARBITS >= 8 -EXTERN struct nx_fontset_s g_8bitfonts; +extern struct nx_fontset_s g_8bitfonts; #endif -EXTERN struct nx_font_s g_fonts; +extern struct nx_font_s g_fonts; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/libs/libnx/nxtk/nxtk.h b/libs/libnx/nxtk/nxtk.h index 58052932ac4..fa3bb818a37 100644 --- a/libs/libnx/nxtk/nxtk.h +++ b/libs/libnx/nxtk/nxtk.h @@ -69,24 +69,20 @@ struct nxtk_framedwindow_s * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* That is the callback for the framed window */ -EXTERN FAR const struct nx_callback_s g_nxtkcb; +extern FAR const struct nx_callback_s g_nxtkcb; /* Frame border colors */ -EXTERN nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES]; -EXTERN nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES]; -EXTERN nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES]; +extern nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES]; +extern nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES]; +extern nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES]; /**************************************************************************** * Public Function Prototypes @@ -206,7 +202,6 @@ void nxtk_subwindowmove(FAR struct nxtk_framedwindow_s *fwnd, int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd, FAR const struct nxgl_rect_s *bounds); -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/net/bluetooth/bluetooth.h b/net/bluetooth/bluetooth.h index 1494b5b80d6..a83945103be 100644 --- a/net/bluetooth/bluetooth.h +++ b/net/bluetooth/bluetooth.h @@ -109,16 +109,13 @@ struct bluetooth_conn_s ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* The Bluetooth socket interface */ -EXTERN const struct sock_intf_s g_bluetooth_sockif; +extern const struct sock_intf_s g_bluetooth_sockif; /* The Bluetooth connections rmutex */ @@ -459,7 +456,6 @@ FAR struct bluetooth_container_s *bluetooth_container_allocate(void); void bluetooth_container_free(FAR struct bluetooth_container_s *container); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/can/can.h b/net/can/can.h index c81f8eef0b0..c26936f2b55 100644 --- a/net/can/can.h +++ b/net/can/can.h @@ -140,14 +140,11 @@ struct can_conn_s ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif -EXTERN const struct sock_intf_s g_can_sockif; +extern const struct sock_intf_s g_can_sockif; /**************************************************************************** * Public Function Prototypes @@ -464,7 +461,6 @@ int can_getsockopt(FAR struct socket *psock, int level, int option, FAR void *value, FAR socklen_t *value_len); #endif -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/icmp/icmp.h b/net/icmp/icmp.h index aa02093629f..f6692dbe67e 100644 --- a/net/icmp/icmp.h +++ b/net/icmp/icmp.h @@ -125,17 +125,14 @@ struct icmp_pmtu_entry ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif #ifdef CONFIG_NET_ICMP_SOCKET /* PF_INET socket address family, IPPROTO_ICMP protocol interface */ -EXTERN const struct sock_intf_s g_icmp_sockif; +extern const struct sock_intf_s g_icmp_sockif; #endif /**************************************************************************** @@ -464,7 +461,6 @@ FAR struct icmp_pmtu_entry *icmpv4_find_pmtu_entry(in_addr_t destipaddr); void icmpv4_add_pmtu_entry(in_addr_t destipaddr, int mtu); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/icmpv6/icmpv6.h b/net/icmpv6/icmpv6.h index aa1914831e9..d99961396ef 100644 --- a/net/icmpv6/icmpv6.h +++ b/net/icmpv6/icmpv6.h @@ -150,17 +150,14 @@ struct icmpv6_pmtu_entry ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif #ifdef CONFIG_NET_ICMPv6_SOCKET /* PF_INET6 socket address family, IPPROTO_ICMP6 protocol interface */ -EXTERN const struct sock_intf_s g_icmpv6_sockif; +extern const struct sock_intf_s g_icmpv6_sockif; #endif /**************************************************************************** @@ -838,7 +835,6 @@ icmpv6_find_pmtu_entry(net_ipv6addr_t destipaddr); void icmpv6_add_pmtu_entry(net_ipv6addr_t destipaddr, int mtu); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h index bbb648354a4..ae3b1c74bfc 100644 --- a/net/ieee802154/ieee802154.h +++ b/net/ieee802154/ieee802154.h @@ -123,16 +123,13 @@ struct ieee802154_conn_s ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* The IEEE 802.15.4 socket interface */ -EXTERN const struct sock_intf_s g_ieee802154_sockif; +extern const struct sock_intf_s g_ieee802154_sockif; /* The IEEE 802.15.4 connections rmutex */ @@ -473,7 +470,6 @@ FAR struct ieee802154_container_s *ieee802154_container_allocate(void); void ieee802154_container_free(FAR struct ieee802154_container_s *container); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/igmp/igmp.h b/net/igmp/igmp.h index c5784ccd733..da52b29dbd5 100644 --- a/net/igmp/igmp.h +++ b/net/igmp/igmp.h @@ -127,15 +127,12 @@ struct igmp_group_s ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif -EXTERN const in_addr_t g_ipv4_allsystems; -EXTERN const in_addr_t g_ipv4_allrouters; +extern const in_addr_t g_ipv4_allsystems; +extern const in_addr_t g_ipv4_allrouters; /**************************************************************************** * Public Function Prototypes @@ -375,7 +372,6 @@ void igmp_addmcastmac(FAR struct net_driver_s *dev, FAR const in_addr_t *ip); void igmp_removemcastmac(FAR struct net_driver_s *dev, FAR const in_addr_t *ip); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/inet/inet.h b/net/inet/inet.h index 173983f25e7..6e9adb608a4 100644 --- a/net/inet/inet.h +++ b/net/inet/inet.h @@ -38,32 +38,28 @@ * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* Well-known IPv6 addresses */ #ifdef CONFIG_NET_IPv6 -EXTERN const net_ipv6addr_t g_ipv6_unspecaddr; /* An address of all zeroes */ -EXTERN const net_ipv6addr_t g_ipv6_loopback; /* An address of loopback */ -EXTERN const net_ipv6addr_t g_ipv6_allnodes; /* All link local nodes */ +extern const net_ipv6addr_t g_ipv6_unspecaddr; /* An address of all zeroes */ +extern const net_ipv6addr_t g_ipv6_loopback; /* An address of loopback */ +extern const net_ipv6addr_t g_ipv6_allnodes; /* All link local nodes */ #if defined(CONFIG_NET_ICMPv6_AUTOCONF) || defined(CONFIG_NET_ICMPv6_ROUTER) || \ defined(CONFIG_NET_MLD) /* IPv6 Multi-cast IP addresses. See RFC 2375 */ -EXTERN const net_ipv6addr_t g_ipv6_allrouters; /* All link local routers */ +extern const net_ipv6addr_t g_ipv6_allrouters; /* All link local routers */ #ifdef CONFIG_NET_ICMPv6_AUTOCONF -EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link address */ +extern const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link address */ #endif #ifdef CONFIG_NET_MLD -EXTERN const net_ipv6addr_t g_ipv6_allmldv2routers; /* All MLDv2 link local routers */ +extern const net_ipv6addr_t g_ipv6_allmldv2routers; /* All MLDv2 link local routers */ #endif #ifdef CONFIG_NET_ETHERNET /* IPv6 Multi-cast Ethernet addresses. Formed from the 16-bit prefix: @@ -73,8 +69,8 @@ EXTERN const net_ipv6addr_t g_ipv6_allmldv2routers; /* All MLDv2 link local rou * and the last 32-bits of the IPv6 IP address */ -EXTERN const struct ether_addr g_ipv6_ethallnodes; /* All link local nodes */ -EXTERN const struct ether_addr g_ipv6_ethallrouters; /* All link local routers */ +extern const struct ether_addr g_ipv6_ethallnodes; /* All link local nodes */ +extern const struct ether_addr g_ipv6_ethallrouters; /* All link local routers */ #endif /* CONFIG_NET_ETHERNET */ #endif /* CONFIG_NET_ICMPv6_AUTOCONF || CONFIG_NET_ICMPv6_ROUTER || CONFIG_NET_MLD */ @@ -324,7 +320,6 @@ uint16_t ipv6_build_header(FAR struct ipv6_hdr_s *ipv6, uint16_t payload_len, uint8_t tclass); #endif -#undef EXTERN #if defined(__cplusplus) } #endif diff --git a/net/local/local.h b/net/local/local.h index a74ec8dde4f..38cc04e2e99 100644 --- a/net/local/local.h +++ b/net/local/local.h @@ -185,16 +185,13 @@ struct local_conn_s ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* The local socket interface */ -EXTERN const struct sock_intf_s g_local_sockif; +extern const struct sock_intf_s g_local_sockif; /* Global protection lock for local socket */ @@ -781,7 +778,6 @@ int local_set_pollthreshold(FAR struct local_conn_s *conn, int local_set_nonblocking(FAR struct local_conn_s *conn); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/netdev/netdev.h b/net/netdev/netdev.h index b5c24b0e770..7ace42f8e2e 100644 --- a/net/netdev/netdev.h +++ b/net/netdev/netdev.h @@ -43,13 +43,9 @@ * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* List of registered Ethernet device drivers. You must have the network @@ -58,7 +54,7 @@ extern "C" * NOTE that this duplicates a declaration in net/tcp/tcp.h */ -EXTERN struct net_driver_s *g_netdevices; +extern struct net_driver_s *g_netdevices; #ifdef CONFIG_NETDEV_IFINDEX /* The set of network devices that have been registered. This is used to @@ -68,7 +64,7 @@ EXTERN struct net_driver_s *g_netdevices; * devices to 32 (MAX_IFINDEX). */ -EXTERN uint32_t g_devset; +extern uint32_t g_devset; /* The set of network devices that have been freed. The purpose of this * set is to postpone reuse of a interface index for as long as possible, @@ -76,7 +72,7 @@ EXTERN uint32_t g_devset; * have been used. */ -EXTERN uint32_t g_devfreed; +extern uint32_t g_devfreed; #endif /**************************************************************************** @@ -617,7 +613,6 @@ void netdev_list_lock(void); void netdev_list_unlock(void); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/netlink/netlink.h b/net/netlink/netlink.h index c036624280d..68a68ad1e66 100644 --- a/net/netlink/netlink.h +++ b/net/netlink/netlink.h @@ -291,14 +291,11 @@ struct nla_policy ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif -EXTERN const struct sock_intf_s g_netlink_sockif; +extern const struct sock_intf_s g_netlink_sockif; /**************************************************************************** * Name: netlink_alloc() @@ -651,7 +648,6 @@ void netlink_lock(void); void netlink_unlock(void); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/pkt/pkt.h b/net/pkt/pkt.h index f5e35cd8355..527edb06dd5 100644 --- a/net/pkt/pkt.h +++ b/net/pkt/pkt.h @@ -122,16 +122,13 @@ struct pkt_conn_s ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif /* The packet socket interface */ -EXTERN const struct sock_intf_s g_pkt_sockif; +extern const struct sock_intf_s g_pkt_sockif; /**************************************************************************** * Public Function Prototypes @@ -467,7 +464,6 @@ int pkt_setsockopt(FAR struct socket *psock, int level, int option, #endif -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/rpmsg/rpmsg.h b/net/rpmsg/rpmsg.h index 21e74af7ba8..37fa858778b 100644 --- a/net/rpmsg/rpmsg.h +++ b/net/rpmsg/rpmsg.h @@ -37,16 +37,12 @@ ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif -EXTERN const struct sock_intf_s g_rpmsg_sockif; +extern const struct sock_intf_s g_rpmsg_sockif; -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/net/usrsock/usrsock.h b/net/usrsock/usrsock.h index 10fa612ec3d..37d2c29c36d 100644 --- a/net/usrsock/usrsock.h +++ b/net/usrsock/usrsock.h @@ -134,14 +134,11 @@ struct usrsock_data_reqstate_s ****************************************************************************/ #ifdef __cplusplus -# define EXTERN extern "C" extern "C" { -#else -# define EXTERN extern #endif -EXTERN const struct sock_intf_s g_usrsock_sockif; +extern const struct sock_intf_s g_usrsock_sockif; /**************************************************************************** * Public Function Prototypes @@ -670,7 +667,6 @@ int usrsock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg); int usrsock_shutdown(FAR struct socket *psock, int how); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/sched/mqueue/mqueue.h b/sched/mqueue/mqueue.h index 1f18ec6a2a4..78dd8ddf20d 100644 --- a/sched/mqueue/mqueue.h +++ b/sched/mqueue/mqueue.h @@ -85,26 +85,23 @@ struct mqueue_msg_s ****************************************************************************/ #ifdef __cplusplus -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif /* The g_msgfree is a list of messages that are available for general use. * The number of messages in this list is a system configuration item. */ -EXTERN struct list_node g_msgfree; +extern struct list_node g_msgfree; /* The g_msgfreeirq is a list of messages that are reserved for use by * interrupt handlers. */ -EXTERN struct list_node g_msgfreeirq; +extern struct list_node g_msgfreeirq; -EXTERN spinlock_t g_msgfreelock; +extern spinlock_t g_msgfreelock; /**************************************************************************** * Public Function Prototypes @@ -144,7 +141,6 @@ void nxmq_notify_send(FAR struct mqueue_inode_s *msgq); void nxmq_recover(FAR struct tcb_s *tcb); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/sched/mqueue/msg.h b/sched/mqueue/msg.h index 629f5417a52..41124fad318 100644 --- a/sched/mqueue/msg.h +++ b/sched/mqueue/msg.h @@ -72,14 +72,11 @@ struct msgbuf_s ****************************************************************************/ #ifdef __cplusplus -#define EXTERN extern "C" extern "C" { -#else -#define EXTERN extern #endif -EXTERN struct list_node g_msgfreelist; +extern struct list_node g_msgfreelist; /**************************************************************************** * Public Function Prototypes @@ -115,7 +112,6 @@ void nxmsg_free(FAR struct msgq_s *msgq); FAR struct msgq_s *nxmsg_lookup(key_t key); -#undef EXTERN #ifdef __cplusplus } #endif
