mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
vulkan_common: two real C89 violations, and the pass that could not see them
gfx/common/vulkan_common.c has been failing the linux-c89 flags on master: a declaration after a statement at the top of vulkan_destroy_swapchain(), where the Win32 exclusive-mode release sits above `unsigned i`, and two VkSurfaceFullScreenExclusive* structs initialised from settings read earlier in the same function, which C89 will not compute at load time. The declaration moves above the #ifdef and the two structs are assigned rather than initialised; no behaviour changes on any path. Neither would have been caught by tools/mingw_syntax_check.sh even when run over the whole tree, because the C89 pass did not define HAVE_VULKAN: the file's settings members did not exist, so it failed on those instead and the real violations never got that far. The define joins that pass, which is what made both visible. The decl gate added last commit then found six more files at the top level using strlcpy through a transitive declaration - the core option manager, the core updater list, both disk-control files, the manual scanner and runahead - and they now include <compat/strl.h> themselves.
This commit is contained in:
1 parent
f9c0e44aa7
commit
c83441dfdd
8 files changed
+36
-16
No files matched your search
@@ -16,6 +16,8 @@
|
||||
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "cheevos/cheevos.h"
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <array/rbuf.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "file_path_special.h"
|
||||
#include "core_info.h"
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <string/stdstring.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "paths.h"
|
||||
#include "retroarch.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <streams/file_stream.h>
|
||||
#include <formats/rjson.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "file_path_special.h"
|
||||
#include "verbosity.h"
|
||||
#include "msg_hash.h"
|
||||
|
||||
+22
-15
@@ -1516,6 +1516,8 @@ end:
|
||||
|
||||
static void vulkan_destroy_swapchain(gfx_ctx_vulkan_data_t *vk)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
/* Exclusive mode is bound to the swapchain; release it first. */
|
||||
if (vk->fse_acquired && vk->fse_release && vk->swapchain != VK_NULL_HANDLE)
|
||||
@@ -1523,7 +1525,6 @@ static void vulkan_destroy_swapchain(gfx_ctx_vulkan_data_t *vk)
|
||||
vk->context.device, vk->swapchain);
|
||||
vk->fse_acquired = false;
|
||||
#endif
|
||||
unsigned i;
|
||||
|
||||
vulkan_emulated_mailbox_deinit(&vk->mailbox);
|
||||
if (vk->swapchain != VK_NULL_HANDLE)
|
||||
@@ -2180,20 +2181,26 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
|
||||
!video_windowed_fullscreen
|
||||
&& settings->uints.video_fse_negotiation == VIDEO_FSE_FORCED;
|
||||
HMONITOR hmonitor;
|
||||
VkSurfaceFullScreenExclusiveInfoEXT fse_info = {
|
||||
VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT,
|
||||
NULL,
|
||||
video_windowed_fullscreen
|
||||
? VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT
|
||||
: (fse_forced
|
||||
? VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT
|
||||
: VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT)
|
||||
};
|
||||
VkSurfaceFullScreenExclusiveWin32InfoEXT fse_win32_info = {
|
||||
VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
/* Assigned rather than initialised: the exclusive mode depends on
|
||||
* two settings read above, and C89 wants an initialiser it can
|
||||
* compute at load time. */
|
||||
VkSurfaceFullScreenExclusiveInfoEXT fse_info;
|
||||
VkSurfaceFullScreenExclusiveWin32InfoEXT fse_win32_info;
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
fse_info.sType =
|
||||
VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT;
|
||||
fse_info.pNext = NULL;
|
||||
fse_info.fullScreenExclusive = video_windowed_fullscreen
|
||||
? VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT
|
||||
: (fse_forced
|
||||
? VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT
|
||||
: VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT);
|
||||
fse_win32_info.sType =
|
||||
VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT;
|
||||
fse_win32_info.pNext = NULL;
|
||||
fse_win32_info.hmonitor = NULL;
|
||||
#endif
|
||||
|
||||
format.format = VK_FORMAT_UNDEFINED;
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <lists/dir_list.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "msg_hash.h"
|
||||
#include "list_special.h"
|
||||
#include "core_info.h"
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <queues/task_queue.h>
|
||||
#include <time/rtime.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "configuration.h"
|
||||
#include "content.h"
|
||||
#include "core.h"
|
||||
|
||||
@@ -67,7 +67,8 @@ C89FLAGS="-fsyntax-only -std=c89 -ansi -pedantic -Werror=pedantic \
|
||||
-D_GNU_SOURCE -I. -Ilibretro-common/include -Ideps -Ideps/stb -Igfx/include \
|
||||
-DRARCH_INTERNAL -DHAVE_THREADS -DHAVE_CONFIGFILE -DHAVE_MENU \
|
||||
-DHAVE_NETWORKING -DHAVE_CHEEVOS -DHAVE_RUNAHEAD -DHAVE_REWIND \
|
||||
-DHAVE_AUDIOMIXER -DHAVE_OVERLAY -DHAVE_RGUI -DHAVE_XMB -DHAVE_OZONE"
|
||||
-DHAVE_AUDIOMIXER -DHAVE_OVERLAY -DHAVE_RGUI -DHAVE_XMB -DHAVE_OZONE \
|
||||
-DHAVE_VULKAN"
|
||||
|
||||
# A Win32-only translation unit cannot be C89-checked with the host gcc:
|
||||
# <windows.h> is not there, the pass dies on the include and the
|
||||
|
||||
Reference in new issue
Block a user