potassco / clingo

🤔 A grounder and solver for logic programs.
https://potassco.org/clingo
MIT License
606 stars 81 forks source link

Code that has no effect #482

Closed yurivict closed 7 months ago

yurivict commented 7 months ago

The last line in this code in libgringo/gringo/output/theory.hh:

        bool operator()(std::pair<IdSpan, LitSpan> const &x, std::pair<IdSpan, LitSpan> const &y) const {
            return x.first.size == y.first.size &&
                   x.second.size == y.second.size &&
                   std::equal(begin(x.first), end(x.first), begin(y.first));
                   std::equal(begin(x.second), end(x.second), begin(y.second));
        }

has no effect.

It also causes this clang warning:

In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/src/ground/statements.cc:25:
In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/ground/statements.hh:28:
In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/ground/statement.hh:28:
In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/ground/literal.hh:30:
In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/ground/instantiation.hh:28:
In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/output/output.hh:31:
In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/output/statements.hh:29:
In file included from /usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/output/literals.hh:36:
/usr/ports/math/clingo/work/clingo-5.7.0/libgringo/gringo/output/theory.hh:203:20: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
                   std::equal(begin(x.second), end(x.second), begin(y.second));
                   ^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
rkaminsk commented 7 months ago

Thanks, there has to be an && of course. :)