[PATCH 3/3] widl: misc fix for function type inline specifiers

Richard Pospesel richard at torproject.org
Thu May 16 17:36:12 CDT 2019


This patch fixes a few issues surrounding the 'inline' function
specifier in widl. The write_client_func_decl function was not taking
inline into account when generating function declarations while
write_type_v was including the inline specifier in function pointer
declarations and generating invalid C code.

Signed-off-by: Richard Pospesel <richard at torproject.net>
---
 tools/widl/client.c | 1 +
 tools/widl/header.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/widl/client.c b/tools/widl/client.c
index 625641e0de..6299a2a211 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -58,6 +58,7 @@ static void write_client_func_decl( const type_t *iface, const var_t *func )
 
     if (!callconv) callconv = "__cdecl";
     write_declspec_decl_left(client, retdeclspec);
+    if (func->declspec.funcspecifier == FUNCTION_SPECIFIER_INLINE) fprintf(client, " inline");
     fprintf(client, " %s ", callconv);
     fprintf(client, "%s%s(\n", prefix_client, get_name(func));
     indent++;
diff --git a/tools/widl/header.c b/tools/widl/header.c
index c96064151a..3211d1d3d8 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -521,7 +521,7 @@ static void write_type_v(FILE *h, decl_spec_t *ds, int is_field, int declonly, c
       int i;
       const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV);
       if (!callconv && is_object_interface) callconv = "STDMETHODCALLTYPE";
-      if (dpt->funcspecifier == FUNCTION_SPECIFIER_INLINE) fprintf(h, "inline ");
+      if (!is_ptr(ds->type) && dpt->funcspecifier == FUNCTION_SPECIFIER_INLINE) fprintf(h, "inline ");
       write_declspec_left(h, type_function_get_retdeclspec(pt), NAME_DEFAULT, declonly);
       fputc(' ', h);
       if (ptr_level) fputc('(', h);
@@ -1435,6 +1435,7 @@ static void write_function_proto(FILE *header, const type_t *iface, const var_t
   if (!callconv) callconv = "__cdecl";
   /* FIXME: do we need to handle call_as? */
   write_declspec_decl_left(header, type_function_get_retdeclspec(fun->declspec.type));
+  if (fun->declspec.funcspecifier == FUNCTION_SPECIFIER_INLINE) fprintf(header, " inline");
   fprintf(header, " %s ", callconv);
   fprintf(header, "%s%s(\n", prefix, get_name(fun));
   if (type_get_function_args(fun->declspec.type))
-- 
2.17.1




More information about the wine-devel mailing list