diff mbox series

[v3,03/13] winansi: use FLEX_ARRAY to avoid compiler warning

Message ID e632a4eef46720d43fd014644ff24d3dac61ebe9.1570201763.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series ci: include a Visual Studio build & test in our Azure Pipeline | expand

Commit Message

Linus Arver via GitGitGadget Oct. 4, 2019, 3:09 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

MSVC would complain thusly:

    C4200: nonstandard extension used: zero-sized array in struct/union

Let's just use the `FLEX_ARRAY` constant that we introduced for exactly
this type of scenario.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/winansi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alban Gruin Oct. 7, 2019, 7:16 p.m. UTC | #1
Hi Johannes,

Le 04/10/2019 à 17:09, Johannes Schindelin via GitGitGadget a écrit :
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> MSVC would complain thusly:
> 
>     C4200: nonstandard extension used: zero-sized array in struct/union
> 
> Let's just use the `FLEX_ARRAY` constant that we introduced for exactly
> this type of scenario.

Perhaps this is a good candidate for a semantic patch?

Cheers,
Alban
diff mbox series

Patch

diff --git a/compat/winansi.c b/compat/winansi.c
index cacd82c833..54fd701cbf 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -546,7 +546,7 @@  static HANDLE swap_osfhnd(int fd, HANDLE new_handle)
 typedef struct _OBJECT_NAME_INFORMATION
 {
 	UNICODE_STRING Name;
-	WCHAR NameBuffer[0];
+	WCHAR NameBuffer[FLEX_ARRAY];
 } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
 
 #define ObjectNameInformation 1