Remove several unnecessary things
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 15 Jan 2019 19:37:41 +0000 (20:37 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 16 Jan 2019 05:27:51 +0000 (06:27 +0100)
More modern cmake requirements mean we don't need to
include some files.

Some TODO comments cannot be addressed in the forecast manner

Simplified some code

Refs #2505, #2831

Change-Id: I3593a072da0ece9b993c7f531ae43fd9fff4afc2

CMakeLists.txt
cmake/CheckCCompilerFlag.cmake [deleted file]
cmake/CheckCXXCompilerFlag.cmake [deleted file]
src/api/cpp/session.cpp
src/gromacs/mdlib/stophandler.cpp

index 1b15aaf05a8cb3f800bfb8f081c806e47ae2e766..44ca7ade08d35796bd4d7ac654cbe8c48e0da1d7 100644 (file)
@@ -146,21 +146,6 @@ set(GMX_STDLIB_LIBRARIES "" CACHE STRING "Linker libraries for a particular C++
 mark_as_advanced(GMX_STDLIB_CXX_FLAGS)
 mark_as_advanced(GMX_STDLIB_LIBRARIES)
 
-########################################################################
-# Detect CXX11 support and flags
-########################################################################
-# The cmake/Check{C,CXX}CompilerFlag.cmake files in the GROMACS distribution
-# are used with permission from CMake v3.0.0 so that GROMACS can detect
-# invalid options with the Intel Compilers, and we have added a line
-# to detect warnings with the Fujitsu compilers on K computer and ICC.
-# CMake-3.0 also has a bug where the FAIL_REGEX pattern for AIX contains
-# a semicolon. Since this is also used as a separator in lists inside CMake,
-# that string ends up being split into two separate patterns, and the last
-# part is just a single word that also matches other messages. We solved this
-# by replacing the semicolon with a period that matches any character.
-#
-# These files should be removed from the source tree when a CMake version that
-# includes the features in question becomes required for building GROMACS.
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 
diff --git a/cmake/CheckCCompilerFlag.cmake b/cmake/CheckCCompilerFlag.cmake
deleted file mode 100644 (file)
index 5c7d436..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-# - Check whether the C compiler supports a given flag.
-# CHECK_C_COMPILER_FLAG(<flag> <var>)
-#  <flag> - the compiler flag
-#  <var>  - variable to store the result
-# This internally calls the check_c_source_compiles macro.
-# See help for CheckCSourceCompiles for a listing of variables
-# that can modify the build.
-
-#=============================================================================
-# Copyright 2006-2011 Kitware, Inc.
-# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
-# Copyright 2011 Matthias Kretz <kretz@kde.org>
-#
-# ORIGINAL Copyright notice (from Copyright.txt):
-#
-# CMake - Cross Platform Makefile Generator
-# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
-# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-# * Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# 
-# * Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-#
-# * Neither the names of Kitware, Inc., the Insight Software Consortium,
-#   nor the names of their contributors may be used to endorse or promote
-#   products derived from this software without specific prior written
-#   permission.
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#=============================================================================
-
-INCLUDE(CheckCSourceCompiles)
-
-MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
-   SET(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
-   SET(CMAKE_REQUIRED_FLAGS "${_FLAG}")
-   CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT}
-     # Some compilers do not fail with a bad flag
-     FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU
-     FAIL_REGEX "unrecognized .*option"                     # GNU
-     FAIL_REGEX "unknown .*option"                          # Clang
-     FAIL_REGEX "ignoring unknown option"                   # MSVC
-     FAIL_REGEX "warning D9002"                             # MSVC, any lang
-     FAIL_REGEX "option.*not supported"                     # Intel
-     FAIL_REGEX "invalid argument .*option"                 # Intel
-     FAIL_REGEX "ignoring option .*argument required"       # Intel
-     FAIL_REGEX "[Uu]nknown option"                         # HP
-     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
-     FAIL_REGEX "command option .* is not recognized"       # XL
-     FAIL_REGEX "command option .* contains an incorrect subargument" # XL
-     FAIL_REGEX "not supported in this configuration. ignored" # AIX
-     FAIL_REGEX "File with unknown suffix passed to linker" # PGI
-     FAIL_REGEX "WARNING: unknown flag:"                    # Open64
-     FAIL_REGEX "Incorrect command line option:"            # Borland
-     FAIL_REGEX "Warning: illegal option"                   # SunStudio 12
-     FAIL_REGEX "[Ww]arning: Invalid"                       # Fujitsu
-     )
-   SET (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
-ENDMACRO (CHECK_C_COMPILER_FLAG)
diff --git a/cmake/CheckCXXCompilerFlag.cmake b/cmake/CheckCXXCompilerFlag.cmake
deleted file mode 100644 (file)
index f11a835..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-# - Check whether the CXX compiler supports a given flag.
-# CHECK_CXX_COMPILER_FLAG(<flag> <var>)
-#  <flag> - the compiler flag
-#  <var>  - variable to store the result
-# This internally calls the check_cxx_source_compiles macro.  See help
-# for CheckCXXSourceCompiles for a listing of variables that can
-# modify the build.
-
-#=============================================================================
-# Copyright 2006-2010 Kitware, Inc.
-# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
-# Copyright 2011 Matthias Kretz <kretz@kde.org>
-#
-# ORIGINAL Copyright notice (from Copyright.txt):
-#
-# CMake - Cross Platform Makefile Generator
-# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
-# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-# * Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# 
-# * Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-#
-# * Neither the names of Kitware, Inc., the Insight Software Consortium,
-#   nor the names of their contributors may be used to endorse or promote
-#   products derived from this software without specific prior written
-#   permission.
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#=============================================================================
-
-INCLUDE(CheckCXXSourceCompiles)
-
-MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
-   SET(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
-   SET(CMAKE_REQUIRED_FLAGS "${_FLAG}")
-   CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
-     # Some compilers do not fail with a bad flag
-     FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU
-     FAIL_REGEX "unrecognized .*option"                     # GNU
-     FAIL_REGEX "unknown .*option"                          # Clang
-     FAIL_REGEX "ignoring unknown option"                   # MSVC
-     FAIL_REGEX "warning D9002"                             # MSVC, any lang
-     FAIL_REGEX "option.*not supported"                     # Intel
-     FAIL_REGEX "invalid argument .*option"                 # Intel
-     FAIL_REGEX "ignoring option .*argument required"       # Intel
-     FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
-     FAIL_REGEX "[Uu]nknown option"                         # HP
-     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
-     FAIL_REGEX "command option .* is not recognized"       # XL
-     FAIL_REGEX "command option .* contains an incorrect subargument" # XL
-     FAIL_REGEX "not supported in this configuration. ignored" # AIX
-     FAIL_REGEX "File with unknown suffix passed to linker" # PGI
-     FAIL_REGEX "WARNING: unknown flag:"                    # Open64
-     FAIL_REGEX "Incorrect command line option:"            # Borland
-     FAIL_REGEX "Warning: illegal option"                   # SunStudio 12
-     FAIL_REGEX "[Ww]arning: Invalid"                       # Fujitsu
-     )
-   SET (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
-ENDMACRO (CHECK_CXX_COMPILER_FLAG)
-
index 9d601e1161863ac8b64240473a8dbea08e60e911..e1abb57b7370fc0fbc18a7761b00065ff389a0c4 100644 (file)
@@ -191,15 +191,13 @@ std::unique_ptr<SessionImpl> SessionImpl::create(std::shared_ptr<ContextImpl>  c
                                                  gmx::LogFilePtr               logFilehandle,
                                                  gmx_multisim_t              * multiSim)
 {
-    using gmx::compat::make_unique;
     // We should be able to get a communicator (or subcommunicator) through the
     // Context.
-    std::unique_ptr<SessionImpl> impl = make_unique<SessionImpl>(std::move(context),
-                                                                 std::move(runnerBuilder),
-                                                                 simulationContext,
-                                                                 std::move(logFilehandle),
-                                                                 multiSim);
-    return impl;
+    return gmx::compat::make_unique<SessionImpl>(std::move(context),
+                                                 std::move(runnerBuilder),
+                                                 simulationContext,
+                                                 std::move(logFilehandle),
+                                                 multiSim);
 }
 
 SessionImpl::SessionImpl(std::shared_ptr<ContextImpl>  context,
index 39babd5e072b452e3c3b26473ea308bf04b349c5..3602f26d2856ef418a3f62d803cb07b74dc911b6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -187,8 +187,8 @@ std::unique_ptr<StopHandler> StopHandlerBuilder::getStopHandlerMD (
 {
     if (!GMX_THREAD_MPI || isMaster)
     {
-        // TODO: Use unique_ptr once we switch to C++14 (unique_ptr can not easily be
-        //       captured in lambda functions in C++11)
+        // Using shared ptr because move-only callable not supported by std::function.
+        // Would require replacement such as fu2::function or cxx_function.
         auto stopConditionSignal = std::make_shared<StopConditionSignal>(
                     nstList, makeBinaryReproducibleSimulation, nstSignalComm);
         registerStopCondition(
@@ -198,8 +198,6 @@ std::unique_ptr<StopHandler> StopHandlerBuilder::getStopHandlerMD (
 
     if (isMaster && maximumHoursToRun > 0)
     {
-        // TODO: Use unique_ptr once we switch to C++14 (unique_ptr can not easily be
-        //       captured in lambda functions in C++11)
         auto stopConditionTime = std::make_shared<StopConditionTime>(
                     nstList, maximumHoursToRun, nstSignalComm);
         registerStopCondition(