添加SCC_TOK_DISABLED标记类型用于表示被禁用的token 实现disable/enable/need_skip函数来管理宏展开过程中的递归控制 重构defined操作符解析逻辑到独立的parse_defined函数中 移除原有的need_rescan标志和相关重扫描逻辑 fix(sstream): 修复位置日志中行列号格式化问题 将snprintf格式字符串中的%u替换为%llu以支持更大的行列数值 test(pproc): 补充宏定义相关的单元测试用例 添加嵌套宏、自引用宏和无参数宏的测试用例
32 lines
1.6 KiB
C
32 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 = \
|
|
snprintf_(_full_msg, sizeof(_full_msg), \
|
|
"%s:%llu:%llu: ", (pos).name, (pos).line, (pos).col); \
|
|
snprintf_(_full_msg + _n, sizeof(_full_msg) - _n, fmt, ##__VA_ARGS__); \
|
|
__scc_usr_log.handler(&__scc_usr_log, level, null, 0, null, "%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__ */
|