From fa1b51b82f6452c233aca82f57d2784baa5f0180 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Tue, 21 Jun 2022 21:39:06 -0400
Subject: [PATCH] vtkCriticalSection: actually deprecate

Mark it as deprecated in 9.1.0. However, because it never warned prior
to 9.2.0, it cannot actually be removed right now. Instead, remove it
when 9.2.0 APIs are removed (and add a marker to make it easy to find
it).
---
 Common/Core/vtkCriticalSection.cxx                        | 6 ++++++
 Common/Core/vtkCriticalSection.h                          | 4 ++++
 Documentation/release/dev/deprecate-vtkCriticalSection.md | 5 +++++
 3 files changed, 15 insertions(+)
 create mode 100644 Documentation/release/dev/deprecate-vtkCriticalSection.md

diff --git a/Common/Core/vtkCriticalSection.cxx b/Common/Core/vtkCriticalSection.cxx
index 36958e4378f..8dc40338aed 100644
--- a/Common/Core/vtkCriticalSection.cxx
+++ b/Common/Core/vtkCriticalSection.cxx
@@ -12,6 +12,12 @@
      PURPOSE.  See the above copyright notice for more information.
 
 =========================================================================*/
+
+// Hide VTK_DEPRECATED_IN_9_1_0() warnings for this class.
+// Remove with VTK_DEPRECATED_IN_9_2_0 because it was not actually deprecated
+// in 9.1.0.
+#define VTK_DEPRECATION_LEVEL 0
+
 #include "vtkCriticalSection.h"
 #include "vtkObjectFactory.h"
 
diff --git a/Common/Core/vtkCriticalSection.h b/Common/Core/vtkCriticalSection.h
index 0fb72e3f71b..40b542b28d5 100644
--- a/Common/Core/vtkCriticalSection.h
+++ b/Common/Core/vtkCriticalSection.h
@@ -37,9 +37,13 @@
 #define vtkCriticalSection_h
 
 #include "vtkCommonCoreModule.h" // For export macro
+#include "vtkDeprecation.h"      // For VTK_DEPRECATED_IN_9_1_0
 #include "vtkObject.h"
 #include <mutex> // for std::mutex
 
+// Remove with VTK_DEPRECATED_IN_9_2_0 because it was not actually deprecated
+// in 9.1.0.
+VTK_DEPRECATED_IN_9_1_0("Use std::mutex instead")
 class VTKCOMMONCORE_EXPORT vtkCriticalSection : public vtkObject
 {
 public:
diff --git a/Documentation/release/dev/deprecate-vtkCriticalSection.md b/Documentation/release/dev/deprecate-vtkCriticalSection.md
new file mode 100644
index 00000000000..31e8f9a0b0e
--- /dev/null
+++ b/Documentation/release/dev/deprecate-vtkCriticalSection.md
@@ -0,0 +1,5 @@
+# vtkCriticalSection deprecation
+
+`vtkCriticalSection` was intended to be deprecated in VTK 9.1.0, but a warning
+was never added to it. VTK now has the warning present as it was originally
+intended.
-- 
GitLab