[vala/0.40] ccodegen: Use unsigned default value for flags-enum



commit 3e856de31e721d3e1596fac79c339b201901a6d2
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Mar 10 18:14:09 2019 +0100

    ccodegen: Use unsigned default value for flags-enum

 codegen/valaccodeattribute.vala | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 6ba9b26cb..1cf0206f7 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -1297,7 +1297,12 @@ public class Vala.CCodeAttribute : AttributeCache {
 
        private string get_default_default_value () {
                if (sym is Enum) {
-                       return "0";
+                       unowned Enum en = (Enum) sym;
+                       if (en.is_flags) {
+                               return "0U";
+                       } else {
+                               return "0";
+                       }
                } else if (sym is Struct) {
                        var st = (Struct) sym;
                        var base_st = st.base_struct;


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