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
         <exp> =  <lVal>
         <exp> == <lVal>
         <exp> != <lVal>
         <lVal> =  <exp>
         <lVal> == <exp>
         <lVal> != <exp>
      They are reduced to <exp> or !<exp>. 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
This commit is contained in:
Przemyslaw Czerpak
2012-10-24 13:36:24 +00:00
parent a0be261a8d
commit 845658b407
6 changed files with 123 additions and 9 deletions

View File

@@ -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
<exp> = <lVal>
<exp> == <lVal>
<exp> != <lVal>
<lVal> = <exp>
<lVal> == <exp>
<lVal> != <exp>
They are reduced to <exp> or !<exp>. 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.

View File

@@ -45,9 +45,9 @@ optimized at compile time:
- Harbour special functions:
HB_I18N_GETTEXT_NOOP( <cConst1> [ , <cConst2> ] )
HB_I18N_NGETTEXT_NOOP( <cConst1> | <acConst1> [ , <cConst2> ] )
HB_I18N_NGETTEXT_NOOP( <nCount>, <cConst1> | <acConst1> [ , <cConst2> ] )
HB_I18N_GETTEXT_NOOP_*( <cConst1> [ , <cConst2> ] )
HB_I18N_NGETTEXT_NOOP_*( <cConst1> | <acConst1> [ , <cConst2> ] )
HB_I18N_NGETTEXT_NOOP_*( <nCount>, <cConst1> | <acConst1> [ , <cConst2> ] )
HB_MUTEXCREATE()
@@ -160,6 +160,18 @@ arguments are well known and can be calculated at compile time:
<expr> + "" => <expr>
"" + <expr> => <expr>
( "<alias>" )-> => <alias>->
<expr> == .T. => <expr>
.T. == <expr> => <expr>
<expr> == .F. => !<expr>
.F. == <expr> => !<expr>
<expr> = .T. => <expr>
.T. = <expr> => <expr>
<expr> = .F. => !<expr>
.F. = <expr> => !<expr>
<expr> != .T. => !<expr>
.T. != <expr> => !<expr>
<expr> != .F. => <expr>
.F. != <expr> => <expr>
In cases when result is meaningless Harbour compiler can skip code
for operation, i.e. for such line of .prg code:

View File

@@ -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;

View File

@@ -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 ||

View File

@@ -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"

View File

@@ -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