diff --git a/src/common/FFlist.h b/src/common/FFlist.h index 498499deb..cf1377b27 100644 --- a/src/common/FFlist.h +++ b/src/common/FFlist.h @@ -134,9 +134,9 @@ static inline void* ffListAdd(FFlist* list, uint32_t elementSize) { #define FF_LIST_CONTAINS(listVar, pCompElement, compFunc) \ ({ \ - typedef __typeof__(*(pCompElement)) compElementType; \ + typedef typeof(*(pCompElement)) compElementType; \ typedef bool compFuncType(const compElementType*, const compElementType*); \ - static_assert(__builtin_types_compatible_p(__typeof__(compFunc), compFuncType), "Incompatible callback function"); \ + static_assert(__builtin_types_compatible_p(typeof(compFunc), compFuncType), "Incompatible callback function"); \ ffListContains(&(listVar), (uint32_t) sizeof(*(pCompElement)), (pCompElement), (bool (*)(const void*, const void*)) compFunc); \ }) diff --git a/src/common/arrutil.h b/src/common/arrutil.h index 83a49d6aa..d2c47b151 100644 --- a/src/common/arrutil.h +++ b/src/common/arrutil.h @@ -6,9 +6,9 @@ #if !__cplusplus && FF_SUPPORTS_COUNT_OF #define ARRAY_SIZE(x) _Countof(x) #elif __has_builtin(__is_array) - #define ARRAY_SIZE(x) ({ static_assert(__is_array(__typeof__(x)), "Must be an array"); (uint32_t) (sizeof(x) / sizeof(*(x))); }) + #define ARRAY_SIZE(x) ({ static_assert(__is_array(typeof(x)), "Must be an array"); (uint32_t) (sizeof(x) / sizeof(*(x))); }) #elif __has_builtin(__builtin_types_compatible_p) - #define ARRAY_SIZE(x) ({ static_assert(!__builtin_types_compatible_p(__typeof__(x), __typeof__(&*(x))), "Must not be a pointer"); (uint32_t) (sizeof(x) / sizeof(*(x))); }) + #define ARRAY_SIZE(x) ({ static_assert(!__builtin_types_compatible_p(typeof(x), typeof(&*(x))), "Must not be a pointer"); (uint32_t) (sizeof(x) / sizeof(*(x))); }) #endif #endif #ifndef ARRAY_SIZE diff --git a/src/common/impl/netif_linux.c b/src/common/impl/netif_linux.c index a881c779d..623cc0ec8 100644 --- a/src/common/impl/netif_linux.c +++ b/src/common/impl/netif_linux.c @@ -163,7 +163,7 @@ bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result) { } FF_DEBUG("Processing IPv4 default route candidate #%d", routeCount); - entry = (__typeof__(entry)) {}; // Default to zero metric (no RTA_PRIORITY found) + entry = (typeof(entry)) {}; // Default to zero metric (no RTA_PRIORITY found) // Parse route attributes size_t rtm_len = RTM_PAYLOAD(nlh); @@ -372,7 +372,7 @@ bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result) { } FF_DEBUG("Processing IPv6 default route candidate #%d", routeCount); - entry = (__typeof__(entry)) {}; // Default to zero metric (no RTA_PRIORITY found) + entry = (typeof(entry)) {}; // Default to zero metric (no RTA_PRIORITY found) // Parse route attributes size_t rtm_len = RTM_PAYLOAD(nlh); diff --git a/src/common/impl/networking_linux.c b/src/common/impl/networking_linux.c index 0d31b4602..dbee39a69 100644 --- a/src/common/impl/networking_linux.c +++ b/src/common/impl/networking_linux.c @@ -406,7 +406,7 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf FF_DEBUG("Setting receive timeout: %u ms", timeout); struct timeval timev; timev.tv_sec = timeout / 1000; - timev.tv_usec = (__typeof__(timev.tv_usec)) ((timeout % 1000) * 1000); // milliseconds to microseconds + timev.tv_usec = (typeof(timev.tv_usec)) ((timeout % 1000) * 1000); // milliseconds to microseconds setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev)); } #endif diff --git a/src/common/library.h b/src/common/library.h index 7ee80cd9c..34001921e 100644 --- a/src/common/library.h +++ b/src/common/library.h @@ -33,7 +33,7 @@ static inline void ffLibraryUnload(void** handle) { #endif #define FF_LIBRARY_SYMBOL(symbolName) \ - __typeof__(&symbolName) ff##symbolName; + typeof(&symbolName) ff##symbolName; #define FF_LIBRARY_LOAD(libraryObjectName, returnValue, libraryFileName, maxVersion, ...) \ [[gnu::cleanup(ffLibraryUnload)]] void* libraryObjectName = ffLibraryLoadSingle(libraryFileName, maxVersion); \ @@ -45,7 +45,7 @@ static inline void ffLibraryUnload(void** handle) { FF_LIBRARY_LOAD(libraryObjectName, "dlopen(" libraryFileName ") failed", libraryFileName, maxVersion, ##__VA_ARGS__) #define FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, symbolMapping, symbolName, returnValue) \ - symbolMapping = (__typeof__(&symbolName)) dlsym(library, #symbolName); \ + symbolMapping = (typeof(&symbolName)) dlsym(library, #symbolName); \ if (__builtin_expect(symbolMapping == nullptr, false)) \ return returnValue; @@ -53,7 +53,7 @@ static inline void ffLibraryUnload(void** handle) { __auto_type FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff##symbolName, symbolName, returnValue); #define FF_LIBRARY_LOAD_SYMBOL_LAZY(library, symbolName) \ - __auto_type ff##symbolName = (__typeof__(&symbolName)) dlsym(library, #symbolName); + __auto_type ff##symbolName = (typeof(&symbolName)) dlsym(library, #symbolName); #define FF_LIBRARY_LOAD_SYMBOL_MESSAGE(library, symbolName) \ __auto_type FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff##symbolName, symbolName, "dlsym " #symbolName " failed"); @@ -75,7 +75,7 @@ void* ffLibraryLoadMulti(const char* path, int maxVersion, ...); #define FF_LIBRARY_EXTENSION "" #define FF_LIBRARY_SYMBOL(symbolName) \ - __typeof__(&symbolName) ff##symbolName; + typeof(&symbolName) ff##symbolName; #define FF_LIBRARY_LOAD(libraryObjectName, returnValue, ...) \ [[maybe_unused]] void* libraryObjectName = nullptr; // Placeholder @@ -84,13 +84,13 @@ void* ffLibraryLoadMulti(const char* path, int maxVersion, ...); FF_LIBRARY_LOAD(libraryObjectName, , libraryFileName, maxVersion, ##__VA_ARGS__) #define FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, symbolMapping, symbolName, returnValue) \ - symbolMapping = (__typeof__(&symbolName)) &symbolName; + symbolMapping = (typeof(&symbolName)) &symbolName; #define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \ [[maybe_unused]] __auto_type FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff##symbolName, symbolName, returnValue); #define FF_LIBRARY_LOAD_SYMBOL_LAZY(library, symbolName) \ - [[maybe_unused]] __auto_type ff##symbolName = (__typeof__(&symbolName)) &symbolName; + [[maybe_unused]] __auto_type ff##symbolName = (typeof(&symbolName)) &symbolName; #define FF_LIBRARY_LOAD_SYMBOL_MESSAGE(library, symbolName) \ [[maybe_unused]] __auto_type FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff##symbolName, symbolName, "dlsym " #symbolName " failed"); diff --git a/src/detection/codec/codec_android.c b/src/detection/codec/codec_android.c index 89d73a823..15782bee4 100644 --- a/src/detection/codec/codec_android.c +++ b/src/detection/codec/codec_android.c @@ -37,8 +37,8 @@ static bool ffCodecIsLikelySoftware(const char* codecName) { static bool ffCodecIsHardwareAccelerated( AMediaCodec* codec, - __typeof__(&AMediaCodec_getName) ffAMediaCodec_getName, - __typeof__(&AMediaCodec_releaseName) ffAMediaCodec_releaseName) { + typeof(&AMediaCodec_getName) ffAMediaCodec_getName, + typeof(&AMediaCodec_releaseName) ffAMediaCodec_releaseName) { if (!codec) { return false; } diff --git a/src/detection/codec/codec_windows.cpp b/src/detection/codec/codec_windows.cpp index 9124d484b..1820361df 100644 --- a/src/detection/codec/codec_windows.cpp +++ b/src/detection/codec/codec_windows.cpp @@ -277,7 +277,7 @@ static const FFCodecMftEncoderSubtype FF_D3D11VA_MFT_ENCODER_SUBTYPES[] = { { &MFVideoFormat_AV1, FF_CODEC_TYPE_AV1 }, }; -static FFCodecType ffDetectD3d11vaDecoders(IDXGIAdapter1* adapter, __typeof__(&D3D11CreateDevice) ffD3D11CreateDevice) { +static FFCodecType ffDetectD3d11vaDecoders(IDXGIAdapter1* adapter, typeof(&D3D11CreateDevice) ffD3D11CreateDevice) { FF_AUTO_RELEASE_COM_OBJECT ID3D11Device* d3dDevice = nullptr; D3D_FEATURE_LEVEL featureLevel; if (FAILED(ffD3D11CreateDevice( @@ -319,7 +319,7 @@ static FFCodecType ffDetectD3d11vaDecoders(IDXGIAdapter1* adapter, __typeof__(&D return decoders; } -static FFCodecType ffDetectD3d11MftEncoders(const LUID& adapterLuid, __typeof__(&MFCreateAttributes) ffMFCreateAttributes, __typeof__(&MFTEnum2) ffMFTEnum2) { +static FFCodecType ffDetectD3d11MftEncoders(const LUID& adapterLuid, typeof(&MFCreateAttributes) ffMFCreateAttributes, typeof(&MFTEnum2) ffMFTEnum2) { FF_AUTO_RELEASE_COM_OBJECT IMFAttributes* attributes = nullptr; if (FAILED(ffMFCreateAttributes(&attributes, 1)) || !attributes) { return FF_CODEC_TYPE_NONE; diff --git a/src/detection/gpu/gpu_driver_specific.h b/src/detection/gpu/gpu_driver_specific.h index 1549f84e8..c8aa34876 100644 --- a/src/detection/gpu/gpu_driver_specific.h +++ b/src/detection/gpu/gpu_driver_specific.h @@ -48,7 +48,7 @@ const char* ffDetectMthreadsGpuInfo(const FFGpuDriverCondition* cond, FFGpuDrive #define FF_GPU_DRIVER_DLLNAME_PATH_PREFIX #endif -[[maybe_unused]] static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName) { +[[maybe_unused]] static inline bool getDriverSpecificDetectionFn(const char* vendor, typeof(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName) { if (vendor == FF_GPU_VENDOR_NAME_NVIDIA) { *pDetectFn = ffDetectNvidiaGpuInfo; #ifdef _WIN32 diff --git a/src/detection/gpu/gpu_drm.c b/src/detection/gpu/gpu_drm.c index 6b94299a4..77f31799e 100644 --- a/src/detection/gpu/gpu_drm.c +++ b/src/detection/gpu/gpu_drm.c @@ -371,7 +371,7 @@ const char* ffDrmDetectNouveau(FFGPUResult* gpu, int fd) { const char* ffGPUDetectDriverSpecific(const FFGPUOptions* options, FFGPUResult* gpu, FFGpuDriverPciBusId pciBusId) { #if !__OpenBSD__ - __typeof__(&ffDetectNvidiaGpuInfo) detectFn; + typeof(&ffDetectNvidiaGpuInfo) detectFn; const char* soName; if (getDriverSpecificDetectionFn(gpu->vendor.chars, &detectFn, &soName) && (options->temp || options->driverSpecific)) { return detectFn(&(FFGpuDriverCondition) { diff --git a/src/detection/gpu/gpu_nvidia.c b/src/detection/gpu/gpu_nvidia.c index 2754ab89e..d32dd542e 100644 --- a/src/detection/gpu/gpu_nvidia.c +++ b/src/detection/gpu/gpu_nvidia.c @@ -52,7 +52,7 @@ static const char* detectMoreByNvapi(FFGpuDriverResult* result) { 1); FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libnvapi, nvapi_QueryInterface) #define FF_NVAPI_INTERFACE(iName, iOffset) \ - __typeof__(&iName) ff##iName = ffnvapi_QueryInterface(iOffset); \ + typeof(&iName) ff##iName = ffnvapi_QueryInterface(iOffset); \ if (ff##iName == nullptr) return "nvapi_QueryInterface " #iName " failed"; FF_NVAPI_INTERFACE(nvapi_Initialize, NVAPI_INTERFACE_OFFSET_INITIALIZE) diff --git a/src/detection/gpu/gpu_windows.c b/src/detection/gpu/gpu_windows.c index ab4cffae8..9a6b95ad7 100644 --- a/src/detection/gpu/gpu_windows.c +++ b/src/detection/gpu/gpu_windows.c @@ -403,7 +403,7 @@ ffGPUDetectWsl2 FF_DEBUG("KMTQAITYPE_UMD_DRIVER_VERSION query failed for adapter #%u: %s", i, ffDebugNtStatus(status)); } - __typeof__(&ffDetectNvidiaGpuInfo) detectFn; + typeof(&ffDetectNvidiaGpuInfo) detectFn; const char* dllName; if (options->driverSpecific && getDriverSpecificDetectionFn(gpu->vendor.chars, &detectFn, &dllName)) { FF_DEBUG("Calling driver-specific detection function for vendor: %s, DLL: %s", gpu->vendor.chars, dllName); diff --git a/src/detection/opengl/opengl_apple.c b/src/detection/opengl/opengl_apple.c index f30710638..d29ae284a 100644 --- a/src/detection/opengl/opengl_apple.c +++ b/src/detection/opengl/opengl_apple.c @@ -6,7 +6,7 @@ #include #include // This brings in CGL, not GL -void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglGetString); +void ffOpenGLHandleResult(FFOpenGLResult* result, typeof(&glGetString) ffglGetString); static const char* cglHandleContext(FFOpenGLResult* result, CGLContextObj context) { if (CGLSetCurrentContext(context) != kCGLNoError) { diff --git a/src/detection/opengl/opengl_haiku.cpp b/src/detection/opengl/opengl_haiku.cpp index 79d451301..47d55500e 100644 --- a/src/detection/opengl/opengl_haiku.cpp +++ b/src/detection/opengl/opengl_haiku.cpp @@ -6,7 +6,7 @@ extern "C" { #if FF_HAVE_EGL const char* ffOpenGLDetectByEGL(FFOpenGLResult* result); #endif -void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglGetString); +void ffOpenGLHandleResult(FFOpenGLResult* result, typeof(&glGetString) ffglGetString); } static const char* oglDetectOpenGL(FFOpenGLResult* result) { diff --git a/src/detection/opengl/opengl_linux.c b/src/detection/opengl/opengl_linux.c index 64cda0613..d63843b90 100644 --- a/src/detection/opengl/opengl_linux.c +++ b/src/detection/opengl/opengl_linux.c @@ -18,7 +18,7 @@ #include -void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglGetString); +void ffOpenGLHandleResult(FFOpenGLResult* result, typeof(&glGetString) ffglGetString); #endif // FF_HAVE_GL @@ -109,7 +109,7 @@ static const char* glxHandleDisplay(FFOpenGLResult* result, GLXData* data) { } static const char* glxHandleData(FFOpenGLResult* result, GLXData* data) { - data->ffglGetString = (__typeof__(data->ffglGetString)) data->ffglXGetProcAddress((const GLubyte*) "glGetString"); + data->ffglGetString = (typeof(data->ffglGetString)) data->ffglXGetProcAddress((const GLubyte*) "glGetString"); if (data->ffglGetString == nullptr) { return "glXGetProcAddress(glGetString) returned nullptr"; } diff --git a/src/detection/opengl/opengl_shared.c b/src/detection/opengl/opengl_shared.c index 027349d11..2c6cf74f3 100644 --- a/src/detection/opengl/opengl_shared.c +++ b/src/detection/opengl/opengl_shared.c @@ -18,7 +18,7 @@ #define GL_SHADING_LANGUAGE_VERSION 0x8B8C #endif -void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglGetString) { +void ffOpenGLHandleResult(FFOpenGLResult* result, typeof(&glGetString) ffglGetString) { ffStrbufAppendS(&result->version, (const char*) ffglGetString(GL_VERSION)); ffStrbufAppendS(&result->renderer, (const char*) ffglGetString(GL_RENDERER)); ffStrbufAppendS(&result->vendor, (const char*) ffglGetString(GL_VENDOR)); @@ -166,7 +166,7 @@ const char* ffOpenGLDetectByEGL(FFOpenGLResult* result) { FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(egl, eglData, eglTerminate); FF_DEBUG("Resolving glGetString via eglGetProcAddress()"); - eglData.ffglGetString = (__typeof__(&glGetString)) ffeglGetProcAddress("glGetString"); + eglData.ffglGetString = (typeof(&glGetString)) ffeglGetProcAddress("glGetString"); if (!eglData.ffglGetString) { FF_DEBUG("eglGetProcAddress('glGetString') returned nullptr"); return "eglGetProcAddress(glGetString) returned nullptr"; diff --git a/src/detection/opengl/opengl_windows.c b/src/detection/opengl/opengl_windows.c index 8f229d210..5b2262cbb 100644 --- a/src/detection/opengl/opengl_windows.c +++ b/src/detection/opengl/opengl_windows.c @@ -13,7 +13,7 @@ typedef struct WGLData { FF_LIBRARY_SYMBOL(wglDeleteContext) } WGLData; -void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglGetString); +void ffOpenGLHandleResult(FFOpenGLResult* result, typeof(&glGetString) ffglGetString); static const char* wglHandleContext(WGLData* wglData, FFOpenGLResult* result, HDC hdc, HGLRC context) { if (wglData->ffwglMakeCurrent(hdc, context) == FALSE) {