summaryrefslogtreecommitdiff
path: root/src/commonlib/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonlib/include')
-rw-r--r--src/commonlib/include/commonlib/cbfs_serialized.h1
-rw-r--r--src/commonlib/include/commonlib/compiler.h51
-rw-r--r--src/commonlib/include/commonlib/fmap_serialized.h1
-rw-r--r--src/commonlib/include/commonlib/rmodule-defs.h1
-rw-r--r--src/commonlib/include/commonlib/tcpa_log_serialized.h1
-rw-r--r--src/commonlib/include/commonlib/timestamp_serialized.h1
6 files changed, 51 insertions, 5 deletions
diff --git a/src/commonlib/include/commonlib/cbfs_serialized.h b/src/commonlib/include/commonlib/cbfs_serialized.h
index e8f027fad3..6e254f6bbe 100644
--- a/src/commonlib/include/commonlib/cbfs_serialized.h
+++ b/src/commonlib/include/commonlib/cbfs_serialized.h
@@ -48,7 +48,6 @@
#define _CBFS_SERIALIZED_H_
#include <stdint.h>
-#include <compiler.h>
/** These are standard values for the known compression
algorithms that coreboot knows about for stages and
diff --git a/src/commonlib/include/commonlib/compiler.h b/src/commonlib/include/commonlib/compiler.h
new file mode 100644
index 0000000000..2e0c454fc9
--- /dev/null
+++ b/src/commonlib/include/commonlib/compiler.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _COMMONLIB_COMPILER_H_
+#define _COMMONLIB_COMPILER_H_
+
+#ifndef __packed
+#if defined(__WIN32) || defined(__WIN64)
+#define __packed __attribute__((gcc_struct, packed))
+#else
+#define __packed __attribute__((packed))
+#endif
+#endif
+
+#ifndef __aligned
+#define __aligned(x) __attribute__((aligned(x)))
+#endif
+
+#ifndef __always_unused
+#define __always_unused __attribute__((unused))
+#endif
+
+#ifndef __must_check
+#define __must_check __attribute__((warn_unused_result))
+#endif
+
+#ifndef __weak
+#define __weak __attribute__((weak))
+#endif
+
+#ifndef __noreturn
+#define __noreturn __attribute__((noreturn))
+#endif
+
+#ifndef __always_inline
+#define __always_inline inline __attribute__((always_inline))
+#endif
+
+#endif
diff --git a/src/commonlib/include/commonlib/fmap_serialized.h b/src/commonlib/include/commonlib/fmap_serialized.h
index cea231b2c2..1e83760442 100644
--- a/src/commonlib/include/commonlib/fmap_serialized.h
+++ b/src/commonlib/include/commonlib/fmap_serialized.h
@@ -37,7 +37,6 @@
#define FLASHMAP_SERIALIZED_H__
#include <stdint.h>
-#include <compiler.h>
#define FMAP_SIGNATURE "__FMAP__"
#define FMAP_VER_MAJOR 1 /* this header's FMAP minor version */
diff --git a/src/commonlib/include/commonlib/rmodule-defs.h b/src/commonlib/include/commonlib/rmodule-defs.h
index 485d6383bf..564fcd26af 100644
--- a/src/commonlib/include/commonlib/rmodule-defs.h
+++ b/src/commonlib/include/commonlib/rmodule-defs.h
@@ -17,7 +17,6 @@
#include <stdint.h>
#include <stddef.h>
-#include <compiler.h>
#define RMODULE_MAGIC 0xf8fe
#define RMODULE_VERSION_1 1
diff --git a/src/commonlib/include/commonlib/tcpa_log_serialized.h b/src/commonlib/include/commonlib/tcpa_log_serialized.h
index 6dfb566fdc..1e9ffaab87 100644
--- a/src/commonlib/include/commonlib/tcpa_log_serialized.h
+++ b/src/commonlib/include/commonlib/tcpa_log_serialized.h
@@ -16,7 +16,6 @@
#ifndef __TCPA_LOG_SERIALIZED_H__
#define __TCPA_LOG_SERIALIZED_H__
-#include <compiler.h>
#include <stdint.h>
#define MAX_TCPA_LOG_ENTRIES 50
diff --git a/src/commonlib/include/commonlib/timestamp_serialized.h b/src/commonlib/include/commonlib/timestamp_serialized.h
index 304e43fab9..cbf07b5aac 100644
--- a/src/commonlib/include/commonlib/timestamp_serialized.h
+++ b/src/commonlib/include/commonlib/timestamp_serialized.h
@@ -17,7 +17,6 @@
#define __TIMESTAMP_SERIALIZED_H__
#include <stdint.h>
-#include <compiler.h>
struct timestamp_entry {
uint32_t entry_id;