This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
when GCC parse a file and don't see empty last line he show warning. I propose add to Code style option-Blank lines add option "add empty last line if she don't exist"
IMHO formatter should add missing new line in end of file in any case.
*** Bug 186355 has been marked as a duplicate of this bug. ***
Bug 186355 suggests that NB should just add missing new line on saving file, without the need to call formatting.
Note that GCC does *not* want an empty line at the end of the file: it just wants to see a newline character. i.e. it wants to see: void somefunc(void)\n {\n dostuff();\n }\n not: void somefunc(void)\n {\n dostuff();\n }\n \n What NB currently produces is: void somefunc(void)\n {\n dostuff();\n }
The C standard requires a newline at the end of a file, which is why gcc and clang warn if it is missing: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character [...]" (C11, 5.1.1.2.2) Ideally NetBeans would have would an "Ensure newline at end of file" option for each language, under Tools > Options > Editor > On Save. There is already a plugin called "EOF Line Feed" for this, which can be enabled through Tools > Plugins > Available Plugins (works in NetBeans 8.1, http://plugins.netbeans.org/plugin/56323/eof-line-feed)