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

via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 17 08:20:04 PDT 2024


Author: Jonas Devlieghere
Date: 2024-10-17T08:19:58-07:00
New Revision: 8c7f80f77505b7ff275d67a49f4f2dd07d604403

URL: https://github.com/llvm/llvm-project/commit/8c7f80f77505b7ff275d67a49f4f2dd07d604403
DIFF: https://github.com/llvm/llvm-project/commit/8c7f80f77505b7ff275d67a49f4f2dd07d604403.diff

LOG: [lldb] Disable warning about codecvt_utf8 deprecation (NFC) (#112446)

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.

Added: 
    

Modified: 
    lldb/include/lldb/Host/Editline.h
    lldb/source/Host/common/Editline.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h
index 9049b106f02a34..a02f90891599ad 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -57,6 +57,23 @@
 
 #include "llvm/ADT/FunctionExtras.h"
 
+#if defined(__clang__) && defined(__has_warning)
+#if __has_warning("-Wdeprecated-declarations")
+#define LLDB_DEPRECATED_WARNING_DISABLE                                        \
+  _Pragma("clang diagnostic push")                                             \
+      _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+#define LLDB_DEPRECATED_WARNING_RESTORE _Pragma("clang diagnostic pop")
+#endif
+#elif defined(__GNUC__) && __GNUC__ > 6
+#define LLDB_DEPRECATED_WARNING_DISABLE                                        \
+  _Pragma("GCC diagnostic push")                                               \
+      _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#define LLDB_DEPRECATED_WARNING_RESTORE _Pragma("GCC diagnostic pop")
+#else
+#define LLDB_DEPRECATED_WARNING_DISABLE
+#define LLDB_DEPRECATED_WARNING_RESTORE
+#endif
+
 namespace lldb_private {
 namespace line_editor {
 
@@ -367,7 +384,9 @@ class Editline {
   void SetGetCharacterFunction(EditlineGetCharCallbackType callbackFn);
 
 #if LLDB_EDITLINE_USE_WCHAR
+  LLDB_DEPRECATED_WARNING_DISABLE
   std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
+  LLDB_DEPRECATED_WARNING_RESTORE
 #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..60117cb5f0e615 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
+  LLDB_DEPRECATED_WARNING_DISABLE
   std::codecvt_utf8<wchar_t> cvt;
+  LLDB_DEPRECATED_WARNING_RESTORE
   llvm::SmallString<4> input;
   for (;;) {
     const char *from_next;


        


More information about the lldb-commits mailing list