• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 1999-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 #ifndef WC_ASSERT_H
19 #define WC_ASSERT_H
20 
21 
22 #ifdef _DEBUG
23 
24 #include "bt_target.h"
25 
26 
27 
28 /* debug settings*/
29 #ifndef WC_DEBUG_LEVEL
30 #define WC_DEBUG_LEVEL 0
31 #endif
32 
33 #if WC_DEBUG_LEVEL == 0
34 
35 #include "stdio.h"  /* for printf()*/
36 
37 #ifdef __cplusplus
38 extern "C" wc_assert(char *message, char *file, UINT32 line);
39 #else
40 void wc_assert(char *message, char *file, UINT32 line);
41 #endif
42 
43 #define WC_ASSERT(_x) if ( !(_x) ) wc_assert("ASSERT at %s line %d\n", __FILE__, __LINE__);
44 #define WC_ASSERT_ALWAYS() wc_assert("ASSERT! at %s line %d\n", __FILE__, __LINE__);
45 
46 #elif WC_DEBUG_LEVEL == 1
47 
48 #include "assert.h"
49 
50 #define WC_ASSERT(_x)        assert(_x);
51 #define WC_ASSERT_ALWAYS()   assert(0);
52 #endif  /* WC_DEBUG_LEVEL*/
53 
54 #else /* _DEBUG*/
55 
56 #ifndef WC_ASSERT
57 #define WC_ASSERT(_x)         ;
58 #endif
59 
60 #ifndef WC_ASSERT_ALWAYS
61 #define WC_ASSERT_ALWAYS()    ;
62 #endif
63 
64 #endif /* _DEBUG*/
65 #endif /* WC_ASSERT_H*/
66