From b3669f02c261ed2142a13a2e8169ad5d6d1bb6d9 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 21 Apr 2025 15:46:35 -0500 Subject: [PATCH] Dropped __cplusplus guards littlefs is not a C++ project, and it's important to make sure users are aware of that in case the header file ever breaks C++ (C++ is _not_ compatible with C99). So dropping these guards. C++ users should wrap the relevant includes with extern "C": extern "C" { #include "lfs.h" } --- bd/lfs_emubd.h | 9 --------- bd/lfs_filebd.h | 9 --------- bd/lfs_rambd.h | 9 --------- lfs.h | 9 --------- lfs_util.h | 9 --------- 5 files changed, 45 deletions(-) diff --git a/bd/lfs_emubd.h b/bd/lfs_emubd.h index 893ddaa4..f6e65d9f 100644 --- a/bd/lfs_emubd.h +++ b/bd/lfs_emubd.h @@ -14,11 +14,6 @@ #include "bd/lfs_rambd.h" #include "bd/lfs_filebd.h" -#ifdef __cplusplus -extern "C" -{ -#endif - // Block device specific tracing #ifndef LFS_EMUBD_TRACE @@ -264,8 +259,4 @@ int lfs_emubd_setpowercycles(const struct lfs_config *cfg, int lfs_emubd_cpy(const struct lfs_config *cfg, lfs_emubd_t *copy); -#ifdef __cplusplus -} /* extern "C" */ -#endif - #endif diff --git a/bd/lfs_filebd.h b/bd/lfs_filebd.h index 0f24996a..45b7d9e3 100644 --- a/bd/lfs_filebd.h +++ b/bd/lfs_filebd.h @@ -11,11 +11,6 @@ #include "lfs.h" #include "lfs_util.h" -#ifdef __cplusplus -extern "C" -{ -#endif - // Block device specific tracing #ifndef LFS_FILEBD_TRACE @@ -58,8 +53,4 @@ int lfs_filebd_erase(const struct lfs_config *cfg, lfs_block_t block); int lfs_filebd_sync(const struct lfs_config *cfg); -#ifdef __cplusplus -} /* extern "C" */ -#endif - #endif diff --git a/bd/lfs_rambd.h b/bd/lfs_rambd.h index 34246802..00df64ff 100644 --- a/bd/lfs_rambd.h +++ b/bd/lfs_rambd.h @@ -11,11 +11,6 @@ #include "lfs.h" #include "lfs_util.h" -#ifdef __cplusplus -extern "C" -{ -#endif - // Block device specific tracing #ifndef LFS_RAMBD_TRACE @@ -67,8 +62,4 @@ int lfs_rambd_erase(const struct lfs_config *cfg, lfs_block_t block); int lfs_rambd_sync(const struct lfs_config *cfg); -#ifdef __cplusplus -} /* extern "C" */ -#endif - #endif diff --git a/lfs.h b/lfs.h index 602e8ed1..1291df05 100644 --- a/lfs.h +++ b/lfs.h @@ -10,11 +10,6 @@ #include "lfs_util.h" -#ifdef __cplusplus -extern "C" -{ -#endif - /// Version info /// @@ -1378,8 +1373,4 @@ int lfsr_fs_grow(lfs_t *lfs, lfs_size_t block_count); #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif - #endif diff --git a/lfs_util.h b/lfs_util.h index 622e6c28..76fa55bc 100644 --- a/lfs_util.h +++ b/lfs_util.h @@ -114,11 +114,6 @@ #include #endif -#ifdef __cplusplus -extern "C" -{ -#endif - // Macros, may be replaced by system specific wrappers. Arguments to these // macros must not have side-effects as the macros can be removed for a smaller @@ -776,9 +771,5 @@ static inline void lfs_free(void *p) { #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif - #endif #endif