Commit Graph

18 Commits

Author SHA1 Message Date
Raul Tambre
2038f2c2b1 C++26: Support detection as the default standard
This was missed in commit f808d8afb9 (CMake: Support upcoming C++26
language level, 2022-08-19, v3.25.0-rc1~218^2).
2024-04-16 15:34:57 -04:00
Brad King
58cd9ee03c Tests/CompileFeatures: Factor out headers to compute C and C++ standard levels 2024-04-05 07:38:56 -04:00
Brad King
80a5a86514 GNU: Fix detection of C++ 11 mode in GCC 4.{4,5,6}
These versions of the compiler have experimental C++11 support and so do
not define `__cplusplus` correctly, but do define a feature macro we can
use to distinguish this mode.
2024-04-05 07:38:14 -04:00
Brad King
c9cc3dc646 PGI: Fix detection of C++ 14/17 modes
The PGI compiler is based on EDG.  Share conditions with Intel Classic.
2024-04-05 07:38:06 -04:00
Brad King
7f05d472a2 NVHPC: Fix detection of C++ 20 mode on NVHPC < 22.7
This compiler does not always define `__cplusplus` correctly, but does
define a feature macro that we can use to distinguish this mode.
2024-04-05 07:37:03 -04:00
Brad King
3587579f34 XL/XLClang: Fix detection of C++ 14 mode on Linux
This compiler does not always define `__cplusplus` correctly, but does
define a feature macro that we can use to distinguish this mode.
2024-04-04 17:56:31 -04:00
Brad King
863cde8c19 Intel: Fix detection of C++ 14/17 modes on Linux/macOS
The Intel Classic C++ compiler is based on EDG.  It does not always
define `__cplusplus` correctly, but does define feature macros that we
can use to distinguish these modes.
2024-04-04 17:56:02 -04:00
Brad King
1e774a86d3 Intel: Fix detection of C++ 17/20 modes on Windows
The Intel Classic C++ compiler for Windows does not always define
`_MSVC_LANG` correctly, but does define feature macros that we can use
to distinguish these modes.
2024-04-04 16:48:46 -04:00
Brad King
b9d4db7098 CompilerId: Clarify C and C++ standard level detection
Use named constants.  Regularize comparison patterns.
2024-04-04 15:13:17 -04:00
Raul Tambre
9f3c70a333 CUDA, CXX, OBJCXX: C++23 support with Clang 12
Clang 12 landed initial support for C++23 language mode flag -std={c|gnu}++2b
in commit 6627a3c2873fdf7ccba1a1573371079be48b36e8.
2020-12-08 18:43:59 +02:00
Brad King
847e8bc98c Intel: Fix default C++ dialect detection on Windows
For the Intel Compiler for Windows we have some subtle preprocessor
checks in compiler feature detection to detect C++11 and C++14 modes.
Use these when detecting the default C++ dialect too.
2019-10-10 13:14:42 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2018-06-01 09:53:42 -04:00
Brad King
7fe580a362 Features: Add infrastructure for C++ 20 language standard
Issue: #17849
2018-03-27 07:40:54 -04:00
Brad King
131c721f54 MSVC: Add flags for C++ language standards
Visual Studio 2015 Update 3 introduced the notion of language standard
levels to MSVC.  The language standard level is defined in `_MSVC_LANG`
instead of `__cplusplus`.  It also added support for the `-std:c++14`
and `-std:c++latest` flags, although the compiler defaults to its C++14
mode anyway.  Visual Studio 2017 Update 3 will introduce support for the
`-std:c++17` flag.

Fixes: #16482
2017-07-17 10:48:43 -04:00
Brad King
ae1a6815b6 Features: Add infrastructure for C++ 17 language standard
Issue: #16468
2016-12-02 11:22:46 -05:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Stephen Kelly
1f4649e62f Features: Update the default_dialect test for old GNU-like compilers.
Prior to GNU 4.7, GNU defined __cplusplus incorrectly, and defined
__GXX_EXPERIMENTAL_CXX0X__ in C++11 mode.
2015-01-15 22:13:22 +01:00
Stephen Kelly
a3d0ae1758 Features: Fix the default C dialect for Clang and GNU.
Clang 3.4 uses C99 by default, and Clang 3.6 uses C11 by default:

 http://thread.gmane.org/gmane.comp.compilers.clang.devel/39379

GNU 4.9 uses C90 by default, and GNU 5.0 uses C11 by default:

 https://gcc.gnu.org/gcc-5/changes.html

Test that the default compiler settings result in the expected dialect
macros being defined for both C and CXX.  Remove the unused main.c
file from the CompileFeatures unit test.
2014-11-20 18:24:59 +01:00