mirror of https://github.com/FreeRDP/FreeRDP
Added WINPR_ASSERT
Added a WinPR macro that can be used for WinPR and FreeRDP to replace standard C assert. It is more verbose and logs issues to WLog which makes it easier for us to trace problems in the field.
This commit is contained in:
parent
210b9f58b7
commit
b435e6db9b
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* WinPR: Windows Portable Runtime
|
||||
* Runtime ASSERT macros
|
||||
*
|
||||
* Copyright 2021 Armin Novak <armin.novak@thincast.com>
|
||||
* Copyright 2021 Thincast Technologies GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef WINPR_ASSERT_H
|
||||
#define WINPR_ASSERT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
#define WINPR_ASSERT(cond) \
|
||||
do \
|
||||
{ \
|
||||
if (!(cond)) \
|
||||
{ \
|
||||
WLog_FATAL("com.freerdp.winpr.assert", "%s [%s:%s:%" PRIuz "]", #cond, __FILE__, \
|
||||
__FUNCTION__, __LINE__); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WINPR_ERROR_H */
|
Loading…
Reference in New Issue