- Timestamp:
- May 5, 2008 1:54:26 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/assert.h
r8578 r8579 292 292 293 293 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 294 315 /** @def AssertBreakStmt 295 316 * Assert that an expression is true and breaks if it isn't. … … 313 334 break; \ 314 335 } else do {} while (0) 315 #endif316 317 /** @def AssertBreakVoid318 * 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_STRICT326 # 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 #else334 # define AssertBreakVoid(expr) \335 if (RT_UNLIKELY(!(expr))) \336 break; \337 else do {} while (0)338 336 #endif 339 337 -
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r8569 r8579 1163 1163 memcpy(&cdb[0], pbCmd, cbCmd); 1164 1164 IOReturn irc = (*ppScsiTaskI)->SetCommandDescriptorBlock(ppScsiTaskI, cdb, cbCmd); 1165 AssertBreak Void(irc == kIOReturnSuccess);1165 AssertBreak(irc == kIOReturnSuccess); 1166 1166 1167 1167 /* Setup the buffer. */ … … 1176 1176 : kSCSIDataTransfer_FromInitiatorToTarget); 1177 1177 } 1178 AssertBreak Void(irc == kIOReturnSuccess);1178 AssertBreak(irc == kIOReturnSuccess); 1179 1179 1180 1180 /* Set the timeout. */ 1181 1181 irc = (*ppScsiTaskI)->SetTimeoutDuration(ppScsiTaskI, cTimeoutMillies ? cTimeoutMillies : 30000 /*ms*/); 1182 AssertBreak Void(irc == kIOReturnSuccess);1182 AssertBreak(irc == kIOReturnSuccess); 1183 1183 1184 1184 /* Execute the command and get the response. */ … … 1188 1188 UInt64 cbReturned = 0; 1189 1189 irc = (*ppScsiTaskI)->ExecuteTaskSync(ppScsiTaskI, &SenseData, &TaskStatus, &cbReturned); 1190 AssertBreak Void(irc == kIOReturnSuccess);1190 AssertBreak(irc == kIOReturnSuccess); 1191 1191 if (pcbBuf) 1192 1192 *pcbBuf = cbReturned; 1193 1193 1194 1194 irc = (*ppScsiTaskI)->GetSCSIServiceResponse(ppScsiTaskI, &ServiceResponse); 1195 AssertBreak Void(irc == kIOReturnSuccess);1196 AssertBreak Void(ServiceResponse == kSCSIServiceResponse_TASK_COMPLETE);1195 AssertBreak(irc == kIOReturnSuccess); 1196 AssertBreak(ServiceResponse == kSCSIServiceResponse_TASK_COMPLETE); 1197 1197 1198 1198 if (TaskStatus == kSCSITaskStatus_GOOD) -
trunk/src/VBox/Main/MachineImpl.cpp
r8573 r8579 4409 4409 /* slot unicity is guaranteed by XML Schema */ 4410 4410 uint32_t slot = (*it).value <uint32_t> ("slot"); 4411 AssertBreak Void(slot < ELEMENTS (mNetworkAdapters));4411 AssertBreak (slot < ELEMENTS (mNetworkAdapters)); 4412 4412 4413 4413 rc = mNetworkAdapters [slot]->loadSettings (*it); … … 4429 4429 /* slot unicity is guaranteed by XML Schema */ 4430 4430 uint32_t slot = (*it).value <uint32_t> ("slot"); 4431 AssertBreak Void(slot < ELEMENTS (mSerialPorts));4431 AssertBreak (slot < ELEMENTS (mSerialPorts)); 4432 4432 4433 4433 rc = mSerialPorts [slot]->loadSettings (*it); … … 4449 4449 /* slot unicity is guaranteed by XML Schema */ 4450 4450 uint32_t slot = (*it).value <uint32_t> ("slot"); 4451 AssertBreak Void(slot < ELEMENTS (mSerialPorts));4451 AssertBreak (slot < ELEMENTS (mSerialPorts)); 4452 4452 4453 4453 rc = mParallelPorts [slot]->loadSettings (*it); -
trunk/src/VBox/Main/darwin/iokit.cpp
r8569 r8579 821 821 do /* loop for breaking out of on failure. */ 822 822 { 823 AssertBreak Void(pCur);823 AssertBreak(pCur); 824 824 825 825 /* … … 829 829 pCur->enmState = USBDEVICESTATE_USED_BY_HOST_CAPTURABLE; /* just a default, we'll try harder in a bit. */ 830 830 831 AssertBreak Void(darwinDictGetU8(PropsRef, CFSTR(kUSBDeviceClass), &pCur->bDeviceClass));831 AssertBreak(darwinDictGetU8(PropsRef, CFSTR(kUSBDeviceClass), &pCur->bDeviceClass)); 832 832 /* skip hubs */ 833 833 if (pCur->bDeviceClass == 0x09 /* hub, find a define! */) 834 834 break; 835 AssertBreak Void(darwinDictGetU8(PropsRef, CFSTR(kUSBDeviceSubClass), &pCur->bDeviceSubClass));836 AssertBreak Void(darwinDictGetU8(PropsRef, CFSTR(kUSBDeviceProtocol), &pCur->bDeviceProtocol));837 AssertBreak Void(darwinDictGetU16(PropsRef, CFSTR(kUSBVendorID), &pCur->idVendor));838 AssertBreak Void(darwinDictGetU16(PropsRef, CFSTR(kUSBProductID), &pCur->idProduct));839 AssertBreak Void(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)); 840 840 uint32_t u32LocationId; 841 AssertBreak Void(darwinDictGetU32(PropsRef, CFSTR(kUSBDevicePropertyLocationID), &u32LocationId));841 AssertBreak(darwinDictGetU32(PropsRef, CFSTR(kUSBDevicePropertyLocationID), &u32LocationId)); 842 842 uint64_t u64SessionId; 843 AssertBreak Void(darwinDictGetU64(PropsRef, CFSTR("sessionID"), &u64SessionId));843 AssertBreak(darwinDictGetU64(PropsRef, CFSTR("sessionID"), &u64SessionId)); 844 844 char szAddress[64]; 845 845 RTStrPrintf(szAddress, sizeof(szAddress), "p=0x%04RX16;v=0x%04RX16;s=0x%016RX64;l=0x%08RX32", 846 846 pCur->idProduct, pCur->idVendor, u64SessionId, u32LocationId); 847 847 pCur->pszAddress = RTStrDup(szAddress); 848 AssertBreak Void(pCur->pszAddress);848 AssertBreak(pCur->pszAddress); 849 849 pCur->bBus = u32LocationId >> 24; 850 AssertBreak Void(darwinDictGetU8(PropsRef, CFSTR("PortNum"), &pCur->bPort));850 AssertBreak(darwinDictGetU8(PropsRef, CFSTR("PortNum"), &pCur->bPort)); 851 851 uint8_t bSpeed; 852 AssertBreak Void(darwinDictGetU8(PropsRef, CFSTR(kUSBDevicePropertySpeed), &bSpeed));852 AssertBreak(darwinDictGetU8(PropsRef, CFSTR(kUSBDevicePropertySpeed), &bSpeed)); 853 853 Assert(bSpeed <= 2); 854 854 pCur->enmSpeed = bSpeed == 2 ? USBDEVICESPEED_HIGH … … 1027 1027 SInt32 i32 = (int16_t)u64Value; 1028 1028 CFNumberRef Num = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &i32); 1029 AssertBreak Void(Num);1029 AssertBreak(Num); 1030 1030 CFDictionarySetValue(RefMatchingDict, chValue == 'p' ? CFSTR(kUSBProductID) : CFSTR(kUSBVendorID), Num); 1031 1031 CFRelease(Num); -
trunk/src/VBox/Runtime/common/time/time.cpp
r8569 r8579 468 468 { 469 469 /* If you change one, zero the other to make clear what you mean. */ 470 AssertBreak Void(pTime->u8Month <= 12);471 AssertBreak Void(pTime->u8MonthDay <= (fLeapYear472 473 470 AssertBreak(pTime->u8Month <= 12); 471 AssertBreak(pTime->u8MonthDay <= (fLeapYear 472 ? g_acDaysInMonthsLeap[pTime->u8Month - 1] 473 : g_acDaysInMonths[pTime->u8Month - 1])); 474 474 uint16_t u16YearDay = pTime->u8MonthDay - 1 475 475 + (fLeapYear 476 476 ? g_aiDayOfYearLeap[pTime->u8Month - 1] 477 477 : g_aiDayOfYear[pTime->u8Month - 1]); 478 AssertBreak Void(u16YearDay == pTime->u16YearDay);478 AssertBreak(u16YearDay == pTime->u16YearDay); 479 479 fRecalc = false; 480 480 } while (0); -
trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
r8569 r8579 256 256 if (ASMAtomicCmpXchgU64(&pVM->tm.s.u64VirtualRawPrev, u64NanoTS, u64PrevNanoTS)) 257 257 break; 258 AssertBreak Void(--cTries <= 0);258 AssertBreak(--cTries <= 0); 259 259 if (cTries < 25 && !VM_IS_EMT(pVM)) /* give up early */ 260 260 break;
Note:
See TracChangeset
for help on using the changeset viewer.