]> git.draconx.ca Git - gob-dx.git/commitdiff
Make --no-gnu suppress get_type function attributes.
authorNick Bowler <nbowler@draconx.ca>
Tue, 11 Feb 2020 05:23:29 +0000 (00:23 -0500)
committerNick Bowler <nbowler@draconx.ca>
Wed, 3 Mar 2021 05:49:56 +0000 (00:49 -0500)
For some reason the G_GNUC_CONST / G_GNUC_PURE attributes on generated
get_type function declarations are not currently covered by the --no-gnu
option.  This seems unexpected, so let's get those suppressed.

src/main.c
tests/options.at

index 81b22f1452220c3b8d7eb46d137337c71776bf89..295199cb6c0263d3d89b929f9c26b97729b37621 100644 (file)
@@ -3907,7 +3907,7 @@ print_class_block(Class *c)
                    " * Public methods\n"
                    " */\n");
 
-       if (!overrode_get_type) {
+       if (!overrode_get_type && !no_gnu) {
                /*
                 * For ordinary "static" types it should be safe to mark the
                 * get_type implementation as const, since the get_type
@@ -4315,7 +4315,8 @@ print_enum (EnumDef *enode)
        g_free (str);
 
        out_printf (outh, "%s_get_type()\n", funcprefix);
-       out_printf (outh, "GType %s_get_type (void) G_GNUC_CONST;\n\n", funcprefix);
+       out_printf (outh, "GType %s_get_type (void)%s;\n\n",
+                         funcprefix, no_gnu ? "": " G_GNUC_CONST");
 
        out_printf (out,
                    "GType\n%s_get_type (void)\n"
@@ -4380,7 +4381,8 @@ print_flags (Flags *fnode)
        g_free (str);
 
        out_printf (outh, "%s_get_type()\n", funcprefix);
-       out_printf (outh, "GType %s_get_type (void) G_GNUC_CONST;\n\n", funcprefix);
+       out_printf (outh, "GType %s_get_type (void)%s;\n\n",
+                         funcprefix, no_gnu ? "" : " G_GNUC_CONST");
 
        out_printf (out,
                    "GType\n%s_get_type (void)\n"
@@ -4443,7 +4445,8 @@ print_error (Error *enode)
        g_free (str);
 
        out_printf (outh, "%s_get_type ()\n", funcprefix);
-       out_printf (outh, "GType %s_get_type (void) G_GNUC_CONST;\n\n", funcprefix);
+       out_printf (outh, "GType %s_get_type (void)%s;\n\n",
+                         funcprefix, no_gnu ? "" : " G_GNUC_CONST");
 
        out_printf (out,
                    "GType\n%s_get_type (void)\n"
index 4fb710e0fd6950453f361eb3a45a8335e151672b..53eda4695d45898f6184c092bc5aa08d9079e152 100644 (file)
@@ -418,9 +418,6 @@ class :Test from G:Object
 }
 ]])
 
-# --no-gnu is currently busted for the get_type function declaration.
-AT_XFAIL_IF([:])
-
 AT_CHECK([gob2 test.gob])
 AT_CHECK([cat test*.h test.c | grep '_GNUC_' >/dev/null], [0])