#include "aop-duplicate.h"
#include "aop-dynval.h"
#include "aop-pointcut.h"
+#include "aop-type.h"
/* Throw a fatal error if a dynval is not allowed in a before-advice
call. */
return ret;
}
+/* Whenver InterAspect matches an "all signed" or "all unsigned"
+ value, it needs to cast it up to a long long before passing it. */
+static tree
+cast_to_all_integer (tree val)
+{
+ tree gcc_type;
+ HOST_WIDE_INT size;
+
+ gcc_type = TREE_TYPE (val);
+ aop_assert (TREE_CODE (gcc_type) == INTEGER_TYPE);
+
+ size = int_size_in_bytes (gcc_type);
+ aop_assert (size > 0 && size <= 8);
+
+ if (size < 8)
+ {
+ tree cast_type = TYPE_UNSIGNED (gcc_type) ? long_long_unsigned_type_node
+ : long_long_integer_type_node;
+
+ val = build1 (CONVERT_EXPR, cast_type, val);
+ return val;
+ }
+ else
+ {
+ /* No cast necessary. */
+ return val;
+ }
+}
+
static tree
build_dynval (struct aop_dynval *dv)
{
- return dv->get_dynval (dv);
+ const struct aop_type *type;
+ tree val;
+
+ val = dv->get_dynval (dv);
+ type = dv->type;
+
+ if (type->kind == ATK_ALL_SIGNED || type->kind == ATK_ALL_UNSIGNED)
+ val = cast_to_all_integer (val);
+
+ return val;
}
/* Weaving functions all take varags parameters that represent the