Skip to content

Commit e634e9c

Browse files
aiger2: Resolve warnings
- Remove unused statics CONST_FALSE and CONST_TRUE (which appear to have been folded into the `Index` declaration as CFALSE and CTRUE). - Assign default value of EMPTY_LIT to `a` and `b` for comparison ops. - Tag debug only variables with YS_MAYBE_UNUSED, don't assign unused variables (but continue to call the function because it moves the file pointer).
1 parent 1de5d98 commit e634e9c

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

backends/aiger2/aiger.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ struct Index {
262262
if (cell->type.in(ID($gt), ID($ge)))
263263
std::swap(aport, bport);
264264
int carry = cell->type.in(ID($le), ID($ge)) ? CFALSE : CTRUE;
265-
Lit a, b;
265+
Lit a = Writer::EMPTY_LIT;
266+
Lit b = Writer::EMPTY_LIT;
266267
// TODO: this might not be the most economic structure; revisit at a later date
267268
for (int i = 0; i < width; i++) {
268269
a = visit(cursor, aport[i]);
@@ -664,8 +665,6 @@ struct Index {
664665
struct AigerWriter : Index<AigerWriter, unsigned int, 0, 1> {
665666
typedef unsigned int Lit;
666667

667-
const static Lit CONST_FALSE = 0;
668-
const static Lit CONST_TRUE = 1;
669668
const static constexpr Lit EMPTY_LIT = std::numeric_limits<Lit>::max();
670669

671670
static Lit negate(Lit lit) {
@@ -802,8 +801,6 @@ struct AigerWriter : Index<AigerWriter, unsigned int, 0, 1> {
802801
};
803802

804803
struct XAigerAnalysis : Index<XAigerAnalysis, int, 0, 0> {
805-
const static int CONST_FALSE = 0;
806-
const static int CONST_TRUE = 0;
807804
const static constexpr int EMPTY_LIT = -1;
808805

809806
XAigerAnalysis()

frontends/aiger2/xaiger.cc

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,10 @@ struct Xaiger2Frontend : public Frontend {
198198

199199
int ci_counter = 0;
200200
for (uint32_t i = 0; i < no_boxes; i++) {
201-
uint32_t box_inputs, box_outputs, box_id, box_seq;
202-
box_inputs = read_be32(*f);
203-
box_outputs = read_be32(*f);
204-
box_id = read_be32(*f);
205-
box_seq = read_be32(*f);
201+
/* unused box_inputs = */ read_be32(*f);
202+
YS_MAYBE_UNUSED auto box_outputs = read_be32(*f);
203+
/* unused box_id = */ read_be32(*f);
204+
auto box_seq = read_be32(*f);
206205

207206
log("box_seq=%d boxes.size=%d\n", box_seq, (int) boxes.size());
208207
log_assert(box_seq < boxes.size());
@@ -337,11 +336,10 @@ struct Xaiger2Frontend : public Frontend {
337336
len, ci_num, co_num, pi_num, po_num, no_boxes);
338337

339338
for (uint32_t i = 0; i < no_boxes; i++) {
340-
uint32_t box_inputs, box_outputs, box_id, box_seq;
341-
box_inputs = read_be32(*f);
342-
box_outputs = read_be32(*f);
343-
box_id = read_be32(*f);
344-
box_seq = read_be32(*f);
339+
YS_MAYBE_UNUSED auto box_inputs = read_be32(*f);
340+
/* unused box_outputs = */ read_be32(*f);
341+
/* unused box_id = */ read_be32(*f);
342+
auto box_seq = read_be32(*f);
345343

346344
log("box_seq=%d boxes.size=%d\n", box_seq, (int) boxes.size());
347345
log_assert(box_seq < boxes.size());

0 commit comments

Comments
 (0)