aboutsummaryrefslogtreecommitdiff
path: root/include/gsl/gsl_assert
diff options
context:
space:
mode:
authorAnna Gringauze <annagrin@microsoft.com>2019-01-15 10:27:34 -0800
committerGitHub <noreply@github.com>2019-01-15 10:27:34 -0800
commit6418b5f4de2204cd5a335b00d2f8754301b8b382 (patch)
treea755048982e8389bf9c8610b15ae157f172958f0 /include/gsl/gsl_assert
parent6eeed739f1acb81c8b69ceae11bd5f350dab3601 (diff)
downloadMicrosoft-GSL-6418b5f4de2204cd5a335b00d2f8754301b8b382.tar.gz
Clang cl (#762)
* Added c++17 test configurations for clang5.0 and clang6.0 * Fix #739 correct cppcorecheck warnings for clang-cl * Add clang-cl configurations * Corrections Appveyor; Temporarily disable msvc compilation for faster testing (#741) * Add path to clang-cl.exe (#741) * Escape backslash in path (#741) * Update vcpkg (#741) * Check vcpkg version; try without building vcpkg; use latest clang-cl from path (#741) * Fix blocks in ps script (#741) * Try accessing APPVEYOR_BUILD_FOLDER variable (#471) * Update span size() bug confirmation test for GCC 6.5 (#741) * MSVC flags to Clang-cl; disable c++98-compat and undefined macro warnings (#741) * Suppress clang warning on tests (missing-prototypes) (#741) * Fix clang warning -Wnewline-eof (#741) * Fix clang warning -Wdouble-promotion (#741) * Set linker explicitly * Clean condition statement * For Clang, fallback to the AppVeyor installed version of CMake * Fix clang warning -Wmissing-variable-declarations * Fallback to the MSVC linker until vcpkg has been updated * Revert "Fallback to the MSVC linker until vcpkg has been updated" This reverts commit 7263f3289e6e835c32fc7800d0c2d4e58bd21178. * Fix clang warning -Wunused-member-function * Fix clang warning -Wmissing-noreturn * Fix clang warning -Winvalid-noreturn on Windows * Add macro block end comment on large #if blocks * Workaround: fallback to mscv link.exe * Workaround: get msvc paths into PowerShell through intermediate file * Workaround: fix, remove "PATH=" from text * Workaround: try with full-path; and return user PATH * Workaround: fix, escape backslashes * Revert all since "Workaround: fallback to mscv link.exe" did not work on AppVeyor This reverts the commits: bda3d6a428e5d19e97375b2e575b0f51ff1b4bc0 97062933acfb6428535c0fdcab5d94371ce72bfc 0f4fb04bac9c2d091005b791294237250dbe0668 1b0c19afd154f4ffc5ef793014c1bc2324534fd0 a5739ea5f0cd7633527b5e5d3b16a9e3ade7149f * Suppress output of git pull; remove vcpkg from cache * Re-enable AppVeyor builds for all platforms * Correct typo Co-Authored-By: Farwaykorse <Farwaykorse@users.noreply.github.com> * Add Clang-cl 7.0.0 to the supported platforms * Revert "Fix clang warning -Wunused-member-function" This reverts commit 6fe1a4203501145ab4350b9152ecc11f3a30e49a. * Fix or locally suppress clang warning -Wunused-member-function * format touched code and correct comment * git pull --quiet * fix logic error in workaround * fix missing bracket * Suppress output of mkdir * Replace MSBuild with Ninja * Suppress output of 7z * Add architecture flags for Clang * Drop workaround for lld-link * 7-zip Overwrite and Alternative output suppression without suppressing errors Replaces 3c1c0794dd9a29908cc7c38f591bd3c7b4929677 * AppVeyor setup and CMake before build * reorder compiler configuration * remove unnecessary * remove -fno-strict-aliasing * remove -Wsign-conversion, since before v4.0 part of -Wconversion * -Wctor-dtor-privacy is GCC only * remove -Woverloaded-virtual part of -Wmost, part of -Wall * add -Wmissing-noreturn * remove the pragmas for -Wunused-member-function * Re-add MSBuild generator on AppVeyor * Print CMake commands * Add MSBuild toolset selection * Separate Architecture setting * clang-cl: add -Weverything * clang-cl -Wno-c++98-compat * clang-cl -Wno-c++98-compat-pedantic * clang-cl -Wno-missing-prototypes * clang-cl C++14 -Wno-unused-member-function * clang-cl -Wundef __GNUC__ * clang++: add -Weverything * clang++ -Wno-c++98-compat * clang++ -Wno-c++98-compat-pedantic * clang++ -Wno-missing-prototypes * clang++ -Wno-weak-vtables * clang++ C++14 -Wno-unused-member-function * clang++ fix -Wundef _MSC_VER * clang++ -Wno-padded * clang++ solve -Wdeprecated * Add AppleClang compiler target Since CMake v3.0 use of Clang for both is deprecated * clang++ v5.0 C++17 -Wno-undefined-func-template * Add VS2015 + LLVM/clang-cl to AppVeyor * Do not disable constexpr when compiling with clang-cl on Windows * Clean-up clang-only warnings (now under -Weverything) * Revert "Fix clang warning -Winvalid-noreturn on Windows" This reverts commit 2238c4760e86feebb2a18620b77312bd01055f61. * Suppress -Winvalid-noreturn for the MS STL noexception workaround * CMake: put preprocessor definition in target_compile_definitions * Solve compiler warning C4668: __GNUC__ not defined
Diffstat (limited to 'include/gsl/gsl_assert')
-rw-r--r--include/gsl/gsl_assert26
1 files changed, 18 insertions, 8 deletions
diff --git a/include/gsl/gsl_assert b/include/gsl/gsl_assert
index 3c952e6..c704633 100644
--- a/include/gsl/gsl_assert
+++ b/include/gsl/gsl_assert
@@ -22,17 +22,17 @@
//
// make suppress attributes parse for some compilers
-// Hopefully temporary until suppresion standardization occurs
+// Hopefully temporary until suppression standardization occurs
//
-#if defined (_MSC_VER)
-#define GSL_SUPPRESS(x) [[gsl::suppress(x)]]
-#else
#if defined(__clang__)
#define GSL_SUPPRESS(x) [[gsl::suppress("x")]]
#else
+#if defined(_MSC_VER)
+#define GSL_SUPPRESS(x) [[gsl::suppress(x)]]
+#else
#define GSL_SUPPRESS(x)
-#endif // __clang__
#endif // _MSC_VER
+#endif // __clang__
//
// Temporary until MSVC STL supports no-exceptions mode.
@@ -42,6 +42,12 @@
#define GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND
#include <intrin.h>
#define RANGE_CHECKS_FAILURE 0
+
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Winvalid-noreturn"
+#endif
+
#endif
//
@@ -98,7 +104,7 @@ namespace details
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
typedef void (__cdecl *terminate_handler)();
-
+
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute
[[noreturn]] inline void __cdecl default_terminate_handler()
{
@@ -138,7 +144,7 @@ namespace details
throw std::forward<Exception>(exception);
}
-#endif
+#endif // GSL_TERMINATE_ON_CONTRACT_VIOLATION
} // namespace details
} // namespace gsl
@@ -159,9 +165,13 @@ namespace details
#define GSL_CONTRACT_CHECK(type, cond) GSL_ASSUME(cond)
-#endif
+#endif // GSL_THROW_ON_CONTRACT_VIOLATION
#define Expects(cond) GSL_CONTRACT_CHECK("Precondition", cond)
#define Ensures(cond) GSL_CONTRACT_CHECK("Postcondition", cond)
+#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND) && defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
#endif // GSL_CONTRACTS_H