diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2020-08-28 19:15:01 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2020-09-01 17:57:50 +0200 |
commit | fd96f1014b11d073d775ea4777f3b3ba2eb93520 (patch) | |
tree | 264f612690b669290b79d04b8b03819b3fc07d64 /libdm | |
parent | cc2218b4014015bd2633454e683293851183e08c (diff) | |
download | lvm2-fd96f1014b11d073d775ea4777f3b3ba2eb93520.tar.gz |
gcc: zero-sized array to fexlible array C99
Switch remaining zero sized struct to flexible arrays to be C99
complient.
These simple rules should apply:
- The incomplete array type must be the last element within the structure.
- There cannot be an array of structures that contain a flexible array member.
- Structures that contain a flexible array member cannot be used as a member of another structure.
- The structure must contain at least one named member in addition to the flexible array member.
Although some of the code pieces should be still improved.
Diffstat (limited to 'libdm')
-rw-r--r-- | libdm/datastruct/hash.c | 2 | ||||
-rw-r--r-- | libdm/libdevmapper.h | 6 | ||||
-rw-r--r-- | libdm/libdm-stats.c | 2 | ||||
-rw-r--r-- | libdm/misc/dm-ioctl.h | 8 |
4 files changed, 9 insertions, 9 deletions
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c index 4c940039a..726347ea2 100644 --- a/libdm/datastruct/hash.c +++ b/libdm/datastruct/hash.c @@ -20,7 +20,7 @@ struct dm_hash_node { void *data; unsigned data_len; unsigned keylen; - char key[0]; + char key[]; }; struct dm_hash_table { diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index e9b140563..059b96f0b 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -165,20 +165,20 @@ struct dm_info { struct dm_deps { uint32_t count; uint32_t filler; - uint64_t device[0]; + uint64_t device[]; }; struct dm_names { uint64_t dev; uint32_t next; /* Offset to next struct from start of this struct */ - char name[0]; + char name[]; }; struct dm_versions { uint32_t next; /* Offset to next struct from start of this struct */ uint32_t version[3]; - char name[0]; + char name[]; }; int dm_get_library_version(char *version, size_t size); diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index 5379bed5e..f8d79d807 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -65,7 +65,7 @@ struct dm_histogram { const struct dm_stats_region *region; uint64_t sum; /* Sum of histogram bin counts. */ int nr_bins; /* Number of histogram bins assigned. */ - struct dm_histogram_bin bins[0]; + struct dm_histogram_bin bins[]; }; /* diff --git a/libdm/misc/dm-ioctl.h b/libdm/misc/dm-ioctl.h index 52a7a93d1..55dee2148 100644 --- a/libdm/misc/dm-ioctl.h +++ b/libdm/misc/dm-ioctl.h @@ -183,7 +183,7 @@ struct dm_target_spec { struct dm_target_deps { uint32_t count; /* Array size */ uint32_t padding; /* unused */ - uint64_t dev[0]; /* out */ + uint64_t dev[]; /* out */ }; /* @@ -193,7 +193,7 @@ struct dm_name_list { uint64_t dev; uint32_t next; /* offset to the next record from the _start_ of this */ - char name[0]; + char name[]; }; /* @@ -203,7 +203,7 @@ struct dm_target_versions { uint32_t next; uint32_t version[3]; - char name[0]; + char name[]; }; /* @@ -212,7 +212,7 @@ struct dm_target_versions { struct dm_target_msg { uint64_t sector; /* Device sector */ - char message[0]; + char message[]; }; /* |