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>
This commit is contained in:
Nico Huber
2018-10-04 23:42:42 +02:00
parent 834543c0c7
commit d44221f9c8
342 changed files with 33 additions and 454 deletions

View File

@@ -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"

View File

@@ -18,7 +18,6 @@
#include "common.h"
#include <stdint.h>
#include <compiler.h>
#include <vb2_api.h>

View File

@@ -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

View File

@@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <compiler.h>
#include "fit.h"

View File

@@ -37,7 +37,6 @@
#define FLASHMAP_LIB_FMAP_H__
#include <inttypes.h>
#include <compiler.h>
#include <valstr.h>
#define FMAP_SIGNATURE "__FMAP__"

View File

@@ -17,7 +17,6 @@
#include <getopt.h>
#include <stdlib.h>
#include <time.h>
#include <compiler.h>
#include "common.h"