VirtualBox

Changeset 85121 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Jul 8, 2020 7:33:26 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139061
Message:

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

Location:
trunk/src/VBox/Runtime/r3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/init.cpp

    r82968 r85121  
    151151 * termination callback chain.
    152152 */
    153 static void rtR3ExitCallback(void)
     153static void rtR3ExitCallback(void) RT_NOTHROW_DEF
    154154{
    155155    ASMAtomicWriteBool(&g_frtAtExitCalled, true);
  • trunk/src/VBox/Runtime/r3/win/internal-r3-win.h

    r82968 r85121  
    136136typedef int             (WINAPI *PFNWSAENUMNETWORKEVENTS)(UINT_PTR, HANDLE, struct _WSANETWORKEVENTS *);
    137137/** WSASend */
    138 typedef int             (WINAPI *PFNWSASend)(UINT_PTR, struct _WSABUF *, DWORD, LPDWORD, DWORD dwFlags, struct _OVERLAPPED *, PFNRT /*LPWSAOVERLAPPED_COMPLETION_ROUTINE*/);
     138typedef int             (WINAPI *PFNWSASend)(UINT_PTR, struct _WSABUF *, DWORD, LPDWORD, DWORD dwFlags, struct _OVERLAPPED *, uintptr_t /*LPWSAOVERLAPPED_COMPLETION_ROUTINE*/);
    139139
    140140/** socket */
  • trunk/src/VBox/Runtime/r3/win/process-win.cpp

    r82968 r85121  
    20762076            rc = RTErrConvertFromWin32(dwErr);
    20772077            if (rc == VERR_UNRESOLVED_ERROR)
    2078                 LogRelFunc(("CreateProcessWithLogonW (%p) failed: dwErr=%u (%#x), rc=%Rrc\n",
    2079                             g_pfnCreateProcessWithLogonW, dwErr, dwErr, rc));
     2078                LogRelFunc(("CreateProcessWithLogonW failed: dwErr=%u (%#x), rc=%Rrc\n", dwErr, dwErr, rc));
    20802079        }
    20812080        if (pwszzBlock)
  • trunk/src/VBox/Runtime/r3/win/thread-win.cpp

    r84840 r85121  
    5959*   Internal Functions                                                                                                           *
    6060*********************************************************************************************************************************/
    61 static unsigned __stdcall rtThreadNativeMain(void *pvArgs);
     61static unsigned __stdcall rtThreadNativeMain(void *pvArgs) RT_NOTHROW_PROTO;
    6262static void rtThreadWinTellDebuggerThreadName(uint32_t idThread, const char *pszName);
    6363
     
    243243 * Wrapper which unpacks the param stuff and calls thread function.
    244244 */
    245 static unsigned __stdcall rtThreadNativeMain(void *pvArgs)
     245static unsigned __stdcall rtThreadNativeMain(void *pvArgs) RT_NOTHROW_DEF
    246246{
    247247    DWORD           dwThreadId = GetCurrentThreadId();
  • trunk/src/VBox/Runtime/r3/xml.cpp

    r84000 r85121  
    385385struct GlobalLock::Data
    386386{
    387     PFNEXTERNALENTITYLOADER pOldLoader;
     387    PFNEXTERNALENTITYLOADER pfnOldLoader;
    388388    RTCLock lock;
    389389
    390390    Data()
    391         : pOldLoader(NULL),
    392           lock(gGlobal.sxml.lock)
     391        : pfnOldLoader(NULL)
     392        , lock(gGlobal.sxml.lock)
    393393    {
    394394    }
     
    402402GlobalLock::~GlobalLock()
    403403{
    404     if (m->pOldLoader)
    405         xmlSetExternalEntityLoader(m->pOldLoader);
     404    if (m->pfnOldLoader)
     405        xmlSetExternalEntityLoader(m->pfnOldLoader);
    406406    delete m;
    407407    m = NULL;
    408408}
    409409
    410 void GlobalLock::setExternalEntityLoader(PFNEXTERNALENTITYLOADER pLoader)
    411 {
    412     m->pOldLoader = xmlGetExternalEntityLoader();
    413     xmlSetExternalEntityLoader(pLoader);
     410void GlobalLock::setExternalEntityLoader(PFNEXTERNALENTITYLOADER pfnLoader)
     411{
     412    m->pfnOldLoader = xmlGetExternalEntityLoader();
     413    xmlSetExternalEntityLoader(pfnLoader);
    414414}
    415415
     
    18241824////////////////////////////////////////////////////////////////////////////////
    18251825
    1826 static void xmlParserBaseGenericError(void *pCtx, const char *pszMsg, ...)
     1826static void xmlParserBaseGenericError(void *pCtx, const char *pszMsg, ...) RT_NOTHROW_DEF
    18271827{
    18281828    NOREF(pCtx);
     
    18331833}
    18341834
    1835 static void xmlParserBaseStructuredError(void *pCtx, xmlErrorPtr error)
     1835static void xmlParserBaseStructuredError(void *pCtx, xmlErrorPtr error) RT_NOTHROW_DEF
    18361836{
    18371837    NOREF(pCtx);
     
    20182018}
    20192019
    2020 /*static*/ int XmlStringWriter::WriteCallbackForSize(void *pvUser, const char *pachBuf, int cbToWrite)
     2020/*static*/ int XmlStringWriter::WriteCallbackForSize(void *pvUser, const char *pachBuf, int cbToWrite) RT_NOTHROW_DEF
    20212021{
    20222022    if (cbToWrite > 0)
     
    20262026}
    20272027
    2028 /*static*/ int XmlStringWriter::WriteCallbackForReal(void *pvUser, const char *pachBuf, int cbToWrite)
     2028/*static*/ int XmlStringWriter::WriteCallbackForReal(void *pvUser, const char *pachBuf, int cbToWrite) RT_NOTHROW_DEF
    20292029{
    20302030    XmlStringWriter *pThis = static_cast<XmlStringWriter*>(pvUser);
     
    20482048}
    20492049
    2050 int XmlStringWriter::CloseCallback(void *pvUser)
     2050/*static*/ int XmlStringWriter::CloseCallback(void *pvUser) RT_NOTHROW_DEF
    20512051{
    20522052    /* Nothing to do here. */
     
    21732173}
    21742174
    2175 // static
    2176 int XmlFileParser::ReadCallback(void *aCtxt, char *aBuf, int aLen)
     2175/*static*/ int XmlFileParser::ReadCallback(void *aCtxt, char *aBuf, int aLen) RT_NOTHROW_DEF
    21772176{
    21782177    ReadContext *pContext = static_cast<ReadContext*>(aCtxt);
     
    21932192}
    21942193
    2195 int XmlFileParser::CloseCallback(void *aCtxt)
     2194/*static*/ int XmlFileParser::CloseCallback(void *aCtxt) RT_NOTHROW_DEF
    21962195{
    21972196    /// @todo to be written
     
    23012300}
    23022301
    2303 int XmlFileWriter::WriteCallback(void *aCtxt, const char *aBuf, int aLen)
     2302/*static*/ int XmlFileWriter::WriteCallback(void *aCtxt, const char *aBuf, int aLen) RT_NOTHROW_DEF
    23042303{
    23052304    WriteContext *pContext = static_cast<WriteContext*>(aCtxt);
     
    23192318}
    23202319
    2321 int XmlFileWriter::CloseCallback(void *aCtxt)
     2320/*static*/ int XmlFileWriter::CloseCallback(void *aCtxt) RT_NOTHROW_DEF
    23222321{
    23232322    /// @todo to be written
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette