Commit b69335d1 authored by Marti's avatar Marti
Browse files

removed obsolete define WIN_GET_DEBUG_CONSOLE

changed the check for debug console to check if NDEBUG is not defined as
it is the standard behaviour
parent b3f63732
...@@ -156,13 +156,6 @@ if (NOT CATCH_SIGSEGV) ...@@ -156,13 +156,6 @@ if (NOT CATCH_SIGSEGV)
add_definitions( -DNO_CATCH_SIGSEGV ) add_definitions( -DNO_CATCH_SIGSEGV )
endif() endif()
if (WIN32)
set ( WIN_GET_DEBUG_CONSOLE False CACHE BOOL "Whether a debug console should be visible on windows" )
if (WIN_GET_DEBUG_CONSOLE)
add_definitions( -DWIN_GET_DEBUG_CONSOLE )
endif()
endif ()
......
...@@ -108,14 +108,6 @@ ...@@ -108,14 +108,6 @@
* *
* ==========================================================*/ * ==========================================================*/
// Includes for windows debugging console
#ifdef WIN32
#ifdef WIN_GET_DEBUG_CONSOLE
#include <fcntl.h>
#include <io.h>
#endif
#endif
#ifdef WIN32 #ifdef WIN32
void attachConsole() void attachConsole()
...@@ -131,7 +123,7 @@ ...@@ -131,7 +123,7 @@
else else
{ {
//create and attach a new console if needed //create and attach a new console if needed
#ifdef _DEBUG #ifndef NDEBUG
//always open a console in debug mode //always open a console in debug mode
AllocConsole(); AllocConsole();
freopen("CONIN$", "r", stdin); freopen("CONIN$", "r", stdin);
...@@ -148,30 +140,7 @@ ...@@ -148,30 +140,7 @@
} }
} }
} }
#ifdef WIN_GET_DEBUG_CONSOLE
void getConsole() {
//Create a console for this application
AllocConsole();
//Redirect unbuffered STDOUT to the console
HANDLE ConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
int SystemOutput = _open_osfhandle(intptr_t(ConsoleOutput), _O_TEXT);
FILE *COutputHandle = _fdopen(SystemOutput, "w" );
*stdout = *COutputHandle;
setvbuf(stdout, NULL, _IONBF, 0);
//Redirect unbuffered STDERR to the console
HANDLE ConsoleError = GetStdHandle(STD_ERROR_HANDLE);
int SystemError = _open_osfhandle(intptr_t(ConsoleError), _O_TEXT);
FILE *CErrorHandle = _fdopen(SystemError, "w" );
*stderr = *CErrorHandle;
setvbuf(stderr, NULL, _IONBF, 0);
//Redirect unbuffered STDIN to the console
HANDLE ConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
int SystemInput = _open_osfhandle(intptr_t(ConsoleInput), _O_TEXT);
FILE *CInputHandle = _fdopen(SystemInput, "r" );
*stdin = *CInputHandle;
setvbuf(stdin, NULL, _IONBF, 0);
}
#endif
#endif #endif
/* ========================================================== /* ==========================================================
...@@ -401,12 +370,6 @@ int main(int argc, char **argv) ...@@ -401,12 +370,6 @@ int main(int argc, char **argv)
OpenFlipper::Options::windowTitle(TOSTRING(PRODUCT_STRING)" v" + OpenFlipper::Options::coreVersion()); OpenFlipper::Options::windowTitle(TOSTRING(PRODUCT_STRING)" v" + OpenFlipper::Options::coreVersion());
#ifdef WIN32
#ifdef WIN_GET_DEBUG_CONSOLE
getConsole();
#endif
#endif
if ( !OpenFlipper::Options::nogui() ) { if ( !OpenFlipper::Options::nogui() ) {
// OpenGL check // OpenGL check
...@@ -435,11 +398,9 @@ int main(int argc, char **argv) ...@@ -435,11 +398,9 @@ int main(int argc, char **argv)
delete w; delete w;
return 1; return 1;
} }
#ifdef WIN32
#ifndef WIN_GET_DEBUG_CONSOLE //only attach to parent console if no separate debug console is requested //attach a console if necessary
attachConsole(); attachConsole();
#endif
#endif
QString tLang = OpenFlipperSettings().value("Core/Language/Translation","en_US").toString(); QString tLang = OpenFlipperSettings().value("Core/Language/Translation","en_US").toString();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment