Closed Bug 787730 Opened 9 years ago Closed 9 years ago

building tests fails with clang 3.2

Categories

(Core :: General, defect)

x86_64
FreeBSD
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: jbeich, Assigned: jbeich)

References

Details

Attachments

(1 file, 2 obsolete files)

No description provided.
dom/plugins/test/testplugin/nptest.cpp:3595:24: error: assigning
      to 'char' from incompatible type 'nullptr_t'
    *((char*) siteEnd) = NULL;
                       ^ ~~~~
dom/plugins/test/testplugin/nptest.cpp:3597:25: error: assigning
      to 'char' from incompatible type 'nullptr_t'
    *((char*) flagsEnd) = NULL;
                        ^ ~~~~
dom/plugins/test/testplugin/nptest.cpp:3598:21: error: assigning
      to 'char' from incompatible type 'nullptr_t'
    *((char*) next) = NULL;
                    ^ ~~~~
Attachment #657611 - Flags: review?
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), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:42:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(row->AsSharedWString(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:45:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(row->AsSharedBlob(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:72:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(stmt->AsSharedUTF8String(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:75:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(stmt->AsSharedWString(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:78:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(stmt->AsSharedBlob(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:86:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(valueArray->AsSharedUTF8String(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:89:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(valueArray->AsSharedWString(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storage/test/test_AsXXX_helpers.cpp:92:3: error: use of
      overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream'
      (aka 'basic_ostringstream<char>') and 'nullptr_t')
  do_check_eq(valueArray->AsSharedBlob(0, &len), NULL);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Attachment #657612 - Flags: review?(ehsan)
Attachment #657611 - Flags: review? → review?(ehsan)
Blocks: clang-macosx
Depends on: 784776
Actually, both cases want 'char'.
Attachment #657611 - Attachment is obsolete: true
Attachment #657612 - Attachment is obsolete: true
Attachment #657611 - Flags: review?(ehsan)
Attachment #657612 - Flags: review?(ehsan)
Attachment #657637 - Flags: review?(ehsan)
Attachment #657637 - Flags: review?(ehsan) → review+
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/4485a0ef19bd
Assignee: nobody → jbeich
Keywords: checkin-needed
Target Milestone: --- → mozilla18
https://hg.mozilla.org/mozilla-central/rev/4485a0ef19bd
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
This bug's patch was incorrect, for test_AsXXX_helpers.cpp.

The lines there were originally comparing two pointers, and apparently a compiler complained that the null pointer had an ambiguous pointer-type.

The correct fix for that would be to cast it to the correct pointer-type. The fix that landed here, though, was to swap it out for a non-pointer type, which apparently breaks some compilers because now we're comparing a pointer to a non-pointer.
(In reply to Daniel Holbert [:dholbert] from comment #6)
> The fix that landed here, though, was to swap it out for a non-pointer type,
> which apparently breaks some compilers because now we're comparing a pointer
> to a non-pointer.

In particular, it broke Jesse's clang build, with errors like:
{
test_AsXXX_helpers.cpp:42:3: error: comparison between pointer and integer
      ('const PRUnichar *' (aka 'const unsigned short *') and 'int')
  do_check_eq(row->AsSharedWString(0, &len), '\0');
  ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~
}

(Aside: it's also really weird to be comparing a string pointer to '\0'. The former is a pointer-to-characters; the latter is a character, so it looks like we're trying to do string comparison by pointer-equality or something.)
(In reply to comment #7)
> (In reply to Daniel Holbert [:dholbert] from comment #6)
> > The fix that landed here, though, was to swap it out for a non-pointer type,
> > which apparently breaks some compilers because now we're comparing a pointer
> > to a non-pointer.
> 
> In particular, it broke Jesse's clang build, with errors like:
> {
> test_AsXXX_helpers.cpp:42:3: error: comparison between pointer and integer
>       ('const PRUnichar *' (aka 'const unsigned short *') and 'int')
>   do_check_eq(row->AsSharedWString(0, &len), '\0');
>   ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~
> }

It didn't build just Jesse's build, it broke everybody's who is using a recent clang (me included.)
Blocks: 884022
I filed bug 884022 on this bustage.
No longer blocks: 884022
Depends on: 884022
You need to log in before you can comment on or make changes to this bug.