From f77cfc4275b1fba4f9fedea6e40b00e0ebbe142c Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 8 Jul 2012 20:36:50 -0400 Subject: [PATCH] scanner: Ensure "complete_ctype" patch doesn't throw an exception for anonymous unions The previous patch introduced a regression where we would crash on encountering an anonymous union. Work around this by just writing out 'gpointer' in this case, and add a regression test. --- giscanner/transformer.py | 2 ++ tests/scanner/Regress-1.0-expected.gir | 16 +++++++++++++++- tests/scanner/regress.h | 11 +++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 91d00afc..d6320d84 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -449,6 +449,8 @@ raise ValueError.""" CTYPE_UNION, CTYPE_ENUM]: value = source_type.name + if not value: + value = 'gpointer' if const: value = 'const ' + value if volatile: diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 0b39bff8..631dd98e 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -55,6 +55,20 @@ and/or use gtk-doc annotations. --> c:type="REGRESS_LONG_STRING_CONSTANT"> + + + + + + + + + + + + + @@ -1474,7 +1488,7 @@ Use with regress_test_obj_emit_sig_with_obj - + diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index 97b9135b..fd937cdd 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -875,4 +875,15 @@ void regress_test_struct_fixed_array_frob (RegressTestStructFixedArray *str); void regress_has_parameter_named_attrs (int foo, gpointer attributes); + +typedef struct { + int dummy; + struct { + const char *name; + guint x; + } attributes[32]; + + double dummy2; +} RegressLikeGnomeKeyringPasswordSchema; + #endif /* __GITESTTYPES_H__ */ -- 2.34.1