From 3642dd3d0eb30eae5771e00690c3afe842334ae5 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 26 May 2017 09:23:55 +1000 Subject: [PATCH] Check that __WORDSIZE is at least 32 bits. --- cmd/puffs-gen-c/data.go | 2 +- cmd/puffs-gen-c/preamble.h | 4 ++++ gen/c/gif.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/puffs-gen-c/data.go b/cmd/puffs-gen-c/data.go index 0abce79b..7fd3133c 100644 --- a/cmd/puffs-gen-c/data.go +++ b/cmd/puffs-gen-c/data.go @@ -6,5 +6,5 @@ package main const preamble = "" + - "// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#include \n" + + "// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#include \n\n#if __WORDSIZE < 32\n#error \"Puffs requires a word size of at least 32 bits\"\n#endif\n" + "" diff --git a/cmd/puffs-gen-c/preamble.h b/cmd/puffs-gen-c/preamble.h index ebcc7e23..eae69c87 100644 --- a/cmd/puffs-gen-c/preamble.h +++ b/cmd/puffs-gen-c/preamble.h @@ -4,3 +4,7 @@ // in the LICENSE file. #include + +#if __WORDSIZE < 32 +#error "Puffs requires a word size of at least 32 bits" +#endif diff --git a/gen/c/gif.c b/gen/c/gif.c index 397da97c..7e827606 100644 --- a/gen/c/gif.c +++ b/gen/c/gif.c @@ -5,6 +5,10 @@ #include +#if __WORDSIZE < 32 +#error "Puffs requires a word size of at least 32 bits" +#endif + #ifdef __cplusplus extern "C" { #endif