Merge pull request #164 from yinqiwu/master

Redefine __attribute__, solve the problem of compilation in IAR envir…
This commit is contained in:
Peter Andersson
2017-09-08 14:45:29 +02:00
committed by GitHub
+19 -3
View File
@@ -141,6 +141,22 @@
#define SPIFFS_OBJ_ID_DELETED ((spiffs_obj_id)0)
#define SPIFFS_OBJ_ID_FREE ((spiffs_obj_id)-1)
#if defined(__GNUC__) || defined(__clang__)
/* For GCC and clang */
#define SPIFFS_PACKED __attribute__((packed))
#elif defined(__ICCARM__) || defined(__CC_ARM)
/* For IAR ARM and Keil MDK-ARM compilers */
#define SPIFFS_PACKED
#else
/* Unknown compiler */
#define SPIFFS_PACKED
#endif
#if SPIFFS_USE_MAGIC
#if !SPIFFS_USE_MAGIC_LENGTH
#define SPIFFS_MAGIC(fs, bix) \
@@ -464,7 +480,7 @@ typedef struct {
// page header, part of each page except object lookup pages
// NB: this is always aligned when the data page is an object index,
// as in this case struct spiffs_page_object_ix is used
typedef struct __attribute(( packed )) {
typedef struct SPIFFS_PACKED {
// object id
spiffs_obj_id obj_id;
// object span index
@@ -474,7 +490,7 @@ typedef struct __attribute(( packed )) {
} spiffs_page_header;
// object index header page header
typedef struct __attribute(( packed ))
typedef struct SPIFFS_PACKED
#if SPIFFS_ALIGNED_OBJECT_INDEX_TABLES
__attribute(( aligned(sizeof(spiffs_page_ix)) ))
#endif
@@ -496,7 +512,7 @@ typedef struct __attribute(( packed ))
} spiffs_page_object_ix_header;
// object index page header
typedef struct __attribute(( packed )) {
typedef struct SPIFFS_PACKED {
spiffs_page_header p_hdr;
u8_t _align[4 - ((sizeof(spiffs_page_header)&3)==0 ? 4 : (sizeof(spiffs_page_header)&3))];
} spiffs_page_object_ix;