equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
138 #endif |
138 #endif |
139 |
139 |
140 // For backward compatibility. |
140 // For backward compatibility. |
141 #define assert(p, ...) vmassert(p, __VA_ARGS__) |
141 #define assert(p, ...) vmassert(p, __VA_ARGS__) |
142 |
142 |
|
143 #ifndef ASSERT |
|
144 #define vmassert_status(p, status, msg) |
|
145 #else |
143 // This version of vmassert is for use with checking return status from |
146 // This version of vmassert is for use with checking return status from |
144 // library calls that return actual error values eg. EINVAL, |
147 // library calls that return actual error values eg. EINVAL, |
145 // ENOMEM etc, rather than returning -1 and setting errno. |
148 // ENOMEM etc, rather than returning -1 and setting errno. |
146 // When the status is not what is expected it is very useful to know |
149 // When the status is not what is expected it is very useful to know |
147 // what status was actually returned, so we pass the status variable as |
150 // what status was actually returned, so we pass the status variable as |
153 report_vm_status_error(__FILE__, __LINE__, "assert(" #p ") failed", \ |
156 report_vm_status_error(__FILE__, __LINE__, "assert(" #p ") failed", \ |
154 status, msg); \ |
157 status, msg); \ |
155 BREAKPOINT; \ |
158 BREAKPOINT; \ |
156 } \ |
159 } \ |
157 } while (0) |
160 } while (0) |
|
161 #endif |
158 |
162 |
159 // For backward compatibility. |
163 // For backward compatibility. |
160 #define assert_status(p, status, msg) vmassert_status(p, status, msg) |
164 #define assert_status(p, status, msg) vmassert_status(p, status, msg) |
161 |
165 |
162 // guarantee is like vmassert except it's always executed -- use it for |
166 // guarantee is like vmassert except it's always executed -- use it for |