From 745425778aac65c71a9af45e7982227e4fa84add Mon Sep 17 00:00:00 2001 From: Galaxy1458 <55453380+Galaxy1458@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:08:54 +0800 Subject: [PATCH] remove -Wimplicit-fallthrough (#52717) * delete [-Wno-error=terminate], test=develop * remove GPUps[-Wterminate],test=develop * remove some -Wno-, test=develop * modify ~MatmulDescriptor * mess * remove -Wimplicit-fallthrough, test=develop * remove -Wimplicit-fallthrough, test=develop * remove -Wimplicit-fallthrough, test=develop * remove -Wimplicit-fallthrough, test=develop * remove , test=develop --- paddle/fluid/imperative/layout_transformer.h | 6 ++++++ .../api/composite_backward/composite_backward_api.h | 4 ++++ paddle/utils/string/tinyformat/tinyformat.h | 13 +++++++++++++ 3 files changed, 23 insertions(+) diff --git a/paddle/fluid/imperative/layout_transformer.h b/paddle/fluid/imperative/layout_transformer.h index 4dba2d16d59..93c924a095c 100644 --- a/paddle/fluid/imperative/layout_transformer.h +++ b/paddle/fluid/imperative/layout_transformer.h @@ -402,10 +402,16 @@ class ArgmaxOpTransformer case paddle::framework::proto::AttrType::INT: { auto axis = PADDLE_GET_CONST(int, (*attrs)["axis"]); (*attrs)["axis"] = static_cast(perm[axis]); +#ifdef LINUX + __attribute__((fallthrough)); +#endif } case paddle::framework::proto::AttrType::LONG: { auto axis = PADDLE_GET_CONST(int64_t, (*attrs)["axis"]); (*attrs)["axis"] = static_cast(perm[axis]); +#ifdef LINUX + __attribute__((fallthrough)); +#endif } default: VLOG(4) << "The data_type of axis is Error, axis must be int or " diff --git a/paddle/fluid/prim/api/composite_backward/composite_backward_api.h b/paddle/fluid/prim/api/composite_backward/composite_backward_api.h index 286d3cae8de..6697f1a614c 100644 --- a/paddle/fluid/prim/api/composite_backward/composite_backward_api.h +++ b/paddle/fluid/prim/api/composite_backward/composite_backward_api.h @@ -1485,7 +1485,11 @@ void batch_norm_grad(const Tensor& x, } break; } +#ifdef LINUX + __attribute__((fallthrough)); +#endif } + default: PADDLE_THROW(phi::errors::InvalidArgument("Unknown storage order: %s", data_layout)); diff --git a/paddle/utils/string/tinyformat/tinyformat.h b/paddle/utils/string/tinyformat/tinyformat.h index f9c55fe1835..bd8d47849db 100644 --- a/paddle/utils/string/tinyformat/tinyformat.h +++ b/paddle/utils/string/tinyformat/tinyformat.h @@ -691,6 +691,9 @@ inline const char *streamStateFromFormat(std::ostream &out, // NOLINT break; case 'X': out.setf(std::ios::uppercase); +#ifdef LINUX + __attribute__((fallthrough)); +#endif case 'x': case 'p': out.setf(std::ios::hex, std::ios::basefield); @@ -698,17 +701,27 @@ inline const char *streamStateFromFormat(std::ostream &out, // NOLINT break; case 'E': out.setf(std::ios::uppercase); +#ifdef LINUX + __attribute__((fallthrough)); +#endif case 'e': out.setf(std::ios::scientific, std::ios::floatfield); out.setf(std::ios::dec, std::ios::basefield); break; case 'F': out.setf(std::ios::uppercase); +#ifdef LINUX + __attribute__((fallthrough)); +#endif case 'f': out.setf(std::ios::fixed, std::ios::floatfield); break; case 'G': out.setf(std::ios::uppercase); +#ifdef LINUX + __attribute__((fallthrough)); +#endif + case 'g': out.setf(std::ios::dec, std::ios::basefield); // As in boost::format, let stream decide float format. -- GitLab