If the source file begins with
# if ! defined X
...
# define X
then this is not considered an include guard. Any whitespace after the ! causes the pattern matching to fail. Similarly with # if !defined (X).
On the other hand, the more common form # ifndef X works fine.