[Lldb-commits] [lldb] 2dbcfad - [lldb-vscod] fix build with NDEBUG on windows

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 30 06:22:38 PDT 2019


Author: SquallATF
Date: 2019-10-30T14:20:22+01:00
New Revision: 2dbcfad35de6a1c86e794d911304ed50257d6d87

URL: https://github.com/llvm/llvm-project/commit/2dbcfad35de6a1c86e794d911304ed50257d6d87
DIFF: https://github.com/llvm/llvm-project/commit/2dbcfad35de6a1c86e794d911304ed50257d6d87.diff

LOG: [lldb-vscod] fix build with NDEBUG on windows

Summary: _setmode in assert will not run when build with NDEBUG

Reviewers: mstorsjo, labath, amccarth

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D69612

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-vscode/VSCode.cpp b/lldb/tools/lldb-vscode/VSCode.cpp
index 283798eb7aba..74c3088f4c78 100644
--- a/lldb/tools/lldb-vscode/VSCode.cpp
+++ b/lldb/tools/lldb-vscode/VSCode.cpp
@@ -44,8 +44,10 @@ VSCode::VSCode()
 // 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 @@ void VSCode::RunExitCommands() {
 }
 
 } // namespace lldb_vscode
-


        


More information about the lldb-commits mailing list