Last Comment Bug 713560 - MOZ_STATIC_ASSERT doesn't use 'reason' as often as it could
: MOZ_STATIC_ASSERT doesn't use 'reason' as often as it could
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: MFBT (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla12
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-26 13:16 PST by Zack Weinberg (:zwol)
Modified: 2011-12-28 11:07 PST (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Zack Weinberg (:zwol) 2011-12-26 13:16:57 PST
MOZ_STATIC_ASSERT(cond, reason) is #defined to the C++11 static_assert() whenever available; due to the variety of compilers we support, there are four separate #defines that do that, under a bunch of #ifdefs, in the present version of the file: <http://hg.mozilla.org/mozilla-central/file/9f29daaecbcc/mfbt/Assertions.h#l63>

Only one of those four definitions reads

#      define MOZ_STATIC_ASSERT(cond, reason)    static_assert((cond), reason)

the other three are

#      define MOZ_STATIC_ASSERT(cond, reason)    static_assert((cond), #cond)

making no use of 'reason'. This seems wrong.
Comment 1 Jeff Walden [:Waldo] (remove +bmo to email) 2011-12-27 10:17:47 PST
Hmm, yeah, that was wrong, wasn't it.  Thanks for pointing it out, fixed here (seems typo-land enough that it's not worth wasting someone's time reviewing it):

https://hg.mozilla.org/integration/mozilla-inbound/rev/3b3f1c6d6983
Comment 2 Matt Brubeck (:mbrubeck) 2011-12-28 11:07:26 PST
https://hg.mozilla.org/mozilla-central/rev/3b3f1c6d6983

Note You need to log in before you can comment on or make changes to this bug.