labath created this revision.
labath added reviewers: christos, krytarowski, davide.

Despite the documentation for the el_get(EL_GETTC) function claiming the
vararg part is (const char *name, void *value), in reality the function
expects the vararg list to be terminated by a null pointer, which can be
clearly seen by examining the source code. Although this is mostly
bening because the extra values are not used it any way, it still lights
up as an error when running the tests under msan.

Work around this quirk by adding an explicit nullptr to the end of the
argument list.


https://reviews.llvm.org/D61191

Files:
  source/Host/common/Editline.cpp


Index: source/Host/common/Editline.cpp
===================================================================
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -1215,9 +1215,11 @@
   if (m_editline != nullptr) {
     el_resize(m_editline);
     int columns;
-    // Despite the man page claiming non-zero indicates success, it's actually
-    // zero
-    if (el_get(m_editline, EL_GETTC, "co", &columns) == 0) {
+    // Mac man page claims non-zero indicates success, but it's actually
+    // zero. Additionally, all manpages document the varargs part of this
+    // function as (const char *name, void *value), but in reality the source
+    // code expects the vararg list to be terminated by a null pointer.
+    if (el_get(m_editline, EL_GETTC, "co", &columns, nullptr) == 0) {
       m_terminal_width = columns;
       if (m_current_line_rows != -1) {
         const LineInfoW *info = el_wline(m_editline);


Index: source/Host/common/Editline.cpp
===================================================================
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -1215,9 +1215,11 @@
   if (m_editline != nullptr) {
     el_resize(m_editline);
     int columns;
-    // Despite the man page claiming non-zero indicates success, it's actually
-    // zero
-    if (el_get(m_editline, EL_GETTC, "co", &columns) == 0) {
+    // Mac man page claims non-zero indicates success, but it's actually
+    // zero. Additionally, all manpages document the varargs part of this
+    // function as (const char *name, void *value), but in reality the source
+    // code expects the vararg list to be terminated by a null pointer.
+    if (el_get(m_editline, EL_GETTC, "co", &columns, nullptr) == 0) {
       m_terminal_width = columns;
       if (m_current_line_rows != -1) {
         const LineInfoW *info = el_wline(m_editline);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to