Menu

#77 adjust to compile using -w3 -es2

v1.0_(example)
open
nobody
None
1
2021-03-15
2021-02-16
No

folder winapi

1 Attachments

Discussion

1 2 > >> (Page 1 of 2)
  • Wilfried Brunken

    Hello José,
    i checked your delivered code, here my intermediate report.
    I used WinMerge to compare the files.
    With the options "-w3 -es2" the compile
    process stopped at this module, where a first warning
    appears.
    I realized, that this setting is best for find some
    incompatibilities in the prg code (causes some crashes in sample programs ?),
    like not correspending method declaration in the class
    part and the implementation of the method and
    not used parameters or variables (examples):

    • METHOD Activate CLASS xxx
      must be set to
      METHOD Activate() CLASS xxx

    • LOCAL a
      a := " " <== remove this, warning about unused variable
      IF condition
      a := "True"
      ELSE
      a := "False"
      ENDIF

    • Here variable a is forever filled with a value (means not NIL)

    • Problem with unused parameters:
      STATIC FUNCTION FltGoTo( oBrw, nRecord )

    (oBrw) <== add this, good idea

    RETURN dbGoto( nRecord )
    

    I replaced the files, but there are many other warnings to fix,
    it is a lot of work to do in the complete WinApi source code (and GTK).
    Also all sample programs and utils must be tested after the modifications.
    The makefile.gcc contains the new options in a comment line,
    ready for activate it if work is done.

    With r2939 i committed your recent modifications.
    I checked them with my application CLLOG:
    But at this time it is not possible to compile with "-w3 -es2".
    Be patient, i am very busy now and there are other items to handle, inclusive my app CLLOG.
    My suggestion is, i'll do this step by step, so the ticket must be hold
    open an longer period.

    MNI TNX for your support,
    73 es 55 de
    DF7BE, Wilfried

     
  • José M. C. Quintas

    (oBrw) -> perhaps not so good, HB_SYMBOL_UNUSED(x) makes the same, and may be better because call attention about the variable
    But after first changes, I remember that some variables can be used on #ifdef #else #endif, and need tests on windows and linux.
    I prepare on github machines with harbour 3.2, harbour 3.4 and linux, but need help on linux machine.
    linux machine is here: https://github.com/JoseQuintas/hwgui/blob/main/.github/workflows/hwgui_hb34_linux.yml
    hwgui compilation is made on each commit, on all machines.
    Later will compile all samples too.
    It is a good check, to do not forgot anything.

     
  • José M. C. Quintas

    some changes on hbps: using allways hwgui.hbc, setup can be made only on hbc
    on hbc {!hblib} will add libraries only for exe/dll (on lib creation they do not exists)
    note: each zip is one folder, windows format crlf
    Note a zero-length file, is to remember to delete a duplicated file.

     

    Last edit: José M. C. Quintas 2021-02-18
  • José M. C. Quintas

    more files, each zip is the file folder
    adjust to compile using -w3 -es2, and format source code (not full format)

     
  • Wilfried Brunken

    Hello José,
    uuuh, a lot of work is done last evening.
    I modified the files of WinAPI, so the standard libraries of HWGUI
    can be build with "-w3 -es2".
    I tested the files with my app "CLLOG" and some samples
    and the hgt test sample in directory test.

    Here some troubles fixed:

    Warning W0001 Method <new( )="" baction,="" lonce="" value,="" nid,="" oparent,=""> not declared or declaration mismatch in class <htimer>
    == > a lot of conflicts between the METHOD declaration in the CLASS group an the implementation,</htimer></new(>

    \source\common\procmisc\scrdebug.prg:
    STATIC FUNCTION MacroError( e )
    * Parameters not used
    HB_SYMBOL_UNUSED(e)
    BREAK
    * Warning W0028 Unreachable code
    RETURN .T.
    ==> Here i commented the BREAK command out, do you have an idea
    (will try with QUIT command?)

    Warning W0032 Variable 'N' is assigned but not used in function ...:
    IF ( n := Eval( ::bOther,Self,msg,wParam,lParam ) ) != - 1
    Devide into 2 instructions:
    n := Eval( ::bOther,Self,msg,wParam,lParam )
    IF n != - 1

    Please check the code (r2940)
    I think, that with this options it is easier to find crashes i detected in the samples
    and some other obscure behaviour.

    For me to do this weekend (i can spend some time for this case):
    - Same procedure for GTK source code
    - Search for code blocks, found some conflicts here.
    Must search for corresponding Eval() and correct the parameters (urgent)
    - Test with all sample program and again for "CLLOG".

    After this, i will look for your hbp files you posted.

    Please post me the code modification, if you find bugs bases on this big modifications
    with this ticket (please also for all other users and developers).
    I will check it as soon as possible.

    For archive purposes (and for possible needed revert of changes)
    i posted the output of "svn diff" before commit with this ticket.

    MNI TNX for user support !

    With regards,
    73 es 55 de
    DF7BE, Wilfried

     
  • José M. C. Quintas

    yes, it is on the sources I send.
    if .T.
    break
    endif
    and the n, remove it
    if Eval( ::bOther,Self,msg,wParam,lParam ) != -1
    I am adjusting to -w3 -es2 too, but I began to work on one hbp at a time,, smallest first.
    On this way, we can archive one lib at a time.
    The last one will be the samples.

     
  • José M. C. Quintas

    CAUTION with changes, not sure about this: on an codeblock
    hcolumn():New( "", { | v, o | ..... } )
    because do not use v, you change to
    hcolumn():New( "", { | o | ... } )
    this block do not need v, but hColumn() may need it, and may cause wrong parameters, except if hcolumn() class was changed too and do not need first parameter.
    I only see this because I change the source too, and git shows as a conflict.
    procmisc/scrdebug.prg
    But may be you change anothers codeblocks too in same way, and this is DANGEROUS

     
  • José M. C. Quintas

    Only scrdebug.prg has the mentioned situation.
    I send it attached on previous zip, if you update it, all ok.

     
  • Wilfried Brunken

    Hello José,
    good morning, i started now the corrections of the modifications i made.
    At first:
    1) must convert your files back to UNIX line endings
    2) needed to modify in procscri.prg

    ifdef WINDOWS

    to

    ifdef __PLATFORM__WINDOWS

    And i saw this:
    oBrwData:AddColumn( HColumn():New( "",{ |v, o | HB_SYMBOL_UNUSED( v ), o:aArray[ o:nCurrent, 1 ] }, "C", 30, 0 ) )
    to avoid the warning in the block.

    I'll revert the block commands in the code committed yesterday and add "HB_SYMBOL_UNUSED",
    do it also in the GTK code, otherwise now ready for commit.

    Then i start to check your other code delivered by you.
    And a new ticket from Itamar i must to look for (tutorial).

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Wilfried Brunken

    Hello José,
    looking into the svn difflog, i
    detected 3 files for WinAPI to
    revert the changes of the inconsistent
    blocks. Committed with r2942.

    Now i continue with GTK and your other posted code.
    please wait for clone to Git if a am ready with all.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • José M. C. Quintas

    please wait for clone to Git if a am ready with all.
    Ok about this.
    Now I use git svn fetch -r2900:HEAD
    And apply last commits on git, before my changes.

     
  • Wilfried Brunken

    svn commit -m"Ticket #77: value with HB_SYMBOL_UNUSED( x ) for unused variables for GTK, see post to ticket."

    Hallo José,
    committed Code for GTK with r2943.
    I tested with dbview.prg and winprn.prg
    Please check.
    I'll check your files for hwreport and hwmake until next monday or tuesday,
    i am very busy now.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Itamar M. Lins Jr.

    Hi!
    Now see others problems that before not exists

    itamar@itamar-desktop:~/dev/hwgui-code/hwgui$ hbmk2 hwgui.hbp -rebuild
    hbmk2: Harbour: Compilando módulos...
    Harbour 3.2.0dev (r2101261627)
    Copyright (c) 1999-2020, https://harbour.github.io/
    hbmk2: Compilando...
    ../../../../source/gtk/commond.c:16:10: fatal error: gtk/gtk.h: Arquivo ou diretório inexistente
       16 | #include "gtk/gtk.h"
          |          ^~~~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/control.c:23:10: fatal error: cairo.h: Arquivo ou diretório inexistente
       23 | #include <cairo.h>
          |          ^~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/draw.c:17:10: fatal error: cairo.h: Arquivo ou diretório inexistente
       17 | #include <cairo.h>
          |          ^~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/drawtext.c:17:10: fatal error: cairo.h: Arquivo ou diretório inexistente
       17 | #include <cairo.h>
          |          ^~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/window.c:17:10: fatal error: gtk/gtk.h: Arquivo ou diretório inexistente
       17 | #include "gtk/gtk.h"
          |          ^~~~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/wprint.c:18:10: fatal error: gtk/gtk.h: Arquivo ou diretório inexistente
       18 | #include "gtk/gtk.h"
          |          ^~~~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/menu_c.c:15:10: fatal error: gtk/gtk.h: Arquivo ou diretório inexistente
       15 | #include "gtk/gtk.h"
          |          ^~~~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/message.c:16:10: fatal error: gtk/gtk.h: Arquivo ou diretório inexistente
       16 | #include "gtk/gtk.h"
          |          ^~~~~~~~~~~
    compilation terminated.
    ../../../../source/gtk/misc.c:28:10: fatal error: gtk/gtk.h: Arquivo ou diretório inexistente
       28 | #include "gtk/gtk.h"
          |          ^~~~~~~~~~~
    compilation terminated.
    In file included from /usr/include/string.h:519,
                     from /usr/local/include/harbour/hbdefs.h:53,
                     from /usr/local/include/harbour/hbvmpub.h:50,
                     from /usr/local/include/harbour/hbapi.h:55,
                     from ../../../../include/guilib.h:9,
                     from ../../../../source/gtk/inter.c:13:
    In function ‘strncpy’,
        inlined from ‘HB_FUN_HWG_GETUTCTIMEDATE’ at ../../../../source/gtk/inter.c:122:3:
    /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 24 bytes from a string of length 127 [-Wstringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In function ‘strncpy’,
        inlined from ‘HB_FUN_HWG_GETDATEANSI’ at ../../../../source/gtk/inter.c:154:3:
    /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 24 bytes from a string of length 127 [-Wstringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

    Best regards,
    Itamar M. Lins Jr.

     

    Last edit: Itamar M. Lins Jr. 2021-02-21
  • Itamar M. Lins Jr.

    Hello Itamar,
    could you do us a favour:
    Please do not paste such mass of output messages into the post window,
    please collect them in a file and post it as an attachment.
    This blows up the web page.
    Thanks.

    With regards,
    73 es 55 de
    Wilfried, DF7BE

    ==== Original post ====
    Hi!
    Here hwgui.hbc files test ok

    #
    # $Id: hwgui.hbc 2943 2021-02-20 17:32:38Z df7be $
    #
    
    # Include this file in hbmk2 command line to build an app:
    #   'hbmk2 hwgui.hbc test.prg'
    
    incpaths=include
    libpaths=lib
    
    {win}gt=gtgui
    
    libs=hwgui procmisc hbxml hwgdebug
    {win&!allmingw&!watcom&}libs=hbactivex
    
    {unix}ldflags+="`pkg-config --libs gtk+-2.0`"
    

    And hwgui.hbp file

    #
    # $Id: hwgui.hbp 2943 2021-02-20 17:32:38Z df7be $
    #
    
    -3rd=hbide_version=1.0
    -3rd=hbide_type=Lib
    -3rd=hbide_title=hwgui
    -3rd=hbide_output=hwgui
    
    -inc
    -hblib
    -olib/hwgui
    -n
    -q0
    -w
    -es2
    -iinclude
    
    # Uncomment these two lines to build HwGUI in Unicode mode
    #-prgflag=-DUNICODE
    #-cflag=-DUNICODE
    
    -cflag=-DHWG_USE_POINTER_ITEM
    "{unix}-cflag=`pkg-config --cflags gtk+-2.0`"
    
    @hwgui.hbm
    
    # ============== EOF of hwgui.hbp ====================
    

    And warnings for 64Bits on Linux GCC 10.2
    ~~~
    ==> moved to attached file "messages.txt".

     

    Last edit: Wilfried Brunken 2021-02-21
  • Itamar M. Lins Jr.

    Hi!
    Probably remove inadvertently this flag "-iinclude" of files .hbp
    procmisc.hbp same problem.

    Best regards,
    Itamar M. Lins Jr.

     
  • José M. C. Quintas

    My error.
    New hwgui.hbc
    And now I can compile on github/ubuntu linux.

     

    Last edit: José M. C. Quintas 2021-02-21
  • Wilfried Brunken

    Hello Itamar,
    this could be a problem of the newer GCC version, handling warnings much stronger.
    My version is:
    gcc --version
    gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609

    and there are no Warnings.
    I added a new include file "warnings.h" for setting PRAGMA's to
    suppress warnings. This file could be extended for newer compiler versions.
    Please post the versions of your OS.
    If you have modifcations for this header, feel free to post them.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Wilfried Brunken

    Hello José,
    here my report for
    hwmake and hwreport.
    I committed my intermediate state with r2944.
    With MingW32 the hwmake is compilable and runs.
    A long time ago, i tried to compile and run the hwreport
    utility, but it fails, because it is designed for BCC.
    The problem is, that the rc-file is not suitable for MinGW.
    A long time ago, i extracted the icon from the hex value in the
    rc file. The file "repbuild2.rc" is a trial for Ming32, but
    compile with windres.exe fails for compile.
    So the port for LINUX/GTK must be done later.
    Please check.

    hwreport.prg: No changes
    opensave.prg:
    Removed
    #define SB_VERT

    propert.prg:
    Removed
    #define UDS_SETBUDDYINT 2
    * #define UDS_ALIGNRIGHT 4

    Solved by

    ifdef xx

    ..

    endif

    Compile error message follows.

    With regards,
    MNI TNX, 73 ed 55 de
    DF7BE, Wilfried

    C:\hwgui\hwgui\contrib\hwreport>hbmk2 hwreport.hbp
    Harbour 3.2.0dev (r2002101434)
    Copyright (c) 1999-2020, https://harbour.github.io/
    windres.exe: repbuild.rc:4: syntax error
    repbuild.rc:2:0: fatal error: when writing output to : Broken pipe
    compilation terminated.
    windres.exe: preprocessing failed.
    hbmk2[hwreport]: Error: Running resource compiler. 1
    windres.exe -I"C:/harbour/core-master/include" -I../../include repbuild.rc -O coff -o C:/Users/AFULAP~1/AppData/Local/Temp/hbmk_2xrz1e.dir/repbuild.reso

    C:\hwgui\hwgui\contrib\hwreport>hbmk2 hwreport.hbp
    Harbour 3.2.0dev (r2002101434)
    Copyright (c) 1999-2020, https://harbour.github.io/
    windres.exe: repbuild2.rc:4: syntax error
    hbmk2[hwreport]: Error: Running resource compiler. 1
    windres.exe -I"C:/harbour/core-master/include" -I../../include repbuild2.rc -O coff -o C:/Users/AFULAP~1/AppData/Local/Temp/hbmk_3jo9lj.dir/repbuild2.reso

     
  • José M. C. Quintas

    on windows, need lsetdebugger on procscri.prg

     
  • Oleksii Myronenko

    Hi!

    Harbour 3.2.0dev (r2101261627)
    Copyright (c) 1999-2020, https://harbour.github.io/
    
    source\common\procmisc\procscri.prg(538) Warning W0001  Ambiguous reference 'LSETDEBUGGER'
    
    No code generated.
    hbmk2[procmisc]: Error: Running Harbour compiler (built-in). 255
    (c:\dev\harbour\bin\harbour.exe) -n1 source\common\procmisc\procini.prg source\common\procmisc\procs7.prg source\common\procmisc\procscri.prg source\common\procmisc\scrdebug.prg source\common\editor\hcedit.prg source\common\editor\hilight.prg -q -m -n -es2 -DHBMK_HAS_HWGUI=1 -w -oC:\Users\o2m\AppData\Local\Temp\hbmk_9p0c28.dir\ -ic:\dev\harbour\include -iinclude
    
     
  • José M. C. Quintas

    previous attached file is about this warning on windows.

     
  • Wilfried Brunken

    Hello José,
    your corrected common/procmisc/procscri.prg
    committed.
    Please check. On Windows/MinGW32 and Ubuntu 16 no problems.

    Hello Itamar
    the only way to avoid this mass of warnings is to
    set compiler pragma's (see my post from yesterday).
    This was already done with GCC 8.2 of MinGW64
    so it can be realized here in the same way.
    The facts is , that the recent GTK 2 implementation must be
    adapted to GCC 10 (Please open a ticket at the GTK developper's group ?).
    I can not retrace the warning at this moment,
    because i need some time to update my Ubuntu, so
    i need your help:
    - First copy modified file "warnings.h" from include directory of last commit r2946 into
    your local copy of HWGUI.
    - insert the line
    #include "warnings.h"
    in every c-file of directory "source\gtk"
    causing the warning's.
    (Done for misc.c and control.c)
    - Post a list with the names of modified files, so that i can
    synchronize and check them.
    - Check again, after i committed the modifications,
    i'll inform you then.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Itamar M. Lins Jr.

    Hi!
    José Quintas and I, we used the hbmk2 files to compile, as long as the files to compile hwgui.hbp and hwgui.hbc and the others are not fixed, I can't test it.

    Please see -iinclude flag removed of file hwgui.hbp and others.

    Best regards,
    Itamar M. Lins Jr.

     
  • José M. C. Quintas

    Check my message about "my error", attached I send hwgui.hbc with changes

     
  • Wilfried Brunken

    Hello José, Hello Itamar,
    step by step:
    Committed with r2947, the compile works
    with the hbmk2 utility now.
    Please check.

    Added in some files this:

    / Avoid warnings from GCC /

    include "warnings.h"

    Here the output of compile run on my Ubuntu 16 system:

    hbmk2 hwgui.hbp procmisc.hbp hbxml.hbp hwgdebug.hbp
    Harbour 3.2.0dev (r2006301601)
    Copyright (c) 1999-2020, https://harbour.github.io/
    Harbour 3.2.0dev (r2006301601)
    Copyright (c) 1999-2020, https://harbour.github.io/
    Harbour 3.2.0dev (r2006301601)
    Copyright (c) 1999-2020, https://harbour.github.io/
    Harbour 3.2.0dev (r2006301601)
    Copyright (c) 1999-2020, https://harbour.github.io/

    Also the tutor runs:
    cltest@afulinux4:~/hwgui/utils/tutorial$ hbmk2 tutor.hbp
    Harbour 3.2.0dev (r2006301601)
    Copyright (c) 1999-2020, https://harbour.github.io/

    I hope, that's OK now.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.