Summary: assert.h assertion gets stripped from builds. I don't want these assertions to be stripped so implement a custom assert macro. This also allows the assertion to be documented with a message. Reviewed By: javache Differential Revision: D3648805 fbshipit-source-id: a6bf1bb55e1e0ee37284647ab76d66f3956a66c0
33 lines
705 B
C
33 lines
705 B
C
/**
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
# define CSS_EXTERN_C_BEGIN extern "C" {
|
|
# define CSS_EXTERN_C_END }
|
|
#else
|
|
# define CSS_EXTERN_C_BEGIN
|
|
# define CSS_EXTERN_C_END
|
|
#endif
|
|
|
|
#ifndef FB_ASSERTIONS_ENABLED
|
|
#define FB_ASSERTIONS_ENABLED 1
|
|
#endif
|
|
|
|
#if !(FB_ASSERTIONS_ENABLED)
|
|
#define abort()
|
|
#endif
|
|
|
|
#define CSS_ASSERT(X, message) \
|
|
if (!(X)) { \
|
|
fprintf(stderr, "%s\n", message); \
|
|
abort(); \
|
|
}
|