[gobject-introspection] giscanner: Support ISO varargs in function macros



commit 58d8aa20b6e54d07d94aa68d25519dc3e1b91a53
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Mar 22 15:06:28 2022 +0000

    giscanner: Support ISO varargs in function macros
    
    This fixes support for macros like `g_message()` in GLib.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 giscanner/scannerparser.y | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y
index 09c7a5c5..e0709cde 100644
--- a/giscanner/scannerparser.y
+++ b/giscanner/scannerparser.y
@@ -307,6 +307,7 @@ set_or_merge_base_type (GISourceType *type,
 %type <symbol> parameter_declaration
 %type <symbol> struct_declarator
 %type <list> enumerator_list
+%type <list> function_macro_argument_list
 %type <list> identifier_list
 %type <list> init_declarator_list
 %type <list> parameter_list
@@ -1513,8 +1514,28 @@ object_macro
          }
        ;
 
+function_macro_argument_list
+       : identifier
+         {
+               GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, 
lineno);
+               sym->ident = $1;
+               $$ = g_list_append (NULL, sym);
+         }
+       | ELLIPSIS
+         {
+               GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_ELLIPSIS, scanner->current_file, 
lineno);
+               $$ = g_list_append (NULL, sym);
+         }
+       | identifier ',' function_macro_argument_list
+         {
+               GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, 
lineno);
+               sym->ident = $1;
+               $$ = g_list_prepend ($3, sym);
+         }
+       ;
+
 function_macro_define
-       : function_macro '(' identifier_list ')'
+       : function_macro '(' function_macro_argument_list ')'
           {
                GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_FUNCTION_MACRO, 
scanner->current_file, lineno);
                GISourceType *func = gi_source_function_new ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]