public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: tbsaunde+gcc@tbsaunde.org
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 1/2] add GCC_FINAL to ansidecl.h
Date: Mon, 10 Aug 2015 12:05:00 -0000	[thread overview]
Message-ID: <1439208314-7390-1-git-send-email-tbsaunde+gcc@tbsaunde.org> (raw)

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

Hi,

This allows classes and virtual functions to be marked as final if the compiler
supports C++11, or is gcc 4.7 or later.

bootstrapped + regtested on x86_64-linux-gnu, ok?

Trev

include/ChangeLog:

2015-08-10  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* ansidecl.h (GCC_FINAL): New macro.
---
 include/ansidecl.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/ansidecl.h b/include/ansidecl.h
index 224627d..6e4bfc2 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -313,6 +313,15 @@ So instead we use the macro below and test it against specific values.  */
 #define ENUM_BITFIELD(TYPE) unsigned int
 #endif
 
+    /* This is used to mark a class or virtual function as final.  */
+#if __cplusplus >= 201103L
+#define GCC_FINAL final
+#elif GCC_VERSION >= 4007
+#define GCC_FINAL __final
+#else
+#define GCC_FINAL
+#endif
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.4.0

             reply	other threads:[~2015-08-10 12:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 12:05 tbsaunde+gcc [this message]
2015-08-10 12:06 ` [PATCH 2/2] replace several uses of the anon namespace with GCC_FINAL tbsaunde+gcc
2015-08-10 13:56   ` Markus Trippelsdorf
2015-08-10 14:45     ` Trevor Saunders
2015-08-11 19:23   ` Jeff Law
2015-08-12 18:57     ` Richard Sandiford
2015-08-12 19:03       ` Jeff Law
2015-08-12 20:36         ` Trevor Saunders
2015-08-13 17:33           ` Mikhail Maltsev
2015-08-14 22:56             ` Trevor Saunders
2015-08-13 20:23           ` Richard Sandiford
2015-08-12 23:58         ` Markus Trippelsdorf
2015-08-13  1:05           ` David Malcolm
2015-08-11 19:22 ` [PATCH 1/2] add GCC_FINAL to ansidecl.h Jeff Law

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=1439208314-7390-1-git-send-email-tbsaunde+gcc@tbsaunde.org \
    --to=tbsaunde+gcc@tbsaunde.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).