core: add generic `container_of` macro

If the compiler is either set to use C11, or it is a GCC compatible
compiler like clang, then compile time type error detection is
available. If your compiler is anything else, then a no type errors can
be found, but be macro will still work.