- 在argparse库中将所有null指针常量替换为nullptr - 更新头文件和源文件中的指针初始化和比较操作 - 修改测试文件中的相关断言检查 - 更新AST定义文件中的注释说明
33 lines
1.6 KiB
C
33 lines
1.6 KiB
C
#ifndef __SCC_POS_LOG_H__
|
|
#define __SCC_POS_LOG_H__
|
|
|
|
#include "scc_pos.h"
|
|
#include <scc_core.h>
|
|
|
|
extern logger_t __scc_usr_log;
|
|
|
|
#define SCC_POS_LOG(level, pos, fmt, ...) \
|
|
do { \
|
|
char _full_msg[LOGGER_MAX_BUF_SIZE]; \
|
|
int _n = \
|
|
scc_snprintf(_full_msg, sizeof(_full_msg), \
|
|
"%s:%zu:%zu: ", (pos).name, (pos).line, (pos).col); \
|
|
scc_snprintf(_full_msg + _n, sizeof(_full_msg) - _n, fmt, \
|
|
##__VA_ARGS__); \
|
|
__scc_usr_log.handler(&__scc_usr_log, level, nullptr, 0, nullptr, \
|
|
"%s", _full_msg); \
|
|
} while (0)
|
|
|
|
#define SCC_DEBUG(pos, fmt, ...) \
|
|
SCC_POS_LOG(LOG_LEVEL_DEBUG, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_INFO(pos, fmt, ...) \
|
|
SCC_POS_LOG(LOG_LEVEL_INFO, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_WARN(pos, fmt, ...) \
|
|
SCC_POS_LOG(LOG_LEVEL_WARN, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_ERROR(pos, fmt, ...) \
|
|
SCC_POS_LOG(LOG_LEVEL_ERROR, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_FATAL(pos, fmt, ...) \
|
|
SCC_POS_LOG(LOG_LEVEL_FATAL, pos, fmt, ##__VA_ARGS__)
|
|
|
|
#endif /* __SCC_POS_LOG_H__ */
|