VirtualBox

Changeset 62721 in vbox


Ignore:
Timestamp:
Jul 29, 2016 10:31:28 PM (8 years ago)
Author:
vboxsync
Message:

IPRT/testcases: warnings

Location:
trunk/src/VBox/Runtime/testcase
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstLog.cpp

    r62477 r62721  
    6464    RTLogPrintf("%%RHv: %RHv\n", (RTGCPTR)0x87654321);
    6565
    66     RTLogPrintf("%%RI8 : %RI8\n", (uint8_t)808);
     66    RTLogPrintf("%%RI8 : %RI8\n", (uint8_t)88);
    6767    RTLogPrintf("%%RI16: %RI16\n", (uint16_t)16016);
    6868    RTLogPrintf("%%RI32: %RI32\n", _1G);
    6969    RTLogPrintf("%%RI64: %RI64\n", _1E);
    7070
    71     RTLogPrintf("%%RU8 : %RU8\n", (uint8_t)808);
     71    RTLogPrintf("%%RU8 : %RU8\n", (uint8_t)88);
    7272    RTLogPrintf("%%RU16: %RU16\n", (uint16_t)16016);
    7373    RTLogPrintf("%%RU32: %RU32\n", _2G32);
    7474    RTLogPrintf("%%RU64: %RU64\n", _2E);
    7575
    76     RTLogPrintf("%%RX8 : %RX8 %#RX8\n",   (uint8_t)808, (uint8_t)808);
     76    RTLogPrintf("%%RX8 : %RX8 %#RX8\n",   (uint8_t)88, (uint8_t)88);
    7777    RTLogPrintf("%%RX16: %RX16 %#RX16\n", (uint16_t)16016, (uint16_t)16016);
    7878    RTLogPrintf("%%RX32: %RX32 %#RX32\n", _2G32, _2G32);
  • trunk/src/VBox/Runtime/testcase/tstRTCritSect.cpp

    r62592 r62721  
    152152static DECLCALLBACK(int) ThreadTest1(RTTHREAD ThreadSelf, void *pvArgs)
    153153{
     154    RT_NOREF1(ThreadSelf);
    154155    THREADTEST1ARGS Args = *(PTHREADTEST1ARGS)pvArgs;
    155156    Log2(("ThreadTest1: Start - iThread=%d ThreadSelf=%p\n", Args.iThread, ThreadSelf));
     
    246247static DECLCALLBACK(int) ThreadTest2(RTTHREAD ThreadSelf, void *pvArg)
    247248{
     249    RT_NOREF1(ThreadSelf);
    248250    PTHREADTEST2ARGS pArgs = (PTHREADTEST2ARGS)pvArg;
    249251    Log2(("ThreadTest2: Start - iThread=%d ThreadSelf=%p\n", pArgs->iThread, ThreadSelf));
     
    312314            }
    313315        }
    314         ASMAtomicCmpXchgU32(pArgs->pu32Alone, pArgs->iThread, ~0);
     316        ASMAtomicCmpXchgU32(pArgs->pu32Alone, pArgs->iThread, UINT32_MAX);
    315317        for (u32 = 0; u32 < pArgs->cCheckLoops; u32++)
    316318        {
     
    322324            }
    323325        }
    324         ASMAtomicXchgU32(pArgs->pu32Alone, ~0);
     326        ASMAtomicXchgU32(pArgs->pu32Alone, UINT32_MAX);
    325327
    326328        /*
     
    376378    RTTEST_CHECK_RC_RET(g_hTest, RTSemEventCreate(&EventDone), VINF_SUCCESS, 1);
    377379    uint32_t volatile   u32Release = 0;
    378     uint32_t volatile   u32Alone = ~0;
    379     uint32_t volatile   u32Prev = ~0;
     380    uint32_t volatile   u32Alone = UINT32_MAX;
     381    uint32_t volatile   u32Prev = UINT32_MAX;
    380382    uint32_t volatile   cSeq = 0;
    381383    uint32_t volatile   cReordered = 0;
  • trunk/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp

    r62477 r62721  
    431431
    432432
     433/* Global to avoid weird C4640 warning about "construction of local static object is not thread-safe". */
     434static const struct
     435{
     436    const char * const      apszArgs[5];
     437    const char             *pszCmdLine;
     438} g_aMscCrtTests[] =
     439{
     440    {
     441        { "abcd", "a ", " b", " c ", NULL },
     442        "abcd \"a \" \" b\" \" c \""
     443    },
     444    {
     445        { "a\\\\\\b", "de fg", "h", NULL, NULL },
     446        "a\\\\\\b \"de fg\" h"
     447    },
     448    {
     449        { "a\\\"b", "c", "d", "\"", NULL },
     450        "\"a\\\\\\\"b\" c d \"\\\"\""
     451    },
     452    {
     453        { "a\\\\b c", "d", "e", " \\", NULL },
     454        "\"a\\\\b c\" d e \" \\\\\""
     455    },
     456};
     457
    433458static void tst2(void)
    434459{
    435460    RTTestISub("RTGetOptArgvToString / MS_CRT");
    436461
    437     static const struct
    438     {
    439         const char * const      apszArgs[5];
    440         const char             *pszCmdLine;
    441     } s_aMscCrtTests[] =
    442     {
    443         {
    444             { "abcd", "a ", " b", " c ", NULL },
    445             "abcd \"a \" \" b\" \" c \""
    446         },
    447         {
    448             { "a\\\\\\b", "de fg", "h", NULL, NULL },
    449             "a\\\\\\b \"de fg\" h"
    450         },
    451         {
    452             { "a\\\"b", "c", "d", "\"", NULL },
    453             "\"a\\\\\\\"b\" c d \"\\\"\""
    454         },
    455         {
    456             { "a\\\\b c", "d", "e", " \\", NULL },
    457             "\"a\\\\b c\" d e \" \\\\\""
    458         },
    459     };
    460 
    461     for (size_t i = 0; i < RT_ELEMENTS(s_aMscCrtTests); i++)
     462    for (size_t i = 0; i < RT_ELEMENTS(g_aMscCrtTests); i++)
    462463    {
    463464        char *pszCmdLine = NULL;
    464         int rc = RTGetOptArgvToString(&pszCmdLine, s_aMscCrtTests[i].apszArgs, RTGETOPTARGV_CNV_QUOTE_MS_CRT);
     465        int rc = RTGetOptArgvToString(&pszCmdLine, g_aMscCrtTests[i].apszArgs, RTGETOPTARGV_CNV_QUOTE_MS_CRT);
    465466        RTTESTI_CHECK_RC_RETV(rc, VINF_SUCCESS);
    466         if (!strcmp(s_aMscCrtTests[i].pszCmdLine, pszCmdLine))
    467             tstCheckNativeMsCrtToArgv(pszCmdLine, -1, s_aMscCrtTests[i].apszArgs);
     467        if (!strcmp(g_aMscCrtTests[i].pszCmdLine, pszCmdLine))
     468            tstCheckNativeMsCrtToArgv(pszCmdLine, -1, g_aMscCrtTests[i].apszArgs);
    468469        else
    469470            RTTestIFailed("g_aTest[%i] failed:\n"
    470471                          " got      '%s'\n"
    471472                          " expected '%s'\n",
    472                           i, pszCmdLine, s_aMscCrtTests[i].pszCmdLine);
     473                          i, pszCmdLine, g_aMscCrtTests[i].pszCmdLine);
    473474        RTStrFree(pszCmdLine);
    474475    }
  • trunk/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp

    r62570 r62721  
    640640    CHECKVAL(*pu8, 0, "%#x");
    641641
    642     CHECKOP(ASMAtomicXchgU8(pu8, 0xff), 0, "%#x", uint8_t);
     642    CHECKOP(ASMAtomicXchgU8(pu8, UINT8_C(0xff)), 0, "%#x", uint8_t);
    643643    CHECKVAL(*pu8, 0xff, "%#x");
    644644
    645     CHECKOP(ASMAtomicXchgU8(pu8, 0x87), 0xffff, "%#x", uint8_t);
     645    CHECKOP(ASMAtomicXchgU8(pu8, UINT8_C(0x87)), UINT8_C(0xff), "%#x", uint8_t);
    646646    CHECKVAL(*pu8, 0x87, "%#x");
    647647}
     
    14341434                    pbBuf2[offEnd] = 0xff;
    14351435                }
     1436#ifdef _MSC_VER /* simple stupid compiler warnings */
     1437                else
     1438                    bSaved1 = bSaved2 = 0;
     1439#endif
    14361440
    14371441                uint8_t *pbRet = (uint8_t *)ASMMemFirstMismatchingU8(pbBuf1 + offStart, cb, bFiller1);
     
    16671671    u64Out = ASMByteSwapU64(u64In);
    16681672    CHECKVAL(u64Out, u64In, "%#018RX64");
    1669     u64In  = ~(uint64_t)0;
     1673    u64In  = UINT64_MAX;
    16701674    u64Out = ASMByteSwapU64(u64In);
    16711675    CHECKVAL(u64Out, u64In, "%#018RX64");
     
    16861690    u32Out = ASMByteSwapU32(u32In);
    16871691    CHECKVAL(u32Out, u32In, "%#010RX32");
    1688     u32In  = ~(uint32_t)0;
     1692    u32In  = UINT32_MAX;
    16891693    u32Out = ASMByteSwapU32(u32In);
    16901694    CHECKVAL(u32Out, u32In, "%#010RX32");
     
    17051709    u16Out = ASMByteSwapU16(u16In);
    17061710    CHECKVAL(u16Out, u16In, "%#06RX16");
    1707     u16In  = ~(uint16_t)0;
     1711    u16In  = UINT16_MAX;
    17081712    u16Out = ASMByteSwapU16(u16In);
    17091713    CHECKVAL(u16Out, u16In, "%#06RX16");
  • trunk/src/VBox/Runtime/testcase/tstRTMemWipe.cpp

    r62477 r62721  
    4646    for (uint32_t p = 0; p < RTRandU32Ex(1, 64); p++)
    4747    {
    48         size_t cbAlloc = RTRandS32Ex(1, _1M) * sizeof(uint8_t);
     48        uint32_t cbAlloc = RTRandS32Ex(1, _1M) * sizeof(uint8_t);
    4949
    5050        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Testing wipe #%.02RU32 (%u bytes) ...\n",
     
    6969            continue;
    7070        }
    71         size_t cbWipeRand = RTRandU32Ex(1, cbAlloc);
     71        uint32_t cbWipeRand = RTRandU32Ex(1, cbAlloc);
    7272        RTMemWipeThoroughly(pvWipe, RT_MIN(cbAlloc, cbWipeRand), p /* Passes */);
    7373        if (!memcmp(pvWipe, pvBuf, cbAlloc))
  • trunk/src/VBox/Runtime/testcase/tstRTPipe.cpp

    r62477 r62721  
    252252    RTPIPE  hPipeR = (RTPIPE)1;
    253253    RTPIPE  hPipeW = (RTPIPE)1;
    254     RTTESTI_CHECK_RC(RTPipeCreate(&hPipeR, &hPipeW, ~0), VERR_INVALID_PARAMETER);
     254    RTTESTI_CHECK_RC(RTPipeCreate(&hPipeR, &hPipeW, UINT32_MAX), VERR_INVALID_PARAMETER);
    255255    RTTESTI_CHECK_RC(RTPipeCreate(NULL, &hPipeW, 0), VERR_INVALID_POINTER);
    256256    RTTESTI_CHECK_RC(RTPipeCreate(&hPipeR, NULL, 0), VERR_INVALID_POINTER);
  • trunk/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h

    r62477 r62721  
    4747char                g_szSrvName[64];
    4848/** The length of the service name.  */
    49 uint32_t            g_cchSrvName;
     49size_t              g_cchSrvName;
    5050/** The base address of the service module. */
    5151void               *g_pvImageBase;
  • trunk/src/VBox/Runtime/testcase/tstRTR0MemUserKernelDriver.cpp

    r62477 r62721  
    4949extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
    5050{
     51    RT_NOREF3(argc, argv, envp);
    5152#ifndef VBOX
    5253    RTPrintf("tstSup: SKIPPED\n");
  • trunk/src/VBox/Runtime/testcase/tstRTR0SemMutexDriver.cpp

    r62477 r62721  
    176176extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
    177177{
     178    RT_NOREF3(argc, argv, envp);
    178179#ifndef VBOX
    179180    RTPrintf("tstSup: SKIPPED\n");
  • trunk/src/VBox/Runtime/testcase/tstRTR0ThreadDriver.cpp

    r62477 r62721  
    4949extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
    5050{
     51    RT_NOREF3(argc, argv, envp);
    5152#ifndef VBOX
    5253    RTPrintf("tstRTR0Thread: SKIPPED\n");
  • trunk/src/VBox/Runtime/testcase/tstRTR0ThreadPreemptionDriver.cpp

    r62477 r62721  
    5858static DECLCALLBACK(int) MyThreadProc(RTTHREAD hSelf, void *pvCpuIdx)
    5959{
     60    RT_NOREF1(hSelf);
    6061    RTCPUSET Affinity;
    6162    RTCpuSetEmpty(&Affinity);
     
    8283extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
    8384{
     85    RT_NOREF3(argc, argv, envp);
    8486#ifndef VBOX
    8587    RTPrintf("tstSup: SKIPPED\n");
Note: See TracChangeset for help on using the changeset viewer.

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