Skip to content

Commit

Permalink
Add some missing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
GrieferAtWork committed Oct 7, 2023
1 parent c82000a commit b57ba19
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
9 changes: 6 additions & 3 deletions src/deemon/objects/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class_clear(DeeTypeObject *__restrict self) {
}
}

INTERN void DCALL
INTERN NONNULL((1)) void DCALL
class_pclear(DeeTypeObject *__restrict self, unsigned int gc_priority) {
struct class_desc *my_class;
DREF DeeObject *buffer[64];
Expand Down Expand Up @@ -317,7 +317,7 @@ class_pclear(DeeTypeObject *__restrict self, unsigned int gc_priority) {
}


PRIVATE void DCALL
PRIVATE NONNULL((1, 3)) void DCALL
calls_desc_cache_operator(struct class_desc *__restrict self,
uint16_t name, DeeObject *__restrict func) {
struct class_optable *table;
Expand Down Expand Up @@ -579,7 +579,7 @@ DeeClass_TryGetPrivateOperator(DeeTypeObject const *__restrict self, uint16_t na
}


INTERN void DCALL
INTERN NONNULL((1)) void DCALL
instance_clear_members(struct instance_desc *__restrict self, uint16_t size) {
DREF DeeObject *buffer[64];
size_t buflen;
Expand Down Expand Up @@ -976,6 +976,7 @@ instance_builtin_tcopy(DeeTypeObject *tp_self,
instance_clear_members(instance, size);
return -1;
}

#ifdef CONFIG_NOBASE_OPTIMIZED_CLASS_OPERATORS
INTERN WUNUSED NONNULL((1, 2, 3)) int DCALL
instance_builtin_nobase_tcopy(DeeTypeObject *tp_self,
Expand All @@ -998,6 +999,7 @@ instance_builtin_nobase_tcopy(DeeTypeObject *tp_self,
return 0;
}
#endif /* CONFIG_NOBASE_OPTIMIZED_CLASS_OPERATORS */

INTERN WUNUSED NONNULL((1, 2)) int DCALL
instance_builtin_tdeepload(DeeTypeObject *tp_self,
DeeObject *__restrict self) {
Expand All @@ -1022,6 +1024,7 @@ instance_builtin_copy(DeeObject *__restrict self,
DeeObject *__restrict other) {
return instance_builtin_tcopy(Dee_TYPE(self), self, other);
}

#ifdef CONFIG_NOBASE_OPTIMIZED_CLASS_OPERATORS
INTERN WUNUSED NONNULL((1, 2)) int DCALL
instance_builtin_nobase_copy(DeeObject *__restrict self,
Expand Down
37 changes: 19 additions & 18 deletions src/deemon/objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ DeeType_Implements(DeeTypeObject const *test_type,


/* Inheriting the weakref support address works, however
* it slows down object destruction more than it speeds up
* weakref usage, so we don't actually use it!. */
* it slows down object destruction more than it speeds
* up weakref usage, so we don't actually use it!. */
#undef CONFIG_INHERIT_WEAKREF_SUPPORT_ADDRESS
#if 0
#define CONFIG_INHERIT_WEAKREF_SUPPORT_ADDRESS
Expand Down Expand Up @@ -168,7 +168,7 @@ type_inherit_weakrefs(DeeTypeObject *__restrict self) {
#endif /* CONFIG_INHERIT_WEAKREF_SUPPORT_ADDRESS */

/* ==== Core Object API ==== */
LOCAL struct weakref_list *DCALL
LOCAL WUNUSED NONNULL((1)) struct weakref_list *DCALL
weakrefs_get(DeeObject *__restrict ob) {
DeeTypeObject *tp = Dee_TYPE(ob);
#ifdef CONFIG_INHERIT_WEAKREF_SUPPORT_ADDRESS
Expand Down Expand Up @@ -2188,7 +2188,7 @@ object_enumattr(DeeObject *self, size_t argc, DeeObject *const *argv) {
return NULL;
}

INTDEF dssize_t DCALL
INTDEF WUNUSED NONNULL((1, 2, 4)) dssize_t DCALL
object_format_generic(DeeObject *__restrict self,
dformatprinter printer, void *arg,
/*utf-8*/ char const *__restrict format_str,
Expand Down Expand Up @@ -2343,7 +2343,7 @@ object_decpost(DeeObject *self, size_t argc, DeeObject *const *argv) {
}

#define DEFINE_DEPRECATED_INPLACE_BINARY(name, func) \
PRIVATE WUNUSED DREF DeeObject *DCALL \
PRIVATE WUNUSED NONNULL((1)) DREF DeeObject *DCALL \
object_##name(DeeObject *self, size_t argc, \
DeeObject *const *argv) { \
DREF DeeObject *selfref; \
Expand Down Expand Up @@ -2482,16 +2482,17 @@ PRIVATE struct type_member tpconst object_class_members[] = {
};


INTDEF WUNUSED NONNULL((1)) DREF DeeObject *DCALL instance_get_itable(DeeObject *__restrict self);
INTDEF WUNUSED NONNULL((1)) DREF DeeObject *DCALL
instance_get_itable(DeeObject *__restrict self);

/* Runtime-versions of compiler-intrinsic standard attributes. */
PRIVATE struct type_getset tpconst object_getsets[] = {
TYPE_GETTER(STR_this, &DeeObject_NewRef, "Always re-return @this object"),
TYPE_GETTER(STR_class, &object_class_get,
"->?DType\n"
"Returns the class of @this Type, which is usually identical to "
/**/ "?#type, however in the case of a super-proxy, the viewed Type is "
/**/ "returned, rather than the actual Type"),
/**/ "?#type, however in the case of a super-proxy, the viewed "
/**/ "Type is returned, rather than the actual Type."),
TYPE_GETTER("super", &DeeSuper_Of,
"->?DSuper\n"
"Returns a view for the super-instance of @this object"),
Expand All @@ -2500,8 +2501,8 @@ PRIVATE struct type_getset tpconst object_getsets[] = {
"Returns an indexable sequence describing the instance object "
/**/ "table, as referenced by ?Aaddr?AAttribute?Ert:{ClassDescriptor}.\n"
"For non-user-defined classes (aka. when ${this.class.__isclass__} "
/**/ "is ?f), an empty sequence is returned\n"
"The class-attribute table can be accessed through ?A__ctable__?DType"),
/**/ "is ?f), an empty sequence is returned.\n"
"The class-attribute table can be accessed through ?A__ctable__?DType."),

/* Helper function: `foo.id' returns a unique id for any object. */
TYPE_GETTER("id", &object_id_get,
Expand All @@ -2511,7 +2512,7 @@ PRIVATE struct type_getset tpconst object_getsets[] = {
/* Utility function: Return the size of a given object (in bytes) */
TYPE_GETTER("__sizeof__", &object_sizeof,
"->?Dint\n"
"Return the size of @this object in bytes"),
"Return the size of @this object in bytes."),
TYPE_GETSET_END
};

Expand Down Expand Up @@ -2676,7 +2677,7 @@ type_printrepr(DeeTypeObject *__restrict self, dformatprinter printer, void *arg
INTDEF NONNULL((1)) void DCALL class_fini(DeeTypeObject *__restrict self);
INTDEF NONNULL((1, 2)) void DCALL class_visit(DeeTypeObject *__restrict self, dvisit_t proc, void *arg);
INTDEF NONNULL((1)) void DCALL class_clear(DeeTypeObject *__restrict self);
INTDEF void DCALL class_pclear(DeeTypeObject *__restrict self, unsigned int gc_priority);
INTDEF NONNULL((1)) void DCALL class_pclear(DeeTypeObject *__restrict self, unsigned int gc_priority);

PRIVATE NONNULL((1)) void DCALL
type_fini(DeeTypeObject *__restrict self) {
Expand Down Expand Up @@ -2731,7 +2732,7 @@ type_clear(DeeTypeObject *__restrict self) {
class_clear(self);
}

PRIVATE void DCALL
PRIVATE NONNULL((1)) void DCALL
type_pclear(DeeTypeObject *__restrict self, unsigned int gc_priority) {
if (DeeType_IsClass(self))
class_pclear(self, gc_priority);
Expand Down Expand Up @@ -2774,22 +2775,22 @@ type_implements(DeeTypeObject *self, size_t argc,
}


PRIVATE ATTR_COLD int DCALL
PRIVATE ATTR_COLD NONNULL((1)) int DCALL
err_init_var_type(DeeTypeObject *__restrict self) {
return DeeError_Throwf(&DeeError_TypeError,
"Cannot instantiate variable-length type %k",
self);
}

PRIVATE ATTR_COLD int DCALL
PRIVATE ATTR_COLD NONNULL((1)) int DCALL
err_missing_mandatory_init(DeeTypeObject *__restrict self) {
return DeeError_Throwf(&DeeError_TypeError,
"Missing initializer for mandatory base-type %k",
self);
}

PRIVATE char const str_shared_ctor_failed[] = "Constructor of shared object failed\n";
INTDEF void DCALL
INTDEF NONNULL((1)) void DCALL
instance_clear_members(struct instance_desc *__restrict self, uint16_t size);

PRIVATE WUNUSED NONNULL((1)) DREF DeeObject *DCALL
Expand Down Expand Up @@ -2968,7 +2969,7 @@ set_private_basic_member(DeeTypeObject *__restrict tp_self,
return temp;
}

PRIVATE int DCALL
PRIVATE WUNUSED NONNULL((1, 2, 3, 4)) int DCALL
unpack_init_info(DeeObject *__restrict info,
DREF DeeObject **__restrict p_init_fields,
DREF DeeObject **__restrict p_init_args,
Expand Down Expand Up @@ -3134,7 +3135,7 @@ unpack_init_info1(DeeObject *__restrict info) {
return NULL;
}

INTDEF int DCALL
INTDEF WUNUSED NONNULL((1, 2)) int DCALL
type_invoke_base_constructor(DeeTypeObject *__restrict tp_self,
DeeObject *__restrict self, size_t argc,
DeeObject *const *argv, DeeObject *kw);
Expand Down

0 comments on commit b57ba19

Please sign in to comment.