From 618753c5b4f0e8fb3a422fa372c1ef37eae9b596 Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Fri, 5 Aug 2016 16:28:19 +0100 Subject: [PATCH] C++11: Update compilation rules to specify C++11 support and conformance The change from C++0x to C++11 allows all of C++11 functionality to be used in OpenFOAM, in particular constructor delegation which avoids code duplication or constructor helper functions. However, this also means a change to the minimum gcc version supported which is now 4.7 rather than 4.5. Note that gcc-4.7 does not support the entire C++11 standard but does support all of the functionality currently needed for further OpenFOAM development. The minimum gcc-version which supports the entire C++11 standard is 4.8 which is now the recommended minimum gcc version. --- etc/config.csh/settings | 6 ------ etc/config.sh/compiler | 6 ------ wmake/rules/linux64Clang/c++ | 2 +- wmake/rules/linux64Gcc/c++ | 2 +- wmake/rules/linux64GccKNL/c++ | 2 +- wmake/rules/linux64Icc/c++ | 2 +- wmake/rules/linux64IccKNL/c++ | 2 +- wmake/rules/linuxARM7Gcc/c++ | 2 +- wmake/rules/linuxClang/c++ | 2 +- wmake/rules/linuxGcc/c++ | 2 +- wmake/rules/linuxIA64Gcc/c++ | 2 +- wmake/rules/linuxIA64Icc/c++ | 2 +- wmake/rules/linuxIcc/c++ | 2 +- wmake/rules/linuxPPC64Gcc/c++ | 2 +- wmake/rules/linuxPPC64leGcc/c++ | 2 +- wmake/rules/solaris64Gcc/c++ | 2 +- wmake/rules/solarisGcc/c++ | 2 +- 17 files changed, 15 insertions(+), 27 deletions(-) diff --git a/etc/config.csh/settings b/etc/config.csh/settings index c1fbd06432..282558a88d 100644 --- a/etc/config.csh/settings +++ b/etc/config.csh/settings @@ -225,12 +225,6 @@ case ThirdParty: case Gcc48: set gcc_version=gcc-4.8.5 breaksw - case Gcc45: - set gcc_version=gcc-4.5.4 - breaksw - case Gcc46: - set gcc_version=gcc-4.6.4 - breaksw case Gcc47: set gcc_version=gcc-4.7.4 breaksw diff --git a/etc/config.sh/compiler b/etc/config.sh/compiler index beba1e542d..6a941352b5 100644 --- a/etc/config.sh/compiler +++ b/etc/config.sh/compiler @@ -42,12 +42,6 @@ OpenFOAM | ThirdParty) Gcc | Gcc48) gcc_version=gcc-4.8.5 ;; - Gcc45) - gcc_version=gcc-4.5.4 - ;; - Gcc46) - gcc_version=gcc-4.6.4 - ;; Gcc47) gcc_version=gcc-4.7.4 ;; diff --git a/wmake/rules/linux64Clang/c++ b/wmake/rules/linux64Clang/c++ index 84ed0f4107..1b51566179 100644 --- a/wmake/rules/linux64Clang/c++ +++ b/wmake/rules/linux64Clang/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-tautological-undefined-compare -Wno-shift-negative-value -CC = clang++ -std=c++0x -m64 +CC = clang++ -std=c++11 -m64 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linux64Gcc/c++ b/wmake/rules/linux64Gcc/c++ index a47d0d499a..fd17d5b805 100644 --- a/wmake/rules/linux64Gcc/c++ +++ b/wmake/rules/linux64Gcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++0x -m64 +CC = g++ -std=c++11 -m64 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linux64GccKNL/c++ b/wmake/rules/linux64GccKNL/c++ index ed1ad0de52..a16731b749 100644 --- a/wmake/rules/linux64GccKNL/c++ +++ b/wmake/rules/linux64GccKNL/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++0x -m64 -march=knl -DvectorMachine -DKNL +CC = g++ -std=c++11 -m64 -march=knl -DvectorMachine -DKNL include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linux64Icc/c++ b/wmake/rules/linux64Icc/c++ index 6eb5d22b4a..df0ba70fdb 100644 --- a/wmake/rules/linux64Icc/c++ +++ b/wmake/rules/linux64Icc/c++ @@ -6,7 +6,7 @@ c++WARN = -Wall -Wextra -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invali # Suppress some warnings for flex++ and CGAL c++LESSWARN = -diag-disable 1224,2026,2305 -CC = icpc -std=c++0x -fp-trap=common -fp-model precise +CC = icpc -std=c++11 -fp-trap=common -fp-model precise include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linux64IccKNL/c++ b/wmake/rules/linux64IccKNL/c++ index 1cef033388..0a2eb83915 100644 --- a/wmake/rules/linux64IccKNL/c++ +++ b/wmake/rules/linux64IccKNL/c++ @@ -6,7 +6,7 @@ c++WARN = -Wall -Wextra -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invali # Suppress some warnings for flex++ and CGAL c++LESSWARN = -diag-disable 1224,2026,2305 -CC = icpc -std=c++0x -fp-trap=common -fp-model precise -fp-speculation=safe -DKNL +CC = icpc -std=c++11 -fp-trap=common -fp-model precise -fp-speculation=safe -DKNL include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxARM7Gcc/c++ b/wmake/rules/linuxARM7Gcc/c++ index 80fccf2710..0a7cc5b7fe 100644 --- a/wmake/rules/linuxARM7Gcc/c++ +++ b/wmake/rules/linuxARM7Gcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++0x +CC = g++ -std=c++11 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxClang/c++ b/wmake/rules/linuxClang/c++ index b029fbcfd7..b2001baf2e 100644 --- a/wmake/rules/linuxClang/c++ +++ b/wmake/rules/linuxClang/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedef -Wno-tautological-undefined-compare -Wno-shift-negative-value -CC = clang++ -std=c++0x -m32 +CC = clang++ -std=c++11 -m32 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxGcc/c++ b/wmake/rules/linuxGcc/c++ index c1c34a8419..38201d2c50 100644 --- a/wmake/rules/linuxGcc/c++ +++ b/wmake/rules/linuxGcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++0x -m32 +CC = g++ -std=c++11 -m32 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxIA64Gcc/c++ b/wmake/rules/linuxIA64Gcc/c++ index 6d152ecd1a..2f8c58892f 100644 --- a/wmake/rules/linuxIA64Gcc/c++ +++ b/wmake/rules/linuxIA64Gcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++0x +CC = g++ -std=c++11 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxIA64Icc/c++ b/wmake/rules/linuxIA64Icc/c++ index a8a9341e1a..f2f7278db6 100644 --- a/wmake/rules/linuxIA64Icc/c++ +++ b/wmake/rules/linuxIA64Icc/c++ @@ -6,7 +6,7 @@ c++WARN = -Wall -Wextra -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invali # Suppress some warnings for flex++ and CGAL c++LESSWARN = -diag-disable 1224,2026,2305 -CC = icpc -std=c++0x +CC = icpc -std=c++11 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxIcc/c++ b/wmake/rules/linuxIcc/c++ index 0f749883c5..1f46c67f53 100644 --- a/wmake/rules/linuxIcc/c++ +++ b/wmake/rules/linuxIcc/c++ @@ -6,7 +6,7 @@ c++WARN = -Wall -Wextra -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invali # Suppress some warnings for flex++ and CGAL c++LESSWARN = -diag-disable 1224,2026,2305 -CC = icpc -std=c++0x -fp-trap=common -fp-model precise +CC = icpc -std=c++11 -fp-trap=common -fp-model precise include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxPPC64Gcc/c++ b/wmake/rules/linuxPPC64Gcc/c++ index 7c33079384..b32a38f19e 100644 --- a/wmake/rules/linuxPPC64Gcc/c++ +++ b/wmake/rules/linuxPPC64Gcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++0x -m64 -mcpu=power5+ +CC = g++ -std=c++11 -m64 -mcpu=power5+ include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/linuxPPC64leGcc/c++ b/wmake/rules/linuxPPC64leGcc/c++ index 805f821822..e97ed991a2 100644 --- a/wmake/rules/linuxPPC64leGcc/c++ +++ b/wmake/rules/linuxPPC64leGcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds -CC = g++ -std=c++0x -m64 -mcpu=power8 +CC = g++ -std=c++11 -m64 -mcpu=power8 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/solaris64Gcc/c++ b/wmake/rules/solaris64Gcc/c++ index 324522f10b..20b9a01368 100644 --- a/wmake/rules/solaris64Gcc/c++ +++ b/wmake/rules/solaris64Gcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -CC = g++ -std=c++0x -m64 +CC = g++ -std=c++11 -m64 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/rules/solarisGcc/c++ b/wmake/rules/solarisGcc/c++ index d8e968fb9f..cc4f8fd71c 100644 --- a/wmake/rules/solarisGcc/c++ +++ b/wmake/rules/solarisGcc/c++ @@ -5,7 +5,7 @@ c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-para # Suppress some warnings for flex++ and CGAL c++LESSWARN = -CC = g++ -std=c++0x +CC = g++ -std=c++11 include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) -- GitLab