public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Gerald Pfeifer <gerald@pfeifer.com>
Cc: Jack Howarth <howarth@bromo.med.uc.edu>,
	Janis Johnson <janisjo@codesourcery.com>,
		gcc-patches@gcc.gnu.org,
	Richard Guenther <richard.guenther@gmail.com>
Subject: Re: [PATCH][4.6] detect C++ errors to fix 2288 and 18770
Date: Mon, 23 May 2011 08:34:00 -0000	[thread overview]
Message-ID: <BANLkTin=C60iOxzW3a6y+NZE8q=S1kROng@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1105222326050.13877@gerinyyl.fvgr>

On Sun, May 22, 2011 at 2:29 PM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> On Sun, 22 May 2011, Jack Howarth wrote:
>>> 2010-03-18  Janis Johnson  <janis187@us.ibm.com>
>>>
>>> gcc/cp
>>>      PR c++/2288
>>>      PR c++/18770
>>>      * name-lookup.h (enum scope_kind): Add sk_cond.
>>>      * name-lookup.c (pushdecl_maybe_friend): Get scope of shadowed local.
>>>      Detect and report error for redeclaration from for-init or if
>>>      or switch condition.
>>>      (begin_scope): Handle sk_cond.
>>>      * semantics.c (begin_if_stmt): Use sk_cond.
>>>      (begin switch_stmt): Ditto.
>>>
>>> gcc/testsuite/
>>>      PR c++/2288
>>>      PR c++/18770
>>>      * g++.old-deja/g++.jason/cond.C: Remove xfails.
>>>      * g++.dg/parse/pr18770.C: New test.
>> Any chance we can get this committed to gcc trunk while in 4.7 stage 1
>> (since it was already approved for 4.6 stage 1 and never applied...
>> http://gcc.gnu.org/ml/gcc-patches/2010-05/msg00264.html). It would be
>> nice to have in gcc 4.7 so that other open source projects that only
>> build against g++ would be alerted to fix their sources.
>
> It's my understanding that an approved patch can be committed by anyone
> with write access unless it is retracted or there is some other reason
> not to. Customary that is left to the submitter if she has write access,
> of course.
>

FWIW, I tried Janis's patch on 4.6 branch and I got

/export/gnu/import/git/gcc/gcc/testsuite/g++.dg/parse/pr18770.C: In
function 'void e1()':^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.dg/parse/pr18770.C:29:11:
error: redeclaration of 'int k'^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.dg/parse/pr18770.C:27:12:
error: 'int k' previously declared here^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.dg/parse/pr18770.C: In
function 'void e4()':^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.dg/parse/pr18770.C:63:11:
error: redeclaration of 'int i'^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.dg/parse/pr18770.C:61:14:
error: 'int i' previously declared here^M

FAIL: g++.dg/parse/pr18770.C prev (test for errors, line 14)
FAIL: g++.dg/parse/pr18770.C redecl (test for errors, line 17)
PASS: g++.dg/parse/pr18770.C prev (test for errors, line 27)
PASS: g++.dg/parse/pr18770.C redecl (test for errors, line 29)
FAIL: g++.dg/parse/pr18770.C prev (test for errors, line 37)
FAIL: g++.dg/parse/pr18770.C redecl (test for errors, line 39)
FAIL: g++.dg/parse/pr18770.C prev (test for errors, line 47)
FAIL: g++.dg/parse/pr18770.C redecl (test for errors, line 53)
PASS: g++.dg/parse/pr18770.C prev (test for errors, line 61)
PASS: g++.dg/parse/pr18770.C redecl (test for errors, line 63)
FAIL: g++.dg/parse/pr18770.C prev (test for errors, line 71)
FAIL: g++.dg/parse/pr18770.C redecl (test for errors, line 73)
PASS: g++.dg/parse/pr18770.C (test for excess errors)

/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:
In function 'int main()':^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:22:11:
error: redeclaration of 'int i'^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:20:14:
error: 'int i' previously declared here^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:27:11:
error: redeclaration of 'int i'^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:25:14:
error: 'int i' previously declared here^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:36:16:
error: types may not be defined in conditions^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:39:3:
error: 'A' was not declared in this scope^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:39:5:
error: expected ';' before 'bar'^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:42:12:
error: types may not be defined in conditions^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:42:40:
error: 'one' was not declared in this scope^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:51:14:
warning: declaration of 'int f()' has 'extern' and is initialized
[enabled by default]^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:51:18:
error: function 'int f()' is initialized like a variable^M
/export/gnu/import/git/gcc/gcc/testsuite/g++.old-deja/g++.jason/cond.C:55:23:
error: extended initializer lists only available with -std=c++0x or
-std=gnu++0x^M

FAIL: g++.old-deja/g++.jason/cond.C  (test for errors, line 9)
FAIL: g++.old-deja/g++.jason/cond.C  (test for errors, line 11)
FAIL: g++.old-deja/g++.jason/cond.C  (test for errors, line 16)
PASS: g++.old-deja/g++.jason/cond.C  (test for errors, line 20)
PASS: g++.old-deja/g++.jason/cond.C  (test for errors, line 22)
PASS: g++.old-deja/g++.jason/cond.C  (test for errors, line 25)
PASS: g++.old-deja/g++.jason/cond.C  (test for errors, line 27)
FAIL: g++.old-deja/g++.jason/cond.C  (test for errors, line 30)
FAIL: g++.old-deja/g++.jason/cond.C  (test for errors, line 33)
PASS: g++.old-deja/g++.jason/cond.C  (test for errors, line 36)
PASS: g++.old-deja/g++.jason/cond.C decl (test for errors, line 39)
PASS: g++.old-deja/g++.jason/cond.C exp (test for errors, line 39)
PASS: g++.old-deja/g++.jason/cond.C def (test for errors, line 42)
PASS: g++.old-deja/g++.jason/cond.C expected (test for errors, line 42)
PASS: g++.old-deja/g++.jason/cond.C extern (test for warnings, line 51)

The patch no longer catches all problems.


-- 
H.J.

  reply	other threads:[~2011-05-22 22:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 21:39 Janis Johnson
2010-05-05  2:32 ` Jason Merrill
2011-05-22 21:24 ` Jack Howarth
2011-05-23  7:13   ` Gerald Pfeifer
2011-05-23  8:34     ` H.J. Lu [this message]
2011-05-25 19:57       ` Nathan Froyd
2011-05-26  8:11         ` Nathan Froyd
2011-05-26 18:24           ` Peter Bergner
2011-05-26 19:17           ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTin=C60iOxzW3a6y+NZE8q=S1kROng@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gerald@pfeifer.com \
    --cc=howarth@bromo.med.uc.edu \
    --cc=janisjo@codesourcery.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).