Commit Graph

9 Commits

Author SHA1 Message Date
Kenneth Moreland
bd5b84fa90 Have VTKM_IS_TRIVIAL* macros show types better
Changed the definition of `VTKM_IS_TRIVIAL`,
`VTKM_IS_TRIVIALLY_COPYABLE` and the like to use internal structs to do
the static assert rather than have them do the static assert themselves.
This makes the compiler more likely to tell you the actual type being
checked rather. (At least, this was the case on my clang compiler.)
2021-04-02 07:37:26 -06:00
Matt Larsen
b64502e22d Merge topic 'identify_xl'
292ac2e4c clang is not is_trivially safe
8e588504f Merge branch 'identify_xl' of gitlab.kitware.com:mclarsen/vtk-m into identify_xl
9c5396394 Merge remote-tracking branch 'upstream/master' into identify_xl
8d8228f36 correct type in comment
4d7a08c18 add xl compiler identification

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@acm.org>
Merge-request: !2440
2021-03-20 13:00:53 -04:00
larsen30@llnl.gov
292ac2e4c1 clang is not is_trivially safe 2021-03-11 13:33:27 -08:00
Li-Ta Lo
b590a8ebb2 Add floating point atomics 2021-03-11 08:19:51 -07:00
Kenneth Moreland
80c1f0a974 Be more conservative about is_trivial support
`std::is_trivial` is part of the C++14 specification. However, we have
encountered multiple compilers that purport to implement C++14 but do
not implement `std::is_trivial` and the like checks correctly.

To avoid such issues, only use `std::is_trivial` on compilers that we
have tested to support it.
2021-03-01 15:12:27 -07:00
Kenneth Moreland
4a7aae86f9 Allow Variant to be trivial
Although `vtkm::internal::Variant` respected the trivially copyable
attribute of the types it contains, it was never totally trivial (i.e.
`std::is_trivial<Variant<...>>` was never true). The reason was that
`Variant` was initializing its `Index` parameter to signify that it was
not initialized. However, the fact that `Index` was initialized meant
that it was not trivially constructed.

Now, `Variant` type checks its types to see if they are all trivially
constructible. If so, it makes itself trivially constructible.

This means that `Index` may or may not be valid if `Variant` is
constructed without an argument. This in turn means that the result of
`Variant::IsValid` becomes undefined. That should be OK in practice.
`Index` will "point" to an uninitialized object, but that object is
trivially constructed anyway. However, that could cause problems if
developers used `IsValid` to determine if something is selected.
2020-09-22 16:22:37 -06:00
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Kenneth Moreland
dca8144345 Add vtkmstd::integer_sequence
`integer_sequence` is an essential tool when dealing with structures
like a `Tuple`. Make sure that we have one (even though it was not
introduced until C++14).
2020-03-16 17:12:16 -06:00
Kenneth Moreland
5773ea3e13 Add porting layer for future std features
Currently, VTK-m is using C++11. However, it is often useful to use
features in the `std` namespace that are defined for C++14 or later. We
can provide our own versions (sometimes), but it is preferable to use
the version provided by the compiler if available.

There were already some examples of defining portable versions of C++14
and C++17 classes in a `vtkmstd` namespace, but these were sprinkled
around the source code.

There is now a top level `vtkmstd` directory and in it are header files
that provide portable versions of these future C++ classes. In each
case, preprocessor macros are used to select which version of the class
to use.
2020-03-16 17:12:16 -06:00