Add attributes to avl functions

This PR redoes #140
This macro is not a runtime check. So we need both, runtime check for attributes being `NULL` and compiletime checks.