From 1577f4d8a2bf543cf5da3da20fe72abd11a42852 Mon Sep 17 00:00:00 2001 From: regehr Date: Mon, 11 Feb 2008 20:46:38 +0000 Subject: [PATCH] Annotation improvements, and add deputy_no_annots.h which causes CPP to take an app.c and squash all annotations. --- tos/lib/safe/include/deputy_annots.h | 10 +++++++--- tos/lib/safe/include/deputy_no_annots.h | 6 ++++++ tos/lib/safe/include/nesc_annots.h | 6 +++--- 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 tos/lib/safe/include/deputy_no_annots.h diff --git a/tos/lib/safe/include/deputy_annots.h b/tos/lib/safe/include/deputy_annots.h index 4667f1fa..2b20b908 100644 --- a/tos/lib/safe/include/deputy_annots.h +++ b/tos/lib/safe/include/deputy_annots.h @@ -1,6 +1,10 @@ #define __DEPUTY_BOUND(__lo,__hi) __attribute__((bounds((__lo),(__hi)))) -#define __DEPUTY_COUNT(__n) _DEPUTY_BOUND(__this, __this + (__n)) -#define __DEPUTY_SINGLE(__n) _DEPUTY_COUNT(1) -#define __DEPUTY_TRUSTED_CAST(__type,__expr) ((__type)((void * TRUSTED COPYTYPE)(__expr))) +#define __DEPUTY_COUNT(__n) __DEPUTY_BOUND(__this, __this + (__n)) +#define __DEPUTY_SINGLE(__n) __DEPUTY_COUNT(1) +#define __DEPUTY_TRUSTED_CAST(__type,__expr) ((__type)((void * __DEPUTY_TRUSTED __DEPUTY_COPYTYPE)(__expr))) #define TC(__type,__expr) __DEPUTY_TRUSTED_CAST(__type,__expr) + +#define __DEPUTY_NONNULL __attribute__((nonnull)) +#define __DEPUTY_TRUSTED __attribute__((trusted)) +#define __DEPUTY_COPYTYPE __attribute__((copytype)) diff --git a/tos/lib/safe/include/deputy_no_annots.h b/tos/lib/safe/include/deputy_no_annots.h new file mode 100644 index 00000000..ecb3c718 --- /dev/null +++ b/tos/lib/safe/include/deputy_no_annots.h @@ -0,0 +1,6 @@ +#define __DEPUTY_BOUND(__lo,__hi) +#define __DEPUTY_COUNT(__n) +#define __DEPUTY_SINGLE(__n) +#define __DEPUTY_TRUSTED_CAST(__type,__expr) + +#define TC(__type,__expr) __DEPUTY_TRUSTED_CAST(__type,__expr) diff --git a/tos/lib/safe/include/nesc_annots.h b/tos/lib/safe/include/nesc_annots.h index 2b25e100..f0cc00cf 100644 --- a/tos/lib/safe/include/nesc_annots.h +++ b/tos/lib/safe/include/nesc_annots.h @@ -1,3 +1,3 @@ -struct @bound @deputy_scope() @macro("_DEPUTY_BOUND") { void *lo, *hi; }; -struct @count @deputy_scope() @macro("_DEPUTY_COUNT") { int n; }; -struct @single @deputy_scope() @macro("_DEPUTY_SINGLE") { }; +struct @bound @deputy_scope() @macro("__DEPUTY_BOUND") { void *lo, *hi; }; +struct @count @deputy_scope() @macro("__DEPUTY_COUNT") { int n; }; +struct @single @deputy_scope() @macro("__DEPUTY_SINGLE") { }; -- 2.39.2