From c0b28bd5daf631414b5014a8e65d5f69b7d7d36e Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 15 Jan 2011 00:15:42 +0000 Subject: [PATCH] 2011-01-15 01:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcomp.h * do not inherit in macrocompiler -z compile time switch when -kc is also used * harbour/src/common/expropt2.c * disable logical expression optimization (reduction) in macrocompiler when -kc compile time switch is used. * harbour/config/beos/gcc.mk * harbour/config/qnx/gcc.mk * harbour/config/bsd/gcc.mk * harbour/config/wce/mingwarm.mk * harbour/config/vxworks/gcc.mk * harbour/config/hpux/gcc.mk * harbour/config/darwin/gcc.mk * harbour/config/dos/djgpp.mk * harbour/config/win/mingw.mk * harbour/config/linux/gcc.mk * harbour/config/cygwin/gcc.mk * harbour/config/symbian/gcc.mk * harbour/config/os2/gcc.mk * harbour/config/sunos/gcc.mk * harbour/utils/hbmk2/hbmk2.prg * enable some important warnings in GCC builds using -W... instead of -Wall and -Wno-... for warning level set to low. It should help in backward compatibility with some older GCC versions. --- harbour/ChangeLog | 28 ++++++++++++++++++++++++++++ harbour/config/beos/gcc.mk | 2 +- harbour/config/bsd/gcc.mk | 2 +- harbour/config/cygwin/gcc.mk | 2 +- harbour/config/darwin/gcc.mk | 2 +- harbour/config/dos/djgpp.mk | 2 +- harbour/config/hpux/gcc.mk | 2 +- harbour/config/linux/gcc.mk | 2 +- harbour/config/os2/gcc.mk | 2 +- harbour/config/qnx/gcc.mk | 2 +- harbour/config/sunos/gcc.mk | 2 +- harbour/config/symbian/gcc.mk | 2 +- harbour/config/vxworks/gcc.mk | 2 +- harbour/config/wce/mingwarm.mk | 2 +- harbour/config/win/mingw.mk | 2 +- harbour/include/hbcomp.h | 17 ++++++++++------- harbour/src/common/expropt2.c | 6 ++++-- harbour/utils/hbmk2/hbmk2.prg | 8 ++++---- 18 files changed, 60 insertions(+), 27 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d00f55647a..8d1f01a09d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,34 @@ The license applies to all entries newer than 2009-04-28. */ +2011-01-15 01:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbcomp.h + * do not inherit in macrocompiler -z compile time switch when -kc is + also used + + * harbour/src/common/expropt2.c + * disable logical expression optimization (reduction) in macrocompiler + when -kc compile time switch is used. + + * harbour/config/beos/gcc.mk + * harbour/config/qnx/gcc.mk + * harbour/config/bsd/gcc.mk + * harbour/config/wce/mingwarm.mk + * harbour/config/vxworks/gcc.mk + * harbour/config/hpux/gcc.mk + * harbour/config/darwin/gcc.mk + * harbour/config/dos/djgpp.mk + * harbour/config/win/mingw.mk + * harbour/config/linux/gcc.mk + * harbour/config/cygwin/gcc.mk + * harbour/config/symbian/gcc.mk + * harbour/config/os2/gcc.mk + * harbour/config/sunos/gcc.mk + * harbour/utils/hbmk2/hbmk2.prg + * enable some important warnings in GCC builds using -W... instead + of -Wall and -Wno-... for warning level set to low. + It should help in backward compatibility with some older GCC versions. + 2011-01-14 10:12 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/config/beos/gcc.mk * harbour/config/qnx/gcc.mk diff --git a/harbour/config/beos/gcc.mk b/harbour/config/beos/gcc.mk index a9284e4675..a6833b7c63 100644 --- a/harbour/config/beos/gcc.mk +++ b/harbour/config/beos/gcc.mk @@ -23,7 +23,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/bsd/gcc.mk b/harbour/config/bsd/gcc.mk index bc59b6fa6f..16f8386cd9 100644 --- a/harbour/config/bsd/gcc.mk +++ b/harbour/config/bsd/gcc.mk @@ -25,7 +25,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/cygwin/gcc.mk b/harbour/config/cygwin/gcc.mk index 2cf6fa1605..38283f6284 100644 --- a/harbour/config/cygwin/gcc.mk +++ b/harbour/config/cygwin/gcc.mk @@ -21,7 +21,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/darwin/gcc.mk b/harbour/config/darwin/gcc.mk index 8b7c96b3c2..a20c98f9d0 100644 --- a/harbour/config/darwin/gcc.mk +++ b/harbour/config/darwin/gcc.mk @@ -31,7 +31,7 @@ CFLAGS += -fno-common ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/dos/djgpp.mk b/harbour/config/dos/djgpp.mk index d0da345b17..4365e7edd9 100644 --- a/harbour/config/dos/djgpp.mk +++ b/harbour/config/dos/djgpp.mk @@ -22,7 +22,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/hpux/gcc.mk b/harbour/config/hpux/gcc.mk index 83d88a708b..521502138c 100644 --- a/harbour/config/hpux/gcc.mk +++ b/harbour/config/hpux/gcc.mk @@ -27,7 +27,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/linux/gcc.mk b/harbour/config/linux/gcc.mk index bc59b6fa6f..16f8386cd9 100644 --- a/harbour/config/linux/gcc.mk +++ b/harbour/config/linux/gcc.mk @@ -25,7 +25,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/os2/gcc.mk b/harbour/config/os2/gcc.mk index 5cdb5c6b13..8c62457f65 100644 --- a/harbour/config/os2/gcc.mk +++ b/harbour/config/os2/gcc.mk @@ -30,7 +30,7 @@ endif ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/qnx/gcc.mk b/harbour/config/qnx/gcc.mk index b480a90433..c133a91b7e 100644 --- a/harbour/config/qnx/gcc.mk +++ b/harbour/config/qnx/gcc.mk @@ -25,7 +25,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/sunos/gcc.mk b/harbour/config/sunos/gcc.mk index 61bedee631..f22e81f814 100644 --- a/harbour/config/sunos/gcc.mk +++ b/harbour/config/sunos/gcc.mk @@ -25,7 +25,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/symbian/gcc.mk b/harbour/config/symbian/gcc.mk index 3fd3828903..4e8b82f599 100644 --- a/harbour/config/symbian/gcc.mk +++ b/harbour/config/symbian/gcc.mk @@ -25,7 +25,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/vxworks/gcc.mk b/harbour/config/vxworks/gcc.mk index 006f61dd47..5bd647aee7 100644 --- a/harbour/config/vxworks/gcc.mk +++ b/harbour/config/vxworks/gcc.mk @@ -35,7 +35,7 @@ CFLAGS += -D_C99 -D_HAS_C9X ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/wce/mingwarm.mk b/harbour/config/wce/mingwarm.mk index 643fdcaa73..9911695500 100644 --- a/harbour/config/wce/mingwarm.mk +++ b/harbour/config/wce/mingwarm.mk @@ -21,7 +21,7 @@ CFLAGS += -I. -I$(HB_HOST_INC) ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/config/win/mingw.mk b/harbour/config/win/mingw.mk index 4004ad5b31..58dbc2b51b 100644 --- a/harbour/config/win/mingw.mk +++ b/harbour/config/win/mingw.mk @@ -36,7 +36,7 @@ endif ifneq ($(HB_BUILD_WARN),no) CFLAGS += -W -Wall else - CFLAGS += -Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main + CFLAGS += -Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat endif ifneq ($(HB_BUILD_OPTIM),no) diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 5c5d728097..da69e4e64a 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -400,13 +400,16 @@ extern const HB_BYTE hb_comp_pcode_len[]; #if defined( HB_MACRO_SUPPORT ) # define HB_MACRO_GENFLAGS HB_COMPFLAG_RT_MACRO #elif ! defined( HB_COMMON_SUPPORT ) -# define HB_MACRO_GENFLAGS ( ( ( HB_BYTE ) HB_COMP_PARAM->supported ) & \ - ( HB_COMPFLAG_HARBOUR | \ - HB_COMPFLAG_XBASE | \ - HB_COMPFLAG_SHORTCUTS | \ - HB_COMPFLAG_ARRSTR | \ - HB_COMPFLAG_EXTOPT | \ - HB_COMPFLAG_RT_MACRO ) ) +# define HB_MACRO_GENFLAGS ( ( ( ( HB_BYTE ) HB_COMP_PARAM->supported ) & \ + ( HB_COMPFLAG_HARBOUR | \ + HB_COMPFLAG_XBASE | \ + HB_COMPFLAG_SHORTCUTS | \ + HB_COMPFLAG_ARRSTR | \ + HB_COMPFLAG_EXTOPT | \ + HB_COMPFLAG_RT_MACRO ) ) | \ + ( ( HB_COMP_PARAM->supported & \ + HB_COMPFLAG_HARBOUR ) == 0 ? \ + HB_COMPFLAG_SHORTCUTS : 0 ) ) #endif HB_EXTERN_END diff --git a/harbour/src/common/expropt2.c b/harbour/src/common/expropt2.c index 680d74ed31..59990f9138 100644 --- a/harbour/src/common/expropt2.c +++ b/harbour/src/common/expropt2.c @@ -1725,7 +1725,8 @@ HB_EXPR_PTR hb_compExprReduceAnd( HB_EXPR_PTR pSelf, HB_COMP_DECL ) } } else if( pRight->ExprType == HB_ET_LOGICAL && - HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) + HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) && + ( HB_COMP_PARAM->mode == HB_MODE_COMPILER || HB_SUPPORT_HARBOUR ) ) { if( pRight->value.asLogical ) { @@ -1792,7 +1793,8 @@ HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_COMP_DECL ) } } else if( pRight->ExprType == HB_ET_LOGICAL && - HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) + HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) && + ( HB_COMP_PARAM->mode == HB_MODE_COMPILER || HB_SUPPORT_HARBOUR ) ) { if( pRight->value.asLogical ) { diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 7ca75ba5d5..833409c137 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -3181,7 +3181,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) SWITCH hbmk[ _HBMK_nWARN ] CASE _WARN_MAX ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall -pedantic" ) ; EXIT CASE _WARN_YES ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall" ) ; EXIT - CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main" ) ; EXIT + CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat" ) ; EXIT CASE _WARN_NO ; AAdd( hbmk[ _HBMK_aOPTC ], "-w" ) ; EXIT ENDSWITCH ENDIF @@ -3427,7 +3427,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) SWITCH hbmk[ _HBMK_nWARN ] CASE _WARN_MAX ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall -pedantic" ) ; EXIT CASE _WARN_YES ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall" ) ; EXIT - CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main" ) ; EXIT + CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat" ) ; EXIT CASE _WARN_NO ; AAdd( hbmk[ _HBMK_aOPTC ], "-w" ) ; EXIT ENDSWITCH cOpt_CompC += " {FC}" @@ -3561,7 +3561,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) SWITCH hbmk[ _HBMK_nWARN ] CASE _WARN_MAX ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall -pedantic" ) ; EXIT CASE _WARN_YES ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall" ) ; EXIT - CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main" ) ; EXIT + CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat" ) ; EXIT CASE _WARN_NO ; AAdd( hbmk[ _HBMK_aOPTC ], "-w" ) ; EXIT ENDSWITCH cOpt_CompC += " {FC}" @@ -3669,7 +3669,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) SWITCH hbmk[ _HBMK_nWARN ] CASE _WARN_MAX ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall -pedantic" ) ; EXIT CASE _WARN_YES ; AAdd( hbmk[ _HBMK_aOPTC ], "-W -Wall" ) ; EXIT - CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wall -Wno-unused -Wno-pointer-sign -Wno-uninitialized -Wno-switch -Wno-strict-overflow -Wno-main" ) ; EXIT + CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-Wimplicit-int -Wimplicit-function-declaration -Wmissing-braces -Wreturn-type -Wformat" ) ; EXIT CASE _WARN_NO ; AAdd( hbmk[ _HBMK_aOPTC ], "-w" ) ; EXIT ENDSWITCH cOpt_CompC += " {FC}"