Bugzilla – Bug 1191
Test does not build: signed-unsigned mismatch
Last modified: 2011-06-17 16:39:08 UTC
Created attachment 1166 [details] Path with a fix Got this while building tests on a pristine checkout (on debian squeeze): [1037/1351] cxx: src/stats/test/basic-data-calculators-test-suite.cc -> build/optimized/src/stats/test/basic-data-calculators-test-suite_3.o cc1plus: warnings being treated as errors ../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void OneIntegerTestCase::DoRun()’: ../src/stats/test/basic-data-calculators-test-suite.cc:71: error: comparison between signed and unsigned integer expressions ../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveIntegersTestCase::DoRun()’: ../src/stats/test/basic-data-calculators-test-suite.cc:149: error: comparison between signed and unsigned integer expressions ../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveDoublesTestCase::DoRun()’: ../src/stats/test/basic-data-calculators-test-suite.cc:227: error: comparison between signed and unsigned integer expressions The attached patch fixes it. (changing the loop variable to match the type of the limit)
Bug closed. ns-3-dev changeset: ea18c95c3a9d
I tried the fix in that changeset before posting the patch, it doesn't work for me at least. With it, I get: [1078/1578] cxx: src/stats/test/basic-data-calculators-test-suite.cc -> build/optimized/src/stats/test/basic-data-calculators-test-suite_3.o cc1plus: warnings being treated as errors ../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void OneIntegerTestCase::DoRun()’: ../src/stats/test/basic-data-calculators-test-suite.cc:96: error: comparison between signed and unsigned integer expressions ../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveIntegersTestCase::DoRun()’: ../src/stats/test/basic-data-calculators-test-suite.cc:174: error: comparison between signed and unsigned integer expressions ../src/stats/test/basic-data-calculators-test-suite.cc: In member function ‘virtual void FiveDoublesTestCase::DoRun()’: ../src/stats/test/basic-data-calculators-test-suite.cc:252: error: comparison between signed and unsigned integer expressions And I don't feel comfortable casting the return value of the getters (which would fix that error above). That's why I went for making the loop variable signed. Cheers.
Also notice that basic-data-calculators.h clearly states that getCount() returns a long, not a uint32_t.
I will do what the patch proposed.
Bug closed. ns-3-dev changeset: b1e882592130