[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.
This commit is contained in:
Jonas Devlieghere
2024-10-17 08:19:58 -07:00
committed by GitHub
parent 92663defb1
commit 8c7f80f775
2 changed files with 21 additions and 0 deletions

View File

@@ -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 @@ private:
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;

View File

@@ -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;