Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef __CASSERT_H__ |
| 8 | #define __CASSERT_H__ |
| 9 | |
| 10 | /******************************************************************************* |
| 11 | * Macro to flag a compile time assertion. It uses the preprocessor to generate |
| 12 | * an invalid C construct if 'cond' evaluates to false. |
| 13 | * The following compilation error is triggered if the assertion fails: |
| 14 | * "error: size of array 'msg' is negative" |
| 15 | ******************************************************************************/ |
| 16 | #define CASSERT(cond, msg) typedef char msg[(cond) ? 1 : -1] |
| 17 | |
| 18 | #endif /* __CASSERT_H__ */ |