diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b1c5538cfb..056a8ecb32 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,36 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-24 15:35 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/include/hbexprb.c + ! fixed typo in function IDs. + HB_I18N_NGETTEXT_STRICT() and HB_I18N_NGETTEXT_NOOP() were not + recognized as i18n gettext functions + + * harbour/doc/cmpopt.txt + ! fixed HB_I18N_NGETTEXT_NOOP*() syntax used in examples + + * harbour/src/common/expropt2.c + * harbour/doc/cmpopt.txt + + added compile time optimizations for expressions like + = + == + != + = + == + != + They are reduced to or !. Because it may disable + some runtime errors so it's not Clipper compatible optimization + and is enabled when -ko compiler switch is used. + + * harbour/src/compiler/hbgenerr.c + ! do not generate some warnings like: + Meaningless use of expression '%s' + when -w harbour compiler option is not used + + * harbour/src/rtl/gtxwc/gtxwc.c + ! indenting + 2012-10-24 13:53 UTC+0200 Viktor Szakats (harbour syenar.net) * INSTALL + documented HB_INSTALL_3RDDYN envvar. diff --git a/harbour/doc/cmpopt.txt b/harbour/doc/cmpopt.txt index 7678175e83..013249ea6a 100644 --- a/harbour/doc/cmpopt.txt +++ b/harbour/doc/cmpopt.txt @@ -45,9 +45,9 @@ optimized at compile time: - Harbour special functions: HB_I18N_GETTEXT_NOOP( [ , ] ) - HB_I18N_NGETTEXT_NOOP( | [ , ] ) + HB_I18N_NGETTEXT_NOOP( , | [ , ] ) HB_I18N_GETTEXT_NOOP_*( [ , ] ) - HB_I18N_NGETTEXT_NOOP_*( | [ , ] ) + HB_I18N_NGETTEXT_NOOP_*( , | [ , ] ) HB_MUTEXCREATE() @@ -160,6 +160,18 @@ arguments are well known and can be calculated at compile time: + "" => "" + => ( "" )-> => -> + == .T. => + .T. == => + == .F. => ! + .F. == => ! + = .T. => + .T. = => + = .F. => ! + .F. = => ! + != .T. => ! + .T. != => ! + != .F. => + .F. != => In cases when result is meaningless Harbour compiler can skip code for operation, i.e. for such line of .prg code: diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 33b1ecf1c0..58466a7cc8 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -1934,9 +1934,9 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) HB_BOOL fStrict, fNoop, fPlural; fStrict = funcID == HB_F_I18N_GETTEXT_STRICT || - funcID == HB_F_I18N_GETTEXT_STRICT; + funcID == HB_F_I18N_NGETTEXT_STRICT; fNoop = funcID == HB_F_I18N_GETTEXT_NOOP || - funcID == HB_F_I18N_GETTEXT_NOOP; + funcID == HB_F_I18N_NGETTEXT_NOOP; fPlural = funcID == HB_F_I18N_NGETTEXT || funcID == HB_F_I18N_NGETTEXT_NOOP || funcID == HB_F_I18N_NGETTEXT_STRICT; diff --git a/harbour/src/common/expropt2.c b/harbour/src/common/expropt2.c index 5a8c27d960..c4955a09c3 100644 --- a/harbour/src/common/expropt2.c +++ b/harbour/src/common/expropt2.c @@ -1143,6 +1143,42 @@ HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_COMP_DECL ) HB_COMP_EXPR_FREE( pLeft ); HB_COMP_EXPR_FREE( pRight ); } + else if( HB_SUPPORT_EXTOPT && + ( pLeft->ExprType == HB_ET_LOGICAL || + pRight->ExprType == HB_ET_LOGICAL ) ) + { + /* NOTE: This will not generate a runtime error if incompatible + * data type is used + */ + + if( pLeft->ExprType == HB_ET_LOGICAL ) + { + pSelf->value.asOperator.pLeft = pRight; + pRight = pLeft; + pLeft = pSelf->value.asOperator.pRight; + } + + if( !pRight->value.asLogical ) + { + pSelf->ExprType = HB_ET_NONE; + HB_COMP_EXPR_FREE( pSelf ); + pSelf = pLeft; + } + else if( pLeft->ExprType == HB_EO_NOT ) + { + pSelf->ExprType = HB_ET_NONE; + HB_COMP_EXPR_FREE( pSelf ); + pSelf = pLeft->value.asOperator.pLeft; + pLeft->ExprType = HB_ET_NONE; + HB_COMP_EXPR_FREE( pLeft ); + } + else + { + pSelf->ExprType = HB_EO_NOT; + pSelf->value.asOperator.pRight = NULL; + } + HB_COMP_EXPR_FREE( pRight ); + } else if( ( pLeft->ExprType == HB_ET_NIL && ( pRight->ExprType == HB_ET_NUMERIC || pRight->ExprType == HB_ET_LOGICAL || @@ -1648,6 +1684,42 @@ HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_COMP_DECL ) HB_COMP_EXPR_FREE( pLeft ); HB_COMP_EXPR_FREE( pRight ); } + else if( HB_SUPPORT_EXTOPT && + ( pLeft->ExprType == HB_ET_LOGICAL || + pRight->ExprType == HB_ET_LOGICAL ) ) + { + /* NOTE: This will not generate a runtime error if incompatible + * data type is used + */ + + if( pLeft->ExprType == HB_ET_LOGICAL ) + { + pSelf->value.asOperator.pLeft = pRight; + pRight = pLeft; + pLeft = pSelf->value.asOperator.pRight; + } + + if( pRight->value.asLogical ) + { + pSelf->ExprType = HB_ET_NONE; + HB_COMP_EXPR_FREE( pSelf ); + pSelf = pLeft; + } + else if( pLeft->ExprType == HB_EO_NOT ) + { + pSelf->ExprType = HB_ET_NONE; + HB_COMP_EXPR_FREE( pSelf ); + pSelf = pLeft->value.asOperator.pLeft; + pLeft->ExprType = HB_ET_NONE; + HB_COMP_EXPR_FREE( pLeft ); + } + else + { + pSelf->ExprType = HB_EO_NOT; + pSelf->value.asOperator.pRight = NULL; + } + HB_COMP_EXPR_FREE( pRight ); + } else if( ( pLeft->ExprType == HB_ET_NIL && ( pRight->ExprType == HB_ET_NUMERIC || pRight->ExprType == HB_ET_LOGICAL || diff --git a/harbour/src/compiler/hbgenerr.c b/harbour/src/compiler/hbgenerr.c index eebd441d1b..0173bd8e97 100644 --- a/harbour/src/compiler/hbgenerr.c +++ b/harbour/src/compiler/hbgenerr.c @@ -141,11 +141,11 @@ const char * const hb_comp_szWarnings[] = "4Suspicious type in assignment to declared array element expected '%s'", "3Class '%s' not known in declaration of '%s'", "3Message '%s' not known in class '%s'", - "0Meaningless use of expression '%s'", + "1Meaningless use of expression '%s'", "2Unreachable code", "1Redundant 'ANNOUNCE %s' statement ignored", - "0Duplicate variable '%s' in nested FOR loop", - "0Invalid variable '%s' for enumerator message", + "1Duplicate variable '%s' in nested FOR loop", + "1Invalid variable '%s' for enumerator message", "3Variable '%s' is assigned but not used in function '%s'", "3Variable '%s' is never assigned in function '%s'", "2STATIC Function '%s' defined but never used" diff --git a/harbour/src/rtl/gtxwc/gtxwc.c b/harbour/src/rtl/gtxwc/gtxwc.c index 5cc134c344..5fcf699777 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.c +++ b/harbour/src/rtl/gtxwc/gtxwc.c @@ -4415,8 +4415,8 @@ static HB_BOOL hb_gt_xwc_ConnectX( PXWND_DEF wnd, HB_BOOL fExit ) s_atomCutBuffer0 = XInternAtom( wnd->dpy, "CUT_BUFFER0", False ); s_atomText = XInternAtom( wnd->dpy, "TEXT", False ); s_atomCompoundText = XInternAtom( wnd->dpy, "COMPOUND_TEXT", False ); - s_atomFullScreen = XInternAtom(wnd->dpy, "_NET_WM_STATE_FULLSCREEN", False); - s_atomState = XInternAtom(wnd->dpy, "_NET_WM_STATE", False); + s_atomFullScreen = XInternAtom(wnd->dpy, "_NET_WM_STATE_FULLSCREEN", False ); + s_atomState = XInternAtom(wnd->dpy, "_NET_WM_STATE", False ); HB_XWC_XLIB_UNLOCK