From 4377f6e603c64a86c934f1546aa9db482f2e1a4e Mon Sep 17 00:00:00 2001 From: Werner Henze <34543625+beinhaerter@users.noreply.github.com> Date: Mon, 31 Jan 2022 22:06:42 +0100 Subject: [PATCH] quoted form of #include when GSL includes GSL files (#1030) [SF.12: Prefer the quoted form of #include for files relative to the including file and the angle bracket form everywhere else](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rs-incform) Additionally changed #include order in `span` so that all `span_ext` is in the GSL include block and not in the STL include block. Fixes issues #1025. Co-authored-by: Werner Henze --- include/gsl/algorithm | 4 ++-- include/gsl/gsl | 16 ++++++++-------- include/gsl/gsl_algorithm | 2 +- include/gsl/gsl_assert | 2 +- include/gsl/gsl_byte | 2 +- include/gsl/gsl_narrow | 2 +- include/gsl/gsl_util | 2 +- include/gsl/narrow | 4 ++-- include/gsl/pointers | 2 +- include/gsl/span | 16 ++++++++-------- include/gsl/span_ext | 4 ++-- include/gsl/string_span | 6 +++--- include/gsl/util | 2 +- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/gsl/algorithm b/include/gsl/algorithm index b27475d..584f5cd 100644 --- a/include/gsl/algorithm +++ b/include/gsl/algorithm @@ -17,8 +17,8 @@ #ifndef GSL_ALGORITHM_H #define GSL_ALGORITHM_H -#include // for Expects -#include // for dynamic_extent, span +#include "assert" // for Expects +#include "span" // for dynamic_extent, span #include // for copy_n #include // for ptrdiff_t diff --git a/include/gsl/gsl b/include/gsl/gsl index adadc40..3d9e288 100644 --- a/include/gsl/gsl +++ b/include/gsl/gsl @@ -17,16 +17,16 @@ #ifndef GSL_GSL_H #define GSL_GSL_H -#include // copy -#include // Ensures/Expects -#include // byte -#include // owner, not_null -#include // span -#include // zstring, string_span, zstring_builder... -#include // finally()/narrow_cast()... +#include "algorithm" // copy +#include "assert" // Ensures/Expects +#include "byte" // byte +#include "pointers" // owner, not_null +#include "span" // span +#include "string_span" // zstring, string_span, zstring_builder... +#include "util" // finally()/narrow_cast()... #ifdef __cpp_exceptions -#include // narrow() +#include "narrow" // narrow() #endif #endif // GSL_GSL_H diff --git a/include/gsl/gsl_algorithm b/include/gsl/gsl_algorithm index 303a5ae..951679a 100644 --- a/include/gsl/gsl_algorithm +++ b/include/gsl/gsl_algorithm @@ -1,4 +1,4 @@ #pragma once #pragma message( \ "This header will soon be removed. Use instead of ") -#include +#include "algorithm" diff --git a/include/gsl/gsl_assert b/include/gsl/gsl_assert index b83a772..222ce30 100644 --- a/include/gsl/gsl_assert +++ b/include/gsl/gsl_assert @@ -1,3 +1,3 @@ #pragma once #pragma message("This header will soon be removed. Use instead of ") -#include +#include "assert" diff --git a/include/gsl/gsl_byte b/include/gsl/gsl_byte index 4f198ce..831bb2d 100644 --- a/include/gsl/gsl_byte +++ b/include/gsl/gsl_byte @@ -1,3 +1,3 @@ #pragma once #pragma message("This header will soon be removed. Use instead of ") -#include +#include "byte" diff --git a/include/gsl/gsl_narrow b/include/gsl/gsl_narrow index 6c2cd10..3e3e8cf 100644 --- a/include/gsl/gsl_narrow +++ b/include/gsl/gsl_narrow @@ -1,3 +1,3 @@ #pragma once #pragma message("This header will soon be removed. Use instead of ") -#include +#include "narrow" diff --git a/include/gsl/gsl_util b/include/gsl/gsl_util index 6a6d77e..a7ed739 100644 --- a/include/gsl/gsl_util +++ b/include/gsl/gsl_util @@ -1,3 +1,3 @@ #pragma once #pragma message("This header will soon be removed. Use instead of ") -#include +#include "util" diff --git a/include/gsl/narrow b/include/gsl/narrow index bec30d1..bad581c 100644 --- a/include/gsl/narrow +++ b/include/gsl/narrow @@ -16,8 +16,8 @@ #ifndef GSL_NARROW_H #define GSL_NARROW_H -#include // for Expects -#include // for narrow_cast +#include "assert" // for Expects +#include "util" // for narrow_cast namespace gsl { struct narrowing_error : public std::exception diff --git a/include/gsl/pointers b/include/gsl/pointers index e6b2348..a0a77ac 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -17,7 +17,7 @@ #ifndef GSL_POINTERS_H #define GSL_POINTERS_H -#include // for Ensures, Expects +#include "assert" // for Ensures, Expects #include // for forward #include // for ptrdiff_t, nullptr_t, size_t diff --git a/include/gsl/span b/include/gsl/span index cc8a7b9..5488f52 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -17,15 +17,15 @@ #ifndef GSL_SPAN_H #define GSL_SPAN_H -#include // for Expects -#include // for byte -#include // for narrow_cast +#include "assert" // for Expects +#include "byte" // for byte +#include "span_ext" // for span specialization of gsl::at and other span-related extensions +#include "util" // for narrow_cast -#include // for array -#include // for ptrdiff_t, size_t, nullptr_t -#include // for span specialization of gsl::at and other span-related extensions -#include // for reverse_iterator, distance, random_access_... -#include // for enable_if_t, declval, is_convertible, inte... +#include // for array +#include // for ptrdiff_t, size_t, nullptr_t +#include // for reverse_iterator, distance, random_access_... +#include // for enable_if_t, declval, is_convertible, inte... #if defined(_MSC_VER) && !defined(__clang__) #pragma warning(push) diff --git a/include/gsl/span_ext b/include/gsl/span_ext index 5feb2b8..d86f736 100644 --- a/include/gsl/span_ext +++ b/include/gsl/span_ext @@ -27,8 +27,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#include // GSL_KERNEL_MODE -#include // for narrow_cast, narrow +#include "assert" // GSL_KERNEL_MODE +#include "util" // for narrow_cast, narrow #include // for ptrdiff_t, size_t #include diff --git a/include/gsl/string_span b/include/gsl/string_span index bcc672a..397c561 100644 --- a/include/gsl/string_span +++ b/include/gsl/string_span @@ -17,9 +17,9 @@ #ifndef GSL_STRING_SPAN_H #define GSL_STRING_SPAN_H -#include // for Ensures, Expects -#include // for operator!=, operator==, dynamic_extent -#include // for narrow_cast +#include "assert" // for Ensures, Expects +#include "span_ext" // for operator!=, operator==, dynamic_extent +#include "util" // for narrow_cast #include // for equal, lexicographical_compare #include // for array diff --git a/include/gsl/util b/include/gsl/util index a215bad..b6dbd18 100644 --- a/include/gsl/util +++ b/include/gsl/util @@ -17,7 +17,7 @@ #ifndef GSL_UTIL_H #define GSL_UTIL_H -#include // for Expects +#include "assert" // for Expects #include #include // for ptrdiff_t, size_t