From 543ac9af28f7a14c3846e7e67f8e0a16086b9caa Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 2 Apr 2021 22:43:55 +1100 Subject: [PATCH] Restrict "ignore -Wold-style-cast" to C++ --- cmd/wuffs-c/release.go | 4 +++- release/c/wuffs-unsupported-snapshot.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/wuffs-c/release.go b/cmd/wuffs-c/release.go index b68bc5db..4eb0162a 100644 --- a/cmd/wuffs-c/release.go +++ b/cmd/wuffs-c/release.go @@ -170,10 +170,12 @@ const grPragmaPush = ` #if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wunreachable-code" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-parameter" +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif #endif ` diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index b1791a0e..b8945bbe 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -13,10 +13,12 @@ #if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wunreachable-code" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-parameter" +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif #endif // Copyright 2017 The Wuffs Authors.