Added const qualifier to some aop_type variables.
Added locale.h include, which is necessary to compile on Ubuntu.
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
+#include <locale.h>
+
#include <config.h>
#include <system.h>
#include <coretypes.h>
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
+#include <locale.h>
+
#include <config.h>
#include <system.h>
#include <coretypes.h>
}
struct aop_pointcut *
-aop_match_assignment_by_type (struct aop_type *type)
+aop_match_assignment_by_type (const struct aop_type *type)
{
struct aop_pointcut *pc;
pc->kind = ATP_ASSIGN;
pc->join_on = op_join_on_assign;
+ pc->pc_assign.type = type;
+
return pc;
}
};
struct aop_pc_assign {
- struct aop_type *type;
+ const struct aop_type *type;
};
/* An AOP pointcut represents the a set of joinponts: locations in the
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
+#include <locale.h>
#include <stddef.h>
#include <config.h>
#include <system.h>
#include <coretypes.h>
+#include <tm.h>
+#include <tree.h>
+#include "aop.h"
#include "aop-type.h"
static struct aop_type _aop_t_all_signed = {
/* Match an actual GCC type with an AOP type specification. */
bool
-does_type_match (tree gcc_type, struct aop_type *aop_type)
+does_type_match (tree gcc_type, const struct aop_type *aop_type)
{
- return true;
+ aop_assert (gcc_type != NULL && aop_type != NULL);
+
+ if (aop_type->kind == ATK_ALL_POINTER)
+ {
+ return (TREE_CODE (gcc_type) == POINTER_TYPE);
+ }
+ else if (aop_type->pointer_levels == 0)
+ {
+ switch (aop_type->kind)
+ {
+ case ATK_ALL_SIGNED:
+ return (TREE_CODE (gcc_type) == INTEGER_TYPE
+ && !TYPE_UNSIGNED (gcc_type));
+ case ATK_ALL_UNSIGNED:
+ return (TREE_CODE (gcc_type) == INTEGER_TYPE
+ && TYPE_UNSIGNED (gcc_type));
+ case ATK_ALL_FP:
+ return (TREE_CODE (gcc_type) == REAL_TYPE);
+ default:
+ break;
+ }
+ }
+
+ aop_assert (0);
}
const char *tag;
};
-bool does_type_match (tree gcc_type, struct aop_type *aop_type);
+bool does_type_match (tree gcc_type, const struct aop_type *aop_type);
#endif
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
+#include <locale.h>
#include <stdarg.h>
#include <config.h>
typedef unsigned int (*pass_callback) ();
typedef void (*join_callback) (struct aop_joinpoint *);
-extern struct aop_pointcut *aop_match_assignment_by_type (struct aop_type *type);
+extern struct aop_pointcut *aop_match_assignment_by_type (
+ const struct aop_type *type);
extern const char *aop_capture_lhs_name (struct aop_joinpoint *jp);
extern void aop_do_weave (struct aop_joinpoint *jp, const char *name, ...);
+extern const struct aop_type *aop_t_all_signed ();
+extern const struct aop_type *aop_t_all_unsigned ();
+extern const struct aop_type *aop_t_all_fp ();
+extern const struct aop_type *aop_t_all_pointer ();
+
extern void aop_register_pass (const char *pass_name, pass_callback callback);
extern void aop_join_on (struct aop_pointcut *pc, join_callback callback);
extern void aop_main ();