Select one of the symbols to view example projects that use it.
 
Outline
#define _PICO_ASSERT_H
#include <stdbool.h>
#include <cassert>
#include <assert.h>
#define PARAM_ASSERTIONS_ENABLE_ALL
#define PARAM_ASSERTIONS_DISABLE_ALL
#define PARAM_ASSERTIONS_ENABLED
#define invalid_params_if
#define valid_params_if
#define hard_assert_if
#define invalid_params_if_and_return
#define hard_assert
Files
loading...
SourceVuRaspberry Pi Pico SDK and ExamplesPicoSDKsrc/common/pico_base_headers/include/pico/assert.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause *//* ... */ #ifndef _PICO_ASSERT_H #define _PICO_ASSERT_H #include <stdbool.h> #ifdef __cplusplus #include <cassert> extern "C" { #else #include <assert.h> #endif // PICO_CONFIG: PARAM_ASSERTIONS_ENABLE_ALL, Global assert enable, type=bool, default=0, group=pico_base // PICO_CONFIG: PARAM_ASSERTIONS_DISABLE_ALL, Global assert disable, type=bool, default=0, group=pico_base #ifndef PARAM_ASSERTIONS_ENABLE_ALL #define PARAM_ASSERTIONS_ENABLE_ALL 0 #endif #ifndef PARAM_ASSERTIONS_DISABLE_ALL #define PARAM_ASSERTIONS_DISABLE_ALL 0 #endif #define PARAM_ASSERTIONS_ENABLED(x) ((PARAM_ASSERTIONS_ENABLED_ ## x || PARAM_ASSERTIONS_ENABLE_ALL) && !PARAM_ASSERTIONS_DISABLE_ALL) #define invalid_params_if(x, test) ({if (PARAM_ASSERTIONS_ENABLED(x)) assert(!(test));}) #define valid_params_if(x, test) ({if (PARAM_ASSERTIONS_ENABLED(x)) assert(test);}) #define hard_assert_if(x, test) ({if (PARAM_ASSERTIONS_ENABLED(x)) hard_assert(!(test));}) #define invalid_params_if_and_return(x, test, rc) ({/*if (PARAM_ASSERTIONS_ENABLED(x)) assert(!(test)); */ if (test) return rc; }) 5 defines #ifdef NDEBUG extern void hard_assertion_failure(void); static inline void hard_assert(bool condition, ...) { if (!condition) hard_assertion_failure(); }hard_assert (bool condition, ...) { ... } /* ... */#else #define hard_assert assert #endif #ifdef __cplusplus }extern "C" { ... } #endif/* ... */ #endif
Details
Show:
from
Types: Columns: