summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2022-03-22 15:06:28 +0000
committerPhilip Withnall <pwithnall@endlessos.org>2022-03-22 15:06:28 +0000
commit58d8aa20b6e54d07d94aa68d25519dc3e1b91a53 (patch)
tree913e54e92f145c7cb6f7ae321eeda955aee53f4e
parent7ea7690e860a61b5b2918bf4c026425cbbfd974f (diff)
downloadgobject-introspection-58d8aa20b6e54d07d94aa68d25519dc3e1b91a53.tar.gz
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>
-rw-r--r--giscanner/scannerparser.y23
1 files changed, 22 insertions, 1 deletions
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 ();