Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit b410c51

Browse files
vgao1996facebook-github-bot
authored andcommitted
comment out unused parameters
Summary: This uses `clang-tidy` to comment out unused parameters (in functions, methods and lambdas) in fbcode. Cases that the tool failed to handle are fixed manually. Reviewed By: igorsugak Differential Revision: D5454343 fbshipit-source-id: 5dee339b4334e25e963891b519a5aa81fbf627b2
1 parent 7df0d66 commit b410c51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+327
-260
lines changed

caffe2/binaries/make_image_db.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ CAFFE2_DEFINE_bool(warp, false, "If warp is set, warp the images to square.");
3737
namespace caffe2 {
3838

3939
void ConvertImageDataset(
40-
const string& input_folder, const string& list_filename,
41-
const string& output_db_name, const bool shuffle) {
40+
const string& input_folder,
41+
const string& list_filename,
42+
const string& output_db_name,
43+
const bool /*shuffle*/) {
4244
std::ifstream list_file(list_filename);
4345
std::vector<std::pair<std::string, int> > lines;
4446
std::string filename;

caffe2/contrib/nervana/nervana_math_gpu.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void Gemm<float, CUDAContext, NervanaEngine>(
2222
const float beta,
2323
float* C,
2424
CUDAContext* context,
25-
TensorProto::DataType math_type) {
25+
TensorProto::DataType /*math_type*/) {
2626
// Note that cublas follows fortran order, so the order is different from
2727
// the cblas convention.
2828
int lda = (TransA == CblasNoTrans) ? K : M;

caffe2/contrib/prof/cuda_profile_ops.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CudaProfileInitializeOp : public OperatorBase {
5656
unlink(config_.c_str());
5757
}
5858

59-
virtual bool Run(int /* unused */ stream_id = 0) {
59+
virtual bool Run(int /* unused */ /*stream_id*/ = 0) {
6060
// If this fails, check the contents of "output" for hints.
6161
CUDA_CHECK(
6262
cudaProfilerInitialize(config_.c_str(), output_.c_str(), cudaCSV));
@@ -73,7 +73,7 @@ class CudaProfileStartOp : public OperatorBase {
7373
CudaProfileStartOp(const OperatorDef& operator_def, Workspace* ws)
7474
: OperatorBase(operator_def, ws) {}
7575

76-
virtual bool Run(int /* unused */ stream_id = 0) {
76+
virtual bool Run(int /* unused */ /*stream_id*/ = 0) {
7777
CUDA_ENFORCE(cudaProfilerStart());
7878
return true;
7979
}
@@ -84,7 +84,7 @@ class CudaProfileStopOp : public OperatorBase {
8484
CudaProfileStopOp(const OperatorDef& operator_def, Workspace* ws)
8585
: OperatorBase(operator_def, ws) {}
8686

87-
virtual bool Run(int /* unused */ stream_id = 0) {
87+
virtual bool Run(int /* unused */ /*stream_id*/ = 0) {
8888
CUDA_ENFORCE(cudaProfilerStop());
8989
return true;
9090
}

caffe2/contrib/torch/torch_op.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Torch final {
5656
return Traits::tensorTy;
5757
}
5858

59-
void setContext(Context* context) {}
59+
void setContext(Context* /*context*/) {}
6060

6161
void setTensor(typename Traits::Tensor* t, Blob* blob) {
6262
CAFFE_ENFORCE_EQ(tensorTy(*blob), Traits::tensorTy);

caffe2/contrib/transform/transform.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ class Transform {
6363
* Given the current subgraph (ordered), should we append the new node at idx?
6464
*/
6565
virtual bool PatternRule(
66-
const transform::Graph& g,
67-
const std::vector<int>& subgraph,
68-
int idx) {
66+
const transform::Graph& /*g*/,
67+
const std::vector<int>& /*subgraph*/,
68+
int /*idx*/) {
6969
CAFFE_NOT_IMPLEMENTED;
7070
}
7171

@@ -74,8 +74,8 @@ class Transform {
7474
* Given a subgraph, can we accept it?
7575
*/
7676
virtual bool ValidatorRule(
77-
const transform::Graph& g,
78-
const std::vector<int>& subgraph) {
77+
const transform::Graph& /*g*/,
78+
const std::vector<int>& /*subgraph*/) {
7979
CAFFE_NOT_IMPLEMENTED;
8080
}
8181

@@ -84,8 +84,8 @@ class Transform {
8484
* upon the subgraph.
8585
*/
8686
virtual bool ReplaceRule(
87-
const std::vector<int>& subgraph,
88-
transform::Graph* g_ptr) {
87+
const std::vector<int>& /*subgraph*/,
88+
transform::Graph* /*g_ptr*/) {
8989
CAFFE_NOT_IMPLEMENTED;
9090
}
9191

caffe2/contrib/warpctc/ctc_op.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace caffe2 {
66

77
namespace detail {
88
template <>
9-
ctcComputeInfo workspaceInfo<CPUContext>(const CPUContext& context) {
9+
ctcComputeInfo workspaceInfo<CPUContext>(const CPUContext& /*context*/) {
1010
ctcComputeInfo result;
1111
result.loc = CTC_CPU;
1212
result.num_threads = 1;

caffe2/core/blob_serialization.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ std::string Blob::Serialize(const string& name) const {
8686
// Specialization for StoreDeviceDetail for CPU - nothing needs to be done.
8787
template <>
8888
void TensorSerializer<CPUContext>::StoreDeviceDetail(
89-
const Tensor<CPUContext>& input, TensorProto* proto) {}
89+
const Tensor<CPUContext>& /*input*/,
90+
TensorProto* /*proto*/) {}
9091

9192
// The actual serialization registry objects.
9293
CAFFE_DEFINE_TYPED_REGISTRY(

caffe2/core/blob_serialization.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,11 @@ void TensorSerializer<Context>::SerializeWithChunkSize(
263263

264264
template <class Context>
265265
void TensorSerializer<Context>::Serialize(
266-
const Tensor<Context>& input, const string& name,
267-
TensorProto* proto_ptr, size_t chunkBegin, int32_t chunkSize) {
266+
const Tensor<Context>& input,
267+
const string& /*name*/,
268+
TensorProto* proto_ptr,
269+
size_t chunkBegin,
270+
int32_t chunkSize) {
268271
CAFFE_ENFORCE(
269272
chunkBegin <= input.size(),
270273
"Chunk begin is out of tensor: ",

caffe2/core/blob_serializer_base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BlobSerializerBase {
4646
const Blob& blob,
4747
const std::string& name,
4848
SerializationAcceptor acceptor,
49-
int chunk_size) {
49+
int /*chunk_size*/) {
5050
// Base implementation.
5151
Serialize(blob, name, acceptor);
5252
}

caffe2/core/blob_test.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ class VectorCursor : public db::Cursor {
649649
pos_ = 0;
650650
}
651651
~VectorCursor() {}
652-
void Seek(const string& key) override {}
652+
void Seek(const string& /*key*/) override {}
653653
void SeekToFirst() override {}
654654
void Next() override {
655655
++pos_;
@@ -790,7 +790,8 @@ TEST(CustomChunkSize, BigTensorSerialization) {
790790
tensor->mutable_data<float>();
791791
std::mutex mutex;
792792
int counter = 0;
793-
auto acceptor = [&](const std::string& key, const std::string& value) {
793+
auto acceptor = [&](const std::string& /*key*/,
794+
const std::string& /*value*/) {
794795
std::lock_guard<std::mutex> guard(mutex);
795796
counter++;
796797
};

caffe2/core/common.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class SkipIndices {
201201
template <>
202202
class SkipIndices<> {
203203
public:
204-
static inline bool Contains(const int i) {
204+
static inline bool Contains(const int /*i*/) {
205205
return false;
206206
}
207207
};

caffe2/core/context.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class CPUContext final {
121121

122122
~CPUContext() noexcept {}
123123

124-
inline void SwitchToDevice(int stream_id) {}
124+
inline void SwitchToDevice(int /*stream_id*/) {}
125125
inline void SwitchToDevice() {
126126
SwitchToDevice(0);
127127
}

caffe2/core/db.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MiniDBCursor : public Cursor {
2828
}
2929
~MiniDBCursor() {}
3030

31-
void Seek(const string& key) override {
31+
void Seek(const string& /*key*/) override {
3232
LOG(FATAL) << "MiniDB does not support seeking to a specifi key.";
3333
}
3434

caffe2/core/db.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Transaction {
7979
*/
8080
class DB {
8181
public:
82-
DB(const string& source, Mode mode) : mode_(mode) {}
82+
DB(const string& /*source*/, Mode mode) : mode_(mode) {}
8383
virtual ~DB() { }
8484
/**
8585
* Closes the database.

caffe2/core/logging.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ constexpr bool IsUsingGoogleLogging() {
5151
*/
5252
void ShowLogInfoToStderr();
5353

54-
inline void MakeStringInternal(std::stringstream& ss) {}
54+
inline void MakeStringInternal(std::stringstream& /*ss*/) {}
5555

5656
template <typename T>
5757
inline void MakeStringInternal(std::stringstream& ss, const T& t) {

caffe2/core/net.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ class NetBase {
5252
* opeartor.
5353
*/
5454
virtual vector<float> TEST_Benchmark(
55-
const int warmup_runs,
56-
const int main_runs,
57-
const bool run_individual) {
55+
const int /*warmup_runs*/,
56+
const int /*main_runs*/,
57+
const bool /*run_individual*/) {
5858
LOG(ERROR) << "Benchmark not implemented for this net type.";
5959
return vector<float>();
6060
}

caffe2/core/net_test.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class NetTestDummyOp final : public OperatorBase {
2323
: OperatorBase(operator_def, ws),
2424
fail_(OperatorBase::GetSingleArgument<bool>("fail", false)) {}
2525

26-
bool Run(int /* unused */ stream_id) override {
26+
bool Run(int /* unused */ /*stream_id*/) override {
2727
if (fail_) {
2828
return false;
2929
}

caffe2/core/operator.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class OperatorBase {
101101
inline const vector<const Blob*>& Inputs() const { return inputs_; }
102102
inline const vector<Blob*>& Outputs() { return outputs_; }
103103

104-
virtual bool Run(int /* unused */ stream_id = 0) {
104+
virtual bool Run(int /* unused */ /*stream_id*/ = 0) {
105105
CAFFE_NOT_IMPLEMENTED;
106106
}
107107

@@ -413,7 +413,7 @@ struct DispatchHelper<FixedValues<FirstVal, Values...>, ExtraArgs...> {
413413
template <typename... ExtraArgs>
414414
struct DispatchHelper<FixedValues<>, ExtraArgs...> {
415415
template <typename Op>
416-
static bool call(Op* op, TIndex size) {
416+
static bool call(Op* op, TIndex /*size*/) {
417417
return op->template DoRunWithValue<ExtraArgs..., -1>();
418418
}
419419
};

caffe2/core/operator_schema.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ OpSchema& OpSchema::IdenticalTypeAndShapeOfInputDim(int idx, int dim) {
210210

211211
OpSchema& OpSchema::ScalarType(::caffe2::TensorProto_DataType dt) {
212212
return TensorInferenceFunction(
213-
[dt](const OperatorDef&, const vector<TensorShape>& input_types) {
214-
vector<TensorShape> out(1);
215-
out[0].set_data_type(dt);
216-
return out;
217-
});
213+
[dt](const OperatorDef&, const vector<TensorShape>& /*input_types*/) {
214+
vector<TensorShape> out(1);
215+
out[0].set_data_type(dt);
216+
return out;
217+
});
218218
}
219219

220220
OpSchema& OpSchema::CostInferenceFunction(CostInferenceFunctionType function) {

caffe2/core/operator_schema_test.cc

+6-7
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,12 @@ TEST(OperatorSchemaTest, TestCastSchema) {
212212
OPERATOR_SCHEMA(OpSchemaCostInference)
213213
.NumInputs(2)
214214
.NumOutputs(2)
215-
.CostInferenceFunction(
216-
[](const OperatorDef& def, const vector<TensorShape>& inputs) {
217-
struct OpSchema::Cost c;
218-
c.flops =
219-
2 * inputs[0].dims(0) * inputs[0].dims(1) * inputs[1].dims(1);
220-
return c;
221-
});
215+
.CostInferenceFunction([](const OperatorDef& /*def*/,
216+
const vector<TensorShape>& inputs) {
217+
struct OpSchema::Cost c;
218+
c.flops = 2 * inputs[0].dims(0) * inputs[0].dims(1) * inputs[1].dims(1);
219+
return c;
220+
});
222221

223222
TEST(OperatorSchemaTest, TestCostInference) {
224223
const OpSchema* schema = OpSchemaRegistry::Schema("OpSchemaCostInference");

caffe2/core/operator_test.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace caffe2 {
1212
class JustTest : public OperatorBase {
1313
public:
1414
using OperatorBase::OperatorBase;
15-
bool Run(int /* unused */ stream_id) override {
15+
bool Run(int /* unused */ /*stream_id*/) override {
1616
return true;
1717
}
1818
virtual string type() {
@@ -26,7 +26,7 @@ class JustTestAndNeverConstructs : public JustTest {
2626
: JustTest(def, ws) {
2727
throw UnsupportedOperatorFeature("I just don't construct.");
2828
}
29-
bool Run(int /* unused */ stream_id) override {
29+
bool Run(int /* unused */ /*stream_id*/) override {
3030
return true;
3131
}
3232
string type() override {
@@ -37,7 +37,7 @@ class JustTestAndNeverConstructs : public JustTest {
3737
class JustTestAndDoesConstruct : public JustTest {
3838
public:
3939
using JustTest::JustTest;
40-
bool Run(int /* unused */ stream_id) override {
40+
bool Run(int /* unused */ /*stream_id*/) override {
4141
return true;
4242
}
4343
string type() override {
@@ -48,7 +48,7 @@ class JustTestAndDoesConstruct : public JustTest {
4848
class JustTestWithSomeOutput : public JustTest {
4949
public:
5050
using JustTest::JustTest;
51-
bool Run(int /* unused */ stream_id) override {
51+
bool Run(int /* unused */ /*stream_id*/) override {
5252
*OperatorBase::Output<int>(0) = 5;
5353
return true;
5454
}

caffe2/core/plan_executor.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct Reporter {
7272
// Returns a function that returns `true` if we should continue
7373
// iterating, given the current iteration count.
7474
std::function<bool(int64_t)> getContinuationTest(
75-
Workspace* ws,
75+
Workspace* /*ws*/,
7676
const ExecutionStep& step) {
7777
if (step.has_should_stop_blob()) {
7878
CAFFE_ENFORCE(
@@ -93,7 +93,7 @@ std::function<bool(int64_t)> getContinuationTest(
9393
if (onlyOnce) {
9494
return [](int64_t i) { return i == 0; };
9595
} else {
96-
return [](int64_t i) { return true; };
96+
return [](int64_t /*i*/) { return true; };
9797
}
9898
}
9999
};

caffe2/core/typeid.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ class TypeMeta {
221221
* A placeholder function for types that do not allow assignment.
222222
*/
223223
template <typename T>
224-
static void _CopyNotAllowed(const void* src, void* dst, size_t n) {
224+
static void
225+
_CopyNotAllowed(const void* /*src*/, void* /*dst*/, size_t /*n*/) {
225226
std::cerr << "Type " << Name<T>() << " does not allow assignment.";
226227
// This is an error by design, so we will quit loud.
227228
abort();

caffe2/core/workspace.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct StopOnSignal {
3737

3838
StopOnSignal(const StopOnSignal& other) : handler_(other.handler_) {}
3939

40-
bool operator()(int iter) {
40+
bool operator()(int /*iter*/) {
4141
return handler_->CheckForSignals() != SignalHandler::Action::STOP;
4242
}
4343

caffe2/cuda_rtc/elemenntwise_rtc_gpu.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ class ElementwiseRTCFunction
1111
ElementwiseRTCFunction() : CudaRTCFunction(), name_(GetUniqueName()) {}
1212

1313
template <typename... Args>
14-
string KernelName(Args... args) { return name_; }
14+
string KernelName(Args... /*args*/) {
15+
return name_;
16+
}
1517

1618
template <typename... Args>
1719
string GetSource(Args... args);

caffe2/cuda_rtc/pool_op_rtc_gpu.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ class MaxPoolRTCFunction : public CudaRTCFunction<MaxPoolRTCFunction> {
104104
MaxPoolRTCFunction() : CudaRTCFunction(), name_(GetUniqueName()) {}
105105

106106
template <typename... Args>
107-
string KernelName(Args... args) { return name_; }
107+
string KernelName(Args... /*args*/) {
108+
return name_;
109+
}
108110

109111
template <typename... Args>
110112
string GetSource(Args... args);
@@ -119,7 +121,9 @@ class MaxPoolGradientRTCFunction
119121
MaxPoolGradientRTCFunction() : CudaRTCFunction(), name_(GetUniqueName()) {}
120122

121123
template <typename... Args>
122-
string KernelName(Args... args) { return name_; }
124+
string KernelName(Args... /*args*/) {
125+
return name_;
126+
}
123127

124128
template <typename... Args>
125129
string GetSource(Args... args);

caffe2/db/protodb.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ProtoDBCursor : public Cursor {
1313
: proto_(proto), iter_(0) {}
1414
~ProtoDBCursor() {}
1515

16-
void Seek(const string& str) override {
16+
void Seek(const string& /*str*/) override {
1717
CAFFE_THROW("ProtoDB is not designed to support seeking.");
1818
}
1919

0 commit comments

Comments
 (0)