btrfs-progs: move a union with variable sized type to the end
[WARNING] Clang 15.0.7 gives the following warning: image/main.c:95:2: warning: field '' with variable sized type 'union metadump_struct::(anonymous at image/main.c:95:2)' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] union { ^ [CAUSE] The union contains meta_cluster, which variable sized: struct meta_cluster { struct meta_cluster_header header; struct meta_cluster_item items[]; } __attribute__ ((__packed__)); Thus clang gives above warning since it's a GNU extension. [FIX] Just move the union to the end of the structure. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3a1d4aa089
commit
c3a41e5d4c
10
image/main.c
10
image/main.c
|
@ -93,11 +93,6 @@ struct metadump_struct {
|
|||
struct btrfs_root *root;
|
||||
FILE *out;
|
||||
|
||||
union {
|
||||
struct meta_cluster cluster;
|
||||
char meta_cluster_bytes[IMAGE_BLOCK_SIZE];
|
||||
};
|
||||
|
||||
pthread_t threads[MAX_WORKER_THREADS];
|
||||
size_t num_threads;
|
||||
pthread_mutex_t mutex;
|
||||
|
@ -120,6 +115,11 @@ struct metadump_struct {
|
|||
enum sanitize_mode sanitize_names;
|
||||
|
||||
int error;
|
||||
|
||||
union {
|
||||
struct meta_cluster cluster;
|
||||
char meta_cluster_bytes[IMAGE_BLOCK_SIZE];
|
||||
};
|
||||
};
|
||||
|
||||
struct mdrestore_struct {
|
||||
|
|
Loading…
Reference in New Issue