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



commit f6719bdb25faf8d28a4c646a450d66db38e75b90
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 b6f60498c..93e4c77e9 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -1312,7 +1312,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) {
                        unowned Struct st = (Struct) sym;
                        unowned Struct? base_st = st.base_struct;


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