[NFC] Check for defined(__GNUC__) before use (#116076)
This silences some spurious warnings on Windows builds with clang-cl
that `__GNUC__` is not defined if `-Wundef` is passed, which is the default
in MLIR.
These warnings make Windows builds of LLVM very noisy when MLIR is
included.