-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[lldb] Disable warning about codecvt_utf8 deprecation (NFC) #112446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] Disable warning about codecvt_utf8 deprecation (NFC) #112446
Conversation
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.
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesDisable -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:
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;
|
There was an attempt to remove this (https://reviews.llvm.org/D106035) but this hit some issues on Arch and with column counting which is out of scope for what I'm trying to achieve. |
I'm not actually sure the approach in that patch is feasible. Last time I looked at this (which was a long time ago, to be fair), to problem was basically that editline could be built in two modes (wide or not), and we had to do something to match what was being used there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be a non-deprecated way of achieving this, though I'm not entirely sure about its portability (windows is the main question, but I guess we don't use editline there anyway). I don't think you have to do that, but it is an option.
- Rename macro and include LLDB prefix. - Fix copy/paste error. - Define empty macro in else block.
Thanks, I see you did something similar in |
) 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)
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.