From bdbfc3c298b4cdc36412d6abd55a4fe79e643b44 Mon Sep 17 00:00:00 2001 From: Dan Handley Date: Thu, 17 Apr 2014 17:29:58 +0100 Subject: [PATCH] Separate out CASSERT macro into own header Separate out the CASSERT macro out of bl_common.h into its own header to allow more efficient header inclusion. Change-Id: I291be0b6b8f9879645e839a8f0dd1ec9b3db9639 --- include/bl31/context.h | 2 +- include/bl31/runtime_svc.h | 2 +- include/bl32/payloads/tsp.h | 2 +- include/common/bl_common.h | 8 ------ include/lib/cassert.h | 42 ++++++++++++++++++++++++++++++++ services/spd/tspd/tspd_private.h | 1 + 6 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 include/lib/cassert.h diff --git a/include/bl31/context.h b/include/bl31/context.h index cb4cd8e2..b0c98102 100644 --- a/include/bl31/context.h +++ b/include/bl31/context.h @@ -31,8 +31,8 @@ #ifndef __CONTEXT_H__ #define __CONTEXT_H__ -#include #include +#include /******************************************************************************* * Constants that allow assembler code to access members of and the 'gp_regs' diff --git a/include/bl31/runtime_svc.h b/include/bl31/runtime_svc.h index 148c0bc8..ab2137df 100644 --- a/include/bl31/runtime_svc.h +++ b/include/bl31/runtime_svc.h @@ -31,7 +31,7 @@ #ifndef __RUNTIME_SVC_H__ #define __RUNTIME_SVC_H__ #include -#include +#include /******************************************************************************* * Bit definitions inside the function id as per the SMC calling convention diff --git a/include/bl32/payloads/tsp.h b/include/bl32/payloads/tsp.h index 9d747d72..68a65b27 100644 --- a/include/bl32/payloads/tsp.h +++ b/include/bl32/payloads/tsp.h @@ -31,8 +31,8 @@ #ifndef __TSP_H__ #define __TSP_H__ -#include #include +#include /* * SMC function IDs that TSP uses to signal various forms of completions diff --git a/include/common/bl_common.h b/include/common/bl_common.h index a751d78a..527f6472 100644 --- a/include/common/bl_common.h +++ b/include/common/bl_common.h @@ -48,14 +48,6 @@ #define BOT_LOAD !TOP_LOAD #define LOAD_MASK (1 << 0) -/******************************************************************************* - * Macro to flag a compile time assertion. It uses the preprocessor to generate - * an invalid C construct if 'cond' evaluates to false. - * The following compilation error is triggered if the assertion fails: - * "error: size of array 'msg' is negative" - ******************************************************************************/ -#define CASSERT(cond, msg) typedef char msg[(cond) ? 1 : -1] - /****************************************************************************** * Opcode passed in x0 to tell next EL that we want to run an image. * Corresponds to the function ID of the only SMC that the BL1 exception diff --git a/include/lib/cassert.h b/include/lib/cassert.h new file mode 100644 index 00000000..0e5529dd --- /dev/null +++ b/include/lib/cassert.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of ARM nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __CASSERT_H__ +#define __CASSERT_H__ + +/******************************************************************************* + * Macro to flag a compile time assertion. It uses the preprocessor to generate + * an invalid C construct if 'cond' evaluates to false. + * The following compilation error is triggered if the assertion fails: + * "error: size of array 'msg' is negative" + ******************************************************************************/ +#define CASSERT(cond, msg) typedef char msg[(cond) ? 1 : -1] + +#endif /* __CASSERT_H__ */ diff --git a/services/spd/tspd/tspd_private.h b/services/spd/tspd/tspd_private.h index 69cf1996..9eff9ec4 100644 --- a/services/spd/tspd/tspd_private.h +++ b/services/spd/tspd/tspd_private.h @@ -35,6 +35,7 @@ #include #include #include +#include /******************************************************************************* * Secure Payload PM state information e.g. SP is suspended, uninitialised etc -- 2.30.2