From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19334 invoked by alias); 15 Jul 2011 21:09:29 -0000 Received: (qmail 19322 invoked by uid 22791); 15 Jul 2011 21:09:28 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Jul 2011 21:09:10 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6FL9Arv028196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Jul 2011 17:09:10 -0400 Received: from host1.jankratochvil.net ([10.3.113.13]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6FL98lr023213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Jul 2011 17:09:09 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p6FL97ao017720; Fri, 15 Jul 2011 23:09:07 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p6FL96Ag017719; Fri, 15 Jul 2011 23:09:06 +0200 Date: Sat, 16 Jul 2011 09:45:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [rfc] Be in language c more c++ compatible Message-ID: <20110715210906.GA17148@host1.jankratochvil.net> References: <20110715191920.GA29975@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00410.txt.bz2 On Fri, 15 Jul 2011 22:58:28 +0200, Tom Tromey wrote: > >>>>> "Jan" == Jan Kratochvil writes: > Jan> The current source language is "auto; currently c". > > I am curious why this happens. > It seems like it should say "currently c++" -- I didn't check the code > but my mental model would be that if there is no frame, then the default > symtab should either be 'main' or, if no main, say the first CU in the > symbol file; and the default symtab's language should be used for auto. You are close but I do not think it matters. One can have purely C program which has dynamically (even indirectly) linked some library in C++ and one should be able to access C++ expressions in that library. One cannot with the main program is in Fortran or other languages but C vs. C++ are both mixed in the real world and also their parsing does not conflict too much. > Jan> The second (valops.c) part is there because with `language c++' > Jan> parsing "C::t" is straight OP_TYPE handled correctly in > Jan> evaluate_subexp_standard. But with `language c' it gets parsed as > Jan> OP_SCOPE and I find there a bug, copied the code there. > > I don't even know why we have OP_SCOPE. I agree, c-exp.y already tries to resolve everything to OP_TYPE and OP_VAR_VALUE. I admit I tried to remove but the code still depends on it. Also non-C languages use OP_SCOPE. I find that cleanup as a different one / additional one. Thanks, Jan