diff options
author | Nico Huber <nico.h@gmx.de> | 2018-10-04 23:42:42 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2018-10-08 16:57:27 +0000 |
commit | d44221f9c8f3686e040ff9481829315068b321a3 (patch) | |
tree | 76337bf1cae88feda44e3c63dd7e32e964e8767d /src/commonlib/include | |
parent | 834543c0c71544b547194b093b8e1da990722762 (diff) | |
download | coreboot-d44221f9c8f3686e040ff9481829315068b321a3.tar.xz |
Move compiler.h to commonlib
Its spreading copies got out of sync. And as it is not a standard header
but used in commonlib code, it belongs into commonlib. While we are at
it, always include it via GCC's `-include` switch.
Some Windows and BSD quirk handling went into the util copies. We always
guard from redefinitions now to prevent further issues.
Change-Id: I850414e6db1d799dce71ff2dc044e6a000ad2552
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/28927
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/commonlib/include')
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; |