Closed
Bug 895322
Opened 12 years ago
Closed 12 years ago
Replace MOZ_STATIC_ASSERT with static_assert
Categories
(Core :: MFBT, defect)
Core
MFBT
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: emk, Assigned: ehsan.akhgari)
References
Details
Attachments
(7 files, 3 obsolete files)
799 bytes,
text/plain
|
Waldo
:
review+
|
Details |
806 bytes,
text/plain
|
Waldo
:
review+
|
Details |
180.92 KB,
patch
|
Details | Diff | Splinter Review | |
1.07 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
966 bytes,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
3.48 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
1.16 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
After bug 894242, static_assert should be available everywhere.
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #777840 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 2•12 years ago
|
||
This script helps preserve indentation across multiple lines.
Assignee | ||
Comment 3•12 years ago
|
||
Comment on attachment 777842 [details]
assert_replacer.py, the replacer engine
Hmm, this script has a bug.
Attachment #777842 -
Attachment is obsolete: true
Attachment #777842 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #777840 -
Attachment is obsolete: true
Attachment #777840 -
Flags: review?(jwalden+bmo)
Attachment #777852 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 5•12 years ago
|
||
Attachment #777853 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 6•12 years ago
|
||
Hmm, we seem to have one usage of MOZ_STATIC_ASSERT in xpcom/base/nsErrorAssertsC.c which was added in bug 836438. Is it worth to keep MOZ_STATIC_ASSERT around for that?
Assignee | ||
Comment 7•12 years ago
|
||
Hmm, there is another C usage in media/webrtc (the static asserts in media/webrtc/signaling/src/sipcc/core/includes/ccapi.h)
Comment 8•12 years ago
|
||
Maybe we define MOZ_STATIC_ASSERT only ifndef __cplusplus?
Comment 9•12 years ago
|
||
There's also still some PR_STATIC_ASSERTs laying around:
<http://dxr.mozilla.org/mozilla-central/search?limit=100&redirect=false&q=PR_STATIC_ASSERT%20-path%3Asecurity%2Fnss%2F%20-path%3Ansprpub%2F>.
Also, any C++-language CONFIGURE_STATIC_ASSERTs could be changed to static_asert as well.
Assignee | ||
Comment 10•12 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #8)
> Maybe we define MOZ_STATIC_ASSERT only ifndef __cplusplus?
Good idea.
(In reply to Joshua Cranmer [:jcranmer] from comment #9)
> There's also still some PR_STATIC_ASSERTs laying around:
> <http://dxr.mozilla.org/mozilla-central/
> search?limit=100&redirect=false&q=PR_STATIC_ASSERT%20-
> path%3Asecurity%2Fnss%2F%20-path%3Ansprpub%2F>.
>
> Also, any C++-language CONFIGURE_STATIC_ASSERTs could be changed to
> static_asert as well.
Please file follow-up bugs for these. Thanks!
Assignee | ||
Comment 11•12 years ago
|
||
(There's more C stuff in libmar, FWIW)
Assignee | ||
Comment 12•12 years ago
|
||
Attachment #777852 -
Attachment is obsolete: true
Attachment #777852 -
Flags: review?(jwalden+bmo)
Attachment #777933 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 13•12 years ago
|
||
Assignee | ||
Comment 14•12 years ago
|
||
Attachment #777961 -
Flags: review?
Assignee | ||
Updated•12 years ago
|
Attachment #777961 -
Flags: review? → review?(jwalden+bmo)
Assignee | ||
Comment 15•12 years ago
|
||
Attachment #777962 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 16•12 years ago
|
||
Attachment #777967 -
Flags: review?(jwalden+bmo)
Comment 17•12 years ago
|
||
(In reply to Joshua Cranmer [:jcranmer] from comment #9)
> There's also still some PR_STATIC_ASSERTs laying around:
> <http://dxr.mozilla.org/mozilla-central/
> search?limit=100&redirect=false&q=PR_STATIC_ASSERT%20-
> path%3Asecurity%2Fnss%2F%20-path%3Ansprpub%2F>.
Bug 712936
> Also, any C++-language CONFIGURE_STATIC_ASSERTs could be changed to
> static_asert as well.
Bug 895553
See Also: → 712936
Comment 18•12 years ago
|
||
Comment on attachment 777853 [details]
assert_replacer.py, the replacer engine
Looks plausible. Should be quick enough to skim the script's changes to deal with anything this changes bogusly.
Attachment #777853 -
Flags: review?(jwalden+bmo) → review+
Comment 19•12 years ago
|
||
Comment on attachment 777933 [details]
static_assert.sh, the driver script
I suppose those are the only C .h files we have? And this was verified just by building? Fine by me, someone'll complain right quick if we mess it up. :-)
Attachment #777933 -
Flags: review?(jwalden+bmo) → review+
Comment 20•12 years ago
|
||
Comment on attachment 777936 [details] [diff] [review]
Part 1: Autogenerated patch to convert MOZ_STATIC_ASSERT to static_assert in C++ code
Review of attachment 777936 [details] [diff] [review]:
-----------------------------------------------------------------
We should do a post-pass afterward searching for
static_assert\(\([A-Z]
and
static_assert\(\(mozilla::
to get rid of the parenthesization of type trait queries that contained embedded commas -- needed so the commas wouldn't be trigger macro-parameter parsing, but no longer needed with built-into-the-language static_assert.
::: ipc/chromium/src/base/pickle.cc
@@ +20,1 @@
> "Insufficient alignment");
Your rewrite script didn't unfutz alignment here for whatever reason.
@@ +65,1 @@
> "Pointers have different alignments");
Or here.
@@ +85,1 @@
> "Pointers have different alignments");
Or here.
Updated•12 years ago
|
Attachment #777961 -
Flags: review?(jwalden+bmo) → review+
Updated•12 years ago
|
Attachment #777962 -
Flags: review?(jwalden+bmo) → review+
Updated•12 years ago
|
Attachment #777967 -
Flags: review?(jwalden+bmo) → review+
Comment 21•12 years ago
|
||
Note we can probably build mar as C++
Assignee | ||
Comment 22•12 years ago
|
||
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #19)
> Comment on attachment 777933 [details]
> static_assert.sh, the driver script
>
> I suppose those are the only C .h files we have?
Looks like it.
> And this was verified just by building?
Correct.
> Fine by me, someone'll complain right quick if we mess it up.
> :-)
I'm sure they will. :-)
Assignee | ||
Comment 23•12 years ago
|
||
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #20)
> Comment on attachment 777936 [details] [diff] [review]
> Part 1: Autogenerated patch to convert MOZ_STATIC_ASSERT to static_assert in
> C++ code
>
> Review of attachment 777936 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> We should do a post-pass afterward searching for
>
> static_assert\(\([A-Z]
>
> and
>
> static_assert\(\(mozilla::
>
> to get rid of the parenthesization of type trait queries that contained
> embedded commas -- needed so the commas wouldn't be trigger macro-parameter
> parsing, but no longer needed with built-into-the-language static_assert.
OK, I'll do this manually.
> ::: ipc/chromium/src/base/pickle.cc
> @@ +20,1 @@
> > "Insufficient alignment");
>
> Your rewrite script didn't unfutz alignment here for whatever reason.
>
> @@ +65,1 @@
> > "Pointers have different alignments");
>
> Or here.
>
> @@ +85,1 @@
> > "Pointers have different alignments");
>
> Or here.
Well, my script tried to handle sane code. And these locations use tabs. ;-)
Assignee | ||
Comment 24•12 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #21)
> Note we can probably build mar as C++
Bug 895860.
Assignee | ||
Comment 25•12 years ago
|
||
Sadface: <https://tbpl.mozilla.org/?tree=Try&rev=d4b57b18a21c>
Looks like on Android builds, we build the host tools using the system c++ (don't know which gcc that is) which doesn't support C++11. glandium, is this known?
<https://tbpl.mozilla.org/php/getParsedLog.php?id=25487631&tree=Try>
Flags: needinfo?(mh+mozilla)
Comment 26•12 years ago
|
||
Ah yeah, our support for host c++ on cross-compiles kind of sucks. Please file a bug about the host C++ not honoring C++11 and I'll look at it over the week-end.
Flags: needinfo?(mh+mozilla)
Assignee | ||
Comment 27•12 years ago
|
||
It escapes me how on earth this did not break my local builds!
Attachment #778462 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 28•12 years ago
|
||
Assignee | ||
Comment 29•12 years ago
|
||
Now the only problem left is bug 895915.
Assignee | ||
Comment 30•12 years ago
|
||
(Note to self: land this with a change to CLOBBER.)
Comment 31•12 years ago
|
||
Comment on attachment 778462 [details] [diff] [review]
Part 2.1: Stop generating MOZ_STATIC_ASSERT in Web IDL bindings
You could manually correct that static_assert((I while you're here.
Attachment #778462 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 32•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/552bca1bc885
https://hg.mozilla.org/integration/mozilla-inbound/rev/81eb7ee863cd
https://hg.mozilla.org/integration/mozilla-inbound/rev/9ca5f1740017
https://hg.mozilla.org/integration/mozilla-inbound/rev/851bab4e2e3a
https://hg.mozilla.org/integration/mozilla-inbound/rev/b5506e604ae4
Comment 33•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/552bca1bc885
https://hg.mozilla.org/mozilla-central/rev/81eb7ee863cd
https://hg.mozilla.org/mozilla-central/rev/9ca5f1740017
https://hg.mozilla.org/mozilla-central/rev/851bab4e2e3a
https://hg.mozilla.org/mozilla-central/rev/b5506e604ae4
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
![]() |
||
Comment 34•12 years ago
|
||
I filed bug 900275 for removing JS_STATIC_ASSERT.
You need to log in
before you can comment on or make changes to this bug.
Description
•