summaryrefslogtreecommitdiffstats
path: root/Utilities/std/cm
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2020-08-29 20:27:37 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-09-03 13:30:21 (GMT)
commitbdca8b01d2d96d63e685e7eca03e0f51f5410fdf (patch)
treef7e14aa6967bd3981b0bff21c4f0e113de275fb3 /Utilities/std/cm
parent093ba4061da68d8c86a09b3631767912ffb183e2 (diff)
downloadCMake-bdca8b01d2d96d63e685e7eca03e0f51f5410fdf.zip
CMake-bdca8b01d2d96d63e685e7eca03e0f51f5410fdf.tar.gz
CMake-bdca8b01d2d96d63e685e7eca03e0f51f5410fdf.tar.bz2
Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
Diffstat (limited to 'Utilities/std/cm')
-rw-r--r--Utilities/std/cm/algorithm5
-rw-r--r--Utilities/std/cm/bits/erase_if.hxx5
-rw-r--r--Utilities/std/cm/deque5
-rw-r--r--Utilities/std/cm/filesystem5
-rw-r--r--Utilities/std/cm/iomanip5
-rw-r--r--Utilities/std/cm/iterator5
-rw-r--r--Utilities/std/cm/list5
-rw-r--r--Utilities/std/cm/map5
-rw-r--r--Utilities/std/cm/memory5
-rw-r--r--Utilities/std/cm/optional5
-rw-r--r--Utilities/std/cm/set5
-rw-r--r--Utilities/std/cm/shared_mutex5
-rw-r--r--Utilities/std/cm/string5
-rw-r--r--Utilities/std/cm/string_view4
-rw-r--r--Utilities/std/cm/type_traits5
-rw-r--r--Utilities/std/cm/unordered_map5
-rw-r--r--Utilities/std/cm/unordered_set5
-rw-r--r--Utilities/std/cm/utility5
-rw-r--r--Utilities/std/cm/vector5
19 files changed, 19 insertions, 75 deletions
diff --git a/Utilities/std/cm/algorithm b/Utilities/std/cm/algorithm
index 8ade99c..93fe224 100644
--- a/Utilities/std/cm/algorithm
+++ b/Utilities/std/cm/algorithm
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_algorithm
-#define cm_algorithm
+#pragma once
#include <algorithm> // IWYU pragma: export
#include <cassert>
@@ -34,5 +33,3 @@ T const& clamp(T const& v, T const& lo, T const& hi, Comp comp)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/bits/erase_if.hxx b/Utilities/std/cm/bits/erase_if.hxx
index 8952fb5..354b0c2 100644
--- a/Utilities/std/cm/bits/erase_if.hxx
+++ b/Utilities/std/cm/bits/erase_if.hxx
@@ -4,8 +4,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_bits_erase_if_hxx
-#define cm_bits_erase_if_hxx
+#pragma once
namespace cm {
namespace internals {
@@ -25,5 +24,3 @@ void erase_if(Container& cont, Predicate pred)
} // namespace internals
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/deque b/Utilities/std/cm/deque
index 4bb6725..b7b6959 100644
--- a/Utilities/std/cm/deque
+++ b/Utilities/std/cm/deque
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_deque
-#define cm_deque
+#pragma once
#include <algorithm>
#include <deque> // IWYU pragma: export
@@ -36,5 +35,3 @@ inline void erase_if(std::deque<T, Allocator>& cont, Predicate pred)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/filesystem b/Utilities/std/cm/filesystem
index 6021712..cb05b22 100644
--- a/Utilities/std/cm/filesystem
+++ b/Utilities/std/cm/filesystem
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_filesystem
-#define cm_filesystem
+#pragma once
#include "cmSTL.hxx" // IWYU pragma: keep
@@ -1171,5 +1170,3 @@ std::size_t hash_value(const path& p) noexcept;
} // namespace filesystem
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/iomanip b/Utilities/std/cm/iomanip
index 6f68530..602b912 100644
--- a/Utilities/std/cm/iomanip
+++ b/Utilities/std/cm/iomanip
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_iomanip
-#define cm_iomanip
+#pragma once
#include <iomanip> // IWYU pragma: export
#if __cplusplus < 201402L || defined(_MSVC_LANG) && _MSVC_LANG < 201402L
@@ -179,5 +178,3 @@ inline internals::quoted_string<cm::string_view, char> quoted(
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/iterator b/Utilities/std/cm/iterator
index 718f1d6..3b38cc7 100644
--- a/Utilities/std/cm/iterator
+++ b/Utilities/std/cm/iterator
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_iterator
-#define cm_iterator
+#pragma once
#include <iterator> // IWYU pragma: export
@@ -212,5 +211,3 @@ constexpr T* data(T (&arr)[N]) noexcept
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/list b/Utilities/std/cm/list
index ba5d94a..380bff8 100644
--- a/Utilities/std/cm/list
+++ b/Utilities/std/cm/list
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_list
-#define cm_list
+#pragma once
#include <list> // IWYU pragma: export
@@ -35,5 +34,3 @@ inline void erase_if(std::list<T, Allocator>& cont, Predicate pred)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/map b/Utilities/std/cm/map
index e348dec..1794cd7 100644
--- a/Utilities/std/cm/map
+++ b/Utilities/std/cm/map
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_map
-#define cm_map
+#pragma once
#include <map> // IWYU pragma: export
@@ -40,5 +39,3 @@ inline void erase_if(std::multimap<Key, T, Compare, Allocator>& cont,
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/memory b/Utilities/std/cm/memory
index 5611f6b..005e6e2 100644
--- a/Utilities/std/cm/memory
+++ b/Utilities/std/cm/memory
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_memory
-#define cm_memory
+#pragma once
#include "cmSTL.hxx" // IWYU pragma: keep
@@ -66,5 +65,3 @@ typename internals::make_unique_if<T>::bound_array make_unique(Args&&...) =
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/optional b/Utilities/std/cm/optional
index 80b0951..e691e8e 100644
--- a/Utilities/std/cm/optional
+++ b/Utilities/std/cm/optional
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_optional
-#define cm_optional
+#pragma once
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
# define CMake_HAVE_CXX_OPTIONAL
@@ -340,5 +339,3 @@ T& optional<T>::emplace(Args&&... args)
#endif
}
-
-#endif
diff --git a/Utilities/std/cm/set b/Utilities/std/cm/set
index 56dd474..9fd24d3 100644
--- a/Utilities/std/cm/set
+++ b/Utilities/std/cm/set
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_set
-#define cm_set
+#pragma once
#include <set> // IWYU pragma: export
@@ -39,5 +38,3 @@ inline void erase_if(std::multiset<Key, Compare, Allocator>& cont,
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/shared_mutex b/Utilities/std/cm/shared_mutex
index ec63a7b..a1204fa 100644
--- a/Utilities/std/cm/shared_mutex
+++ b/Utilities/std/cm/shared_mutex
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_shared_mutex
-#define cm_shared_mutex
+#pragma once
#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
# define CMake_HAVE_CXX_SHARED_LOCK
@@ -72,5 +71,3 @@ public:
};
#endif
}
-
-#endif
diff --git a/Utilities/std/cm/string b/Utilities/std/cm/string
index cc4c796..30b1b85 100644
--- a/Utilities/std/cm/string
+++ b/Utilities/std/cm/string
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_string
-#define cm_string
+#pragma once
#include <algorithm>
#include <string> // IWYU pragma: export
@@ -38,5 +37,3 @@ inline void erase_if(std::basic_string<T, Traits, Allocator>& cont,
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/string_view b/Utilities/std/cm/string_view
index 4d359cb..9542bac 100644
--- a/Utilities/std/cm/string_view
+++ b/Utilities/std/cm/string_view
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_string_view
-#define cm_string_view
+#pragma once
#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
# define CMake_HAVE_CXX_STRING_VIEW
@@ -215,4 +214,3 @@ struct hash<cm::string_view>
}
#endif
-#endif
diff --git a/Utilities/std/cm/type_traits b/Utilities/std/cm/type_traits
index e32c2c6..56ec64f 100644
--- a/Utilities/std/cm/type_traits
+++ b/Utilities/std/cm/type_traits
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_type_traits
-#define cm_type_traits
+#pragma once
#include <type_traits> // IWYU pragma: export
@@ -59,5 +58,3 @@ using void_t = typename make_void<ArgTypes...>::type;
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/unordered_map b/Utilities/std/cm/unordered_map
index 5b8a456..d21c37e 100644
--- a/Utilities/std/cm/unordered_map
+++ b/Utilities/std/cm/unordered_map
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_unordered_map
-#define cm_unordered_map
+#pragma once
#include <unordered_map> // IWYU pragma: export
@@ -41,5 +40,3 @@ inline void erase_if(
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/unordered_set b/Utilities/std/cm/unordered_set
index 9debac4..2545ff6 100644
--- a/Utilities/std/cm/unordered_set
+++ b/Utilities/std/cm/unordered_set
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_unordered_set
-#define cm_unordered_set
+#pragma once
#include <unordered_set> // IWYU pragma: export
@@ -41,5 +40,3 @@ inline void erase_if(
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/utility b/Utilities/std/cm/utility
index 3acac4f..c257fc8 100644
--- a/Utilities/std/cm/utility
+++ b/Utilities/std/cm/utility
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_utility
-#define cm_utility
+#pragma once
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
# define CMake_HAVE_CXX_IN_PLACE
@@ -30,5 +29,3 @@ constexpr in_place_t in_place{};
#endif
}
-
-#endif
diff --git a/Utilities/std/cm/vector b/Utilities/std/cm/vector
index 2dbe704..33d9365 100644
--- a/Utilities/std/cm/vector
+++ b/Utilities/std/cm/vector
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_vector
-#define cm_vector
+#pragma once
#include <algorithm>
#include <vector> // IWYU pragma: export
@@ -36,5 +35,3 @@ inline void erase_if(std::vector<T, Allocator>& cont, Predicate pred)
#endif
} // namespace cm
-
-#endif