[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Improve compatibility between M4 and CPP.

From: Raphael 'Kena' Poss
Subject: Re: [PATCH] Improve compatibility between M4 and CPP.
Date: Wed, 8 Jul 2009 13:52:46 +0100

Hi Eric,

Op 8 jul 2009, om 13:35 heeft Eric Blake het volgende geschreven:
If our synclines are not suitable with the c99 preprocessor already, then we are not compliant with POSIX. But naming a new option -- synclines-cpp makes it sound like synclines are not c99-ready unless you use this new
option.  That is, until I read your documentation of the option:

The intended meaning of the name "synclines-cpp" was "synclines as generated BY cpp", not "for cpp".

So in effect, what it looks like you are
trying to introduce is an option to make m4 line directives NOT affect C99 preprocessing (ie. they will be silently ignored by the c99 preprocessor, without affecting the c99 magic macros __LINE__ and __FILE__), but still be recognizable enough for a human reading the file to still correlate the
lines back to previously preprocessed source code.

Either my attempt at documenting this option is poor, or I didn't explain myself properly the first time (or both), but you did not catch the intent behind this.

The purpose of these changes is to allow running M4 _between_ the C preprocessor and _compiler_, i.e. between "cpp" and "cc1":

(C code) -> CPP -> (preprocessed code) -> M4 -> CC1

From that point, unfortunately one has to consider that the syncline format accepted by "cc1", when it is separated from the preprocessor, is not "#line N"; instead cc1's syncline information should be provided by the (archaic, K&R style) different "# N" format. See `do_linemarker' in GCC's libcpp/directives.c, compare with `do_line'.

So in order for CC1 to report messages/errors/warnings at the correct locations in the original source, M4 should output synclines using this format one way or another. Hence the new option.

And if we do add that as an option, we should break this into multiple
patches - one that adds an optional argument to __line__/__file__, and
another patch that introduces the new option, rather than doing it all in
one patch.

My opinion is that they are related, i.e. provide the minimal set of features that allows to fit M4 between CPP and CC1. Now you are the maintainer and you probably now better, including how to apply these two changes on your branch separately from each other.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]