修复规范矛盾并定案5项规则,保护宏统一XXX_H

规则定案:常量在右(a>5)、保护宏XXX_H(禁双下划线)、
头文件常量用#define、存储类前缀(g_/s_)优先、允许void返回值
全库32个.h头文件保护宏 __XXX_H → XXX_H 改名(字节级替换)
S1检查规则同步更新(拒绝双下划线),Inc/gpio.h 反向验证被正确拦截
规范示例矛盾修复:K&R括号、标准类型、变量初始化、命名常量、注释字段补全
This commit is contained in:
2026-09-01 16:07:00 +08:00
parent 2b66f96d01
commit bb76cfd779
35 changed files with 158 additions and 138 deletions
+3 -3
View File
@@ -9,8 +9,8 @@
* 2026-06-06 王建锋 创建初始版本,按代码规范重构
*/
#ifndef __CH395F_H
#define __CH395F_H
#ifndef CH395F_H
#define CH395F_H
/*
* 头文件包含区 - 仅包含本模块必需的头文件
@@ -719,4 +719,4 @@ void ch395f_get_unreach_info(uint8_t *p_buf);
}
#endif
#endif /* __CH395F_H */
#endif /* CH395F_H */
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef __GD5F2GQ5UE_H
#define __GD5F2GQ5UE_H
#ifndef GD5F2GQ5UE_H
#define GD5F2GQ5UE_H
/*
* 模块名称:GD5F2GQ5UE SPI NAND Flash 驱动
@@ -235,4 +235,4 @@ int32_t gd5f_check_ecc(void);
}
#endif
#endif /* __GD5F2GQ5UE_H */
#endif /* GD5F2GQ5UE_H */
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __NAND_FTL_H
#define __NAND_FTL_H
#ifndef NAND_FTL_H
#define NAND_FTL_H
#ifdef __cplusplus
extern "C" {
+3 -3
View File
@@ -8,8 +8,8 @@
* 修改记录:
*/
#ifndef __NET_CONFIG_H
#define __NET_CONFIG_H
#ifndef NET_CONFIG_H
#define NET_CONFIG_H
#ifdef __cplusplus
extern "C" {
@@ -101,4 +101,4 @@ extern "C" {
}
#endif
#endif /* __NET_CONFIG_H */
#endif /* NET_CONFIG_H */
+3 -3
View File
@@ -8,8 +8,8 @@
* 修改记录:
*/
#ifndef __NET_SELECT_H
#define __NET_SELECT_H
#ifndef NET_SELECT_H
#define NET_SELECT_H
#ifdef __cplusplus
extern "C" {
@@ -111,4 +111,4 @@ int net_poll_events(net_pollfd_t *fds, int nfds, int timeout);
}
#endif
#endif /* __NET_SELECT_H */
#endif /* NET_SELECT_H */
+3 -3
View File
@@ -8,8 +8,8 @@
* 修改记录:
*/
#ifndef __NET_SOCKET_H
#define __NET_SOCKET_H
#ifndef NET_SOCKET_H
#define NET_SOCKET_H
#ifdef __cplusplus
extern "C" {
@@ -340,4 +340,4 @@ int net_listen_locked(int sockfd);
}
#endif
#endif /* __NET_SOCKET_H */
#endif /* NET_SOCKET_H */
+3 -3
View File
@@ -8,8 +8,8 @@
* 修改记录:
*/
#ifndef __NET_TYPES_H
#define __NET_TYPES_H
#ifndef NET_TYPES_H
#define NET_TYPES_H
#ifdef __cplusplus
extern "C" {
@@ -175,4 +175,4 @@ typedef struct {
}
#endif
#endif /* __NET_TYPES_H */
#endif /* NET_TYPES_H */
+3 -3
View File
@@ -11,8 +11,8 @@
* 2026-07-18 王建锋 创建初始版本
*/
#ifndef __RS485_H
#define __RS485_H
#ifndef RS485_H
#define RS485_H
#ifdef __cplusplus
extern "C" {
@@ -123,4 +123,4 @@ void rs485_on_rx(uint8_t *buf, uint16_t size);
}
#endif
#endif /* __RS485_H */
#endif /* RS485_H */
+3 -3
View File
@@ -9,8 +9,8 @@
* 2026-07-17 王建锋 创建初始版本,参考 SD2506API-G Ver2.0 手册
*/
#ifndef __SD2506_H
#define __SD2506_H
#ifndef SD2506_H
#define SD2506_H
#ifdef __cplusplus
extern "C" {
@@ -293,4 +293,4 @@ uint8_t sd2506_dec_to_bcd(uint8_t dec);
}
#endif
#endif /* __SD2506_H */
#endif /* SD2506_H */
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef __TPAFE5160_H
#define __TPAFE5160_H
#ifndef TPAFE5160_H
#define TPAFE5160_H
/*
* 模块名称:TPAFE5160 16位8通道同步采样ADC驱动
@@ -230,4 +230,4 @@ void tpafe5160_exti_handler(uint16_t GPIO_Pin);
}
#endif
#endif /* __TPAFE5160_H */
#endif /* TPAFE5160_H */
+3 -3
View File
@@ -7,8 +7,8 @@
* 修改记录:
* 2026-08-29 王建锋 创建初始版本
*/
#ifndef __UI_MENU_H
#define __UI_MENU_H
#ifndef UI_MENU_H
#define UI_MENU_H
#ifdef __cplusplus
extern "C" {
@@ -29,4 +29,4 @@ int ui_menu_init(void);
}
#endif
#endif /* __UI_MENU_H */
#endif /* UI_MENU_H */
+3 -3
View File
@@ -8,8 +8,8 @@
* 2026-08-29 王建锋 创建初始版本
* 2026-08-29 王建锋 修正监听端口为 7003,与 DTU-RemoteLCD 客户端默认端口对齐
*/
#ifndef __UI_NET_SINK_H
#define __UI_NET_SINK_H
#ifndef UI_NET_SINK_H
#define UI_NET_SINK_H
#include <stdint.h>
@@ -54,4 +54,4 @@ void ui_net_sink_poll(void);
}
#endif
#endif /* __UI_NET_SINK_H */
#endif /* UI_NET_SINK_H */
+3 -3
View File
@@ -7,8 +7,8 @@
* 修改记录:
* 2026-08-29 王建锋 创建初始版本
*/
#ifndef __UI_PORT_H
#define __UI_PORT_H
#ifndef UI_PORT_H
#define UI_PORT_H
#include <stdint.h>
#include <stddef.h>
@@ -76,4 +76,4 @@ void ui_port_step(uint32_t tick_ms);
}
#endif
#endif /* __UI_PORT_H */
#endif /* UI_PORT_H */
+3 -3
View File
@@ -15,8 +15,8 @@
* 2026-07-18 王建锋 创建初始版本
*/
#ifndef __DBG_CFG_H
#define __DBG_CFG_H
#ifndef DBG_CFG_H
#define DBG_CFG_H
#ifdef __cplusplus
extern "C" {
@@ -43,4 +43,4 @@ extern "C" {
}
#endif
#endif /* __DBG_CFG_H */
#endif /* DBG_CFG_H */
+3 -3
View File
@@ -14,8 +14,8 @@
* 2026-07-18 王建锋 创建初始版本
*/
#ifndef __DBG_LOG_H
#define __DBG_LOG_H
#ifndef DBG_LOG_H
#define DBG_LOG_H
#ifdef __cplusplus
extern "C" {
@@ -135,4 +135,4 @@ extern "C" {
}
#endif
#endif /* __DBG_LOG_H */
#endif /* DBG_LOG_H */