Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ubuntu-desktop-helper/vala
  • jardon/vala
  • janitor-team/proposed/vala
  • erpel/vala
  • gnome-team/vala
  • ptomato-guest/vala
6 results
Show changes
Commits on Source (12)
Showing
with 992 additions and 867 deletions
0.54.5
0.54.6
0.54.5
0.54.6
2022-01-08 Rico Tzschichholz <ricotz@ubuntu.com>
Release 0.54.6
codegen: Clear existing length values when revisiting a slice expression
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1274
tests: Add "async signal handler" test to increase coverage
2022-01-04 Rico Tzschichholz <ricotz@ubuntu.com>
tests: Add XFAIL tests if undefined behavior sanitizer is enabled
In addition to d3bfaa4ae34c0e6c7a7a9d124e6c3a276c545391
tests: Skip constants/member-access-enum.vala for ASAN
In addition to 50414570d1b54a6106a9a64274bb84977d817616
codegen: Cast given default-value of struct with possible member initializer
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1272
codegen: Allow boxing of non-external SimpleType structs
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1273
gio-2.0: Add custom MemoryOutputStream.with_*data() wrappers
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1271
vala: Correctly replace "in" expression in pre-/postconditions of method
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1269
2021-12-20 Rico Tzschichholz <ricotz@ubuntu.com>
vala: Non nullable enum types are simple types
Fixes a regression of 5b6345a6386b05aaf3f11cb3572940413eb878a8
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1268
vala: Allow unsafe assignment of integer to enum while reporting a notice
2021-12-16 Rico Tzschichholz <ricotz@ubuntu.com>
 
Release 0.54.5
......
Vala 0.54.6
===========
* Various improvements and bug fixes:
- codegen:
+ Allow boxing of non-external SimpleType structs [#1273]
+ Cast given default-value of struct with possible member initializer [#1272]
+ Clear existing length values when revisiting a slice expression [#1274]
- vala:
+ Allow unsafe assignment of integer to enum while reporting a notice
+ Non nullable enum types are simple types [#1268]
+ Correctly replace "in" expression in pre-/postconditions of method [#1269]
* Bindings:
- gio-2.0: Add custom MemoryOutputStream.with_*data() wrappers [#1271]
Vala 0.54.5
===========
* Various improvements and bug fixes:
......
......@@ -82,10 +82,8 @@ ValaCCodeAssignmentOperator
vala_ccode_assignment_get_operator (ValaCCodeAssignment* self)
{
ValaCCodeAssignmentOperator result;
ValaCCodeAssignmentOperator _tmp0_;
g_return_val_if_fail (self != NULL, 0);
_tmp0_ = self->priv->_operator;
result = _tmp0_;
result = self->priv->_operator;
return result;
}
......
......@@ -54,10 +54,8 @@ ValaCCodeBinaryOperator
vala_ccode_binary_expression_get_operator (ValaCCodeBinaryExpression* self)
{
ValaCCodeBinaryOperator result;
ValaCCodeBinaryOperator _tmp0_;
g_return_val_if_fail (self != NULL, 0);
_tmp0_ = self->priv->_operator;
result = _tmp0_;
result = self->priv->_operator;
return result;
}
......
......@@ -85,10 +85,8 @@ CCodeFileType
vala_ccode_file_get_file_type (ValaCCodeFile* self)
{
CCodeFileType result;
CCodeFileType _tmp0_;
g_return_val_if_fail (self != NULL, 0U);
_tmp0_ = self->priv->_file_type;
result = _tmp0_;
result = self->priv->_file_type;
return result;
}
......
......@@ -56,10 +56,8 @@ ValaGGnucSectionType
vala_ccode_ggnuc_section_get_section_type (ValaCCodeGGnucSection* self)
{
ValaGGnucSectionType result;
ValaGGnucSectionType _tmp0_;
g_return_val_if_fail (self != NULL, 0);
_tmp0_ = self->priv->_section_type;
result = _tmp0_;
result = self->priv->_section_type;
return result;
}
......
......@@ -89,10 +89,8 @@ ValaCCodeModifiers
vala_ccode_node_get_modifiers (ValaCCodeNode* self)
{
ValaCCodeModifiers result;
ValaCCodeModifiers _tmp0_;
g_return_val_if_fail (self != NULL, 0U);
_tmp0_ = self->priv->_modifiers;
result = _tmp0_;
result = self->priv->_modifiers;
return result;
}
......
......@@ -53,10 +53,8 @@ ValaCCodeUnaryOperator
vala_ccode_unary_expression_get_operator (ValaCCodeUnaryExpression* self)
{
ValaCCodeUnaryOperator result;
ValaCCodeUnaryOperator _tmp0_;
g_return_val_if_fail (self != NULL, 0);
_tmp0_ = self->priv->_operator;
result = _tmp0_;
result = self->priv->_operator;
return result;
}
......
......@@ -913,6 +913,8 @@ namespace Vala {
[CCode (cheader_filename = "valacodegen.h")]
public static bool is_reference_counting (Vala.TypeSymbol sym);
[CCode (cheader_filename = "valacodegen.h")]
public static void set_array_length (Vala.Expression expr, Vala.CCodeExpression size);
[CCode (cheader_filename = "valacodegen.h")]
public static void set_array_size_cvalue (Vala.TargetValue value, Vala.CCodeExpression? cvalue);
[CCode (cheader_filename = "valacodegen.h")]
public static void set_cvalue (Vala.Expression expr, Vala.CCodeExpression? cvalue);
......
This diff is collapsed.
......@@ -210,7 +210,8 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var splicelen = new CCodeBinaryExpression (CCodeBinaryOperator.MINUS, cstop, cstart);
set_cvalue (expr, cstartpointer);
append_array_length (expr, splicelen);
// Make sure no previous length values are preserved
set_array_length (expr, splicelen);
}
void append_struct_array_free_loop (Struct st) {
......
......@@ -88,11 +88,11 @@ vala_ccode_assignment_module_emit_simple_assignment (ValaCCodeAssignmentModule*
ValaDataType* _tmp3_;
ValaAssignmentOperator _tmp12_;
ValaAssignmentOperator _tmp13_;
gboolean _tmp75_ = FALSE;
gboolean _tmp74_ = FALSE;
ValaExpression* _tmp75_;
ValaExpression* _tmp76_;
ValaExpression* _tmp77_;
ValaDataType* _tmp77_;
ValaDataType* _tmp78_;
ValaDataType* _tmp79_;
ValaTargetValue* result = NULL;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (assignment != NULL, NULL);
......@@ -155,11 +155,10 @@ vala_ccode_assignment_module_emit_simple_assignment (ValaCCodeAssignmentModule*
ValaExpression* _tmp67_;
ValaExpression* _tmp68_;
ValaCCodeExpression* _tmp69_;
ValaCCodeAssignmentOperator _tmp70_;
ValaCCodeAssignment* _tmp71_;
ValaCCodeAssignment* _tmp70_;
ValaCCodeFunction* _tmp71_;
ValaCCodeFunction* _tmp72_;
ValaCCodeFunction* _tmp73_;
ValaCCodeExpression* _tmp74_;
ValaCCodeExpression* _tmp73_;
_tmp24_ = vala_assignment_get_operator (assignment);
_tmp25_ = _tmp24_;
switch (_tmp25_) {
......@@ -330,73 +329,72 @@ vala_ccode_assignment_module_emit_simple_assignment (ValaCCodeAssignmentModule*
_tmp67_ = vala_assignment_get_right (assignment);
_tmp68_ = _tmp67_;
_tmp69_ = vala_get_cvalue (_tmp68_);
_tmp70_ = cop;
_tmp71_ = vala_ccode_assignment_new (_tmp66_, _tmp69_, _tmp70_);
codenode = (ValaCCodeExpression*) _tmp71_;
_tmp72_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
_tmp73_ = _tmp72_;
_tmp74_ = codenode;
vala_ccode_function_add_expression (_tmp73_, _tmp74_);
_tmp70_ = vala_ccode_assignment_new (_tmp66_, _tmp69_, cop);
codenode = (ValaCCodeExpression*) _tmp70_;
_tmp71_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
_tmp72_ = _tmp71_;
_tmp73_ = codenode;
vala_ccode_function_add_expression (_tmp72_, _tmp73_);
_vala_ccode_node_unref0 (codenode);
}
_tmp76_ = vala_assignment_get_left (assignment);
_tmp77_ = _tmp76_;
_tmp78_ = vala_expression_get_value_type (_tmp77_);
_tmp79_ = _tmp78_;
if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp79_, VALA_TYPE_ARRAY_TYPE)) {
_tmp75_ = vala_assignment_get_left (assignment);
_tmp76_ = _tmp75_;
_tmp77_ = vala_expression_get_value_type (_tmp76_);
_tmp78_ = _tmp77_;
if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp78_, VALA_TYPE_ARRAY_TYPE)) {
ValaExpression* _tmp79_;
ValaExpression* _tmp80_;
ValaExpression* _tmp81_;
ValaDataType* _tmp81_;
ValaDataType* _tmp82_;
ValaDataType* _tmp83_;
gboolean _tmp83_;
gboolean _tmp84_;
gboolean _tmp85_;
_tmp80_ = vala_assignment_get_left (assignment);
_tmp81_ = _tmp80_;
_tmp82_ = vala_expression_get_value_type (_tmp81_);
_tmp83_ = _tmp82_;
_tmp84_ = vala_array_type_get_inline_allocated (G_TYPE_CHECK_INSTANCE_CAST (_tmp83_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
_tmp85_ = _tmp84_;
_tmp75_ = _tmp85_;
_tmp79_ = vala_assignment_get_left (assignment);
_tmp80_ = _tmp79_;
_tmp81_ = vala_expression_get_value_type (_tmp80_);
_tmp82_ = _tmp81_;
_tmp83_ = vala_array_type_get_inline_allocated (G_TYPE_CHECK_INSTANCE_CAST (_tmp82_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
_tmp84_ = _tmp83_;
_tmp74_ = _tmp84_;
} else {
_tmp75_ = FALSE;
_tmp74_ = FALSE;
}
if (_tmp75_) {
if (_tmp74_) {
ValaVariable* variable = NULL;
ValaExpression* _tmp85_;
ValaExpression* _tmp86_;
ValaExpression* _tmp87_;
ValaSymbol* _tmp87_;
ValaSymbol* _tmp88_;
ValaSymbol* _tmp89_;
ValaVariable* _tmp90_;
ValaVariable* _tmp89_;
ValaExpression* _tmp90_;
ValaExpression* _tmp91_;
ValaExpression* _tmp92_;
ValaTargetValue* _tmp92_;
ValaTargetValue* _tmp93_;
ValaTargetValue* _tmp94_;
ValaTargetValue* _tmp95_;
_tmp86_ = vala_assignment_get_left (assignment);
_tmp87_ = _tmp86_;
_tmp88_ = vala_expression_get_symbol_reference (_tmp87_);
_tmp89_ = _tmp88_;
variable = G_TYPE_CHECK_INSTANCE_CAST (_tmp89_, VALA_TYPE_VARIABLE, ValaVariable);
_tmp90_ = variable;
_tmp91_ = vala_assignment_get_left (assignment);
_tmp92_ = _tmp91_;
_tmp93_ = vala_expression_get_target_value (_tmp92_);
_tmp94_ = _tmp93_;
_tmp95_ = vala_ccode_base_module_load_variable ((ValaCCodeBaseModule*) self, _tmp90_, _tmp94_, NULL);
result = _tmp95_;
_tmp85_ = vala_assignment_get_left (assignment);
_tmp86_ = _tmp85_;
_tmp87_ = vala_expression_get_symbol_reference (_tmp86_);
_tmp88_ = _tmp87_;
variable = G_TYPE_CHECK_INSTANCE_CAST (_tmp88_, VALA_TYPE_VARIABLE, ValaVariable);
_tmp89_ = variable;
_tmp90_ = vala_assignment_get_left (assignment);
_tmp91_ = _tmp90_;
_tmp92_ = vala_expression_get_target_value (_tmp91_);
_tmp93_ = _tmp92_;
_tmp94_ = vala_ccode_base_module_load_variable ((ValaCCodeBaseModule*) self, _tmp89_, _tmp93_, NULL);
result = _tmp94_;
return result;
} else {
ValaExpression* _tmp95_;
ValaExpression* _tmp96_;
ValaExpression* _tmp97_;
ValaTargetValue* _tmp97_;
ValaTargetValue* _tmp98_;
ValaTargetValue* _tmp99_;
ValaTargetValue* _tmp100_;
_tmp96_ = vala_assignment_get_left (assignment);
_tmp97_ = _tmp96_;
_tmp98_ = vala_expression_get_target_value (_tmp97_);
_tmp99_ = _tmp98_;
_tmp100_ = _vala_target_value_ref0 (_tmp99_);
result = _tmp100_;
_tmp95_ = vala_assignment_get_left (assignment);
_tmp96_ = _tmp95_;
_tmp97_ = vala_expression_get_target_value (_tmp96_);
_tmp98_ = _tmp97_;
_tmp99_ = _vala_target_value_ref0 (_tmp98_);
result = _tmp99_;
return result;
}
}
......
......@@ -801,13 +801,14 @@ const gchar*
vala_ccode_attribute_get_dup_function (ValaCCodeAttribute* self)
{
const gchar* result;
const gchar* _tmp13_;
const gchar* _tmp15_;
g_return_val_if_fail (self != NULL, NULL);
if (!self->priv->dup_function_set) {
ValaAttribute* _tmp0_;
gboolean _tmp3_ = FALSE;
gboolean _tmp4_ = FALSE;
const gchar* _tmp5_;
gboolean _tmp5_ = FALSE;
const gchar* _tmp6_;
_tmp0_ = self->priv->ccode;
if (_tmp0_ != NULL) {
ValaAttribute* _tmp1_;
......@@ -817,39 +818,46 @@ vala_ccode_attribute_get_dup_function (ValaCCodeAttribute* self)
_g_free0 (self->priv->_dup_function);
self->priv->_dup_function = _tmp2_;
}
_tmp5_ = self->priv->_dup_function;
if (_tmp5_ == NULL) {
ValaSymbol* _tmp6_;
gboolean _tmp7_;
_tmp6_ = self->priv->_dup_function;
if (_tmp6_ == NULL) {
ValaSymbol* _tmp7_;
gboolean _tmp8_;
_tmp6_ = self->priv->sym;
_tmp7_ = vala_symbol_get_external_package (_tmp6_);
_tmp8_ = _tmp7_;
_tmp4_ = !_tmp8_;
gboolean _tmp9_;
_tmp7_ = self->priv->sym;
_tmp8_ = vala_symbol_get_external_package (_tmp7_);
_tmp9_ = _tmp8_;
_tmp5_ = !_tmp9_;
} else {
_tmp5_ = FALSE;
}
if (_tmp5_) {
ValaSymbol* _tmp10_;
_tmp10_ = self->priv->sym;
_tmp4_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_STRUCT);
} else {
_tmp4_ = FALSE;
}
if (_tmp4_) {
ValaSymbol* _tmp9_;
_tmp9_ = self->priv->sym;
_tmp3_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, VALA_TYPE_STRUCT);
ValaSymbol* _tmp11_;
_tmp11_ = self->priv->sym;
_tmp3_ = !vala_struct_is_simple_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, VALA_TYPE_STRUCT, ValaStruct));
} else {
_tmp3_ = FALSE;
}
if (_tmp3_) {
const gchar* _tmp10_;
const gchar* _tmp11_;
gchar* _tmp12_;
_tmp10_ = vala_ccode_attribute_get_lower_case_prefix (self);
_tmp11_ = _tmp10_;
_tmp12_ = g_strdup_printf ("%sdup", _tmp11_);
const gchar* _tmp12_;
const gchar* _tmp13_;
gchar* _tmp14_;
_tmp12_ = vala_ccode_attribute_get_lower_case_prefix (self);
_tmp13_ = _tmp12_;
_tmp14_ = g_strdup_printf ("%sdup", _tmp13_);
_g_free0 (self->priv->_dup_function);
self->priv->_dup_function = _tmp12_;
self->priv->_dup_function = _tmp14_;
}
self->priv->dup_function_set = TRUE;
}
_tmp13_ = self->priv->_dup_function;
result = _tmp13_;
_tmp15_ = self->priv->_dup_function;
result = _tmp15_;
return result;
}
......@@ -4203,20 +4211,28 @@ vala_ccode_attribute_get_default_free_function (ValaCCodeAttribute* self)
ValaSymbol* _tmp12_;
_tmp12_ = self->priv->sym;
if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, VALA_TYPE_STRUCT)) {
ValaSymbol* _tmp13_;
gboolean _tmp14_;
gboolean _tmp13_ = FALSE;
ValaSymbol* _tmp14_;
gboolean _tmp15_;
_tmp13_ = self->priv->sym;
_tmp14_ = vala_symbol_get_external_package (_tmp13_);
_tmp15_ = _tmp14_;
if (!_tmp15_) {
const gchar* _tmp16_;
const gchar* _tmp17_;
gchar* _tmp18_;
_tmp16_ = vala_ccode_attribute_get_lower_case_prefix (self);
_tmp17_ = _tmp16_;
_tmp18_ = g_strdup_printf ("%sfree", _tmp17_);
result = _tmp18_;
gboolean _tmp16_;
_tmp14_ = self->priv->sym;
_tmp15_ = vala_symbol_get_external_package (_tmp14_);
_tmp16_ = _tmp15_;
if (!_tmp16_) {
ValaSymbol* _tmp17_;
_tmp17_ = self->priv->sym;
_tmp13_ = !vala_struct_is_simple_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, VALA_TYPE_STRUCT, ValaStruct));
} else {
_tmp13_ = FALSE;
}
if (_tmp13_) {
const gchar* _tmp18_;
const gchar* _tmp19_;
gchar* _tmp20_;
_tmp18_ = vala_ccode_attribute_get_lower_case_prefix (self);
_tmp19_ = _tmp18_;
_tmp20_ = g_strdup_printf ("%sfree", _tmp19_);
result = _tmp20_;
return result;
}
}
......
......@@ -255,7 +255,8 @@ public class Vala.CCodeAttribute : AttributeCache {
if (ccode != null) {
_dup_function = ccode.get_string ("dup_function");
}
if (_dup_function == null && !sym.external_package && sym is Struct) {
if (_dup_function == null && !sym.external_package
&& sym is Struct && !((Struct) sym).is_simple_type ()) {
_dup_function = "%sdup".printf (lower_case_prefix);
}
dup_function_set = true;
......@@ -1021,7 +1022,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
return "%sfree".printf (lower_case_prefix);
} else if (sym is Struct) {
if (!sym.external_package) {
if (!sym.external_package && !((Struct) sym).is_simple_type ()) {
return "%sfree".printf (lower_case_prefix);
}
}
......
This diff is collapsed.
......@@ -6544,7 +6544,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var array_type = type as ArrayType;
if (type.type_symbol != null && !type.nullable
&& (on_error ? get_ccode_default_value_on_error (type.type_symbol) : get_ccode_default_value (type.type_symbol)) != "") {
return new CCodeConstant (on_error ? get_ccode_default_value_on_error (type.type_symbol) : get_ccode_default_value (type.type_symbol));
CCodeExpression val = new CCodeConstant (on_error ? get_ccode_default_value_on_error (type.type_symbol) : get_ccode_default_value (type.type_symbol));
if (st != null && st.get_fields ().size > 0) {
val = new CCodeCastExpression (val, get_ccode_name (st));
}
return val;
} else if (initializer_expression && !type.nullable &&
(st != null || (array_type != null && array_type.fixed_length))) {
// 0-initialize struct with struct initializer { 0 }
......
......@@ -1645,6 +1645,8 @@ VALA_EXTERN void vala_set_delegate_target_destroy_notify (ValaExpression* expr,
ValaCCodeExpression* destroy_notify);
VALA_EXTERN void vala_append_array_length (ValaExpression* expr,
ValaCCodeExpression* size);
VALA_EXTERN void vala_set_array_length (ValaExpression* expr,
ValaCCodeExpression* size);
VALA_EXTERN ValaList* vala_get_array_lengths (ValaExpression* expr);
VALA_EXTERN gboolean vala_get_lvalue (ValaTargetValue* value);
VALA_EXTERN gboolean vala_get_non_null (ValaTargetValue* value);
......
......@@ -521,6 +521,47 @@ vala_append_array_length (ValaExpression* expr,
vala_glib_value_append_array_length_cvalue (_tmp9_, size);
}
void
vala_set_array_length (ValaExpression* expr,
ValaCCodeExpression* size)
{
ValaGLibValue* glib_value = NULL;
ValaTargetValue* _tmp0_;
ValaTargetValue* _tmp1_;
ValaGLibValue* _tmp2_;
ValaGLibValue* _tmp10_;
g_return_if_fail (expr != NULL);
g_return_if_fail (size != NULL);
_tmp0_ = vala_expression_get_target_value (expr);
_tmp1_ = _tmp0_;
glib_value = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VALA_TYPE_GLIB_VALUE, ValaGLibValue);
_tmp2_ = glib_value;
if (_tmp2_ == NULL) {
ValaDataType* _tmp3_;
ValaDataType* _tmp4_;
ValaGLibValue* _tmp5_;
ValaGLibValue* _tmp6_;
ValaTargetValue* _tmp7_;
ValaTargetValue* _tmp8_;
_tmp3_ = vala_expression_get_value_type (expr);
_tmp4_ = _tmp3_;
_tmp5_ = vala_glib_value_new (_tmp4_, NULL, FALSE);
_tmp6_ = _tmp5_;
vala_expression_set_target_value (expr, (ValaTargetValue*) _tmp6_);
_vala_target_value_unref0 (_tmp6_);
_tmp7_ = vala_expression_get_target_value (expr);
_tmp8_ = _tmp7_;
glib_value = G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, VALA_TYPE_GLIB_VALUE, ValaGLibValue);
} else {
ValaGLibValue* _tmp9_;
_tmp9_ = glib_value;
_vala_iterable_unref0 (_tmp9_->array_length_cvalues);
_tmp9_->array_length_cvalues = NULL;
}
_tmp10_ = glib_value;
vala_glib_value_append_array_length_cvalue (_tmp10_, size);
}
ValaList*
vala_get_array_lengths (ValaExpression* expr)
{
......