mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8080775: Better argument formatting for assert() and friends
Reviewed-by: kbarrett, pliden
This commit is contained in:
parent
aa0818a98a
commit
1e71f67736
225 changed files with 1342 additions and 1432 deletions
|
@ -341,13 +341,13 @@ protected:
|
|||
assert(is_size_aligned(left, sizeof(T)), "Must be");
|
||||
|
||||
size_t elements = left / sizeof(T);
|
||||
assert(elements <= (size_t)INT_MAX, err_msg("number of elements " SIZE_FORMAT "doesn't fit into an int.", elements));
|
||||
assert(elements <= (size_t)INT_MAX, "number of elements " SIZE_FORMAT "doesn't fit into an int.", elements);
|
||||
|
||||
int length = (int)elements;
|
||||
|
||||
assert((size_t)size(length) * BytesPerWord == bytes,
|
||||
err_msg("Expected: " SIZE_FORMAT " got: " SIZE_FORMAT,
|
||||
bytes, (size_t)size(length) * BytesPerWord));
|
||||
"Expected: " SIZE_FORMAT " got: " SIZE_FORMAT,
|
||||
bytes, (size_t)size(length) * BytesPerWord);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
@ -380,9 +380,9 @@ protected:
|
|||
// sort the array.
|
||||
bool contains(const T& x) const { return index_of(x) >= 0; }
|
||||
|
||||
T at(int i) const { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return _data[i]; }
|
||||
void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); _data[i] = x; }
|
||||
T* adr_at(const int i) { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return &_data[i]; }
|
||||
T at(int i) const { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return _data[i]; }
|
||||
void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); _data[i] = x; }
|
||||
T* adr_at(const int i) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &_data[i]; }
|
||||
int find(const T& x) { return index_of(x); }
|
||||
|
||||
T at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue