|
From: | Christian Franke |
Subject: | Re: __FILE__ (Re: [PATCH] framework for building modules externally) |
Date: | Mon, 10 Nov 2008 21:39:09 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11 |
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.
... 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.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).
Christian
[Prev in Thread] | Current Thread | [Next in Thread] |