summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-07-15 01:03:35 +0200
committerLudovic Courtès <ludo@gnu.org>2009-07-15 01:03:35 +0200
commit07f99e1c6a74017f41bdc1355cf8645392f433c6 (patch)
tree270a08709618bbc7573149ff6173159a4303b1e1
parent99c7d3caf622b8ed355562359b445396dee1532c (diff)
downloadguile-07f99e1c6a74017f41bdc1355cf8645392f433c6.tar.gz
Make sure at compile-time that `OBJCODE_COOKIE' has the right size.
* libguile/objcodes.c: Use `verify' to assert that the size of `OBJCODE_COOKIE' is a multiple of 8.
-rw-r--r--libguile/objcodes.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index d5d66952c..c758e939b 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -28,6 +28,8 @@
#include <sys/types.h>
#include <assert.h>
+#include <verify.h>
+
#include "_scm.h"
#include "vm-bootstrap.h"
#include "programs.h"
@@ -46,10 +48,14 @@
/* The word size marker in objcode. */
#define OBJCODE_WORD_SIZE OBJCODE_STRINGIFY (SIZEOF_VOID_P)
-/* nb, the length of the header should be a multiple of 8 bytes */
+/* The objcode magic header. */
#define OBJCODE_COOKIE \
"GOOF-0.6-" OBJCODE_ENDIANNESS "-" OBJCODE_WORD_SIZE "---"
+/* The length of the header must be a multiple of 8 bytes. */
+verify ((sizeof (OBJCODE_COOKIE) & 7) != 0);
+
+
/*
* Objcode type