Use a type alias instead of decltype

This commit is contained in:
Chris Robinson 2020-11-23 12:20:33 -08:00
parent d08d6b18c4
commit 7632dfb51a

View File

@ -157,6 +157,8 @@ using namespace std::placeholders;
using std::chrono::seconds; using std::chrono::seconds;
using std::chrono::nanoseconds; using std::chrono::nanoseconds;
using voidp = void*;
/************************************************ /************************************************
* Backends * Backends
@ -897,8 +899,8 @@ public:
if(ALCcontext *ctx{LocalContext}) if(ALCcontext *ctx{LocalContext})
{ {
const bool result{ctx->releaseIfNoDelete()}; const bool result{ctx->releaseIfNoDelete()};
ERR("Context %p current for thread being destroyed%s!\n", ERR("Context %p current for thread being destroyed%s!\n", voidp{ctx},
decltype(std::declval<void*>()){ctx}, result ? "" : ", leak detected"); result ? "" : ", leak detected");
} }
} }
@ -1647,8 +1649,7 @@ void ALCcontext::allocVoices(size_t addcount)
/** Stores the latest ALC device error. */ /** Stores the latest ALC device error. */
static void alcSetError(ALCdevice *device, ALCenum errorCode) static void alcSetError(ALCdevice *device, ALCenum errorCode)
{ {
WARN("Error generated on device %p, code 0x%04x\n", decltype(std::declval<void*>()){device}, WARN("Error generated on device %p, code 0x%04x\n", voidp{device}, errorCode);
errorCode);
if(TrapALCError) if(TrapALCError)
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -2330,7 +2331,7 @@ ALCdevice::ALCdevice(DeviceType type) : Type{type}, mContexts{&EmptyContextArray
ALCdevice::~ALCdevice() ALCdevice::~ALCdevice()
{ {
TRACE("Freeing device %p\n", decltype(std::declval<void*>()){this}); TRACE("Freeing device %p\n", voidp{this});
Backend = nullptr; Backend = nullptr;
@ -2380,7 +2381,7 @@ ALCcontext::ALCcontext(al::intrusive_ptr<ALCdevice> device) : mDevice{std::move(
ALCcontext::~ALCcontext() ALCcontext::~ALCcontext()
{ {
TRACE("Freeing context %p\n", decltype(std::declval<void*>()){this}); TRACE("Freeing context %p\n", voidp{this});
size_t count{0}; size_t count{0};
ALcontextProps *cprops{mUpdate.exchange(nullptr, std::memory_order_relaxed)}; ALcontextProps *cprops{mUpdate.exchange(nullptr, std::memory_order_relaxed)};
@ -2541,7 +2542,7 @@ bool ALCcontext::deinit()
{ {
if(LocalContext == this) if(LocalContext == this)
{ {
WARN("%p released while current on thread\n", decltype(std::declval<void*>()){this}); WARN("%p released while current on thread\n", voidp{this});
ThreadContext.set(nullptr); ThreadContext.set(nullptr);
release(); release();
} }
@ -3396,7 +3397,7 @@ START_API_FUNC
ERR("Failed to initialize the default effect\n"); ERR("Failed to initialize the default effect\n");
} }
TRACE("Created context %p\n", decltype(std::declval<void*>()){context.get()}); TRACE("Created context %p\n", voidp{context.get()});
return context.release(); return context.release();
} }
END_API_FUNC END_API_FUNC
@ -3704,8 +3705,7 @@ START_API_FUNC
DeviceList.emplace(iter, device.get()); DeviceList.emplace(iter, device.get());
} }
TRACE("Created device %p, \"%s\"\n", decltype(std::declval<void*>()){device.get()}, TRACE("Created device %p, \"%s\"\n", voidp{device.get()}, device->DeviceName.c_str());
device->DeviceName.c_str());
return device.release(); return device.release();
} }
END_API_FUNC END_API_FUNC
@ -3747,7 +3747,7 @@ START_API_FUNC
for(ContextRef &context : orphanctxs) for(ContextRef &context : orphanctxs)
{ {
WARN("Releasing orphaned context %p\n", decltype(std::declval<void*>()){context.get()}); WARN("Releasing orphaned context %p\n", voidp{context.get()});
context->deinit(); context->deinit();
} }
orphanctxs.clear(); orphanctxs.clear();
@ -3827,8 +3827,7 @@ START_API_FUNC
DeviceList.emplace(iter, device.get()); DeviceList.emplace(iter, device.get());
} }
TRACE("Created capture device %p, \"%s\"\n", decltype(std::declval<void*>()){device.get()}, TRACE("Created capture device %p, \"%s\"\n", voidp{device.get()}, device->DeviceName.c_str());
device->DeviceName.c_str());
return device.release(); return device.release();
} }
END_API_FUNC END_API_FUNC
@ -4003,7 +4002,7 @@ START_API_FUNC
DeviceList.emplace(iter, device.get()); DeviceList.emplace(iter, device.get());
} }
TRACE("Created loopback device %p\n", decltype(std::declval<void*>()){device.get()}); TRACE("Created loopback device %p\n", voidp{device.get()});
return device.release(); return device.release();
} }
END_API_FUNC END_API_FUNC