Skip to content

Commit

Permalink
Usage of C++11 final keyword.
Browse files Browse the repository at this point in the history
  • Loading branch information
asfernandes committed Sep 2, 2016
1 parent 33198c6 commit 3533997
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
#include "fb_macros.h"
#include "fb_types.h"

#if (__cplusplus >= 201103L)
#define CPP_11
#endif

/*****************************************************
* Linux platforms
*****************************************************/
Expand Down Expand Up @@ -886,6 +890,9 @@ void GDS_breakpoint(int);
#endif

// Check for "final" keyword support

This comment has been minimized.

Copy link
@AlexPeshkoff

AlexPeshkoff Sep 2, 2016

Member

Adriano, do we still try to keep support for non c++11 (may be I've missed something in discussion) ?

This comment has been minimized.

Copy link
@aafemt

aafemt Sep 2, 2016

Contributor

Even if we keep that support, it is much better to define "final" to an empty string for old compilers than pollute code with FB_FINAL which isn't handled by MSVC intellisense well.

This comment has been minimized.

Copy link
@asfernandes

asfernandes Sep 2, 2016

Author Member

This specific feature, final, could be as I done with "override", just use it as "final", as for non-conforming compiler defined as nothing.

@AlexPeshkoff for the others features, compilers not supporting the subset we blessed, will not work for sure.

#ifdef CPP_11
#define FB_FINAL final
#else
#ifdef __GNUC__
#if ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ >= 5))
#define FB_FINAL __final
Expand All @@ -895,6 +902,7 @@ void GDS_breakpoint(int);
#ifndef FB_FINAL
#define FB_FINAL
#endif
#endif

#define FB_UNUSED(value) do { if (value) {} } while (false)
#define FB_UNUSED_VAR(value) (void) value
Expand Down

0 comments on commit 3533997

Please sign in to comment.