gnu_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_type) = create_concat_name (gnat_entity, "JM");
+ TYPE_JUSTIFIED_MODULAR_P (gnu_type) = 1;
TYPE_PACKED (gnu_type) = 1;
TYPE_SIZE (gnu_type) = TYPE_SIZE (gnu_field_type);
TYPE_SIZE_UNIT (gnu_type) = TYPE_SIZE_UNIT (gnu_field_type);
/* We will output additional debug info manually below. */
finish_record_type (gnu_type, gnu_field, 2, false);
- TYPE_JUSTIFIED_MODULAR_P (gnu_type) = 1;
/* Make the original array type a parallel/debug type. Note that
gnat_get_array_descr_info needs a TYPE_IMPL_PACKED_ARRAY_P type
return max_size_unit;
}
+/* Return the unit size of TYPE without reusable tail padding. */
+
+static tree
+gnat_unit_size_without_reusable_padding (tree type)
+{
+ /* The padding of justified modular types can always be reused. */
+ if (TYPE_JUSTIFIED_MODULAR_P (type))
+ return fold_convert (sizetype,
+ size_binop (CEIL_DIV_EXPR,
+ TYPE_ADA_SIZE (type), bitsize_unit_node));
+ return TYPE_SIZE_UNIT (type);
+}
+
static tree get_array_bit_stride (tree);
/* Provide information in INFO for debug output about the TYPE array type.
#define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size
#undef LANG_HOOKS_TYPES_COMPATIBLE_P
#define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p
+#undef LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING
+#define LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING gnat_unit_size_without_reusable_padding
#undef LANG_HOOKS_GET_ARRAY_DESCR_INFO
#define LANG_HOOKS_GET_ARRAY_DESCR_INFO gnat_get_array_descr_info
#undef LANG_HOOKS_GET_SUBRANGE_BOUNDS
#define LANG_HOOKS_DEEP_UNSHARING true
#undef LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS
#define LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS true
-#undef LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE
+#undef LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE
#define LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE gnat_get_sarif_source_language
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;