added custom define for macro `__FILE_NAME__` for non supporting compilers
This commit is contained in:
parent
8bd4898440
commit
2b46c9e3ab
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define LOG_DEFAULT_STREAM stderr
|
#define LOG_DEFAULT_STREAM stderr
|
||||||
|
|
||||||
|
@ -20,6 +21,16 @@
|
||||||
#define LOG_STRING_INFORMATION "Information"
|
#define LOG_STRING_INFORMATION "Information"
|
||||||
#define LOG_STRING_DEBUG "Debug"
|
#define LOG_STRING_DEBUG "Debug"
|
||||||
|
|
||||||
|
// define __FILE_NAME__ macro if not defined
|
||||||
|
// generally not defined by GCC < 11.3 and MSVC
|
||||||
|
#ifndef __FILE_NAME__
|
||||||
|
#if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)
|
||||||
|
#define __FILE_NAME__ (strrstr(__FILE__, "\\\\") ? strrstr(__FILE__, "\\\\") + 1 : __FILE__)
|
||||||
|
#else
|
||||||
|
#define __FILE_NAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Panic is used in cases where the process is in an unrecoverable state.
|
* @brief Panic is used in cases where the process is in an unrecoverable state.
|
||||||
* This macro will print debug information to stderr and call abort() to
|
* This macro will print debug information to stderr and call abort() to
|
||||||
|
|
Loading…
Reference in New Issue