Closed Bug 1123012 Opened 5 years ago Closed 5 years ago

.../audio_coding/main/acm2/audio_coding_module_impl.cc:2075:10: error: reinterpret_cast from 'nullptr_t' to 'const webrtc::AudioEncoder *' is not

Categories

(Core :: WebRTC, defect, P5, major)

All
FreeBSD
defect

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox38 --- fixed
firefox39 --- fixed

People

(Reporter: jbeich, Assigned: gcp)

References

Details

Attachments

(2 files)

The file builds fine with gcc-4.9 but fails with clang 3.5.

In file included from media/webrtc/trunk/webrtc/modules/modules_audio_coding_module/Unified_cpp__audio_coding_module0.cpp:119:
media/webrtc/trunk/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc:2075:10: error:
      reinterpret_cast from 'nullptr_t' to 'const webrtc::AudioEncoder *' is not
      allowed
  return reinterpret_cast<const AudioEncoder*>(NULL);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
media/webrtc/trunk/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc:2094:10: error:
      reinterpret_cast from 'nullptr_t' to 'const webrtc::ReceiverInfo *' is not
      allowed
  return reinterpret_cast<const ReceiverInfo*>(NULL);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
Attached patch use nullptrSplinter Review
FreeBSD implements NULL as nullptr in C++11 mode but GCC provides its own NULL via fixincludes. So, rather than casting just use nullptr because it is "implicitly convertible and comparable to any pointer type or pointer-to-member type."
Attachment #8550835 - Flags: review?(rjesup)
Comment on attachment 8550835 [details] [diff] [review]
use nullptr

Review of attachment 8550835 [details] [diff] [review]:
-----------------------------------------------------------------

Upstream does not use nullptr, so we really don't want to introduce its usage here.  Some other workaround will be needed.  Worst-case - an ifdef, but I'd prefer to avoid it and instead use some type of casting as needed, or a temporary the compiler will do away with.
Attachment #8550835 - Flags: review?(rjesup) → review-
How about just replacing the whole cast by return NULL? Works fine for GCC. What about clang?
Seems to work with GCC 4.9.2 and clang 3.5 for me.
Attachment #8567857 - Flags: review?(rjesup)
Attachment #8567857 - Flags: review?(rjesup) → review+
Comment on attachment 8567857 [details] [diff] [review]
Just return a NULL ptr instead of casting NULL

Works for me as well.
Attachment #8567857 - Flags: feedback+
Severity: normal → major
Flags: firefox-backlog+
Priority: -- → P5
https://hg.mozilla.org/mozilla-central/rev/b7bceb058d33
Assignee: nobody → gpascutto
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Comment on attachment 8567857 [details] [diff] [review]
Just return a NULL ptr instead of casting NULL

The fix didn't make it in time before the uplift:
http://buildbot.rhaalovely.net/builders/mozilla-central-freebsd-amd64
http://buildbot.rhaalovely.net/builders/mozilla-aurora-freebsd-amd64

Approval Request Comment
[Feature/regressing bug #]: bug 1109248 regression
[User impact if declined]: broken build on FreeBSD or any other platform with #define NULL nullptr in system headers; GCC builds aren't affected due to compiler's hacks
[Describe test coverage new/current, TreeHerder]: Try in comment 6, landed in m-c
[Risks and why]: Low, can only break build.
[String/UUID change made/needed]: None
Attachment #8567857 - Flags: approval-mozilla-aurora?
Comment on attachment 8567857 [details] [diff] [review]
Just return a NULL ptr instead of casting NULL

low risk, approving.
Attachment #8567857 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
No longer blocks: webrtc_upstream_bugs
You need to log in before you can comment on or make changes to this bug.