View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016042CMakeModulespublic2016-03-31 11:282016-06-10 14:21
ReporterDaniele E. Domenichelli 
Assigned ToStephen Kelly 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product VersionCMake 3.5 
Target VersionFixed in Version 
Summary0016042: WriteCompilerDetectionHeader does not define YARP_DEFAULTED_FUNCTION
Descriptionwrite_compiler_detection_header(
  FILE "${CMAKE_CURRENT_BINARY_DIR}/compiler_detection.h"
  PREFIX FOO
  COMPILERS
    GNU
  FEATURES
    cxx_deleted_functions
    cxx_defaulted_functions)


Generates the following defines

* YARP_DELETED_FUNCTION ("= delete" or empty if not supported)


I'd expect to see YARP_DEFAULTED_FUNCTION defined in this way (or something similar):

* YARP_DEFAULTED_FUNCTION ("= default" or "{}" if not supported)


Is there some drawback in doing so?
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0040776)
Brad King (manager)
2016-03-31 11:36

Steve, was this just an oversight in the implementation?
(0040780)
Stephen Kelly (developer)
2016-03-31 13:18

struct A
{
  int i;
  A(int val = 0) : i(val) {}
  A(A const&) {}
};

is not the same as

struct A
{
  int i;
  A(int val = 0) : i(val) {}
  A(A const& other) = default;
};

Please re-open if you can show how the macro would be used in a valid way.
(0040781)
Stephen Kelly (developer)
2016-03-31 13:21

For completeness,

struct A
{
  int i;
  A(int val = 0) : i(val) {}

private:
  A(A const&) = delete;
  A& operator=(A const&) = delete;
};

and

struct A
{
  int i;
  A(int val = 0) : i(val) {}

private:
  A(A const&);
  A& operator=(A const&);
};

are both sensible (but the compiler can give a better message for the = delete). See Q_DISABLE_COPY. I submitted a Q_DISABLE_COPY-like macro when writing WriteCompilerDetectionHeader, but it was rejected. Brad was doing reviews off-list unfortunately, so I can't link you to it, but here is the relevant part:

On 05/09/2014 08:35 PM, Brad King wrote:
> Later in the Feature/Define table, I see:
>
> > # ``cxx_deleted_functions`` ``@PREFIX@_DISABLE_COPY``
>
> and in the test header I see:
>
> > # define TEST_DISABLE_COPY(X) \
> > private: \
> > X(X const&) TEST_DELETED_FUNCTION; \
> > X& operator=(X const&) TEST_DELETED_FUNCTION;
>
> IMO this is too involved to provide as an API from CMake.
> I never like when macros hide access specifiers either.
> This looks like more of a convenience macro since its
> implementation is not dependent on the compiler. The
> code can easily be spelled out in a project and will
> be clearer. Let's drop this macro.
(0041209)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-03-31 11:28 Daniele E. Domenichelli New Issue
2016-03-31 11:36 Brad King Note Added: 0040776
2016-03-31 13:18 Stephen Kelly Note Added: 0040780
2016-03-31 13:18 Stephen Kelly Status new => resolved
2016-03-31 13:18 Stephen Kelly Resolution open => no change required
2016-03-31 13:18 Stephen Kelly Assigned To => Stephen Kelly
2016-03-31 13:21 Stephen Kelly Note Added: 0040781
2016-06-10 14:21 Kitware Robot Note Added: 0041209
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team