Astyle 代码格式化
我正在编写一个 Linux 内核模块,并尝试使用 astyle 来帮助我遵循编码标准。它似乎错误地格式化了 spi_driver
结构,我想知道是否有人知道原因。这是传递给 astyle 之前的代码(使用命令 astyle --style=linux lightmod.c
):
static struct spi_driver light_driver = {
.driver = {
.name = "light",
.owner = THIS_MODULE,
},
.probe = light_probe,
.remove = __devexit_p(light_remove),
};
这是输出:
static struct spi_driver light_driver = {
.driver = {
.name = "light",
.owner = THIS_MODULE,
},
.probe = light_probe,
.remove = __devexit_p(light_remove),
};
为什么它缩进 .remove
this方式?有谁知道吗?
I'm writing a linux kernel module, and trying to use astyle to help me follow the coding standard. It seems to be formatting a spi_driver
structure incorrectly and I'm wondering if anyone knows why. This is the code before passing to astyle (with the command astyle --style=linux lightmod.c
):
static struct spi_driver light_driver = {
.driver = {
.name = "light",
.owner = THIS_MODULE,
},
.probe = light_probe,
.remove = __devexit_p(light_remove),
};
And this is the output:
static struct spi_driver light_driver = {
.driver = {
.name = "light",
.owner = THIS_MODULE,
},
.probe = light_probe,
.remove = __devexit_p(light_remove),
};
Why is it indenting .remove
this way? Does anyone know?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这没有什么深层次的原因。 Astyle 似乎无法正确处理 C99 的指定初始值设定项。如果您使用旧式初始化程序,它可以很好地格式化它们。
I don't think that there is a deep reason for this. Astyle simply seems not be able to handle C99's designated initializers correctly. If you use oldstyle initializers it formats them fine.