richardvo...@gmail.com wrote:

Another option would be to replace #if ENABLE_NLS by #if defined(ENABLE_NLS)
&& ENABLE_NLS.

I know the C compiler short-circuits &&, if the preprocessor does also
then this looks like the best solution.  If not, then nested #if.

Yes the preprocessor also short-circuits (I tested a small example to be sure, with gcc 4.1 and gcc 4.4). So the automatic replacement command becomes:

find . -name '*.[ch]' -exec sed -i -e 's, ENABLE_NLS, (defined(ENABLE_NLS) \&\& ENABLE_NLS),g' '{}' ';'

Grégoire

p.s. By the way, this kind of contruct appears in the autoconf manual for a similar problem (middle of page):

http://www.gnu.org/software/autoconf/manual/html_node/Generic-Declarations.html#Generic-Declarations


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

Reply via email to