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.
This commit is contained in:
orbitcowboy 2023-10-07 20:05:43 +02:00 committed by GitHub
parent d48df980b4
commit e9c39c124a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -4791,7 +4791,7 @@ HFONT CreateFont(
</function>
<!--BOOL WINAPI FlushConsoleInputBuffer(_In_ HANDLE hConsoleInput);-->
<function name="FlushConsoleInputBuffer">
<noreturn>true</noreturn>
<noreturn>false</noreturn>
<returnValue type="BOOL"/>
<leak-ignore/>
<arg nr="1" direction="in">

View File

@ -7,7 +7,8 @@
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
#include <windows.h>
#include <Windows.h>
#include <WinCon.h>
#include <cstdio>
#include <direct.h>
#include <cstdlib>
@ -18,6 +19,15 @@
#include <atlstr.h>
#include <string>
/// 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];