public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h
       [not found] <CAFiYyc2qy-_=JKfMhCDWk8bKm9KT_=O6qR-xQ4HzxUCX3SXYgA@mail.gmail.com>
@ 2022-05-23 23:42 ` David Malcolm
  2022-05-24  7:39   ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: David Malcolm @ 2022-05-23 23:42 UTC (permalink / raw)
  To: Richard Biener, gcc-patches, gdb-patches, binutils; +Cc: David Malcolm

libiberty's ansidecl.h provides macros FINAL and OVERRIDE to allow
virtual functions to be labelled with the C++11 "final" and "override"
specifiers, but with empty implementations on pre-C++11 C++ compilers.

We've used the macros in many places in GCC, but as of as of GCC 11
onwards GCC has required a C++11 compiler, such as GCC 4.8 or later.
On the assumption that any such compiler correctly implements "final"
and "override", I've recently simplified GCC's codebase by replacing all
uses of the FINAL and OVERRIDE macros in GCC's source tree with the
lower-case specifiers (via commits r13-690-gff171cb13df671 and
r13-716-g8473ef7be60443).

Here's a patch to eliminate the macros from ansidecl.h which I was
hoping to apply to GCC to complete this transition - but ansidecl.h is
shared with other projects.

I've successfully bootstrapped & regrtested GCC trunk on
x86_64-pc-linux-gnu with this patch.

Of the various other GNU projects using libiberty implemented in C++,
does anyone support being built with a pre-C++11 compiler, or does
everyone assume C++11 or later?  Is anyone else still using these
macros?

Any objections, or is there a reason to keep these macros that I'm
not aware of?  (and did I send this to all the pertinent lists?)

Thanks
Dave

include/ChangeLog:
	* ansidecl.h: Drop macros OVERRIDE and FINAL.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 include/ansidecl.h | 41 -----------------------------------------
 1 file changed, 41 deletions(-)

diff --git a/include/ansidecl.h b/include/ansidecl.h
index 46fe3ffabd9..056a03ebb6e 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -321,47 +321,6 @@ So instead we use the macro below and test it against specific values.  */
 #define CONSTEXPR
 #endif
 
-/* C++11 adds the ability to add "override" after an implementation of a
-   virtual function in a subclass, to:
-     (A) document that this is an override of a virtual function
-     (B) allow the compiler to issue a warning if it isn't (e.g. a mismatch
-         of the type signature).
-
-   Similarly, it allows us to add a "final" to indicate that no subclass
-   may subsequently override the vfunc.
-
-   Provide OVERRIDE and FINAL as macros, allowing us to get these benefits
-   when compiling with C++11 support, but without requiring C++11.
-
-   For gcc, use "-std=c++11" to enable C++11 support; gcc 6 onwards enables
-   this by default (actually GNU++14).  */
-
-#if defined __cplusplus
-# if __cplusplus >= 201103
-   /* C++11 claims to be available: use it.  Final/override were only
-      implemented in 4.7, though.  */
-#  if GCC_VERSION < 4007
-#   define OVERRIDE
-#   define FINAL
-#  else
-#   define OVERRIDE override
-#   define FINAL final
-#  endif
-# elif GCC_VERSION >= 4007
-   /* G++ 4.7 supports __final in C++98.  */
-#  define OVERRIDE
-#  define FINAL __final
-# else
-   /* No C++11 support; leave the macros empty.  */
-#  define OVERRIDE
-#  define FINAL
-# endif
-#else
-  /* No C++11 support; leave the macros empty.  */
-# define OVERRIDE
-# define FINAL
-#endif
-
 /* A macro to disable the copy constructor and assignment operator.
    When building with C++11 and above, the methods are explicitly
    deleted, causing a compile-time error if something tries to copy.
-- 
2.26.3


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

* Re: [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h
  2022-05-23 23:42 ` [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h David Malcolm
@ 2022-05-24  7:39   ` Alan Modra
  2022-05-24 14:10     ` David Malcolm
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2022-05-24  7:39 UTC (permalink / raw)
  To: David Malcolm; +Cc: Richard Biener, gcc-patches, gdb-patches, binutils

On Mon, May 23, 2022 at 07:42:29PM -0400, David Malcolm via Binutils wrote:
> Any objections, or is there a reason to keep these macros that I'm
> not aware of?  (and did I send this to all the pertinent lists?)

No objection from me.  These macros are not used anywhere in
binutils-gdb.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h
  2022-05-24  7:39   ` Alan Modra
@ 2022-05-24 14:10     ` David Malcolm
  2022-05-24 14:12       ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: David Malcolm @ 2022-05-24 14:10 UTC (permalink / raw)
  To: Alan Modra; +Cc: Richard Biener, gcc-patches, gdb-patches, binutils

On Tue, 2022-05-24 at 17:09 +0930, Alan Modra wrote:
> On Mon, May 23, 2022 at 07:42:29PM -0400, David Malcolm via Binutils
> wrote:
> > Any objections, or is there a reason to keep these macros that I'm
> > not aware of?  (and did I send this to all the pertinent lists?)
> 
> No objection from me.  These macros are not used anywhere in
> binutils-gdb.

Thanks Alan.

Richard, is the updated patch OK for gcc trunk? [1]


Thanks
Dave

[1] https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595453.html




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

* Re: [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h
  2022-05-24 14:10     ` David Malcolm
@ 2022-05-24 14:12       ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2022-05-24 14:12 UTC (permalink / raw)
  To: David Malcolm; +Cc: Alan Modra, GCC Patches, gdb-patches, Binutils

On Tue, May 24, 2022 at 4:10 PM David Malcolm <dmalcolm@redhat.com> wrote:
>
> On Tue, 2022-05-24 at 17:09 +0930, Alan Modra wrote:
> > On Mon, May 23, 2022 at 07:42:29PM -0400, David Malcolm via Binutils
> > wrote:
> > > Any objections, or is there a reason to keep these macros that I'm
> > > not aware of?  (and did I send this to all the pertinent lists?)
> >
> > No objection from me.  These macros are not used anywhere in
> > binutils-gdb.
>
> Thanks Alan.
>
> Richard, is the updated patch OK for gcc trunk? [1]

Sure.

Thanks,
Richard.

>
> Thanks
> Dave
>
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595453.html
>
>
>

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

end of thread, other threads:[~2022-05-24 14:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAFiYyc2qy-_=JKfMhCDWk8bKm9KT_=O6qR-xQ4HzxUCX3SXYgA@mail.gmail.com>
2022-05-23 23:42 ` [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h David Malcolm
2022-05-24  7:39   ` Alan Modra
2022-05-24 14:10     ` David Malcolm
2022-05-24 14:12       ` Richard Biener

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