-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix some compilation warning #5744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2006-2021, RT-Thread Development Team | ||
* Copyright (c) 2006-2022, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
|
@@ -195,10 +195,9 @@ static rt_err_t stm32_i2c_bus_unlock(const struct stm32_soft_i2c_config *cfg) | |
/* I2C initialization function */ | ||
int rt_hw_i2c_init(void) | ||
{ | ||
rt_size_t obj_num = sizeof(i2c_obj) / sizeof(struct stm32_i2c); | ||
rt_err_t result; | ||
|
||
for (int i = 0; i < obj_num; i++) | ||
for (rt_size_t i = 0; i < sizeof(i2c_obj) / sizeof(struct stm32_i2c); i++) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里为啥要合并起来呀,感觉可读性还不如之前 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 节省一个内部变量 |
||
{ | ||
i2c_obj[i].ops = stm32_bit_ops_default; | ||
i2c_obj[i].ops.data = (void*)&soft_i2c_config[i]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2006-2021, RT-Thread Development Team | ||
* Copyright (c) 2006-2022, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
|
@@ -10,17 +10,17 @@ | |
#include <rtthread.h> | ||
#include <dfs_romfs.h> | ||
|
||
const static unsigned char _dummy_dummy_txt[] = | ||
static const unsigned char _dummy_dummy_txt[] = | ||
{ | ||
0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x21, 0x0d, 0x0a, | ||
}; | ||
|
||
const static struct romfs_dirent _dummy[] = | ||
static const struct romfs_dirent _dummy[] = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这部分代码是脚本自动生成的,如果要修改,后面最好把tool目录下的脚本也修改了。要不然下次生成又被还原了。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这就是下一个pr了 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这块应该是要改一下脚本吧 脚本生成的有问题 确实应该是static关键字在前 const在后 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 确认了 脚本没啥问题 |
||
{ | ||
{ROMFS_DIRENT_FILE, "dummy.txt", _dummy_dummy_txt, sizeof(_dummy_dummy_txt)}, | ||
}; | ||
|
||
const static unsigned char _dummy_txt[] = | ||
static const unsigned char _dummy_txt[] = | ||
{ | ||
0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x21, 0x0d, 0x0a, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i的取值范围只有 0 ~ 32 有必要 32 位吗?