Newline in cunit generated code

The cunit plugin auto-generates some code, namely the gradle_cunit_register.h header file. If I compile this code with -pedantic-errors, I get:

gradle_cunit_register.h:4:30: error: no newline at end of file [-Werror,-Wnewline-eof]

Of course I can compile without -pedantic-errors, but I consider it good practice to always have all errors enabled. And a newline at the end of the file should be easy to fix.

Thanks!

I’ve added a newline to that file’s template. If we create a new RC for 2.13, I’ll try to get this change into the next release. If not, it’ll be in 2.14 (May).

As a workaround, you could add the line yourself with something like:

tasks.withType(GenerateCUnitLauncher) {
    doLast {
        new File(headerDir, "gradle_cunit_register.h") << '\n'
    }
}
1 Like