summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2018-10-04 23:42:42 +0200
committerNico Huber <nico.h@gmx.de>2018-10-08 16:57:27 +0000
commitd44221f9c8f3686e040ff9481829315068b321a3 (patch)
tree76337bf1cae88feda44e3c63dd7e32e964e8767d /util
parent834543c0c71544b547194b093b8e1da990722762 (diff)
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 'util')
-rw-r--r--util/cbfstool/Makefile.inc3
-rw-r--r--util/cbfstool/cbfs.h1
-rw-r--r--util/cbfstool/compiler.h38
-rw-r--r--util/cbfstool/fit.c1
-rw-r--r--util/cbfstool/flashmap/fmap.h1
-rw-r--r--util/cbfstool/ifwitool.c1
-rw-r--r--util/cbmem/Makefile1
-rw-r--r--util/cbmem/compiler.h33
8 files changed, 3 insertions, 76 deletions
diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc
index 8e4d8b6f4e..1787eb14c0 100644
--- a/util/cbfstool/Makefile.inc
+++ b/util/cbfstool/Makefile.inc
@@ -80,6 +80,7 @@ TOOLCPPFLAGS += -I$(top)/util/cbfstool/flashmap
TOOLCPPFLAGS += -I$(top)/util/cbfstool
TOOLCPPFLAGS += -I$(objutil)/cbfstool
TOOLCPPFLAGS += -I$(top)/src/commonlib/include
+TOOLCPPFLAGS += -include $(top)/src/commonlib/include/commonlib/compiler.h
TOOLCPPFLAGS += -DNEED_VB2_SHA_LIBRARY
TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/include
TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/2lib/include
@@ -131,7 +132,7 @@ $(objutil)/cbfstool/%.o: $(top)/src/commonlib/%.c
$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lz4/lib/%.c
printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
- $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -include $(top)/util/cbfstool/compiler.h -c -o $@ $<
+ $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
$(objutil)/cbfstool/cbfstool: $(addprefix $(objutil)/cbfstool/,$(cbfsobj))
printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index fd2457a573..b082d8c783 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -18,7 +18,6 @@
#include "common.h"
#include <stdint.h>
-#include <compiler.h>
#include <vb2_api.h>
diff --git a/util/cbfstool/compiler.h b/util/cbfstool/compiler.h
deleted file mode 100644
index cf043d5893..0000000000
--- a/util/cbfstool/compiler.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright 2017 Google Inc.
- * Copyright (c) 2017-2018 Eltan B.V.
- *
- * 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 __COMPILER_H__
-#define __COMPILER_H__
-
-#if !defined(__FreeBSD__)
-
-#if !defined(__packed)
-#if defined(__WIN32) || defined(__WIN64)
-#define __packed __attribute__((gcc_struct, packed))
-#else
-#define __packed __attribute__((packed))
-#endif
-#endif
-
-#if !defined(__aligned)
-#define __aligned(x) __attribute__((aligned(x)))
-#endif
-#endif
-
-#define __always_unused __attribute__((unused))
-#define __must_check __attribute__((warn_unused_result))
-
-#endif
diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c
index ad9ab37855..aeb1755032 100644
--- a/util/cbfstool/fit.c
+++ b/util/cbfstool/fit.c
@@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <compiler.h>
#include "fit.h"
diff --git a/util/cbfstool/flashmap/fmap.h b/util/cbfstool/flashmap/fmap.h
index 017d332ef9..6e2091fc4f 100644
--- a/util/cbfstool/flashmap/fmap.h
+++ b/util/cbfstool/flashmap/fmap.h
@@ -37,7 +37,6 @@
#define FLASHMAP_LIB_FMAP_H__
#include <inttypes.h>
-#include <compiler.h>
#include <valstr.h>
#define FMAP_SIGNATURE "__FMAP__"
diff --git a/util/cbfstool/ifwitool.c b/util/cbfstool/ifwitool.c
index c427339a48..1fbb61bfac 100644
--- a/util/cbfstool/ifwitool.c
+++ b/util/cbfstool/ifwitool.c
@@ -17,7 +17,6 @@
#include <getopt.h>
#include <stdlib.h>
#include <time.h>
-#include <compiler.h>
#include "common.h"
diff --git a/util/cbmem/Makefile b/util/cbmem/Makefile
index 694cac7110..9e403a6414 100644
--- a/util/cbmem/Makefile
+++ b/util/cbmem/Makefile
@@ -21,6 +21,7 @@ PREFIX ?= /usr/local
CFLAGS ?= -O2
CFLAGS += -Wall -Werror
CPPFLAGS += -I . -I $(ROOT)/commonlib/include
+CPPFLAGS += -include ../../src/commonlib/include/commonlib/compiler.h
OBJS = $(PROGRAM).o
diff --git a/util/cbmem/compiler.h b/util/cbmem/compiler.h
deleted file mode 100644
index fc6a36b650..0000000000
--- a/util/cbmem/compiler.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 __COMPILER_H__
-#define __COMPILER_H__
-
-#if !defined(__FreeBSD__)
-
-#if defined(__WIN32) || defined(__WIN64)
-#define __packed __attribute__((gcc_struct, packed))
-#else
-#define __packed __attribute__((packed))
-#endif
-
-#define __aligned(x) __attribute__((aligned(x)))
-#endif
-
-#define __always_unused __attribute__((unused))
-#define __must_check __attribute__((warn_unused_result))
-
-#endif