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:
parent
d48df980b4
commit
e9c39c124a
|
@ -4791,7 +4791,7 @@ HFONT CreateFont(
|
||||||
</function>
|
</function>
|
||||||
<!--BOOL WINAPI FlushConsoleInputBuffer(_In_ HANDLE hConsoleInput);-->
|
<!--BOOL WINAPI FlushConsoleInputBuffer(_In_ HANDLE hConsoleInput);-->
|
||||||
<function name="FlushConsoleInputBuffer">
|
<function name="FlushConsoleInputBuffer">
|
||||||
<noreturn>true</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="BOOL"/>
|
<returnValue type="BOOL"/>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
|
#include <WinCon.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -18,6 +19,15 @@
|
||||||
#include <atlstr.h>
|
#include <atlstr.h>
|
||||||
#include <string>
|
#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
|
/// https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew
|
||||||
std::string constVariable_GetModuleFileName(void) {
|
std::string constVariable_GetModuleFileName(void) {
|
||||||
char path[42];
|
char path[42];
|
||||||
|
|
Loading…
Reference in New Issue