[Lldb-commits] [lldb] [lldb] Disable warning about codecvt_utf8 deprecation (NFC) (PR #112446)

via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 15 15:22:23 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Disable -Wdeprecated-declarations for codecvt_utf8 in Editline. This is in preparation for #<!-- -->112276 which narrows the scope of -Wno-deprecated-declarations for building LLDB.

---
Full diff: https://github.com/llvm/llvm-project/pull/112446.diff


2 Files Affected:

- (modified) lldb/include/lldb/Host/Editline.h (+22) 
- (modified) lldb/source/Host/common/Editline.cpp (+2) 


``````````diff
diff --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h
index 9049b106f02a34..f5d461d32b72fa 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -57,6 +57,26 @@
 
 #include "llvm/ADT/FunctionExtras.h"
 
+#if defined(__clang__) && defined(__has_warning)
+#if __has_warning("-Wimplicit-fallthrough")
+#define EL_DISABLE_DEPRECATED_DECLARATION_WARNINGS                             \
+  _Pragma("clang diagnostic push")                                             \
+      _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+#define RESTORE_DEPRECATED_DECLARATION_WARNINGS _Pragma("clang diagnostic pop")
+#endif
+#elif defined(__GNUC__) && __GNUC__ > 6
+#define EL_DISABLE_DEPRECATED_DECLARATION_WARNINGS                             \
+  _Pragma("GCC diagnostic push")                                               \
+      _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#define RESTORE_DEPRECATED_DECLARATION_WARNINGS _Pragma("GCC diagnostic pop")
+#endif
+#ifndef EL_DISABLE_DEPRECATED_DECLARATION_WARNINGS
+#define EL_DISABLE_DEPRECATED_DECLARATION_WARNINGS
+#endif
+#ifndef EL_RESTORE_DEPRECATED_DECLARATION_WARNINGS
+#define EL_RESTORE_DEPRECATED_DECLARATION_WARNINGS
+#endif
+
 namespace lldb_private {
 namespace line_editor {
 
@@ -367,7 +387,9 @@ class Editline {
   void SetGetCharacterFunction(EditlineGetCharCallbackType callbackFn);
 
 #if LLDB_EDITLINE_USE_WCHAR
+  EL_DISABLE_DEPRECATED_DECLARATION_WARNINGS
   std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
+  EL_RESTORE_DEPRECATED_DECLARATION_WARNINGS
 #endif
   ::EditLine *m_editline = nullptr;
   EditlineHistorySP m_history_sp;
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index 561ec228cdb23f..b5b8d46c0721cf 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -1574,7 +1574,9 @@ bool Editline::CompleteCharacter(char ch, EditLineGetCharType &out) {
   out = (unsigned char)ch;
   return true;
 #else
+  EL_DISABLE_DEPRECATED_DECLARATION_WARNINGS
   std::codecvt_utf8<wchar_t> cvt;
+  EL_RESTORE_DEPRECATED_DECLARATION_WARNINGS
   llvm::SmallString<4> input;
   for (;;) {
     const char *from_next;

``````````

</details>


https://github.com/llvm/llvm-project/pull/112446


More information about the lldb-commits mailing list