Opened 3 years ago

Closed 3 years ago

#5066 closed enhancement (complete)

enforce C++11

Reported by: fdupont Owned by: fdupont
Priority: high Milestone: Kea1.2
Component: build system Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

Subtickets

Change History (6)

comment:1 Changed 3 years ago by fdupont

From #4631 about this ticket:

  1. Remove -Wno-deprecated from the compiler flags
  2. Add the code to configure.ac needed to enforce C++11 compilation.

=> we have not yet reached an agreement about this point.

  1. To allow users to continue using log4cplus 1.x, add a check in configure.ac to see what version of log4cplus is being used and set a macro in config.h based on that. Add #ifdefs to the relevant src/lib/log files to allow for either auto_ptr/unique_ptr. (We could also modify src/lib/log/Makefile.am to use -Wno-deprecated if building logging for log4cplus 1.x)

=> this is a variation / addition to #4636

  1. Add a check in configure.ac to check for the version of gtest installed is the user wants to build the tests as well.

=> as far as I know it was done in (merged) #5051

comment:2 Changed 3 years ago by fdupont

  • Owner set to fdupont
  • Status changed from new to accepted

comment:3 Changed 3 years ago by fdupont

  • Owner changed from fdupont to UnAssigned
  • Status changed from accepted to reviewing

Replaced auto_ptr by unique_ptr in code outside src/lib/log
Checked in configure.ac for unique_ptr and aggregate initialization (another C++11 feature to be used by simple parser) in configure and when failed try to add --std=c++11 or --std=c++0x or --std=c++1x to CXX
Added a =Wno-deprecated-declarations in src/lib/log/Makefile.am

Note the last point should be checked as my clang++ on macOS Xcode 8.1 never emits a warning on auto_ptr? I am resuming a Linux VM to check if it disables spurious warnings as expected.

Ready for review

comment:4 Changed 3 years ago by stephen

  • Owner changed from UnAssigned to stephen

comment:5 Changed 3 years ago by stephen

  • Owner changed from stephen to fdupont

Reviewed commit 818d58d73c27092563a244ececddcdd448e2cf70

configure.ac
When finding the correct set of flags for the C++ command, the loop logic is such that the first pass through will check with no flags, then on the second pass through the loop it will check with the flag listed as the first element in the "for" statement, the third pass with the second element and so on. The last element listed in the "for" statement will not be used as a flag in a test. This is OK but (1) please add a comment that behaviour - it is not intuitive and (2) make the final element something that is obviously not a flag (e.g. "terminating_element").

Please merge after you've made those changes, I don't need to see it again.

This will need a ChangeLog entry: perhaps something like:

Altered to compile in C++ 11 mode. Also replace (most) instances of the
deprecated std::auto_ptr with std::unique_ptr

comment:6 Changed 3 years ago by fdupont

  • Resolution set to complete
  • Status changed from reviewing to closed

Merged. Note I recommend to update Jenkins VMs even configure should find the right option when needed...

Note: See TracTickets for help on using tickets.