Closed
Bug 884022
Opened 11 years ago
Closed 11 years ago
Clang build fails in test_AsXXX_helpers.cpp (comparison between pointer and integer)
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: jruderman, Assigned: ehsan.akhgari)
References
Details
Attachments
(1 file, 1 obsolete file)
2.87 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
With a fairly recent clang (llvm svn 184056), the build fails in test_AsXXX_helpers.cpp. Daniel Holbert and Nathan Froyd looked a little bit on IRC. They suspect the fix for bug 787730 was incorrect. /Users/jruderman/trees/mozilla-central/storage/test/test_AsXXX_helpers.cpp:39:3: error: comparison between pointer and integer ('const char *' and 'int') do_check_eq(row->AsSharedUTF8String(0, &len), '\0'); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ /Users/jruderman/trees/mozilla-central/storage/test/storage_test_harness.h:66:19: note: expanded from macro 'do_check_eq' if (aExpected == aActual) { \ ^
Reporter | ||
Updated•11 years ago
|
Assignee | ||
Comment 1•11 years ago
|
||
Reporter | ||
Comment 2•11 years ago
|
||
Comment on attachment 763779 [details] [diff] [review] Patch (v1) Nope, this reintroduces the problem bug 787730 was trying to fix. /Users/jruderman/trees/mozilla-central/storage/test/test_AsXXX_helpers.cpp:39:3: error: use of overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream' (aka 'basic_ostringstream<char>') and 'nullptr_t') do_check_eq(row->AsSharedUTF8String(0, &len), nullptr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/jruderman/trees/mozilla-central/storage/test/storage_test_harness.h:71:12: note: expanded from macro 'do_check_eq' temp << aActual <<"' at line " << __LINE__; \ ~~~~ ^ /usr/include/c++/4.2.1/ostream:112:7: note: candidate function operator<<(__ostream_type& (*__pf)(__ostream_type&)) ^ /usr/include/c++/4.2.1/ostream:121:7: note: candidate function operator<<(__ios_type& (*__pf)(__ios_type&)) ^
Attachment #763779 -
Flags: feedback-
Reporter | ||
Comment 3•11 years ago
|
||
Maybe it would be better to use do_check_true, or introduce a do_check_null. http://mxr.mozilla.org/mozilla-central/source/storage/test/storage_test_harness.h#26
Comment 4•11 years ago
|
||
We can cast nullptr to the correct type or we can use do_check_false. I went with the first solution.
Attachment #763779 -
Attachment is obsolete: true
Attachment #763779 -
Flags: review?(dholbert)
Attachment #763794 -
Flags: review?(dholbert)
Assignee | ||
Comment 5•11 years ago
|
||
Ah, you're using an old libstdc++... :(
Comment 6•11 years ago
|
||
Comment on attachment 763794 [details] [diff] [review] fix clang warnings about pointer-to-int comparisons with test_AsXXX_helpers.cpp I'd prefer static_cast<>, since this is C++, but it doesn't matter too much.
Attachment #763794 -
Flags: review?(dholbert) → review+
Reporter | ||
Comment 7•11 years ago
|
||
For int, I guess this is ok. But for char, (const char *) is another way of saying "C string". What happens if you try to send a nullptr C string to an iostream?
Comment 8•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f53918bafe2a
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Assignee | ||
Comment 9•11 years ago
|
||
(In reply to comment #7) > For int, I guess this is ok. But for char, (const char *) is another way of > saying "C string". What happens if you try to send a nullptr C string to an > iostream? You get no output?
Comment 10•11 years ago
|
||
From some quick googling, it looks like the behavior of cout << (const char*)NULL might be undefined, which does seem problematic. That's how the test was written, though, AFAICT; this bug didn't impact that at all. If you're worried about that, take it up with the test author. :)
Comment 11•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/5dbe9ea88a5a https://hg.mozilla.org/releases/mozilla-b2g18_v1_1_0_hd/rev/5dbe9ea88a5a
status-b2g18:
--- → fixed
status-b2g18-v1.0.0:
--- → wontfix
status-b2g18-v1.0.1:
--- → wontfix
status-b2g-v1.1hd:
--- → fixed
status-firefox22:
--- → wontfix
status-firefox23:
--- → wontfix
status-firefox24:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•