From: borutr Date: Sun, 23 Feb 2003 21:28:42 +0000 (+0000) Subject: corrected assertion in function printILine(): _pipe() was not executed on MSVC, becau... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=752243c8c745f8b9edca892f492f4ffae5595c52;p=fw%2Fsdcc corrected assertion in function printILine(): _pipe() was not executed on MSVC, because NDEBUG is defined (see man assert) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2298 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/asm.c b/src/asm.c index 140691aa..1ab5c527 100644 --- a/src/asm.c +++ b/src/asm.c @@ -9,10 +9,11 @@ #include "common.h" #include "asm.h" -#if defined __MINGW32__ +#ifdef _WIN32 // for O_BINARY in _pipe() # include -#elif !defined(__BORLANDC__) && !defined(_MSC_VER) +# include +#else // for pipe and close # include #endif @@ -266,12 +267,16 @@ char *printILine (iCode *ic) { int filedes[2]; FILE *pipeStream; iCodeTable *icTab=getTableEntry(ic->op); - -#if defined __MINGW32__ - assert(_pipe(filedes, 256, O_BINARY)!=-1); // forget it + int res; + +#ifdef _WIN32 + res = _pipe(filedes, 256, O_BINARY); #else - assert(pipe(filedes)!=-1); // forget it + res = pipe(filedes); #endif + assert(res != -1); // forget it + if (res == -1) + return ""; // return empty line if pipe creation failed // stuff the pipe with the readable icode pipeStream=fdopen(filedes[1],"w");