summaryrefslogtreecommitdiff
path: root/src/commonlib/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-12-15 17:49:12 -0600
committerAaron Durbin <adurbin@chromium.org>2016-01-06 01:11:32 +0100
commitca0a67624b6f38b0a6c86171950b5c2c6507f2ce (patch)
tree67f4a17496ab9708bf04d51af47d668e427030a5 /src/commonlib/include
parent295d58bda85ce30724a3fff87d60b323373f6e5f (diff)
commonlib: Prepare code to be included in cbfstool builds.
Some of the files need to be adjusted so that they can be used both in cbfstool as well as coreboot proper. For coreboot, add a <sys/types.h> file such that proper types can be included from both the tools and coreboot. The other chanes are to accomodate stricter checking in cbfstool. BUG=chrome-os-partner:48412 BUG=chromium:445938 BRANCH=None TEST=Built on glados including tools. Booted. Change-Id: I771c6675c64b8837f775427721dd3300a8fa1bc0 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/12784 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/commonlib/include')
-rw-r--r--src/commonlib/include/commonlib/helpers.h6
-rw-r--r--src/commonlib/include/commonlib/region.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/commonlib/include/commonlib/helpers.h b/src/commonlib/include/commonlib/helpers.h
index 0e337c9ce7..646a66f30d 100644
--- a/src/commonlib/include/commonlib/helpers.h
+++ b/src/commonlib/include/commonlib/helpers.h
@@ -2,7 +2,9 @@
#define COMMONLIB_HELPERS_H
/* This file is for helpers for both coreboot firmware and its utilities. */
+#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#endif
#define ALIGN(x,a) __ALIGN_MASK(x,(__typeof__(x))(a)-1UL)
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
@@ -54,4 +56,8 @@
const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
+#ifndef __unused
+#define __unused __attribute__((unused))
+#endif
+
#endif /* COMMONLIB_HELPERS_H */
diff --git a/src/commonlib/include/commonlib/region.h b/src/commonlib/include/commonlib/region.h
index 35d48ade85..a13c66c316 100644
--- a/src/commonlib/include/commonlib/region.h
+++ b/src/commonlib/include/commonlib/region.h
@@ -16,6 +16,7 @@
#ifndef _REGION_H_
#define _REGION_H_
+#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#include <commonlib/mem_pool.h>