Skip to content

Commit b9c560e

Browse files
committed
[lldb] Disable warning about codecvt_utf8 deprecation (NFC) (llvm#112446)
Disable -Wdeprecated-declarations for codecvt_utf8 in Editline. This is in preparation for llvm#112276 which narrows the scope of -Wno-deprecated-declarations for building LLDB. (cherry picked from commit 8c7f80f)
1 parent 382854d commit b9c560e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lldb/include/lldb/Host/Editline.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@
5757

5858
#include "llvm/ADT/FunctionExtras.h"
5959

60+
#if defined(__clang__) && defined(__has_warning)
61+
#if __has_warning("-Wdeprecated-declarations")
62+
#define LLDB_DEPRECATED_WARNING_DISABLE \
63+
_Pragma("clang diagnostic push") \
64+
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
65+
#define LLDB_DEPRECATED_WARNING_RESTORE _Pragma("clang diagnostic pop")
66+
#endif
67+
#elif defined(__GNUC__) && __GNUC__ > 6
68+
#define LLDB_DEPRECATED_WARNING_DISABLE \
69+
_Pragma("GCC diagnostic push") \
70+
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
71+
#define LLDB_DEPRECATED_WARNING_RESTORE _Pragma("GCC diagnostic pop")
72+
#else
73+
#define LLDB_DEPRECATED_WARNING_DISABLE
74+
#define LLDB_DEPRECATED_WARNING_RESTORE
75+
#endif
76+
6077
namespace lldb_private {
6178
namespace line_editor {
6279

@@ -367,7 +384,9 @@ class Editline {
367384
void SetGetCharacterFunction(EditlineGetCharCallbackType callbackFn);
368385

369386
#if LLDB_EDITLINE_USE_WCHAR
387+
LLDB_DEPRECATED_WARNING_DISABLE
370388
std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
389+
LLDB_DEPRECATED_WARNING_RESTORE
371390
#endif
372391
::EditLine *m_editline = nullptr;
373392
EditlineHistorySP m_history_sp;

lldb/source/Host/common/Editline.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,9 @@ bool Editline::CompleteCharacter(char ch, EditLineGetCharType &out) {
15741574
out = (unsigned char)ch;
15751575
return true;
15761576
#else
1577+
LLDB_DEPRECATED_WARNING_DISABLE
15771578
std::codecvt_utf8<wchar_t> cvt;
1579+
LLDB_DEPRECATED_WARNING_RESTORE
15781580
llvm::SmallString<4> input;
15791581
for (;;) {
15801582
const char *from_next;

0 commit comments

Comments
 (0)