Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Issue 214012: Explicitly compare to NULL when looking for weak_import symbols. (Closed)

Created:
11 years, 3 months ago by Craig
Modified:
9 years, 7 months ago
Reviewers:
Mark Mentovai, maf
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Explicitly compare to NULL when looking for weak_import symbols. Changing the comparison form affects the warning messages generated in various circumstances. See the codereview for details. Also, Apple docs claim that !symbol comparisons will not work. Spotted by Matthew Vosburgh. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=26569

Patch Set 1 #

Patch Set 2 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -3 lines) Patch
M base/debug_util_posix.cc View 3 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Craig
Please review. Original issue at http://codereview.chromium.org/206024/show
11 years, 3 months ago (2009-09-17 17:08:02 UTC) #1
Mark Mentovai
! is fine.
11 years, 3 months ago (2009-09-17 17:08:12 UTC) #2
Craig
On 2009/09/17 17:08:02, Craig wrote: > Please review. > > Original issue at http://codereview.chromium.org/206024/show And ...
11 years, 3 months ago (2009-09-17 17:10:26 UTC) #3
maf
LGTM
11 years, 3 months ago (2009-09-17 20:30:44 UTC) #4
Craig
On 2009/09/17 20:30:44, maf wrote: > LGTM Do you think this patch is going to ...
11 years, 3 months ago (2009-09-18 05:08:38 UTC) #5
maf
11 years, 3 months ago (2009-09-18 05:17:23 UTC) #6
I disagree with Mark.

On some configurations the symbol is weakly defined and present, on
some it's weakly defined and absent, and on some it is strongly
defined and always present.

If the symbol is strongly defined this causes a compiler warning from
GCC (saying the expression is always true):
  if (myFunction)
whereas this does not:
  if (myFunction == NULL)

So explicitly comparing with NULL has an advantage beyond the compiler
support which may or may not still be required.
I was following this documentation which was mentioned earlier in the thread.
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFram...


Maf
Maf

On Thu, Sep 17, 2009 at 10:08 PM,  <craig.schlenter@chromium.org> wrote:
> On 2009/09/17 20:30:44, maf wrote:
>>
>> LGTM
>
> Do you think this patch is going to make a difference given Mark's comments?
> I
> unfortunately don't have a Intel Mac to try this on.
>
> Thank you.
>
> http://codereview.chromium.org/214012
>

Powered by Google App Engine
This is Rietveld 408576698