diff --git a/paddle/fluid/framework/data_feed.h b/paddle/fluid/framework/data_feed.h index 0905f397ae05bf59143f16d761f0924578ff5a2d..415508944c9477d3dc2d0f8ee6c0b0dd5dd8f976 100644 --- a/paddle/fluid/framework/data_feed.h +++ b/paddle/fluid/framework/data_feed.h @@ -976,11 +976,11 @@ class GraphDataGenerator { void ResetEpochFinish() { epoch_finish_ = false; } void ClearSampleState(); void DumpWalkPath(std::string dump_path, size_t dump_rate); - void SetDeviceKeys(std::vector* device_keys, int type) { + void SetDeviceKeys(std::vector* device_keys UNUSED, + int type UNUSED) { // type_to_index_[type] = h_device_keys_.size(); // h_device_keys_.push_back(device_keys); } - std::vector> SampleNeighbors( int64_t* uniq_nodes, int len, @@ -1126,7 +1126,7 @@ class DataFeed { } virtual ~DataFeed() {} virtual void Init(const DataFeedDesc& data_feed_desc) = 0; - virtual bool CheckFile(const char* filename) { + virtual bool CheckFile(const char* filename UNUSED) { PADDLE_THROW(platform::errors::Unimplemented( "This function(CheckFile) is not implemented.")); } @@ -1415,13 +1415,13 @@ class InMemoryDataFeed : public DataFeed { protected: virtual bool ParseOneInstance(T* instance) = 0; virtual bool ParseOneInstanceFromPipe(T* instance) = 0; - virtual void ParseOneInstanceFromSo(const char* str, - T* instance, - CustomParser* parser) {} - virtual int ParseInstanceFromSo(int len, - const char* str, - std::vector* instances, - CustomParser* parser) { + virtual void ParseOneInstanceFromSo(const char* str UNUSED, + T* instance UNUSED, + CustomParser* parser UNUSED) {} + virtual int ParseInstanceFromSo(int len UNUSED, + const char* str UNUSED, + std::vector* instances UNUSED, + CustomParser* parser UNUSED) { return 0; } virtual void PutToFeedVec(const std::vector& ins_vec) = 0; @@ -1656,7 +1656,7 @@ struct RecordCandidate { class RecordCandidateList { public: RecordCandidateList() = default; - RecordCandidateList(const RecordCandidateList&) {} + RecordCandidateList(const RecordCandidateList& UNUSED) {} size_t Size() { return cur_size_; } void ReSize(size_t length); @@ -1802,9 +1802,9 @@ class MultiSlotInMemoryDataFeed : public InMemoryDataFeed { protected: virtual bool ParseOneInstance(Record* instance); virtual bool ParseOneInstanceFromPipe(Record* instance); - virtual void ParseOneInstanceFromSo(const char* str, - Record* instance, - CustomParser* parser) {} + virtual void ParseOneInstanceFromSo(const char* str UNUSED, + Record* instance UNUSED, + CustomParser* parser UNUSED) {} virtual int ParseInstanceFromSo(int len, const char* str, std::vector* instances, @@ -1828,11 +1828,13 @@ class SlotRecordInMemoryDataFeed : public InMemoryDataFeed { protected: bool Start() override; int Next() override; - bool ParseOneInstance(SlotRecord* instance) override { return false; } - bool ParseOneInstanceFromPipe(SlotRecord* instance) override { return false; } + bool ParseOneInstance(SlotRecord* instance UNUSED) override { return false; } + bool ParseOneInstanceFromPipe(SlotRecord* instance UNUSED) override { + return false; + } // virtual void ParseOneInstanceFromSo(const char* str, T* instance, // CustomParser* parser) {} - void PutToFeedVec(const std::vector& ins_vec) override {} + void PutToFeedVec(const std::vector& ins_vec UNUSED) override {} virtual void LoadIntoMemoryByCommand(void); virtual void LoadIntoMemoryByLib(void); diff --git a/paddle/fluid/framework/details/op_registry.h b/paddle/fluid/framework/details/op_registry.h index 7642d0f64a0b05baa6759c47e13ea548af267e13..19b3a281afee6dd3fe22af2d31cfdbec1000d4ca 100644 --- a/paddle/fluid/framework/details/op_registry.h +++ b/paddle/fluid/framework/details/op_registry.h @@ -320,7 +320,7 @@ struct OpInfoFiller { template struct OpInfoFiller { - void operator()(const char* op_type, OpInfo* info) const { + void operator()(const char* op_type UNUSED, OpInfo* info) const { // Note: if fill InferShapeFN by this Filler, the infershape here // will overwrite the op->InferShape func registered in kOperator Filler info->infer_shape_ = [](InferShapeContext* ctx) { @@ -360,7 +360,7 @@ struct OpInfoFiller { // A fake OpInfoFiller of void template <> struct OpInfoFiller { - void operator()(const char* op_type, OpInfo* info) const {} + void operator()(const char* op_type UNUSED, OpInfo* info UNUSED) const {} }; } // namespace details diff --git a/paddle/fluid/framework/inplace_op_inference.h b/paddle/fluid/framework/inplace_op_inference.h index 93bbec251fee445ab7bf738f7a17a1b3681c18e1..2a1a44e57a30a8304afccb965a55ff399771d4f8 100644 --- a/paddle/fluid/framework/inplace_op_inference.h +++ b/paddle/fluid/framework/inplace_op_inference.h @@ -18,7 +18,7 @@ #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/type_defs.h" - +#include "paddle/phi/core/macros.h" namespace paddle { namespace framework { @@ -40,7 +40,7 @@ class InplaceOpInference { class class_name final : public ::paddle::framework::InplaceOpInference { \ public: \ std::unordered_map operator()( \ - bool use_cuda) const final { \ + bool use_cuda UNUSED) const final { \ return {__VA_ARGS__}; \ } \ } diff --git a/paddle/fluid/framework/ir/generate_pass.cc b/paddle/fluid/framework/ir/generate_pass.cc index 455af83427819afaf90c1d7f387e4856be7930a6..dd58b090764cbfd750594a05539fb6348e96feaa 100644 --- a/paddle/fluid/framework/ir/generate_pass.cc +++ b/paddle/fluid/framework/ir/generate_pass.cc @@ -53,7 +53,8 @@ class operation_visitor { : type_(type) {} template - Attribute operator()(const T1& attr, const T2& operation) const { + Attribute operator()(const T1& attr UNUSED, + const T2& operation UNUSED) const { PADDLE_THROW(platform::errors::Unimplemented("Unimplemented operand.")); } diff --git a/paddle/fluid/framework/ir/pass.h b/paddle/fluid/framework/ir/pass.h index 50d7434c7d97abc66b33fe760982af7980526ad0..c7f76cb0bfdd5b369acbfd788595d1c91a63d206 100644 --- a/paddle/fluid/framework/ir/pass.h +++ b/paddle/fluid/framework/ir/pass.h @@ -169,7 +169,7 @@ class Pass { virtual bool SupportApplyProgramViaGraph() const { return true; } protected: - virtual void ApplyImpl(Graph *graph) const { + virtual void ApplyImpl(Graph *graph UNUSED) const { PADDLE_THROW(platform::errors::Unimplemented( "The virtual pass called is not implemented.")); } diff --git a/paddle/fluid/framework/op_desc.h b/paddle/fluid/framework/op_desc.h index d6ce42d5c6519dee935e45dbe6374311ab9413d4..45c7ba639f6a0d2089dc0e6a978d8fac5f6fa892 100644 --- a/paddle/fluid/framework/op_desc.h +++ b/paddle/fluid/framework/op_desc.h @@ -25,6 +25,7 @@ limitations under the License. */ #include "paddle/fluid/framework/attribute.h" #include "paddle/fluid/framework/type_defs.h" #include "paddle/fluid/framework/var_desc.h" +#include "paddle/phi/core/macros.h" namespace paddle { namespace framework { @@ -150,7 +151,7 @@ class OpDesc { const AttributeMap &GetRuntimeAttrMap() const; - std::vector InputNames(bool with_attr_var = false) const { + std::vector InputNames(bool with_attr_var UNUSED = false) const { return MapKeys(inputs_); } std::vector OutputNames() const { return MapKeys(outputs_); } diff --git a/paddle/fluid/framework/op_registry.h b/paddle/fluid/framework/op_registry.h index 61c976cfc7a4c5b557d170161d04803695f32ec4..c0c62a6fd2aa8d45acdd06571678d0e41ce73606 100644 --- a/paddle/fluid/framework/op_registry.h +++ b/paddle/fluid/framework/op_registry.h @@ -35,6 +35,7 @@ limitations under the License. */ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/shape_inference.h" #include "paddle/phi/core/kernel_registry.h" +#include "paddle/phi/core/macros.h" namespace paddle { namespace framework { @@ -218,9 +219,9 @@ struct OpKernelRegistrarFunctor { template struct OpKernelRegistrarFunctor { - void operator()(const char* op_type, - const char* library_type, - int customized_type_value) const {} + void operator()(const char* op_type UNUSED, + const char* library_type UNUSED, + int customized_type_value UNUSED) const {} }; // User can register many kernel in one place. The data type could be diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index 57ba880f4f2cdaf3bc3e01bcefbc033efa3567a3..f055213f7bbc318911ee4850b1a746e83bbab3c6 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -44,6 +44,7 @@ limitations under the License. */ #include "paddle/phi/core/compat/op_utils.h" #include "paddle/phi/core/kernel_context.h" #include "paddle/phi/core/kernel_factory.h" +#include "paddle/phi/core/macros.h" #include "paddle/utils/flat_hash_map.h" namespace paddle { @@ -353,11 +354,11 @@ class OperatorBase { void SetIsCalledByExecutor(bool x) { run_by_executor_ = x; } - virtual void SetIsRuntimeInferShape(bool x) {} + virtual void SetIsRuntimeInferShape(bool x UNUSED) {} - virtual void RuntimeInferShape(const Scope& scope, - const platform::Place& place, - const RuntimeContext& ctx) const {} + virtual void RuntimeInferShape(const Scope& scope UNUSED, + const platform::Place& place UNUSED, + const RuntimeContext& ctx UNUSED) const {} virtual platform::Place GetExecutionPlace( const platform::Place& place) const { @@ -794,7 +795,7 @@ class OperatorWithKernel : public OperatorBase { const phi::KernelKey& expected_kernel_type) const; platform::Place GetExecutionPlace( - const platform::Place& platform) const override { + const platform::Place& platform UNUSED) const override { return kernel_type_->place_; } diff --git a/paddle/fluid/framework/reader.h b/paddle/fluid/framework/reader.h index 9215d701510a1070e48d3ce291ec8779dbfdf34f..103b9a3ca0d4bd6a12a21e2dadcea77b1bd55dd3 100644 --- a/paddle/fluid/framework/reader.h +++ b/paddle/fluid/framework/reader.h @@ -73,7 +73,7 @@ class ReaderBase { virtual ~ReaderBase(); protected: - virtual void ReadNextImpl(paddle::framework::LoDTensorArray* out) {} + virtual void ReadNextImpl(paddle::framework::LoDTensorArray* out UNUSED) {} virtual void ShutdownImpl() {} diff --git a/paddle/fluid/imperative/dygraph_grad_maker.h b/paddle/fluid/imperative/dygraph_grad_maker.h index 0683bdc16a80d3676fea859393e89ee4d7a9a1c4..a81d1c50db81af5cf634268253ab09c5d0f140f0 100644 --- a/paddle/fluid/imperative/dygraph_grad_maker.h +++ b/paddle/fluid/imperative/dygraph_grad_maker.h @@ -61,7 +61,7 @@ class GradOpBaseMakerBase { virtual std::shared_ptr operator()() const = 0; TracedVarList InputGrad( - const std::string& name, bool drop_empty_grad = true) const { + const std::string& name, bool drop_empty_grad UNUSED = true) const { return GetVarBaseList(name, /*is_input=*/true); } diff --git a/paddle/fluid/imperative/op_base.h b/paddle/fluid/imperative/op_base.h index fedcdcbf93a86a655ccca8871f1f275163edabc2..73cf12a8c4c5048f5369f4a8636e9d954064c603 100644 --- a/paddle/fluid/imperative/op_base.h +++ b/paddle/fluid/imperative/op_base.h @@ -118,7 +118,8 @@ class OpBase { attrs_[name] = v; } - void SetBlockAttr(const std::string& name, framework::BlockDesc* block) { + void SetBlockAttr(const std::string& name UNUSED, + framework::BlockDesc* block UNUSED) { PADDLE_THROW(platform::errors::PermissionDenied( "SetBlockAttr is not support in dygraph OpBase")); } diff --git a/paddle/phi/common/transform.h b/paddle/phi/common/transform.h index 38ec0b56273288f0c9594c044c517e7979976d22..e80561284b885fedfeb666e1d81c2b7545927097 100644 --- a/paddle/phi/common/transform.h +++ b/paddle/phi/common/transform.h @@ -70,7 +70,7 @@ struct Transform { template <> struct Transform { template - void operator()(const phi::CPUContext& context, + void operator()(const phi::CPUContext& context UNUSED, InputIter first, InputIter last, OutputIter result, diff --git a/paddle/phi/core/infermeta_utils.h b/paddle/phi/core/infermeta_utils.h index 729c56352cf89f8fb5feab0792097465bd0c9b05..ba09bf9b5d4cf95053382b5291efed68bab378d9 100644 --- a/paddle/phi/core/infermeta_utils.h +++ b/paddle/phi/core/infermeta_utils.h @@ -254,7 +254,7 @@ struct InferMetaFnImpl { template struct InferMetaFnCallHelper> { template - static void Call(InferMetaContext* ctx, Args&... args) { + static void Call(InferMetaContext* ctx UNUSED, Args&... args) { return infer_meta_fn(args...); } }; diff --git a/paddle/phi/kernels/funcs/elementwise_base.h b/paddle/phi/kernels/funcs/elementwise_base.h index 1d40d4d8c2957276ae2b9b4502089d5f585b42e1..b2c747d5348f808b7882f972bc9fc992f6eea6c5 100644 --- a/paddle/phi/kernels/funcs/elementwise_base.h +++ b/paddle/phi/kernels/funcs/elementwise_base.h @@ -224,7 +224,7 @@ class TransformFunctor { trans(ctx_, x_, x_ + nx_, y_, z_, func_); } - inline void RunRowWise(int n, int pre) const { + inline void RunRowWise(int n) const { phi::Transform trans; if (is_xsize_larger_) { trans(ctx_, @@ -243,7 +243,7 @@ class TransformFunctor { } } - inline void RunMidWise(int n, int pre, int post) const { + inline void RunMidWise(int n, int post) const { phi::Transform trans; if (is_xsize_larger_) { trans(ctx_, @@ -435,10 +435,10 @@ void ElementwiseCompute(const CPUContext &dev_ctx, } if (post == 1) { - functor.RunRowWise(n, pre); + functor.RunRowWise(n); return; } else { - functor.RunMidWise(n, pre, post); + functor.RunMidWise(n, post); return; } }