This is the mail archive of the gcc@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: C++ PATCH:


Mark Mitchell <mark@codesourcery.com> writes:

| Gabriel Dos Reis wrote:
| 
| > Actually, we do have machinery to print statement-expression.  It is
| > just that calling dump_expr() is wrong.
| 
| Why do we want to print them?  When does that help the user debug the
| problem?  The only situation I can think of is that it helps them
| identify which statement expression is causing the problem, if there
| are multiple statement expressions on a single line.  And that problem
| is better dealt with by using carets.

we need to print not just declaration, but also statements to inform
about the context where an error occur.  GCC is not going to be the
first C++ compiler to invent that.

| We have enough problems just printing expressions.  (Lowered forms

Lower forms appear because currently we do not do a good in the
front-end  and pretty-printer telling which level of abstraction is
preferred.  I noted initial effort in that direction has already been 
undermined by you.  Since, no technical reason was given, I must
assume it is political.  

| appear, the syntax printed doesn't match what the user typed, etc.)

Again, that is a defect in our front-end representation -- since
you're mentioning EDG, it is an example of compiler that does have
both high level and level repreentations gracefully coexist.  And it
does print expressions outside of declarations.  And
statement expressions too (see below).

| EDG doesn't have a mechanism for printing expressions -- *any*

That statement is factually false as can be verified with EDG-3.5:

   % cat b.C 
   int main()
   {
      if (int i = {0})
         return false;
   }

   % edgcpfe b.C 
   "b.C", line 3: error: expected an expression
        if (int i = {0})
                    ^

   1 error detected in the compilation of "b.C".

   % cat c.C
   struct S {
      int i;
   };

   void f(int) { }

   int main()
   {
      f({sizeof(S) - 3});
   }

   % edgcpfe c.C 
   "c.C", line 9: error: expected an expression
        f({sizeof(S) - 3});
          ^

   1 error detected in the compilation of "c.C".


    % cat d.C && edgcpfe --g++ d.C 
    int main()
    {
       return ({ 0 });
    }
    "d.C", line 3: error: expected a ";"
         return ({ 0 });
                     ^

    1 error detected in the compilation of "d.C".

| expressions, other than declarations -- in diagnostics; I actually
| think that's the right decision.

Please do a reality check. 

| I'm sure you'll disagree, and I'd rather not get into another
| protracted discussion, so please post a message explaining why you
| disagree, and then we'll just leave it at that.

Well, it is difficult to tell whether it is me disagreeing or you
inventing fallacies, but it does not matter.  The motivation for
printing statement is to highlight the context where a diagnostic
occurs.  Printing only declartions is clearly insufficient.

| For 4.1, I'm opposed to patches that cause us to try to print
| statement expressions.  Perhaps you can convince some combination of
| the other C and C++ front-end maintainers that it makes sense to print
| them.

Before deciding on whether it is just another obstructionism from your 
part, it would be useful to know if you oppose just to statement
expressions or any kind of statement.  If it is another instance of
of maintainerhisp abuse based on fallacy, contrary to GCC mission
statement you're probably right.

-- Gaby


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