From 3cd5de7df60ba8493b8ad75040fbfd7ed941e894 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 12 Mar 2010 10:42:29 +0000 Subject: [PATCH] 2010-03-12 11:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Readded -pipe option for gcc (except djgpp) and icc/linux family compilers in a more sophisticated way. Now -pipe option is only used when hbmk2 controls the output filename, and in such case the output filename will always be deleted by hbmk2 if the C compiler returned error. This way -pipe can never leave faulty or dummy object files on disk, confusing incremental builds or just leaving trash behind. BTW, it'd be interesting to know why such seemingly buggy behavior hasn't been fixed in gcc in the last 6-7 years... (making -pipe option useless for Harbour build process f.e.) --- harbour/ChangeLog | 17 +++++++++++++++-- harbour/utils/hbmk2/hbmk2.prg | 23 ++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9dd2ee458d..4e865d749d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,11 +17,24 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-03-12 11:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + + Readded -pipe option for gcc (except djgpp) and icc/linux family + compilers in a more sophisticated way. Now -pipe option is only + used when hbmk2 controls the output filename, and in such case + the output filename will always be deleted by hbmk2 if the + C compiler returned error. This way -pipe can never leave + faulty or dummy object files on disk, confusing incremental builds + or just leaving trash behind. BTW, it'd be interesting to + know why such seemingly buggy behavior hasn't been fixed in gcc + in the last 6-7 years... (making -pipe option useless for Harbour + build process f.e.) + 2010-03-12 01:03 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_hbqplaintextedit.cpp * contrib/hbqt/hbqt_hbqplaintextedit.h - ! Fixed behavior of book-marks. Now color representation - on bookmarked lines is persistent and consistent with + ! Fixed behavior of book-marks. Now color representation + on bookmarked lines is persistent and consistent with corresponding buttons in the statusbar. 2010-03-12 02:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 9a05b2d25d..ec22552f6c 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -2402,6 +2402,9 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cOpt_CompC += " {IC} -o{OO}" ELSE cOpt_CompC += " {IC} -o {OO}" + IF hbmk[ _HBMK_cCOMP ] $ "icc|gcc" + AAdd( hbmk[ _HBMK_aOPTC ], "-pipe" ) + ENDIF ENDIF ELSE cOpt_CompC += " {LC}" @@ -2588,6 +2591,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cOptIncMask := "-I{DI}" IF ! Empty( cWorkDir ) cOpt_CompC += " {IC} -o {OO}" + AAdd( hbmk[ _HBMK_aOPTC ], "-pipe" ) ELSE cOpt_CompC += " {LC}" ENDIF @@ -2716,6 +2720,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cOpt_CompC += " {FC}" IF ! Empty( cWorkDir ) cOpt_CompC += " {IC} -o {OO}" + AAdd( hbmk[ _HBMK_aOPTC ], "-pipe" ) ELSE cOpt_CompC += " {LC}" ENDIF @@ -5020,11 +5025,18 @@ STATIC FUNCTION CompileCLoop( hbmk, aTODO, cBin_CompC, cOpt_CompC, cWorkDir, cOb LOCAL cCommand LOCAL tmp, tmp1 + LOCAL lOutputSpecified + LOCAL cOutputFile + FOR EACH tmp IN aTODO cCommand := cOpt_CompC + + lOutputSpecified := "{OO}" $ cCommand + cOutputFile := FN_DirExtSet( tmp, cWorkDir, cObjExt ) + cCommand := StrTran( cCommand, "{IC}", FN_Escape( tmp, nOpt_Esc ) ) - cCommand := StrTran( cCommand, "{OO}", FN_Escape( PathSepToTarget( hbmk, FN_DirExtSet( tmp, cWorkDir, cObjExt ) ), nOpt_Esc ) ) + cCommand := StrTran( cCommand, "{OO}", FN_Escape( PathSepToTarget( hbmk, cOutputFile ), nOpt_Esc ) ) cCommand := cBin_CompC + " " + AllTrim( cCommand ) @@ -5048,6 +5060,15 @@ STATIC FUNCTION CompileCLoop( hbmk, aTODO, cBin_CompC, cOpt_CompC, cWorkDir, cOb IF ! hbmk[ _HBMK_lQuiet ] OutErr( cCommand + _OUT_EOL ) ENDIF + /* Delete output file in case of compile error. + (only if we know for sure what is the output filename, that is when we + speficied it on the command line) + This is to protect against compiler bugs (f.e. gcc with -pipe option) + when dummy or wrong object file is left on the disk, and misleading + next incremental build pass. [vszakats] */ + IF lOutputSpecified + FErase( cOutputFile ) + ENDIF lResult := .F. EXIT ENDIF