VirtualBox

Changeset 8579

Show
Ignore:
Timestamp:
05/05/08 15:54:26 (8 months ago)
Author:
vboxsync
Message:

AssertBreakVoid? -> AssertBreak?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/iprt/assert.h

    r8578 r8579  
    292292 
    293293 
     294/** @def AssertBreak 
     295 * Assert that an expression is true and breaks if it isn't. 
     296 * In RT_STRICT mode it will hit a breakpoint before returning. 
     297 * 
     298 * @param   expr    Expression which should be true. 
     299 */ 
     300#ifdef RT_STRICT 
     301# define AssertBreak(expr) \ 
     302    if (RT_UNLIKELY(!(expr))) \ 
     303    { \ 
     304        AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 
     305        AssertBreakpoint(); \ 
     306        break; \ 
     307    } else do {} while (0) 
     308#else 
     309# define AssertBreak(expr) \ 
     310    if (RT_UNLIKELY(!(expr))) \ 
     311        break; \ 
     312    else do {} while (0) 
     313#endif 
     314 
    294315/** @def AssertBreakStmt 
    295316 * Assert that an expression is true and breaks if it isn't. 
     
    313334        break; \ 
    314335    } else do {} while (0) 
    315 #endif 
    316  
    317 /** @def AssertBreakVoid 
    318  * Assert that an expression is true and breaks if it isn't. 
    319  * In RT_STRICT mode it will hit a breakpoint before returning. 
    320  * 
    321  * @param   expr    Expression which should be true. 
    322  * @todo Rename to AssertBreak. 
    323  * @todo broken, use if. 
    324  */ 
    325 #ifdef RT_STRICT 
    326 # define AssertBreakVoid(expr) \ 
    327     if (RT_UNLIKELY(!(expr))) \ 
    328     { \ 
    329         AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \ 
    330         AssertBreakpoint(); \ 
    331         break; \ 
    332     } else do {} while (0) 
    333 #else 
    334 # define AssertBreakVoid(expr) \ 
    335     if (RT_UNLIKELY(!(expr))) \ 
    336         break; \ 
    337     else do {} while (0) 
    338336#endif 
    339337 
  • trunk/src/VBox/Devices/Storage/DrvHostBase.cpp

    r8569 r8579  
    11631163        memcpy(&cdb[0], pbCmd, cbCmd); 
    11641164        IOReturn irc = (*ppScsiTaskI)->SetCommandDescriptorBlock(ppScsiTaskI, cdb, cbCmd); 
    1165         AssertBreakVoid(irc == kIOReturnSuccess); 
     1165        AssertBreak(irc == kIOReturnSuccess); 
    11661166 
    11671167        /* Setup the buffer. */ 
     
    11761176                                                          : kSCSIDataTransfer_FromInitiatorToTarget); 
    11771177        } 
    1178         AssertBreakVoid(irc == kIOReturnSuccess); 
     1178        AssertBreak(irc == kIOReturnSuccess); 
    11791179 
    11801180        /* Set the timeout. */ 
    11811181        irc = (*ppScsiTaskI)->SetTimeoutDuration(ppScsiTaskI, cTimeoutMillies ? cTimeoutMillies : 30000 /*ms*/); 
    1182         AssertBreakVoid(irc == kIOReturnSuccess); 
     1182        AssertBreak(irc == kIOReturnSuccess); 
    11831183 
    11841184        /* Execute the command and get the response. */ 
     
    11881188        UInt64 cbReturned = 0; 
    11891189        irc = (*ppScsiTaskI)->ExecuteTaskSync(ppScsiTaskI, &SenseData, &TaskStatus, &cbReturned); 
    1190         AssertBreakVoid(irc == kIOReturnSuccess); 
     1190        AssertBreak(irc == kIOReturnSuccess); 
    11911191        if (pcbBuf) 
    11921192            *pcbBuf = cbReturned; 
    11931193 
    11941194        irc = (*ppScsiTaskI)->GetSCSIServiceResponse(ppScsiTaskI, &ServiceResponse); 
    1195         AssertBreakVoid(irc == kIOReturnSuccess); 
    1196         AssertBreakVoid(ServiceResponse == kSCSIServiceResponse_TASK_COMPLETE); 
     1195        AssertBreak(irc == kIOReturnSuccess); 
     1196        AssertBreak(ServiceResponse == kSCSIServiceResponse_TASK_COMPLETE); 
    11971197 
    11981198        if (TaskStatus == kSCSITaskStatus_GOOD) 
  • trunk/src/VBox/Main/MachineImpl.cpp

    r8573 r8579  
    44094409            /* slot unicity is guaranteed by XML Schema */ 
    44104410            uint32_t slot = (*it).value <uint32_t> ("slot"); 
    4411             AssertBreakVoid (slot < ELEMENTS (mNetworkAdapters)); 
     4411            AssertBreak (slot < ELEMENTS (mNetworkAdapters)); 
    44124412 
    44134413            rc = mNetworkAdapters [slot]->loadSettings (*it); 
     
    44294429            /* slot unicity is guaranteed by XML Schema */ 
    44304430            uint32_t slot = (*it).value <uint32_t> ("slot"); 
    4431             AssertBreakVoid (slot < ELEMENTS (mSerialPorts)); 
     4431            AssertBreak (slot < ELEMENTS (mSerialPorts)); 
    44324432 
    44334433            rc = mSerialPorts [slot]->loadSettings (*it); 
     
    44494449            /* slot unicity is guaranteed by XML Schema */ 
    44504450            uint32_t slot = (*it).value <uint32_t> ("slot"); 
    4451             AssertBreakVoid (slot < ELEMENTS (mSerialPorts)); 
     4451            AssertBreak (slot < ELEMENTS (mSerialPorts)); 
    44524452 
    44534453            rc = mParallelPorts [slot]->loadSettings (*it); 
  • trunk/src/VBox/Main/darwin/iokit.cpp

    r8569 r8579  
    821821            do /* loop for breaking out of on failure. */ 
    822822            { 
    823                 AssertBreakVoid(pCur); 
     823                AssertBreak(pCur); 
    824824 
    825825                /* 
     
    829829                pCur->enmState = USBDEVICESTATE_USED_BY_HOST_CAPTURABLE;    /* just a default, we'll try harder in a bit. */ 
    830830 
    831                 AssertBreakVoid(darwinDictGetU8(PropsRef,  CFSTR(kUSBDeviceClass),           &pCur->bDeviceClass)); 
     831                AssertBreak(darwinDictGetU8(PropsRef,  CFSTR(kUSBDeviceClass),           &pCur->bDeviceClass)); 
    832832                /* skip hubs */ 
    833833                if (pCur->bDeviceClass == 0x09 /* hub, find a define! */) 
    834834                    break; 
    835                 AssertBreakVoid(darwinDictGetU8(PropsRef,  CFSTR(kUSBDeviceSubClass),       &pCur->bDeviceSubClass)); 
    836                 AssertBreakVoid(darwinDictGetU8(PropsRef,  CFSTR(kUSBDeviceProtocol),       &pCur->bDeviceProtocol)); 
    837                 AssertBreakVoid(darwinDictGetU16(PropsRef, CFSTR(kUSBVendorID),             &pCur->idVendor)); 
    838                 AssertBreakVoid(darwinDictGetU16(PropsRef, CFSTR(kUSBProductID),            &pCur->idProduct)); 
    839                 AssertBreakVoid(darwinDictGetU16(PropsRef, CFSTR(kUSBDeviceReleaseNumber),  &pCur->bcdDevice)); 
     835                AssertBreak(darwinDictGetU8(PropsRef,  CFSTR(kUSBDeviceSubClass),       &pCur->bDeviceSubClass)); 
     836                AssertBreak(darwinDictGetU8(PropsRef,  CFSTR(kUSBDeviceProtocol),       &pCur->bDeviceProtocol)); 
     837                AssertBreak(darwinDictGetU16(PropsRef, CFSTR(kUSBVendorID),             &pCur->idVendor)); 
     838                AssertBreak(darwinDictGetU16(PropsRef, CFSTR(kUSBProductID),            &pCur->idProduct)); 
     839                AssertBreak(darwinDictGetU16(PropsRef, CFSTR(kUSBDeviceReleaseNumber),  &pCur->bcdDevice)); 
    840840                uint32_t u32LocationId; 
    841                 AssertBreakVoid(darwinDictGetU32(PropsRef, CFSTR(kUSBDevicePropertyLocationID), &u32LocationId)); 
     841                AssertBreak(darwinDictGetU32(PropsRef, CFSTR(kUSBDevicePropertyLocationID), &u32LocationId)); 
    842842                uint64_t u64SessionId; 
    843                 AssertBreakVoid(darwinDictGetU64(PropsRef, CFSTR("sessionID"), &u64SessionId)); 
     843                AssertBreak(darwinDictGetU64(PropsRef, CFSTR("sessionID"), &u64SessionId)); 
    844844                char szAddress[64]; 
    845845                RTStrPrintf(szAddress, sizeof(szAddress), "p=0x%04RX16;v=0x%04RX16;s=0x%016RX64;l=0x%08RX32", 
    846846                            pCur->idProduct, pCur->idVendor, u64SessionId, u32LocationId); 
    847847                pCur->pszAddress = RTStrDup(szAddress); 
    848                 AssertBreakVoid(pCur->pszAddress); 
     848                AssertBreak(pCur->pszAddress); 
    849849                pCur->bBus = u32LocationId >> 24; 
    850                 AssertBreakVoid(darwinDictGetU8(PropsRef,  CFSTR("PortNum"),                &pCur->bPort)); 
     850                AssertBreak(darwinDictGetU8(PropsRef,  CFSTR("PortNum"),                &pCur->bPort)); 
    851851                uint8_t bSpeed; 
    852                 AssertBreakVoid(darwinDictGetU8(PropsRef,  CFSTR(kUSBDevicePropertySpeed),  &bSpeed)); 
     852                AssertBreak(darwinDictGetU8(PropsRef,  CFSTR(kUSBDevicePropertySpeed),  &bSpeed)); 
    853853                Assert(bSpeed <= 2); 
    854854                pCur->enmSpeed = bSpeed == 2 ? USBDEVICESPEED_HIGH 
     
    10271027                SInt32 i32 = (int16_t)u64Value; 
    10281028                CFNumberRef Num = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &i32); 
    1029                 AssertBreakVoid(Num); 
     1029                AssertBreak(Num); 
    10301030                CFDictionarySetValue(RefMatchingDict, chValue == 'p' ? CFSTR(kUSBProductID) : CFSTR(kUSBVendorID), Num); 
    10311031                CFRelease(Num); 
  • trunk/src/VBox/Runtime/common/time/time.cpp

    r8569 r8579  
    468468            { 
    469469                /* If you change one, zero the other to make clear what you mean. */ 
    470                 AssertBreakVoid(pTime->u8Month <= 12); 
    471                 AssertBreakVoid(pTime->u8MonthDay <= (fLeapYear 
    472                                                       ? g_acDaysInMonthsLeap[pTime->u8Month - 1] 
    473                                                       : g_acDaysInMonths[pTime->u8Month - 1])); 
     470                AssertBreak(pTime->u8Month <= 12); 
     471                AssertBreak(pTime->u8MonthDay <= (fLeapYear 
     472                                                  ? g_acDaysInMonthsLeap[pTime->u8Month - 1] 
     473                                                  : g_acDaysInMonths[pTime->u8Month - 1])); 
    474474                uint16_t u16YearDay = pTime->u8MonthDay - 1 
    475475                                    + (fLeapYear 
    476476                                       ? g_aiDayOfYearLeap[pTime->u8Month - 1] 
    477477                                       : g_aiDayOfYear[pTime->u8Month - 1]); 
    478                 AssertBreakVoid(u16YearDay == pTime->u16YearDay); 
     478                AssertBreak(u16YearDay == pTime->u16YearDay); 
    479479                fRecalc = false; 
    480480            } while (0); 
  • trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp

    r8569 r8579  
    256256        if (ASMAtomicCmpXchgU64(&pVM->tm.s.u64VirtualRawPrev, u64NanoTS, u64PrevNanoTS)) 
    257257            break; 
    258         AssertBreakVoid(--cTries <= 0); 
     258        AssertBreak(--cTries <= 0); 
    259259        if (cTries < 25 && !VM_IS_EMT(pVM)) /* give up early */ 
    260260            break; 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy