Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress Clang++ warnings on macOS #2205

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/framework/operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class CExpr {
: expr_type(_expr_type), type(_type) {}
virtual bool eval_bool(const std::string &memory) { return false; };
virtual uint_t eval_uint(const std::string &memory) { return 0ul; };
virtual ~CExpr() = default;

public:
const CExprType expr_type;
Expand Down Expand Up @@ -139,6 +140,8 @@ class CastExpr : public CExpr {
throw std::invalid_argument(R"(invalid cast: from unknown type.)");
}

virtual ~CastExpr() = default;

public:
const std::shared_ptr<CExpr> operand;
};
Expand All @@ -163,6 +166,8 @@ class VarExpr : public CExpr {
return eval_uint_(memory);
}

virtual ~VarExpr() = default;

private:
uint_t eval_uint_(const std::string &memory) {
uint_t val = 0ul;
Expand Down Expand Up @@ -199,6 +204,8 @@ class UintValue : public ValueExpr {

virtual uint_t eval_uint(const std::string &memory) { return value; }

virtual ~UintValue() = default;

public:
const uint_t value;
};
Expand All @@ -215,6 +222,8 @@ class BoolValue : public ValueExpr {
R"(eval_uint is called for Bool value without cast.)");
}

virtual ~BoolValue() = default;

public:
const bool value;
};
Expand Down Expand Up @@ -246,6 +255,8 @@ class UnaryExpr : public CExpr {
throw std::invalid_argument(R"(should not reach here.)");
}

virtual ~UnaryExpr() = default;

public:
const UnaryOp op;
const std::shared_ptr<CExpr> operand;
Expand Down Expand Up @@ -358,6 +369,8 @@ class BinaryExpr : public CExpr {
}
}

virtual ~BinaryExpr() = default;

public:
const BinaryOp op;
const std::shared_ptr<CExpr> left;
Expand Down
6 changes: 3 additions & 3 deletions src/simulators/matrix_product_state/svd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ void lapack_csvd_wrapper(cmatrix_t &A, cmatrix_t &U, rvector_t &S,
zgesdd_("A", &m, &n, lapackA, &m, lapackS, lapackU, &m, lapackV, &n, work_,
&lwork, rwork, iwork, &info);

delete iwork;
delete[] iwork;
free(rwork);
free(work_);
} else {
Expand All @@ -655,8 +655,8 @@ void lapack_csvd_wrapper(cmatrix_t &A, cmatrix_t &U, rvector_t &S,
validate_SVdD_result(tempA, U, S, V);
// #endif

delete lapackS;
delete work;
delete[] lapackS;
delete[] work;

if (info == 0) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/parallel_state_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ParallelStateExecutor : public virtual MultiStateExecutor<state_t> {
protected:
void set_config(const Config &config) override;

virtual uint_t qubit_scale(void) { return 1; }
virtual uint_t qubit_scale(void) override { return 1; }

bool multiple_chunk_required(const Config &config, const Circuit &circuit,
const Noise::NoiseModel &noise) const;
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/statevector/statevector_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class State : public QuantumState::State<statevec_t> {
cmatrix_t density_matrix(const reg_t &qubits);

// Apply the global phase
void apply_global_phase();
void apply_global_phase() override;

protected:
//-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/superoperator/superoperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Superoperator : public DensityMatrix<data_t> {
//-----------------------------------------------------------------------

// Set the size of the vector in terms of qubit number
void set_num_qubits(size_t num_qubits);
void set_num_qubits(size_t num_qubits) override;

// Returns the number of qubits for the superoperator
virtual uint_t num_qubits() const override { return num_qubits_; }
Expand Down
6 changes: 4 additions & 2 deletions src/simulators/tensor_network/tensor_net_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ class State : public QuantumState::State<tensor_net_t> {
auto move_to_vector();
auto copy_to_vector();

void enable_density_matrix(bool flg) { enable_density_matrix_ = flg; }
void enable_density_matrix(bool flg) override {
enable_density_matrix_ = flg;
}

protected:
//-----------------------------------------------------------------------
Expand Down Expand Up @@ -208,7 +210,7 @@ class State : public QuantumState::State<tensor_net_t> {
RngEngine &rng);

// Apply the global phase
void apply_global_phase(void);
void apply_global_phase(void) override;

//-----------------------------------------------------------------------
// Save data instructions
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/unitary/unitary_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class State : public virtual QuantumState::State<unitary_matrix_t> {
auto copy_to_matrix();

// Apply the global phase
void apply_global_phase();
void apply_global_phase() override;

protected:
//-----------------------------------------------------------------------
Expand Down
13 changes: 8 additions & 5 deletions src/transpile/fusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ class UnitaryFusion : public FusionMethod {
std::string("fusion"));
};

virtual bool can_apply(const op_t &op, uint_t max_fused_qubits) const {
virtual bool can_apply(const op_t &op,
uint_t max_fused_qubits) const override {
if (op.conditional || op.sample_noise)
return false;
switch (op.type) {
Expand Down Expand Up @@ -220,7 +221,8 @@ class SuperOpFusion : public UnitaryFusion {
return Operations::make_superop(qubits, std::move(superop));
};

virtual bool can_apply(const op_t &op, uint_t max_fused_qubits) const {
virtual bool can_apply(const op_t &op,
uint_t max_fused_qubits) const override {
if (op.conditional || op.sample_noise)
return false;
switch (op.type) {
Expand Down Expand Up @@ -270,7 +272,8 @@ class KrausFusion : public UnitaryFusion {
return Operations::make_kraus(qubits, Utils::superop2kraus(superop, dim));
};

virtual bool can_apply(const op_t &op, uint_t max_fused_qubits) const {
virtual bool can_apply(const op_t &op,
uint_t max_fused_qubits) const override {
if (op.conditional || op.sample_noise)
return false;
switch (op.type) {
Expand Down Expand Up @@ -346,7 +349,7 @@ void Fuser::allocate_new_operation(oplist_t &ops, const uint_t idx,
ops[i].type = optype_t::nop;
}

class CostBasedFusion : public Fuser {
class CostBasedFusion final : public Fuser {
public:
CostBasedFusion() { std::fill_n(costs_, 64, -1); };

Expand Down Expand Up @@ -377,7 +380,7 @@ class CostBasedFusion : public Fuser {
};

template <size_t N>
class NQubitFusion : public Fuser {
class NQubitFusion final : public Fuser {
public:
NQubitFusion() : opt_name(std::to_string(N) + "_qubits") {}

Expand Down
Loading