This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [distcc] gcc bootstraps with distcc


Alexandre Oliva <aoliva@redhat.com> writes:

> On Aug  5, 2003, Neil Booth <neil@daikokuya.co.uk> wrote:
>
>> Please revert until you can establish that the testsuite case is
>> not there for a good reason.
>
> FWIW, the current behavior seems extremely counter-intuitive to me.
> Consider, for example:
>
> #include <stdio.h>
>
> #define FOO(x) x
>
> int main() {
>   printf ("%i\n", FOO(__LINE__  // <--- line 6
> ));
>   printf ("%i\n", FOO(
> __LINE__ ));                    // <--- line 9
> }
>
> What should __LINE__ expand to i both cases?

6, 9.

To first order, if __LINE__ does not expand to the number of the line
it actually appeared on in the source file, that is a bug.  (Ignore
the possibility of __LINE__ being split over multiple lines with
\-newline; there is no definite right answer then - I think we use the
line of the last character of the identifier.)

There is a second order effect which must not be neglected: If
__LINE__ is part of macro replacement text, it needs to expand to the
line of the macro invocation.  This is because macros like assert()
tend to have __LINE__ as part of their replacement text.  If the macro
invocation extends over multiple lines, then the right answer is
debatable.

Having said all this, the syntax provoking the bug (7 not 6) is
pathological, and I don't support a change unless it can be done for
zero cost.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]