How to compile a Linux kernel module using -std=gnu99?

可紊 提交于 2019-12-03 06:17:41

It turns out that -std=gnu99 does in fact work; I began seeing errors regarding C99 features after removing the compiler flag. So that meant something else was causing the warnings to print out besides the -std= option.

After parsing through the verbose output via make V=1, I discovered the -Wdeclaration-after-statement option as part of the GCC execution. This was the cause of the ISO C90 mixed declaration warnings I saw.

To disable the ISO C90 warnings, pass this to GCC: -Wno-declaration-after-statement.

For example:

ccflags-y := -std=gnu99 -Wno-declaration-after-statement

You can also specify the flag in your Makefile, if you have one:

FLAGS=-std=gnu99
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!