CacheMemory: add allocateVoid() that is == allocate() but no return value.
Review Request #629 - Created March 31, 2011 and submitted
| Information | |
|---|---|
| Lisa Hsu | |
| gem5 | |
| Reviewers | |
| Default | |
| ali, gblack, nate, stever | |
CacheMemory: add allocateVoid() that is == allocate() but no return value. This function duplicates the functionality of allocate() exactly, except that it does not return a return value. In protocols where you just want to allocate a block but do not want that block to be your implicitly passed cache_entry, use this function. Otherwise, SLICC will complain if you do not consume the pointer returned by allocate(), and if you do a dummy assignment Entry foo := cache.allocate(address), the C++ compiler will complain of an unused variable. This is kind of a hack to get around those issues, but suggestions welcome.
Posted (March 31, 2011, 9:15 a.m.)
This is more of a question, then a suggestion. Is there a way to use allocateVoid() a wrapper around allocate() rather than have to duplicate code? What happens if you cast the return pointer to void? Does that suppresss the error? Maybe there is a way to set some attribute on the variable that the compiler can understand. I have no idea if that is actually possible and if any solution would be portable across compiler generations. I'm just curious if there was some way to avoid the code duplication.
