public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57854] New: Would like to have a warning for virtual overrides without C++11 "override" keyword
@ 2013-07-08 23:39 thiago at kde dot org
  2013-07-09  9:29 ` [Bug c++/57854] " manu at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: thiago at kde dot org @ 2013-07-08 23:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854

            Bug ID: 57854
           Summary: Would like to have a warning for virtual overrides
                    without C++11 "override" keyword
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thiago at kde dot org

I would like a new (optional) warning that would point out every C++ virtual
override that is done without the C++11 keyword that indicates an override. By
necessity, this warning would only be permitted in C++11 mode.

The keyword was added so that developers would let the compiler know when an
override is intended. However, the [[base_check]] attribute was dropped from
C++11 prior to standardisation, so there's no way (currently) to ask the
compiler to let us know which classes are doing overrides without the keyword.

This warning should be printed in the otherwise perfectly correct code:

struct Base {
    virtual void v();
};
struct Derived: Base {
    virtual void v(); // warning happens here
};

This warning should not be in -Wall. It should be in -Weffc++. I'll leave it up
to you whether it's in -Wextra.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/57854] Would like to have a warning for virtual overrides without C++11 "override" keyword
  2013-07-08 23:39 [Bug c++/57854] New: Would like to have a warning for virtual overrides without C++11 "override" keyword thiago at kde dot org
@ 2013-07-09  9:29 ` manu at gcc dot gnu.org
  2013-07-09  9:36 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2013-07-09  9:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |manu at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Thiago Macieira from comment #0)
> I would like a new (optional) warning that would point out every C++ virtual
> override that is done without the C++11 keyword that indicates an override.
> By necessity, this warning would only be permitted in C++11 mode.

Hi Thiago,

I am so grateful for KDE that I would like to help here if possible. But I
would like to ask the C++ maintainer whether this is something that would be
accepted in mainline G++ and whether G++ has the capabilities to detect this
easily. Jason, what do you think?

Perhaps the same issues that made [[base_check]] to be dropped would affect the
implementation of this warning? I don't know the specifics.
>From gcc-bugs-return-426003-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jul 09 09:29:07 2013
Return-Path: <gcc-bugs-return-426003-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 834 invoked by alias); 9 Jul 2013 09:29:07 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 653 invoked by uid 48); 9 Jul 2013 09:29:04 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54366] [meta-bug] decltype issues
Date: Tue, 09 Jul 2013 09:29:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords: meta-bug
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-54366-4-Ihocz9UfAZ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-54366-4@http.gcc.gnu.org/bugzilla/>
References: <bug-54366-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-07/txt/msg00510.txt.bz2
Content-length: 472

http://gcc.gnu.org/bugzilla/show_bug.cgi?idT366

Bug 54366 depends on bug 51786, which changed state.

Bug 51786 Summary: [c++0x] Invalid declaration with decltype accepted
http://gcc.gnu.org/bugzilla/show_bug.cgi?idQ786

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/57854] Would like to have a warning for virtual overrides without C++11 "override" keyword
  2013-07-08 23:39 [Bug c++/57854] New: Would like to have a warning for virtual overrides without C++11 "override" keyword thiago at kde dot org
  2013-07-09  9:29 ` [Bug c++/57854] " manu at gcc dot gnu.org
@ 2013-07-09  9:36 ` redi at gcc dot gnu.org
  2013-07-09  9:50 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-09  9:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Thiago Macieira from comment #0)
> 
> It should be in -Weffc++.

Not unless a new C++11 edition of Effective C++ recommends using override on
all overriding functions, and not unless we update -Weffc++ to correspond to
something other than the first edition.

This seems like something that would fit better into a plugin than the core
compiler.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/57854] Would like to have a warning for virtual overrides without C++11 "override" keyword
  2013-07-08 23:39 [Bug c++/57854] New: Would like to have a warning for virtual overrides without C++11 "override" keyword thiago at kde dot org
  2013-07-09  9:29 ` [Bug c++/57854] " manu at gcc dot gnu.org
  2013-07-09  9:36 ` redi at gcc dot gnu.org
@ 2013-07-09  9:50 ` manu at gcc dot gnu.org
  2014-12-14 14:53 ` ville.voutilainen at gmail dot com
  2015-01-13 15:57 ` ville.voutilainen at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2013-07-09  9:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> (In reply to Thiago Macieira from comment #0)
> > 
> > It should be in -Weffc++.
> 
> Not unless a new C++11 edition of Effective C++ recommends using override on
> all overriding functions, and not unless we update -Weffc++ to correspond to
> something other than the first edition.
> 
> This seems like something that would fit better into a plugin than the core
> compiler.

We could add a new option -Wbase-check, no? 

Or we could also write a plugin and distribute it with GCC. I think it is
something that could be generally used and an useful example of how to write
plugins (and a testcase testing the plugin infrastructure).
>From gcc-bugs-return-426008-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jul 09 09:59:53 2013
Return-Path: <gcc-bugs-return-426008-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21281 invoked by alias); 9 Jul 2013 09:59:53 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 21215 invoked by uid 48); 9 Jul 2013 09:59:50 -0000
From: "mikpe at it dot uu.se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57862] invalid read struct uint32_t member (ARMV5)
Date: Tue, 09 Jul 2013 09:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.7.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: critical
X-Bugzilla-Who: mikpe at it dot uu.se
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57862-4-l2fsg1M6yU@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57862-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57862-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-07/txt/msg00515.txt.bz2
Content-length: 496

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW862

--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> ---
This has all the indications of a mis-aligned memory access.  Since you're on
Linux, please make sure that the 'User faults' field in /proc/cpu/alignment
shows a value of 2 (fixup) or 3 (fixup+warn).  You can 'echo 3 >
/proc/cpu/alignment'
in your startup scripts to ensure this setting, or you can hack it into the
kernel source's arch/arm/mm/alignment.c (which is what I do).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/57854] Would like to have a warning for virtual overrides without C++11 "override" keyword
  2013-07-08 23:39 [Bug c++/57854] New: Would like to have a warning for virtual overrides without C++11 "override" keyword thiago at kde dot org
                   ` (2 preceding siblings ...)
  2013-07-09  9:50 ` manu at gcc dot gnu.org
@ 2014-12-14 14:53 ` ville.voutilainen at gmail dot com
  2015-01-13 15:57 ` ville.voutilainen at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 14:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ville.voutilainen at gmail dot com

--- Comment #4 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
We now have -Wsuggest-final-methods, so having something like
-Wsuggest-override wouldn't be far-fetched.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/57854] Would like to have a warning for virtual overrides without C++11 "override" keyword
  2013-07-08 23:39 [Bug c++/57854] New: Would like to have a warning for virtual overrides without C++11 "override" keyword thiago at kde dot org
                   ` (3 preceding siblings ...)
  2014-12-14 14:53 ` ville.voutilainen at gmail dot com
@ 2015-01-13 15:57 ` ville.voutilainen at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-13 15:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854

--- Comment #5 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
It seems to me that
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=219213
implements the desired functionality. Can we close this bug?


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-13 15:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-08 23:39 [Bug c++/57854] New: Would like to have a warning for virtual overrides without C++11 "override" keyword thiago at kde dot org
2013-07-09  9:29 ` [Bug c++/57854] " manu at gcc dot gnu.org
2013-07-09  9:36 ` redi at gcc dot gnu.org
2013-07-09  9:50 ` manu at gcc dot gnu.org
2014-12-14 14:53 ` ville.voutilainen at gmail dot com
2015-01-13 15:57 ` ville.voutilainen at gmail dot com

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).