Use function attributes instead of pragmas to disable optimisations

Clang allows us to check if specific attributes have been implemented
which is more robust than checking version numbers.

GCC does not provide such functionality, but I changed the header guard
to match for consistency.

Also add a sentinel line as a further attempt to prevent accidental
builds with unsupported compilers.