Solve the "empty file problem"
@astavale
Submitted by Al Thomas Link to original bug (#794210)
Description
The "empty file problem" is an indication of Vala's current dependence on GLib, even when there is no code in the Vala source file. It currently has three things that need solving:
-
An empty Vala files compiled to C will have includes for
glib.h
andglib-object.h
. The C file should be empty -
There is currently nothing in the test infrastructure to check C output from valac. A test should be implemented to check that an empty source file produces an empty C file
-
Compiling an empty Vala source file with
--nostdpkg
produces an error "The namespace name `GLib' could not be found". It should produce an empty C file
At present an empty Vala files produces something like:
/* empty_vala_source.c generated by valac 0.39.92.14-46f76-dirty, the Vala compiler
* generated from empty_vala_source.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
The includes don't need to be there. There is currently no option to not have the comment at the beginning, but that is probably fine. Any test mechanism would need to take account of the comment.