Menu

#438 mingw-get: Avoid a jump over initialization issue

Patch_committed
closed-fixed
mingw-get (5)
2010-04-18
2010-03-28
No

This patch fixes the following compiler error with MinGW GCC 4.4.0/4.5.0:

g++ -c -D DEBUGLEVEL=0 -I ../src/mingw-get/src -I ../src/mingw-get/src/pkginfo -I ../src/mingw-get/tinyxml -g -O2 -o tarproc.o ../src/mingw-get/src/tarproc.cpp
../src/mingw-get/src/tarproc.cpp: In member function 'virtual int pkgTarArchiveProcessor::Process()':
../src/mingw-get/src/tarproc.cpp:256: error: jump to case label
../src/mingw-get/src/tarproc.cpp:247: error: crosses initialization of 'char* p'

Discussion

  • Cesar Strauss

    Cesar Strauss - 2010-03-28

    Avoid a jump over initialization issue

     
  • Keith Marshall

    Keith Marshall - 2010-03-29

    Thanks Cesar,

    GCC-3.4.5 doesn't seem to see this as an error. Would simply enclosing the offending initialisation, and the following `while' loop in braces fix it for GCC-4.x?

    Either way, I have a significant tarproc.cpp change set almost ready for check-in, so I'll address this at the same time.

     
  • Cesar Strauss

    Cesar Strauss - 2010-03-29

    Fix it with braces

     
  • Cesar Strauss

    Cesar Strauss - 2010-03-29

    > Would simply enclosing
    > the offending initialisation, and the following `while' loop in braces fix
    > it for GCC-4.x?

    Indeed it does.

    > Either way, I have a significant tarproc.cpp change set almost ready for
    > check-in, so I'll address this at the same time.

    Sure. For reference, I attach a new patch with the above change.

     
  • Keith Marshall

    Keith Marshall - 2010-04-04
    • labels: --> mingw-get
    • milestone: --> Patch_committed
    • assigned_to: nobody --> keithmarshall
    • status: open --> pending-fixed
     
  • Keith Marshall

    Keith Marshall - 2010-04-04

    Thanks Cesar.

    Since it appears to solve the problem satisfactorily, I prefer the solution using braces -- it localises the pointer declaration and usage to the minimum possible scope. I've included the necessary change in my own patch set, (commit to CVS dated 2010-04-04). I believe this resolves the issue; please reopen, if the problem persists.

     
  • Cesar Strauss

    Cesar Strauss - 2010-04-18
    • status: pending-fixed --> closed-fixed
     
  • Cesar Strauss

    Cesar Strauss - 2010-04-18

    The issue is indeed solved, thanks!
    Regards,
    Cesar