aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/mkimg/vhd.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2014-07-23 18:05:39 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2014-07-23 18:05:39 +0000
commit7ea7f92899c5e5ef86386c7c86042134a28ec08b (patch)
treef65b5607f5200b1624db08995b6b86f62da275c7 /usr.bin/mkimg/vhd.c
parent6a1cf96b4a2dee29cf66887652e81ea2addc7821 (diff)
downloadsrc-7ea7f92899c5e5ef86386c7c86042134a28ec08b.tar.gz
src-7ea7f92899c5e5ef86386c7c86042134a28ec08b.zip
Fix builds on older FreeBSD versions and/or non-FreeBSD machines:
don't use _Static_assert unconditionally.
Notes
Notes: svn path=/head/; revision=269021
Diffstat (limited to 'usr.bin/mkimg/vhd.c')
-rw-r--r--usr.bin/mkimg/vhd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/mkimg/vhd.c b/usr.bin/mkimg/vhd.c
index 04d45308b073..af3d95eaccd7 100644
--- a/usr.bin/mkimg/vhd.c
+++ b/usr.bin/mkimg/vhd.c
@@ -40,6 +40,10 @@ __FBSDID("$FreeBSD$");
#include "format.h"
#include "mkimg.h"
+#ifndef __has_extension
+#define __has_extension(x) 0
+#endif
+
/*
* General notes:
* o File is in network byte order.
@@ -88,8 +92,10 @@ struct vhd_footer {
uint8_t saved_state;
uint8_t _reserved[427];
};
+#if __has_extension(c_static_assert)
_Static_assert(sizeof(struct vhd_footer) == VHD_SECTOR_SIZE,
"Wrong size for footer");
+#endif
static uint32_t
vhd_checksum(void *buf, size_t sz)
@@ -250,8 +256,10 @@ struct vhd_dyn_header {
} parent_locator[8];
char _reserved2[256];
};
+#if __has_extension(c_static_assert)
_Static_assert(sizeof(struct vhd_dyn_header) == VHD_SECTOR_SIZE * 2,
"Wrong size for header");
+#endif
static int
vhd_dyn_write(int fd)