Skip to content

Commit

Permalink
codegen: Use G_TYPE_FLAG_NONE when targetting glib >= 2.74
Browse files Browse the repository at this point in the history
  • Loading branch information
ricotz committed Mar 21, 2023
1 parent 0b6996d commit 9f5d3a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions codegen/valaclassregisterfunction.vala
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
return "G_TYPE_FLAG_ABSTRACT";
} else if (CodeContext.get ().require_glib_version (2, 70) && class_reference.is_sealed) {
return "G_TYPE_FLAG_FINAL";
} else if (CodeContext.get ().require_glib_version (2, 74)) {
return "G_TYPE_FLAG_NONE";
} else {
return "0";
}
Expand Down
6 changes: 5 additions & 1 deletion codegen/valatyperegisterfunction.vala
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,11 @@ public abstract class Vala.TypeRegisterFunction {
* @return type flags
*/
public virtual string get_type_flags () {
return "0";
if (CodeContext.get ().require_glib_version (2, 74)) {
return "G_TYPE_FLAG_NONE";
} else {
return "0";
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/glib/conditional-glib-api.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void use_g_memdup2 () {
}

// glib 2.68 drop volatile
// glib 2.74 G_TYPE_FLAG_NONE
[SingleInstance]
class FooVolatile : Object {
}
Expand Down

0 comments on commit 9f5d3a7

Please sign in to comment.