From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14792 invoked by alias); 15 Jul 2011 20:58:53 -0000 Received: (qmail 14784 invoked by uid 22791); 15 Jul 2011 20:58:53 -0000 X-SWARE-Spam-Status: No, hits=-6.9 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 20:58:30 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6FKwUrI013554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Jul 2011 16:58:30 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6FKwTEa017093; Fri, 15 Jul 2011 16:58:30 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p6FKwSA2025916; Fri, 15 Jul 2011 16:58:28 -0400 From: Tom Tromey To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [rfc] Be in language c more c++ compatible References: <20110715191920.GA29975@host1.jankratochvil.net> Date: Sat, 16 Jul 2011 08:42:00 -0000 In-Reply-To: <20110715191920.GA29975@host1.jankratochvil.net> (Jan Kratochvil's message of "Fri, 15 Jul 2011 21:19:20 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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/msg00409.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> echo 'class C { typedef int t; t i; } c;'|g++ -c -o 1.o -g -x c++ - Jan> FSF GDB HEAD Jan> (gdb) show language 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. Jan> The first (c-exp.y) part parses those parts of `language c++' which cannot Jan> (I believe - RFC) lead to misinterpretation of any valid C code even in Jan> `language c'. I think so, though one would have to check eval.c and friends as well to be certain. 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. Tom