diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | al/auxeffectslot.cpp | 3 | ||||
-rw-r--r-- | al/error.cpp | 3 | ||||
-rw-r--r-- | alc/alc.cpp | 33 | ||||
-rw-r--r-- | alc/hrtf.cpp | 4 | ||||
-rw-r--r-- | common/threads.cpp | 2 | ||||
-rw-r--r-- | examples/alhrtf.c | 6 | ||||
-rw-r--r-- | examples/allatency.c | 26 | ||||
-rw-r--r-- | examples/alloopback.c | 8 | ||||
-rw-r--r-- | examples/almultireverb.c | 72 | ||||
-rw-r--r-- | examples/alreverb.c | 48 | ||||
-rw-r--r-- | utils/openal-info.c | 4 |
12 files changed, 108 insertions, 102 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ef1ca6b..4f6cf010 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,6 +222,7 @@ IF(MSVC) ENDIF() ELSE() SET(C_FLAGS ${C_FLAGS} -Winline -Wunused -Wall -Wextra -Wshadow -Wconversion -Wcast-align + -Wpedantic -Wno-zero-length-array $<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast -Wnon-virtual-dtor -Woverloaded-virtual>) IF(ALSOFT_WERROR) diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index df35c533..3c312c66 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -709,7 +709,8 @@ ALeffectslot::~ALeffectslot() if(props) { if(props->State) props->State->release(); - TRACE("Freed unapplied AuxiliaryEffectSlot update %p\n", props); + TRACE("Freed unapplied AuxiliaryEffectSlot update %p\n", + decltype(std::declval<void*>()){props}); delete props; } diff --git a/al/error.cpp b/al/error.cpp index f3e2dbb3..b667d14f 100644 --- a/al/error.cpp +++ b/al/error.cpp @@ -67,7 +67,8 @@ void ALCcontext::setError(ALenum errorCode, const char *msg, ...) else msg = "<internal error constructing message>"; msglen = static_cast<int>(strlen(msg)); - WARN("Error generated on context %p, code 0x%04x, \"%s\"\n", this, errorCode, msg); + WARN("Error generated on context %p, code 0x%04x, \"%s\"\n", + decltype(std::declval<void*>()){this}, errorCode, msg); if(TrapALError) { #ifdef _WIN32 diff --git a/alc/alc.cpp b/alc/alc.cpp index 8a0a3468..0652f858 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -845,8 +845,8 @@ std::atomic<ALCenum> LastNullDeviceError{ALC_NO_ERROR}; void ReleaseThreadCtx(ALCcontext *context) { const bool result{context->releaseIfNoDelete()}; - ERR("Context %p current for thread being destroyed%s!\n", context, - result ? "" : ", leak detected"); + ERR("Context %p current for thread being destroyed%s!\n", + decltype(std::declval<void*>()){context}, result ? "" : ", leak detected"); } class ThreadCtx { @@ -1567,7 +1567,8 @@ void ALCcontext::processUpdates() */ static void alcSetError(ALCdevice *device, ALCenum errorCode) { - WARN("Error generated on device %p, code 0x%04x\n", device, errorCode); + WARN("Error generated on device %p, code 0x%04x\n", decltype(std::declval<void*>()){device}, + errorCode); if(TrapALCError) { #ifdef _WIN32 @@ -2256,7 +2257,7 @@ ALCdevice::ALCdevice(DeviceType type) : Type{type}, mContexts{&EmptyContextArray */ ALCdevice::~ALCdevice() { - TRACE("Freeing device %p\n", this); + TRACE("Freeing device %p\n", decltype(std::declval<void*>()){this}); Backend = nullptr; @@ -2311,15 +2312,15 @@ ALCcontext::ALCcontext(al::intrusive_ptr<ALCdevice> device) : mDevice{std::move( ALCcontext::~ALCcontext() { - TRACE("Freeing context %p\n", this); + TRACE("Freeing context %p\n", decltype(std::declval<void*>()){this}); + size_t count{0}; ALcontextProps *cprops{mUpdate.exchange(nullptr, std::memory_order_relaxed)}; if(cprops) { - TRACE("Freed unapplied context update %p\n", cprops); + ++count; delete cprops; } - size_t count{0}; cprops = mFreeContextProps.exchange(nullptr, std::memory_order_acquire); while(cprops) { @@ -2376,13 +2377,13 @@ ALCcontext::~ALCcontext() mVoices.clear(); + count = 0; ALlistenerProps *lprops{mListener.Params.Update.exchange(nullptr, std::memory_order_relaxed)}; if(lprops) { - TRACE("Freed unapplied listener update %p\n", lprops); + ++count; delete lprops; } - count = 0; lprops = mFreeListenerProps.exchange(nullptr, std::memory_order_acquire); while(lprops) { @@ -2462,7 +2463,7 @@ bool ALCcontext::deinit() { if(LocalContext.get() == this) { - WARN("%p released while current on thread\n", this); + WARN("%p released while current on thread\n", decltype(std::declval<void*>()){this}); LocalContext.set(nullptr); release(); } @@ -3356,7 +3357,7 @@ START_API_FUNC ERR("Failed to initialize the default effect\n"); } - TRACE("Created context %p\n", context.get()); + TRACE("Created context %p\n", decltype(std::declval<void*>()){context.get()}); return context.get(); } END_API_FUNC @@ -3700,7 +3701,8 @@ START_API_FUNC DeviceList.emplace(iter, device); } - TRACE("Created device %p, \"%s\"\n", device.get(), device->DeviceName.c_str()); + TRACE("Created device %p, \"%s\"\n", decltype(std::declval<void*>()){device.get()}, + device->DeviceName.c_str()); return device.get(); } END_API_FUNC @@ -3746,7 +3748,7 @@ START_API_FUNC for(ContextRef &context : orphanctxs) { - WARN("Releasing orphaned context %p\n", context.get()); + WARN("Releasing orphaned context %p\n", decltype(std::declval<void*>()){context.get()}); context->deinit(); } orphanctxs.clear(); @@ -3829,7 +3831,8 @@ START_API_FUNC DeviceList.emplace(iter, device); } - TRACE("Created device %p, \"%s\"\n", device.get(), device->DeviceName.c_str()); + TRACE("Created capture device %p, \"%s\"\n", decltype(std::declval<void*>()){device.get()}, + device->DeviceName.c_str()); return device.get(); } END_API_FUNC @@ -4011,7 +4014,7 @@ START_API_FUNC DeviceList.emplace(iter, device); } - TRACE("Created device %p\n", device.get()); + TRACE("Created loopback device %p\n", decltype(std::declval<void*>()){device.get()}); return device.get(); } END_API_FUNC diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp index 7110478d..b925c5dd 100644 --- a/alc/hrtf.cpp +++ b/alc/hrtf.cpp @@ -1363,13 +1363,13 @@ HrtfEntry *GetLoadedHrtf(HrtfHandle *handle) void HrtfEntry::IncRef() { auto ref = IncrementRef(mRef); - TRACE("HrtfEntry %p increasing refcount to %u\n", this, ref); + TRACE("HrtfEntry %p increasing refcount to %u\n", decltype(std::declval<void*>()){this}, ref); } void HrtfEntry::DecRef() { auto ref = DecrementRef(mRef); - TRACE("HrtfEntry %p decreasing refcount to %u\n", this, ref); + TRACE("HrtfEntry %p decreasing refcount to %u\n", decltype(std::declval<void*>()){this}, ref); if(ref == 0) { std::lock_guard<std::mutex> _{LoadedHrtfLock}; diff --git a/common/threads.cpp b/common/threads.cpp index fe34f5b0..ff01de42 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -43,7 +43,7 @@ void althrd_setname(const char *name) #pragma pack(pop) info.dwType = 0x1000; info.szName = name; - info.dwThreadID = -1; + info.dwThreadID = ~DWORD{0}; info.dwFlags = 0; __try { diff --git a/examples/alhrtf.c b/examples/alhrtf.c index f09f3e99..2be28a91 100644 --- a/examples/alhrtf.c +++ b/examples/alhrtf.c @@ -164,9 +164,9 @@ int main(int argc, char **argv) } /* Define a macro to help load the function pointers. */ -#define LOAD_PROC(d, x) ((x) = alcGetProcAddress((d), #x)) - LOAD_PROC(device, alcGetStringiSOFT); - LOAD_PROC(device, alcResetDeviceSOFT); +#define LOAD_PROC(d, T, x) ((x) = (T)alcGetProcAddress((d), #x)) + LOAD_PROC(device, LPALCGETSTRINGISOFT, alcGetStringiSOFT); + LOAD_PROC(device, LPALCRESETDEVICESOFT, alcResetDeviceSOFT); #undef LOAD_PROC /* Check for the AL_EXT_STEREO_ANGLES extension to be able to also rotate diff --git a/examples/allatency.c b/examples/allatency.c index ad700cc1..a61fb820 100644 --- a/examples/allatency.c +++ b/examples/allatency.c @@ -158,19 +158,19 @@ int main(int argc, char **argv) } /* Define a macro to help load the function pointers. */ -#define LOAD_PROC(x) ((x) = alGetProcAddress(#x)) - LOAD_PROC(alSourcedSOFT); - LOAD_PROC(alSource3dSOFT); - LOAD_PROC(alSourcedvSOFT); - LOAD_PROC(alGetSourcedSOFT); - LOAD_PROC(alGetSource3dSOFT); - LOAD_PROC(alGetSourcedvSOFT); - LOAD_PROC(alSourcei64SOFT); - LOAD_PROC(alSource3i64SOFT); - LOAD_PROC(alSourcei64vSOFT); - LOAD_PROC(alGetSourcei64SOFT); - LOAD_PROC(alGetSource3i64SOFT); - LOAD_PROC(alGetSourcei64vSOFT); +#define LOAD_PROC(T, x) ((x) = (T)alGetProcAddress(#x)) + LOAD_PROC(LPALSOURCEDSOFT, alSourcedSOFT); + LOAD_PROC(LPALSOURCE3DSOFT, alSource3dSOFT); + LOAD_PROC(LPALSOURCEDVSOFT, alSourcedvSOFT); + LOAD_PROC(LPALGETSOURCEDSOFT, alGetSourcedSOFT); + LOAD_PROC(LPALGETSOURCE3DSOFT, alGetSource3dSOFT); + LOAD_PROC(LPALGETSOURCEDVSOFT, alGetSourcedvSOFT); + LOAD_PROC(LPALSOURCEI64SOFT, alSourcei64SOFT); + LOAD_PROC(LPALSOURCE3I64SOFT, alSource3i64SOFT); + LOAD_PROC(LPALSOURCEI64VSOFT, alSourcei64vSOFT); + LOAD_PROC(LPALGETSOURCEI64SOFT, alGetSourcei64SOFT); + LOAD_PROC(LPALGETSOURCE3I64SOFT, alGetSource3i64SOFT); + LOAD_PROC(LPALGETSOURCEI64VSOFT, alGetSourcei64vSOFT); #undef LOAD_PROC /* Initialize SDL_sound. */ diff --git a/examples/alloopback.c b/examples/alloopback.c index 426a2af9..844efa74 100644 --- a/examples/alloopback.c +++ b/examples/alloopback.c @@ -149,10 +149,10 @@ int main(int argc, char *argv[]) } /* Define a macro to help load the function pointers. */ -#define LOAD_PROC(x) ((x) = alcGetProcAddress(NULL, #x)) - LOAD_PROC(alcLoopbackOpenDeviceSOFT); - LOAD_PROC(alcIsRenderFormatSupportedSOFT); - LOAD_PROC(alcRenderSamplesSOFT); +#define LOAD_PROC(T, x) ((x) = (T)alcGetProcAddress(NULL, #x)) + LOAD_PROC(LPALCLOOPBACKOPENDEVICESOFT, alcLoopbackOpenDeviceSOFT); + LOAD_PROC(LPALCISRENDERFORMATSUPPORTEDSOFT, alcIsRenderFormatSupportedSOFT); + LOAD_PROC(LPALCRENDERSAMPLESSOFT, alcRenderSamplesSOFT); #undef LOAD_PROC if(SDL_Init(SDL_INIT_AUDIO) == -1) diff --git a/examples/almultireverb.c b/examples/almultireverb.c index 4e3e188f..a90b3368 100644 --- a/examples/almultireverb.c +++ b/examples/almultireverb.c @@ -523,42 +523,42 @@ int main(int argc, char **argv) } /* Define a macro to help load the function pointers. */ -#define LOAD_PROC(x) ((x) = alGetProcAddress(#x)) - LOAD_PROC(alGenFilters); - LOAD_PROC(alDeleteFilters); - LOAD_PROC(alIsFilter); - LOAD_PROC(alFilteri); - LOAD_PROC(alFilteriv); - LOAD_PROC(alFilterf); - LOAD_PROC(alFilterfv); - LOAD_PROC(alGetFilteri); - LOAD_PROC(alGetFilteriv); - LOAD_PROC(alGetFilterf); - LOAD_PROC(alGetFilterfv); - - LOAD_PROC(alGenEffects); - LOAD_PROC(alDeleteEffects); - LOAD_PROC(alIsEffect); - LOAD_PROC(alEffecti); - LOAD_PROC(alEffectiv); - LOAD_PROC(alEffectf); - LOAD_PROC(alEffectfv); - LOAD_PROC(alGetEffecti); - LOAD_PROC(alGetEffectiv); - LOAD_PROC(alGetEffectf); - LOAD_PROC(alGetEffectfv); - - LOAD_PROC(alGenAuxiliaryEffectSlots); - LOAD_PROC(alDeleteAuxiliaryEffectSlots); - LOAD_PROC(alIsAuxiliaryEffectSlot); - LOAD_PROC(alAuxiliaryEffectSloti); - LOAD_PROC(alAuxiliaryEffectSlotiv); - LOAD_PROC(alAuxiliaryEffectSlotf); - LOAD_PROC(alAuxiliaryEffectSlotfv); - LOAD_PROC(alGetAuxiliaryEffectSloti); - LOAD_PROC(alGetAuxiliaryEffectSlotiv); - LOAD_PROC(alGetAuxiliaryEffectSlotf); - LOAD_PROC(alGetAuxiliaryEffectSlotfv); +#define LOAD_PROC(T, x) ((x) = (T)alGetProcAddress(#x)) + LOAD_PROC(LPALGENFILTERS, alGenFilters); + LOAD_PROC(LPALDELETEFILTERS, alDeleteFilters); + LOAD_PROC(LPALISFILTER, alIsFilter); + LOAD_PROC(LPALFILTERI, alFilteri); + LOAD_PROC(LPALFILTERIV, alFilteriv); + LOAD_PROC(LPALFILTERF, alFilterf); + LOAD_PROC(LPALFILTERFV, alFilterfv); + LOAD_PROC(LPALGETFILTERI, alGetFilteri); + LOAD_PROC(LPALGETFILTERIV, alGetFilteriv); + LOAD_PROC(LPALGETFILTERF, alGetFilterf); + LOAD_PROC(LPALGETFILTERFV, alGetFilterfv); + + LOAD_PROC(LPALGENEFFECTS, alGenEffects); + LOAD_PROC(LPALDELETEEFFECTS, alDeleteEffects); + LOAD_PROC(LPALISEFFECT, alIsEffect); + LOAD_PROC(LPALEFFECTI, alEffecti); + LOAD_PROC(LPALEFFECTIV, alEffectiv); + LOAD_PROC(LPALEFFECTF, alEffectf); + LOAD_PROC(LPALEFFECTFV, alEffectfv); + LOAD_PROC(LPALGETEFFECTI, alGetEffecti); + LOAD_PROC(LPALGETEFFECTIV, alGetEffectiv); + LOAD_PROC(LPALGETEFFECTF, alGetEffectf); + LOAD_PROC(LPALGETEFFECTFV, alGetEffectfv); + + LOAD_PROC(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots); + LOAD_PROC(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots); + LOAD_PROC(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTIV, alAuxiliaryEffectSlotiv); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTF, alAuxiliaryEffectSlotf); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTFV, alAuxiliaryEffectSlotfv); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTI, alGetAuxiliaryEffectSloti); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTIV, alGetAuxiliaryEffectSlotiv); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTF, alGetAuxiliaryEffectSlotf); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTFV, alGetAuxiliaryEffectSlotfv); #undef LOAD_PROC /* Initialize SDL_sound. */ diff --git a/examples/alreverb.c b/examples/alreverb.c index 68f0269f..d789dffe 100644 --- a/examples/alreverb.c +++ b/examples/alreverb.c @@ -252,30 +252,30 @@ int main(int argc, char **argv) } /* Define a macro to help load the function pointers. */ -#define LOAD_PROC(x) ((x) = alGetProcAddress(#x)) - LOAD_PROC(alGenEffects); - LOAD_PROC(alDeleteEffects); - LOAD_PROC(alIsEffect); - LOAD_PROC(alEffecti); - LOAD_PROC(alEffectiv); - LOAD_PROC(alEffectf); - LOAD_PROC(alEffectfv); - LOAD_PROC(alGetEffecti); - LOAD_PROC(alGetEffectiv); - LOAD_PROC(alGetEffectf); - LOAD_PROC(alGetEffectfv); - - LOAD_PROC(alGenAuxiliaryEffectSlots); - LOAD_PROC(alDeleteAuxiliaryEffectSlots); - LOAD_PROC(alIsAuxiliaryEffectSlot); - LOAD_PROC(alAuxiliaryEffectSloti); - LOAD_PROC(alAuxiliaryEffectSlotiv); - LOAD_PROC(alAuxiliaryEffectSlotf); - LOAD_PROC(alAuxiliaryEffectSlotfv); - LOAD_PROC(alGetAuxiliaryEffectSloti); - LOAD_PROC(alGetAuxiliaryEffectSlotiv); - LOAD_PROC(alGetAuxiliaryEffectSlotf); - LOAD_PROC(alGetAuxiliaryEffectSlotfv); +#define LOAD_PROC(T, x) ((x) = (T)alGetProcAddress(#x)) + LOAD_PROC(LPALGENEFFECTS, alGenEffects); + LOAD_PROC(LPALDELETEEFFECTS, alDeleteEffects); + LOAD_PROC(LPALISEFFECT, alIsEffect); + LOAD_PROC(LPALEFFECTI, alEffecti); + LOAD_PROC(LPALEFFECTIV, alEffectiv); + LOAD_PROC(LPALEFFECTF, alEffectf); + LOAD_PROC(LPALEFFECTFV, alEffectfv); + LOAD_PROC(LPALGETEFFECTI, alGetEffecti); + LOAD_PROC(LPALGETEFFECTIV, alGetEffectiv); + LOAD_PROC(LPALGETEFFECTF, alGetEffectf); + LOAD_PROC(LPALGETEFFECTFV, alGetEffectfv); + + LOAD_PROC(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots); + LOAD_PROC(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots); + LOAD_PROC(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTIV, alAuxiliaryEffectSlotiv); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTF, alAuxiliaryEffectSlotf); + LOAD_PROC(LPALAUXILIARYEFFECTSLOTFV, alAuxiliaryEffectSlotfv); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTI, alGetAuxiliaryEffectSloti); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTIV, alGetAuxiliaryEffectSlotiv); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTF, alGetAuxiliaryEffectSlotf); + LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTFV, alGetAuxiliaryEffectSlotfv); #undef LOAD_PROC /* Initialize SDL_sound. */ diff --git a/utils/openal-info.c b/utils/openal-info.c index 76cdf37d..cdce77e0 100644 --- a/utils/openal-info.c +++ b/utils/openal-info.c @@ -223,7 +223,7 @@ static void printHRTFInfo(ALCdevice *device) return; } - alcGetStringiSOFT = alcGetProcAddress(device, "alcGetStringiSOFT"); + alcGetStringiSOFT = (LPALCGETSTRINGISOFT)alcGetProcAddress(device, "alcGetStringiSOFT"); alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &num_hrtfs); if(!num_hrtfs) @@ -263,7 +263,7 @@ static void printResamplerInfo(void) return; } - alGetStringiSOFT = alGetProcAddress("alGetStringiSOFT"); + alGetStringiSOFT = (LPALGETSTRINGISOFT)alGetProcAddress("alGetStringiSOFT"); num_resamplers = alGetInteger(AL_NUM_RESAMPLERS_SOFT); def_resampler = alGetInteger(AL_DEFAULT_RESAMPLER_SOFT); |