none
Unreachable code warning RRS feed

  • Question

  • My UMDF driver's Device.cpp file contains this wrap function:

    DWORD WINAPI pipeServerFunc(CMyDevice *device) 
    {
    	DWORD p = device->pipeServer();
    	return p;
    }

    I build driver in Visual Studio. It builds successfully with 'Win7 Debug' key, but with 'Win7 Release' I get the folloing warning:

    warning C4702: unreachable code

    which refers to 

    DWORD p = device->pipeServer();

    line. This warning breaks the build but it looks strange because mentioned line IS reachale.

    Any ideas?

    Friday, January 11, 2013 10:12 AM

Answers

  • Yes, this does look questionable! Of cource I've tried code you suggest (actually, before I tried to fix it my code was exactly the same).

    Hence, the reason for the warning in a different. Thank you!

    Thursday, January 17, 2013 1:08 PM

All replies

  • This does look questionable, have you tried simplifying the function by eliminating the definition, i.e.:

    DWORD WINAPI pipeServerFunc(CMyDevice *device)
    {
    return device->pipeServer();
     

    }


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Friday, January 11, 2013 12:48 PM
  • Yes, this does look questionable! Of cource I've tried code you suggest (actually, before I tried to fix it my code was exactly the same).

    Hence, the reason for the warning in a different. Thank you!

    Thursday, January 17, 2013 1:08 PM