diff --git a/offload/plugins-nextgen/common/include/ErrorReporting.h b/offload/plugins-nextgen/common/include/ErrorReporting.h index 8478977a8f86af0..2ad0f2b7dd6c651 100644 --- a/offload/plugins-nextgen/common/include/ErrorReporting.h +++ b/offload/plugins-nextgen/common/include/ErrorReporting.h @@ -80,8 +80,10 @@ class ErrorReporter { /// Print \p Format, instantiated with \p Args to stderr. /// TODO: Allow redirection into a file stream. template - [[gnu::format(__printf__, 1, 2)]] static void print(const char *Format, - ArgsTy &&...Args) { +#ifdef __clang__ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77958 + [[gnu::format(__printf__, 1, 2)]] +#endif + static void print(const char *Format, ArgsTy &&...Args) { raw_fd_ostream OS(STDERR_FILENO, false); OS << llvm::format(Format, Args...); } @@ -89,8 +91,10 @@ class ErrorReporter { /// Print \p Format, instantiated with \p Args to stderr, but colored. /// TODO: Allow redirection into a file stream. template - [[gnu::format(__printf__, 2, 3)]] static void - print(ColorTy Color, const char *Format, ArgsTy &&...Args) { +#ifdef __clang__ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77958 + [[gnu::format(__printf__, 2, 3)]] +#endif + static void print(ColorTy Color, const char *Format, ArgsTy &&...Args) { raw_fd_ostream OS(STDERR_FILENO, false); WithColor(OS, HighlightColor(Color)) << llvm::format(Format, Args...); } @@ -99,8 +103,10 @@ class ErrorReporter { /// a banner. /// TODO: Allow redirection into a file stream. template - [[gnu::format(__printf__, 1, 2)]] static void reportError(const char *Format, - ArgsTy &&...Args) { +#ifdef __clang__ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77958 + [[gnu::format(__printf__, 1, 2)]] +#endif + static void reportError(const char *Format, ArgsTy &&...Args) { print(BoldRed, "%s", ErrorBanner); print(BoldRed, Format, Args...); print("\n");