From ce87a7efdb55b36c665b36f0f93e5f867307dd8b Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 19 Oct 2009 23:21:43 +0000 Subject: [PATCH] 2009-10-20 01:20 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added option to control C compiler warning level: -warn=yes mode will set the warning level exactly the same way as it's set for Harbour builds. This is also the default setting. This setting is usually the highest useful setting, which sometimes equals to C compiler default, sometimes not. -warn=no mode will try to turn off warnings. This works exactly the same way as disabling warnings in Harbour builds. Notice this isn't supported with all C compilers, and with some compilers this equals to default C compiler mode. This mode isn't recommended for any sort of serious work. -warn=def mode will leave everything as is, IOW to C compiler defaults. There is no equivalent setting in Harbour builds. * config/wce/poccarm.mk ! Synced warning option with win/pocc. * config/wce/msvcarm.mk ! Synced warning option with win/msvc. ! Synced HB_BUILD_MODE with win/msvc. (this means C++ is now the default) * config/win/xcc.mk ! Synced warning option with pocc. * examples/hbmsql/tests/dbf2msql.prg * examples/hbmsql/tests/test.prg * examples/hbmsql/tests/hbmk.hbm * examples/hbsqlit2/tests/hbsqlite.prg * examples/hbsqlit2/tests/hbmk.hbm * examples/hbapollo/tests/hbmk.hbm * examples/hbapollo/tests/apollo.prg * examples/hbvpdf/tests/pdf_demo.prg * examples/hbvpdf/tests/hbmk.hbm * examples/hbvpdf/tests/tstpdf.prg ! Fixed warnings and errors in example test apps. + Added -es2 option to test default options in examples. --- harbour/ChangeLog | 43 ++++++ harbour/config/wce/msvcarm.mk | 6 +- harbour/config/wce/poccarm.mk | 2 + harbour/config/win/xcc.mk | 6 + harbour/examples/hbapollo/tests/apollo.prg | 4 +- harbour/examples/hbapollo/tests/hbmk.hbm | 2 + harbour/examples/hbmsql/tests/dbf2msql.prg | 4 +- harbour/examples/hbmsql/tests/hbmk.hbm | 2 + harbour/examples/hbmsql/tests/test.prg | 4 +- harbour/examples/hbsqlit2/tests/hbmk.hbm | 2 + harbour/examples/hbsqlit2/tests/hbsqlite.prg | 15 +- harbour/examples/hbvpdf/tests/hbmk.hbm | 2 + harbour/examples/hbvpdf/tests/pdf_demo.prg | 6 +- harbour/examples/hbvpdf/tests/tstpdf.prg | 6 +- harbour/utils/hbmk2/hbmk2.prg | 147 ++++++++++++++----- 15 files changed, 191 insertions(+), 60 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6c56caaa06..b99d0b4a40 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,49 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-20 01:20 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + + Added option to control C compiler warning level: + -warn=yes mode will set the warning level exactly + the same way as it's set for Harbour builds. This + is also the default setting. + This setting is usually the highest useful setting, + which sometimes equals to C compiler default, sometimes + not. + -warn=no mode will try to turn off warnings. This works + exactly the same way as disabling warnings in Harbour + builds. Notice this isn't supported with all C compilers, + and with some compilers this equals to default C compiler + mode. This mode isn't recommended for any sort of serious + work. + -warn=def mode will leave everything as is, IOW to + C compiler defaults. There is no equivalent setting in + Harbour builds. + + * config/wce/poccarm.mk + ! Synced warning option with win/pocc. + + * config/wce/msvcarm.mk + ! Synced warning option with win/msvc. + ! Synced HB_BUILD_MODE with win/msvc. + (this means C++ is now the default) + + * config/win/xcc.mk + ! Synced warning option with pocc. + + * examples/hbmsql/tests/dbf2msql.prg + * examples/hbmsql/tests/test.prg + * examples/hbmsql/tests/hbmk.hbm + * examples/hbsqlit2/tests/hbsqlite.prg + * examples/hbsqlit2/tests/hbmk.hbm + * examples/hbapollo/tests/hbmk.hbm + * examples/hbapollo/tests/apollo.prg + * examples/hbvpdf/tests/pdf_demo.prg + * examples/hbvpdf/tests/hbmk.hbm + * examples/hbvpdf/tests/tstpdf.prg + ! Fixed warnings and errors in example test apps. + + Added -es2 option to test default options in examples. + 2009-10-20 01:18 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbwin/oleinit.c * harbour/contrib/hbwin/hbwinole.h diff --git a/harbour/config/wce/msvcarm.mk b/harbour/config/wce/msvcarm.mk index 51bc7446ba..a2f574db28 100644 --- a/harbour/config/wce/msvcarm.mk +++ b/harbour/config/wce/msvcarm.mk @@ -38,9 +38,13 @@ endif ifeq ($(HB_BUILD_MODE),cpp) CFLAGS += -TP endif +# Build in C++ mode by default +ifeq ($(HB_BUILD_MODE),) + CFLAGS += -TP +endif ifneq ($(HB_BUILD_WARN),no) - CFLAGS += -W4 + CFLAGS += -W4 -wd4127 endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/wce/poccarm.mk b/harbour/config/wce/poccarm.mk index 0bd22a1da5..c752851329 100644 --- a/harbour/config/wce/poccarm.mk +++ b/harbour/config/wce/poccarm.mk @@ -21,6 +21,8 @@ LDFLAGS := ifneq ($(HB_BUILD_WARN),no) CPPFLAGS += -W1 +else + CPPFLAGS += -W0 endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/win/xcc.mk b/harbour/config/win/xcc.mk index fe28ca460e..04d5040e0c 100644 --- a/harbour/config/win/xcc.mk +++ b/harbour/config/win/xcc.mk @@ -24,6 +24,12 @@ endif CPPFLAGS += -MT LDFLAGS := +ifneq ($(HB_BUILD_WARN),no) + CPPFLAGS += -W1 +else + CPPFLAGS += -W0 +endif + ifneq ($(HB_BUILD_OPTIM),no) # disabled - it produces bad code #CPPFLAGS += -Ot diff --git a/harbour/examples/hbapollo/tests/apollo.prg b/harbour/examples/hbapollo/tests/apollo.prg index ab8f312268..930a9f4e2c 100644 --- a/harbour/examples/hbapollo/tests/apollo.prg +++ b/harbour/examples/hbapollo/tests/apollo.prg @@ -53,7 +53,7 @@ #include "apollo.ch" -FUNCTION Main() +PROCEDURE Main() LOCAL nAlias LOCAL f @@ -81,7 +81,7 @@ LOCAL f 6) // Maximum fields added by sx_CreateField IF nAlias == 0 ? "Error creating database" - RETU NIL + RETURN ENDIF sx_CreateField("FIRST" ,"C",40,0) diff --git a/harbour/examples/hbapollo/tests/hbmk.hbm b/harbour/examples/hbapollo/tests/hbmk.hbm index 7a60b00ca4..a7ca888e69 100644 --- a/harbour/examples/hbapollo/tests/hbmk.hbm +++ b/harbour/examples/hbapollo/tests/hbmk.hbm @@ -3,3 +3,5 @@ # ../hbapollo.hbc + +-w3 -es2 diff --git a/harbour/examples/hbmsql/tests/dbf2msql.prg b/harbour/examples/hbmsql/tests/dbf2msql.prg index a85629ed27..e3bd6ddce2 100644 --- a/harbour/examples/hbmsql/tests/dbf2msql.prg +++ b/harbour/examples/hbmsql/tests/dbf2msql.prg @@ -51,9 +51,9 @@ */ -procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11) +procedure main(...) - local cTok, nTok := 1 + local cTok local cHostName, cDataBase, cTable, cFile local aDbfStruct, i local lCreateTable := .F. diff --git a/harbour/examples/hbmsql/tests/hbmk.hbm b/harbour/examples/hbmsql/tests/hbmk.hbm index 85c48fc043..dc6f5a22d4 100644 --- a/harbour/examples/hbmsql/tests/hbmk.hbm +++ b/harbour/examples/hbmsql/tests/hbmk.hbm @@ -3,3 +3,5 @@ # ../hbmsql.hbc + +-w3 -es2 diff --git a/harbour/examples/hbmsql/tests/test.prg b/harbour/examples/hbmsql/tests/test.prg index 80c1026959..f7d384425b 100644 --- a/harbour/examples/hbmsql/tests/test.prg +++ b/harbour/examples/hbmsql/tests/test.prg @@ -54,7 +54,7 @@ procedure main(cArg) - local oServer, oQuery, oQuery2, oRow, i, aStru + local oServer, oQuery, oQuery2, oRow, aStru SET CENTURY ON SET EPOCH TO 1960 @@ -80,7 +80,7 @@ procedure main(cArg) oQuery:=oServer:Query("SELECT * from test where _rowid = 1") - oRow := oQuery:GetBlankRow() +// oRow := oQuery:GetBlankRow() while !wn->(eof()) diff --git a/harbour/examples/hbsqlit2/tests/hbmk.hbm b/harbour/examples/hbsqlit2/tests/hbmk.hbm index 5e58db745c..003c47d377 100644 --- a/harbour/examples/hbsqlit2/tests/hbmk.hbm +++ b/harbour/examples/hbsqlit2/tests/hbmk.hbm @@ -3,3 +3,5 @@ # ../hbsqlit2.hbc + +-w3 -es2 diff --git a/harbour/examples/hbsqlit2/tests/hbsqlite.prg b/harbour/examples/hbsqlit2/tests/hbsqlite.prg index fca8c0aee0..07e0da4ba0 100644 --- a/harbour/examples/hbsqlit2/tests/hbsqlite.prg +++ b/harbour/examples/hbsqlit2/tests/hbsqlite.prg @@ -54,8 +54,7 @@ PROCEDURE MAIN() *--------------------------------------------------------------------------- * Main procedure *--------------------------------------------------------------------------- - LOCAL lError := .F. - LOCAL nError := 0, nOption + LOCAL nError, nOption LOCAL cDbase LOCAL cDTable @@ -71,7 +70,7 @@ PROCEDURE MAIN() #include "setcurs.ch" #include "box.ch" #include "inkey.ch" - #include "hbsqlite.ch" // REQUIRED ! + #include "hbsqlit2.ch" // REQUIRED ! // basic setup SET WRAP ON @@ -209,7 +208,7 @@ RETURN // End Main *--------------------------------------------------------------------------- * Shows Information about fields... *--------------------------------------------------------------------------- - LOCAL aResult, nChoices, n, aBrowse := {}, nLen, cData := "" + LOCAL aResult, n, aBrowse := {}, nLen, cData LOCAL nOldCursor, nOldRow, nOldCol, cOldScreen, cOldColor, cDflt LOCAL nFrom, nTo LOCAL cc, clen @@ -260,7 +259,6 @@ FOR n := 3 TO nLen IIF( aResult[ n ][FLD_PRIMKEY], "TRUE ", "FALSE") AADD( aBrowse, cData) - cData := "" NEXT SETCOLOR( "W+/BG,W+/B,N,N,N/W*" ) @@ -275,7 +273,7 @@ NEXT @ 8,03 SAY " Name" + SPACE(21) + "Default Val." + SPACE(3) + "Type" +; SPACE(10) + "Len Primary Key" COLOR "N/W" - nChoices := ACHOICE( 9, 4, 20, 75, aBrowse ) + ACHOICE( 9, 4, 20, 75, aBrowse ) * restore status RESTSCREEN( 0, 0, MAXROW(), MAXCOL(), cOldScreen ) @@ -598,11 +596,10 @@ RETURN( IIF( nChoices > 0, aResult[ nChoices ], "") ) *--------------------------------------------------------------------------- LOCAL cTable := ShowTables(), aOpt := {" Yes ", " No "} LOCAL nOpt -LOCAL aResult nOpt := ALERT("Warning!;;The table selected will be erased;" +; "without any choice to recover;Continue ? ", aOpt ) IF nOpt == 1 // Yes - aResult := SQLITE_EXECUTE( "drop table " + cTable ) + SQLITE_EXECUTE( "drop table " + cTable ) ENDIF RETURN 0 @@ -653,7 +650,6 @@ RETURN( cData) *--------------------------------------------------------------------------- LOCAL aResult, nFields, nRecc, i, j LOCAL cQuery := ".", cQuery1 -LOCAL cQuery2 := SPACE(74) IF cDBase == NIL .OR. EMPTY(cDBase) RETURN 0 @@ -979,7 +975,6 @@ RETURN( lFound ) PROCEDURE HELP - LOCAL nWide := 40 ALERT( "HARBOUR INTERFACE for SQLITE;;" +; "Version: " + HB_HB4SQLITE_VER + ";;" +; diff --git a/harbour/examples/hbvpdf/tests/hbmk.hbm b/harbour/examples/hbvpdf/tests/hbmk.hbm index 2d9c297375..1c456d2d52 100644 --- a/harbour/examples/hbvpdf/tests/hbmk.hbm +++ b/harbour/examples/hbvpdf/tests/hbmk.hbm @@ -3,3 +3,5 @@ # ../hbvpdf.hbc + +-w3 -es2 diff --git a/harbour/examples/hbvpdf/tests/pdf_demo.prg b/harbour/examples/hbvpdf/tests/pdf_demo.prg index 1299db2618..179cdcef79 100644 --- a/harbour/examples/hbvpdf/tests/pdf_demo.prg +++ b/harbour/examples/hbvpdf/tests/pdf_demo.prg @@ -7,7 +7,7 @@ procedure main() local aReport - local cRun, nWidth, nTab, nI, nJ, nK, nCol, nRow, aStyle, aFonts + local nWidth, nTab, nI, nJ, nK, nCol, nRow, aStyle, aFonts local nTop, nLeft, nBottom, nRight, cTestFile local aColor := { ; "FF0000", "8B0000", "800000", "FF4500", "D2691E", "B8860B", "FF8C00", "FFA500", "DAA520", "808000", "FFD700", "FFFF00", "ADFF2F", "9ACD32", "7FFF00", "7CFC00", "00FF00", "32CD32", "008000", "006400",; @@ -134,7 +134,7 @@ procedure main() pdfNewPage( "LETTER", "P", 6 ) pdfBookAdd( "JPEG", 2, aReport[ REPORTPAGE ], 0 ) pdfImage( 'files' + HB_OSPATHSEPARATOR() + 'color.jpg', 0, 0, "M" ) // file, row, col, units, height, width - pdfRJust(pdfUnderline("JPEG"), nK++, aReport[ REPORTWIDTH ], "R") + pdfRJust(pdfUnderline("JPEG"), nK, aReport[ REPORTWIDTH ], "R") pdfOpenHeader('test.hea') @@ -160,7 +160,7 @@ procedure main() pdfClose() static function cton( cString, nBase ) // this function called only used in pdf_demo.prg -local cTemp, nI, cChar := "", n := 0, nLen +local cTemp, nI, cChar, n := 0, nLen nLen := len( cString ) cTemp := "" diff --git a/harbour/examples/hbvpdf/tests/tstpdf.prg b/harbour/examples/hbvpdf/tests/tstpdf.prg index 1923a3008a..e4f0e86823 100644 --- a/harbour/examples/hbvpdf/tests/tstpdf.prg +++ b/harbour/examples/hbvpdf/tests/tstpdf.prg @@ -10,7 +10,7 @@ function Main() - local cRun, nWidth, nTab, nI, nJ, nK, nCol, nRow, aStyle, aFonts + local nWidth, nTab, nI, nJ, nK, nCol, nRow, aStyle, aFonts local nTop, nLeft, nBottom, nRight, cText, oPdf local aColor := { ; "FF0000", "8B0000", "800000", "FF4500", "D2691E", "B8860B", "FF8C00", "FFA500", "DAA520", "808000", "FFD700", "FFFF00", "ADFF2F", "9ACD32", "7FFF00", "7CFC00", "00FF00", "32CD32", "008000", "006400",; @@ -131,7 +131,7 @@ function Main() oPdf:NewPage( "LETTER", "P", 6 ) oPdf:BookAdd( "JPEG", 2, oPdf:aReport[ REPORTPAGE ], 0 ) oPdf:Image( 'files\color.jpg', 0, 0, "M" ) // file, row, col, units, height, width - oPdf:RJust(oPdf:Underline("JPEG"), nK++, oPdf:aReport[ REPORTWIDTH ], "R") + oPdf:RJust(oPdf:Underline("JPEG"), nK, oPdf:aReport[ REPORTWIDTH ], "R") oPdf:OpenHeader('test.hea') @@ -166,7 +166,7 @@ return nil // This function called only used in tstPdf.prg // static function cton( cString, nBase ) -local cTemp, nI, cChar := "", n := 0, nLen +local cTemp, nI, cChar, n := 0, nLen nLen := len( cString ) cTemp := "" diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 6d55da1ef5..c387c5f3b1 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -99,7 +99,7 @@ /* TODO: Clean up compiler autodetection and add those few feature only found in GNU Make / global.mk, like *nix native autodetection, autodetection of watcom cross-build setups, poccarm/pocc64 setups, - etc. */ + clang, etc. */ #ifndef _HBMK_EMBEDDED_ @@ -138,6 +138,10 @@ REQUEST hbmk_KEYW #define _PAR_cFileName 2 #define _PAR_nLine 3 +#define _WARN_DEF 0 +#define _WARN_YES 1 +#define _WARN_NO 2 + #define _COMPR_OFF 0 #define _COMPR_DEF 1 #define _COMPR_MIN 2 @@ -254,47 +258,48 @@ REQUEST hbmk_KEYW #define _HBMK_lSTRIP 43 #define _HBMK_lOPTIM 44 #define _HBMK_nCOMPR 45 -#define _HBMK_lRUN 46 -#define _HBMK_lINC 47 -#define _HBMK_lREBUILDPO 48 -#define _HBMK_lMINIPO 49 -#define _HBMK_lUNICODE 50 -#define _HBMK_nCONF 51 -#define _HBMK_lIGNOREERROR 52 -#define _HBMK_lIMPLIB 53 +#define _HBMK_nWARN 46 +#define _HBMK_lRUN 47 +#define _HBMK_lINC 48 +#define _HBMK_lREBUILDPO 49 +#define _HBMK_lMINIPO 50 +#define _HBMK_lUNICODE 51 +#define _HBMK_nCONF 52 +#define _HBMK_lIGNOREERROR 53 +#define _HBMK_lIMPLIB 54 -#define _HBMK_lCreateLib 54 -#define _HBMK_lCreateDyn 55 +#define _HBMK_lCreateLib 55 +#define _HBMK_lCreateDyn 56 -#define _HBMK_lBLDFLGP 56 -#define _HBMK_lBLDFLGC 57 -#define _HBMK_lBLDFLGL 58 +#define _HBMK_lBLDFLGP 57 +#define _HBMK_lBLDFLGC 58 +#define _HBMK_lBLDFLGL 59 -#define _HBMK_cFIRST 59 -#define _HBMK_aPRG 60 -#define _HBMK_aC 61 -#define _HBMK_aRESSRC 62 -#define _HBMK_aRESCMP 63 -#define _HBMK_aOBJUSER 64 -#define _HBMK_aICON 65 -#define _HBMK_hDEPTS 66 +#define _HBMK_cFIRST 60 +#define _HBMK_aPRG 61 +#define _HBMK_aC 62 +#define _HBMK_aRESSRC 63 +#define _HBMK_aRESCMP 64 +#define _HBMK_aOBJUSER 65 +#define _HBMK_aICON 66 +#define _HBMK_hDEPTS 67 -#define _HBMK_aPO 67 -#define _HBMK_cHBL 68 -#define _HBMK_cHBLDir 69 -#define _HBMK_aLNG 70 -#define _HBMK_cPO 71 +#define _HBMK_aPO 68 +#define _HBMK_cHBL 69 +#define _HBMK_cHBLDir 70 +#define _HBMK_aLNG 71 +#define _HBMK_cPO 72 -#define _HBMK_lDEBUGTIME 72 -#define _HBMK_lDEBUGINC 73 -#define _HBMK_lDEBUGSTUB 74 -#define _HBMK_lDEBUGI18N 75 +#define _HBMK_lDEBUGTIME 73 +#define _HBMK_lDEBUGINC 74 +#define _HBMK_lDEBUGSTUB 75 +#define _HBMK_lDEBUGI18N 76 -#define _HBMK_cCCPATH 76 -#define _HBMK_cCCPREFIX 77 -#define _HBMK_cCCPOSTFIX 78 +#define _HBMK_cCCPATH 77 +#define _HBMK_cCCPREFIX 78 +#define _HBMK_cCCPOSTFIX 79 -#define _HBMK_MAX_ 78 +#define _HBMK_MAX_ 79 #ifndef _HBMK_EMBEDDED_ @@ -678,6 +683,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) hbmk[ _HBMK_lBEEP ] := .F. hbmk[ _HBMK_lSTRIP ] := .F. hbmk[ _HBMK_lOPTIM ] := .T. + hbmk[ _HBMK_nWARN ] := _WARN_YES hbmk[ _HBMK_nCOMPR ] := _COMPR_OFF hbmk[ _HBMK_lRUN ] := .F. hbmk[ _HBMK_lINC ] := .F. @@ -1499,6 +1505,19 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) CASE cParamL == "-strip" ; hbmk[ _HBMK_lSTRIP ] := .T. CASE cParamL == "-strip-" .OR. ; cParamL == "-nostrip" ; hbmk[ _HBMK_lSTRIP ] := .F. + + CASE cParamL == "-warn" .OR. ; + Left( cParamL, 7 ) == "-warn=" + + DO CASE + CASE SubStr( cParamL, 8 ) == "def" ; hbmk[ _HBMK_nWARN ] := _WARN_DEF + CASE SubStr( cParamL, 8 ) == "no" ; hbmk[ _HBMK_nWARN ] := _WARN_NO + OTHERWISE ; hbmk[ _HBMK_nWARN ] := _WARN_YES + ENDCASE + + CASE cParamL == "-warn-" .OR. ; + cParamL == "-nowarn" ; hbmk[ _HBMK_nWARN ] := _WARN_NO + CASE cParamL == "-compr" .OR. ; Left( cParamL, 7 ) == "-compr=" @@ -1509,7 +1528,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) ENDCASE CASE cParamL == "-compr-" .OR. ; - cParamL == "-nocompr" ; hbmk[ _HBMK_nCOMPR ] := _COMPR_OFF + cParamL == "-nocompr" ; hbmk[ _HBMK_nCOMPR ] := _COMPR_OFF CASE cParamL == "-head" .OR. ; Left( cParamL, 6 ) == "-head=" @@ -1522,7 +1541,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) ENDCASE CASE cParamL == "-head-" .OR. ; - cParamL == "-nohead" ; hbmk[ _HBMK_nHEAD ] := _HEAD_OFF + cParamL == "-nohead" ; hbmk[ _HBMK_nHEAD ] := _HEAD_OFF CASE Left( cParamL, 5 ) == "-cpp=" @@ -2160,6 +2179,15 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) IF hbmk[ _HBMK_lOPTIM ] cOpt_CompC += " -O3" ENDIF + IF hbmk[ _HBMK_cCOMP ] == "icc" + IF hbmk[ _HBMK_nWARN ] == _WARN_YES + /* AAdd( hbmk[ _HBMK_aOPTC ], "-w2 -Wall" ) */ + ENDIF + ELSE + IF hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -W" ) + ENDIF + ENDIF cOpt_CompC += " {FC}" IF hbmk[ _HBMK_lINC ] .AND. ! Empty( cWorkDir ) cOpt_CompC += " {IC} -o {OO}" @@ -2336,6 +2364,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) cOpt_CompC += " -fomit-frame-pointer" ENDIF ENDIF + IF hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -W" ) + ENDIF cOpt_CompC += " {FC}" cOptIncMask := "-I{DI}" IF hbmk[ _HBMK_lINC ] .AND. ! Empty( cWorkDir ) @@ -2446,6 +2477,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) IF hbmk[ _HBMK_lOPTIM ] cOpt_CompC += " -O3" ENDIF + IF hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -W" ) + ENDIF cOpt_CompC += " {FC}" IF hbmk[ _HBMK_lINC ] .AND. ! Empty( cWorkDir ) cOpt_CompC += " {IC} -o {OO}" @@ -2536,6 +2570,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) IF hbmk[ _HBMK_lOPTIM ] cOpt_CompC += " -O3" ENDIF + IF hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -W" ) + ENDIF cOpt_CompC += " {FC}" IF hbmk[ _HBMK_lINC ] .AND. ! Empty( cWorkDir ) cOpt_CompC += " {IC} -o {OO}" @@ -2642,6 +2679,12 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) ENDIF ENDIF DO CASE + CASE hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-w3" ) + CASE hbmk[ _HBMK_nWARN ] == _WARN_NO + AAdd( hbmk[ _HBMK_aOPTC ], "-w0" ) + ENDCASE + DO CASE CASE hbmk[ _HBMK_cPLAT ] == "linux" ; cOpt_CompC += " -zq -bt=linux {FC}" CASE hbmk[ _HBMK_cPLAT ] == "win" ; cOpt_CompC += " -zq -bt=nt {FC}" CASE hbmk[ _HBMK_cPLAT ] == "dos" ; cOpt_CompC += " -zq -bt=dos {FC}" @@ -2775,6 +2818,12 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) IF hbmk[ _HBMK_lOPTIM ] cOpt_CompC += " -d -6 -O2 -OS -Ov -Oi -Oc" ENDIF + DO CASE + CASE hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-w -w-sig- -Q" ) + CASE hbmk[ _HBMK_nWARN ] == _WARN_NO + AAdd( hbmk[ _HBMK_aOPTC ], "-w-" ) + ENDCASE cOpt_CompC += " {FC} {LC}" cBin_Res := "brcc32.exe" cOpt_Res := "{FR} {IR} -fo{OS}" @@ -2881,6 +2930,16 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) ENDIF ENDIF ENDIF + IF hbmk[ _HBMK_cCOMP ] $ "icc|iccia64" + IF hbmk[ _HBMK_nWARN ] == _WARN_YES + /* -W4 is deadly on icc */ + AAdd( hbmk[ _HBMK_aOPTC ], "-W3" ) + ENDIF + ELSE + IF hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-W4 -wd4127" ) + ENDIF + ENDIF cOpt_CompC += " {FC} {LC}" cOptIncMask := "-I{DI}" cOpt_Link := "-nologo -out:{OE} {LO} {DL} {FL} {LL} {LB} {LS}" @@ -3004,6 +3063,13 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) AAdd( hbmk[ _HBMK_aOPTC ], "-D_WINCE" ) AAdd( hbmk[ _HBMK_aOPTC ], "-DUNICODE" ) ENDCASE + DO CASE + CASE hbmk[ _HBMK_nWARN ] == _WARN_YES + /* -W2 is the max, but it contains too many meaningless warnings. */ + AAdd( hbmk[ _HBMK_aOPTC ], "-W1" ) + CASE hbmk[ _HBMK_nWARN ] == _WARN_NO + AAdd( hbmk[ _HBMK_aOPTC ], "-W0" ) + ENDCASE cOpt_Res := "{FR} -Fo{OS} {IR}" cResExt := ".res" cOpt_Lib := "{FA} -out:{OL} {LO}" @@ -3062,6 +3128,12 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) AAdd( hbmk[ _HBMK_aOPTD ], "-fast" ) AAdd( hbmk[ _HBMK_aOPTD ], "-xnolibmopt" ) ENDIF + DO CASE + CASE hbmk[ _HBMK_nWARN ] == _WARN_YES + AAdd( hbmk[ _HBMK_aOPTC ], "-erroff=%all" ) + CASE hbmk[ _HBMK_nWARN ] == _WARN_NO + AAdd( hbmk[ _HBMK_aOPTC ], "-erroff=%none" ) + ENDCASE IF hbmk[ _HBMK_lINC ] .AND. ! Empty( cWorkDir ) cOpt_CompC += " {IC} -o {OO}" ELSE @@ -7291,6 +7363,7 @@ STATIC PROCEDURE ShowHelp( lLong ) { "-nolibgrouping[-]" , I_( "disable library grouping on gcc based compilers" ) },; { "-nomiscsyslib[-]" , I_( "don't add extra list of system libraries to default library list" ) },; { "-traceonly" , I_( "show commands to be executed, but don't execute them" ) },; + { "-[no]warn[=lev]" , I_( "set C compiler warning level\n can be: yes, no, def (default: yes)" ) },; { "-[no]compr[=lev]" , I_( "compress executable/dynamic lib (needs UPX)\n can be: min, max, def" ) },; { "-[no]run" , I_( "run/don't run output executable" ) },; { "-vcshead=" , I_( "generate .ch header file with local repository information. SVN, CVS, Git, Mercurial and Bazaar are currently supported. Generated header will define macro _HBMK_VCS_TYPE_ with the name of detected VCS and _HBMK_VCS_ID_ with the unique ID of local repository" ) },;