Annottate functions using GCC/Clang function attributes

This provides better error reporting from the compiler.