Fix two warnings.
1) size_t >= 0 is always true, and trigger a warning. This is fixed in the code because I feel such warning is useful to catch bugs. 2) extra statements from TRACE. Also fixed. Bug: chromium:1064305 Change-Id: I487ff38f6947554fd175a19148c6f2aaaf56ed37 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19300 Commit-Queue: Zhenyao Mo <zmo@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
4f86505544
commit
8619cbe237
|
@ -81,15 +81,12 @@ namespace dawn_native {
|
|||
// Allocate(size=8, alignment=4) will be satified by using F1.
|
||||
// Allocate(size=8, alignment=16) will be satisified by using F2.
|
||||
//
|
||||
for (size_t currLevel = allocationBlockLevel; currLevel >= 0; currLevel--) {
|
||||
for (size_t ii = 0; ii <= allocationBlockLevel; ++ii) {
|
||||
size_t currLevel = allocationBlockLevel - ii;
|
||||
BuddyBlock* freeBlock = mFreeLists[currLevel].head;
|
||||
if (freeBlock && (freeBlock->mOffset % alignment == 0)) {
|
||||
return currLevel;
|
||||
}
|
||||
|
||||
if (currLevel == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return kInvalidOffset; // No free block exists at any level.
|
||||
}
|
||||
|
@ -264,4 +261,4 @@ namespace dawn_native {
|
|||
delete block;
|
||||
}
|
||||
|
||||
} // namespace dawn_native
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -673,37 +673,35 @@
|
|||
|
||||
// Implementation detail: internal macro to create static category and add
|
||||
// event if the category is enabled.
|
||||
#define INTERNAL_TRACE_EVENT_ADD(platform, phase, category, name, flags, ...) \
|
||||
do { \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, \
|
||||
::dawn_platform::TraceCategory::category); \
|
||||
if (*INTERNALTRACEEVENTUID(catstatic)) { \
|
||||
dawn_platform::TraceEvent::addTraceEvent( \
|
||||
platform, phase, INTERNALTRACEEVENTUID(catstatic), name, \
|
||||
dawn_platform::TraceEvent::noEventId, flags, ##__VA_ARGS__); \
|
||||
} \
|
||||
#define INTERNAL_TRACE_EVENT_ADD(platform, phase, category, name, flags, ...) \
|
||||
do { \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, ::dawn_platform::TraceCategory::category) \
|
||||
if (*INTERNALTRACEEVENTUID(catstatic)) { \
|
||||
dawn_platform::TraceEvent::addTraceEvent( \
|
||||
platform, phase, INTERNALTRACEEVENTUID(catstatic), name, \
|
||||
dawn_platform::TraceEvent::noEventId, flags, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Implementation detail: internal macro to create static category and add begin
|
||||
// event if the category is enabled. Also adds the end event when the scope
|
||||
// ends.
|
||||
#define INTERNAL_TRACE_EVENT_ADD_SCOPED(platform, category, name, ...) \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, ::dawn_platform::TraceCategory::category); \
|
||||
dawn_platform::TraceEvent::TraceEndOnScopeClose INTERNALTRACEEVENTUID(profileScope); \
|
||||
if (*INTERNALTRACEEVENTUID(catstatic)) { \
|
||||
dawn_platform::TraceEvent::addTraceEvent( \
|
||||
platform, TRACE_EVENT_PHASE_BEGIN, INTERNALTRACEEVENTUID(catstatic), name, \
|
||||
dawn_platform::TraceEvent::noEventId, TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \
|
||||
INTERNALTRACEEVENTUID(profileScope) \
|
||||
.initialize(platform, INTERNALTRACEEVENTUID(catstatic), name); \
|
||||
#define INTERNAL_TRACE_EVENT_ADD_SCOPED(platform, category, name, ...) \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, ::dawn_platform::TraceCategory::category) \
|
||||
dawn_platform::TraceEvent::TraceEndOnScopeClose INTERNALTRACEEVENTUID(profileScope); \
|
||||
if (*INTERNALTRACEEVENTUID(catstatic)) { \
|
||||
dawn_platform::TraceEvent::addTraceEvent( \
|
||||
platform, TRACE_EVENT_PHASE_BEGIN, INTERNALTRACEEVENTUID(catstatic), name, \
|
||||
dawn_platform::TraceEvent::noEventId, TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \
|
||||
INTERNALTRACEEVENTUID(profileScope) \
|
||||
.initialize(platform, INTERNALTRACEEVENTUID(catstatic), name); \
|
||||
}
|
||||
|
||||
// Implementation detail: internal macro to create static category and add
|
||||
// event if the category is enabled.
|
||||
#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, phase, category, name, id, flags, ...) \
|
||||
do { \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, \
|
||||
::dawn_platform::TraceCategory::category); \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, ::dawn_platform::TraceCategory::category) \
|
||||
if (*INTERNALTRACEEVENTUID(catstatic)) { \
|
||||
unsigned char traceEventFlags = flags | TRACE_EVENT_FLAG_HAS_ID; \
|
||||
dawn_platform::TraceEvent::TraceID traceEventTraceID(id, &traceEventFlags); \
|
||||
|
|
Loading…
Reference in New Issue