Ticket #4779 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Make Mantid compilable with c++11 (c++0x) option enabled in gcc

Reported by: Russell Taylor Owned by: Russell Taylor
Priority: trivial Milestone: Release 2.1
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Martyn Gigg

Description

A few minor changes are required for compilation to succeed with the -std=c++0x argument to gcc. They will not break the ability to build without this option.

The Intel compiler has the same option available, but it uses the gcc standard library. On the mac this means version 4.2.1, which pre-dates any c++11 changes, so the code already compiles without changes.

Change History

comment:1 Changed 9 years ago by Russell Taylor

  • Status changed from new to accepted

comment:2 Changed 9 years ago by Russell Taylor

No return-by-reference overload for std::complex::imag() in c++11.

This reworks the code to avoid the attempt to use such a method, and simplifies it as well by losing the #defines. Re #4779.

Changeset: 2409c6a77bb5c74079195b06fc8c9170b24d17d2

comment:3 Changed 9 years ago by Russell Taylor

Get around changes to std::pair constructor in GCC C++11. Re #4779.

This relates to the introduction of perfect forwarding constructors. It's not hard to work around this with code that should still work everywhere.

Changeset: 948341d7e62123b94aea55201925d388143f5711

comment:4 Changed 9 years ago by Russell Taylor

Small fix so that flags can be customized locally. Re #4779.

Changeset: 3f89d5fa35e2a975402ef114bd3721b28693c7b6

comment:5 Changed 9 years ago by Russell Taylor

Try to fix gcc 4.6.1 build (fedora 15). Re #4779.

Seems that this specific version of gcc (but no other) cannot choose between the copy and move constructors at this point.

Changeset: 13c6d347ce99eccd2547df0394637c069654748a

comment:6 Changed 9 years ago by Russell Taylor

A number of commits failed to make it into here:

comment:7 Changed 9 years ago by Russell Taylor

Clean up an unnecessarily ugly line. Re #4779.

Changeset: 3ee0ee9176be7655e9ec89406ee4f025cc64ba2b

comment:8 Changed 9 years ago by Russell Taylor

  • Status changed from accepted to verify
  • Resolution set to fixed

To test: make sure that the flag is present when building (use make VERBOSE=1 to see if --std=c++0x is there) and that the builds are succeeding - which they would not if the second change under comment:6 is still there.

comment:9 Changed 9 years ago by Russell Taylor

Clean up an unnecessarily ugly line. Re #4779.

Changeset: 3ee0ee9176be7655e9ec89406ee4f025cc64ba2b

comment:10 Changed 9 years ago by Russell Taylor

Use emplace_back to avoid copy constructor call for every event.

The previous commit (dd887c9) actually won't help because TofEvent is not movable (it uses composition). This change does, though only gcc implements it so far. That's the theory, but I have to admit I can't see a difference in run time. Re #4472, Re #4779.

Changeset: e87a472294ea8de6b3685aa7d3b8a47fc6eb3aed

comment:11 Changed 9 years ago by Russell Taylor

Use emplace_back to avoid copy constructor call for every event.

The previous commit (dd887c9) actually won't help because TofEvent is not movable (it uses composition). This change does, though only gcc implements it so far. That's the theory, but I have to admit I can't see a difference in run time. Re #4472, Re #4779.

Changeset: e87a472294ea8de6b3685aa7d3b8a47fc6eb3aed

comment:12 Changed 8 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:13 Changed 8 years ago by Martyn Gigg

We've got c++11 usage dotted around now and all the linux builds are fine.

comment:14 Changed 8 years ago by Martyn Gigg

  • Status changed from verifying to closed

comment:15 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 5626

Note: See TracTickets for help on using tickets.