Robert Millan wrote:
On Thu, Nov 06, 2008 at 10:10:56PM +0100, Christian Franke wrote:
See attached patch for a possible fix: Each module using grub_dprintf (here disk.c) may specify its name in 'this_file'. When all modules are changed, the '#define this_file' and all #undefs can be removed.

This adds redundancy which later makes it more work to move code around and
rename files, etc.  Why not make it part of the build system?  I.e. to build
foo.c, you need gcc -Dfile=foo.c foo.c ?


Rarely used, but makes sense.

Even leaving the source as is and using 'gcc -D__FILE__=foo.c ...' would work, but then gcc emits a warning.


But then again, since gcc is free software perhaps it'd make more sense to
add new candy there? (e.g. __RELATIVE_FILE__ or so).

... and/or a new option '-ffile_var_relative_to=PREFIX' which removes PREFIX (e.g. "$srcdir/") from __FILE__ expansions. Then such a fix could easily be added also to other existing projects, without any sourcecode changes.

Christian



_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to