From e9c39c124afbd52af5aca698f09466e22af374cc Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sat, 7 Oct 2023 20:05:43 +0200 Subject: [PATCH] windows.cfg: Fix wrong FlushConsoleInputBuffer configuration (#5526) After flushing, the function returns. Before it was configured to not-return. A proper regression test was added. --- cfg/windows.cfg | 2 +- test/cfg/windows.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 47a428c82..2c4437067 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -4791,7 +4791,7 @@ HFONT CreateFont( - true + false diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index 7c90898fd..ffcbd94ad 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -7,7 +7,8 @@ // No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0 // -#include +#include +#include #include #include #include @@ -18,6 +19,15 @@ #include #include +/// https://learn.microsoft.com/en-us/windows/console/flushconsoleinputbuffer +BOOL unreachableCode_FlushConsoleInputBuffer(int &val) +{ + const BOOL retVal = FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); + // still reachable after call FlushConsoleInputBuffer() + val = 42; + return retVal; +} + /// https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew std::string constVariable_GetModuleFileName(void) { char path[42];