[Lldb-commits] [PATCH] D69612: [lldb-vscod] fix build with NDEBUG on windows

2019-10-30 Thread Peiyuan Song via Phabricator via lldb-commits
SquallATF created this revision.
SquallATF added a reviewer: mstorsjo.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

_setmode in assert will not run when build with NDEBUG


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69612

Files:
  lldb/tools/lldb-vscode/VSCode.cpp


Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -44,8 +44,10 @@
 // Windows opens stdout and stdin in text mode which converts \n to 13,10
 // while the value is just 10 on Darwin/Linux. Setting the file mode to binary
 // fixes this.
-  assert(_setmode(fileno(stdout), _O_BINARY));
-  assert(_setmode(fileno(stdin), _O_BINARY));
+  int result = _setmode(fileno(stdout), _O_BINARY);
+  assert(result);
+  result = _setmode(fileno(stdin), _O_BINARY);
+  assert(result);
 #endif
   if (log_file_path)
 log.reset(new std::ofstream(log_file_path));
@@ -301,4 +303,3 @@
 }
 
 } // namespace lldb_vscode
-


Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -44,8 +44,10 @@
 // Windows opens stdout and stdin in text mode which converts \n to 13,10
 // while the value is just 10 on Darwin/Linux. Setting the file mode to binary
 // fixes this.
-  assert(_setmode(fileno(stdout), _O_BINARY));
-  assert(_setmode(fileno(stdin), _O_BINARY));
+  int result = _setmode(fileno(stdout), _O_BINARY);
+  assert(result);
+  result = _setmode(fileno(stdin), _O_BINARY);
+  assert(result);
 #endif
   if (log_file_path)
 log.reset(new std::ofstream(log_file_path));
@@ -301,4 +303,3 @@
 }
 
 } // namespace lldb_vscode
-
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69612: [lldb-vscod] fix build with NDEBUG on windows

2019-10-30 Thread Peiyuan Song via Phabricator via lldb-commits
SquallATF added a comment.

In D69612#1726829 , @labath wrote:

> LGTM, modulo the `(void) result` stuff. Do you need someone to commit this 
> for you?


Yes I need.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69612/new/

https://reviews.llvm.org/D69612



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits