On Tue Sep 27 15:44:59 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` On 9/27/22 06:14, Jacek Caban (@jacek) wrote:
Jacek Caban (@jacek) commented about tools/widl/header.c:
fprintf(header, "#ifndef __%s__\n", header_token); fprintf(header, "#define __%s__\n\n", header_token);
+ fprintf(header, "#ifndef __WIDL_INLINE\n"); + fprintf(header, "#if defined(__cplusplus) || defined(_MSC_VER)\n"); + fprintf(header, "#define __WIDL_INLINE static inline\n"); + fprintf(header, "#elif defined(__GNUC__)\n"); + fprintf(header, "#define __WIDL_INLINE static __inline__\n"); + fprintf(header, "#endif\n\n");
Do we really need __WIDL_INLINE? It seems to me that we could just use static inline unconditionally.
For Wine, we can, but "inline" isn't C89, and my understanding is that mingw-w64 would like to maintain c89 compatiblity (and widl is shared with mingw-w64). Cf. [1]. [1] https://sourceforge.net/p/mingw-w64/mailman/message/37685824/ ``` I would agree if it would be essential for generated headers. Since the feature is optional in the first place, someone needing -std=c89 can simply not use those wrappers. Also note that -std=gnu89 is fine, so I don't think it's needed in practice.
Anyway, it's not really a strong opinion, having the macro is not a big deal. However, then I would suggest to move `static` out of it, that is `#define __WIDL_INLINE inline` or `__inline__` and then have wrappers as `static __WIDL_INLINE ...`. Maybe we could also define the macro only when `WIDL_C_INLINE_WRAPPERS` is defined. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/935#note_9413