Closed
Bug 1093191
Opened 10 years ago
Closed 10 years ago
Make .cpp files in editor/libeditor include their own .h file first
Categories
(Core :: DOM: Editor, defect)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: dholbert, Assigned: dholbert)
Details
Attachments
(3 files)
2.94 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
3.40 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
28.81 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
We have a general best-practice that Foo.cpp's first #include should be for Foo.h (if Foo.h exists). This lets us verify that Foo.h correctly forward-declares all the types that it uses. (If it doesn't, then Foo.cpp will fail to compile. Filing this bug on fixing up .cpp files in editor/libeditor to conform to this.
Assignee | ||
Comment 1•10 years ago
|
||
First: when bumping #includes up for this bug, I noticed that several of these files start with...
> #include <stdio.h> // for printf
...and yet don't use printf at all.
So, this patch drops those includes.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8516072 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Comment 2•10 years ago
|
||
Unsurprisingly, the "main" patch here (which I'll post next) caused build failures, because it caught some missing forward-decls / includes in the .h files. This patch adds those missing forward-decls / includes, so that we can continue compiling. (Note: I built with "ac_add_options --disable-unified-compilation" to catch these, since otherwise, unified compilation lets us cheat & have the things we need already declared/defined by previous .cpp files.)
Attachment #8516074 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Comment 3•10 years ago
|
||
Comment on attachment 8516074 [details] [diff] [review] part 2: add missing forward-decls / #includes >+++ b/editor/libeditor/nsHTMLEditUtils.h > #ifndef nsHTMLEditUtils_h__ > #define nsHTMLEditUtils_h__ > >+#include "mozilla/Types.h" > (In case it's not clear, this ^ include is to give us "int32_t", which this header uses in some function-signatures lower down.)
Assignee | ||
Comment 4•10 years ago
|
||
...and here's the main patch here -- making each .cpp file #include its own .h file first.
Attachment #8516075 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Comment 5•10 years ago
|
||
(FWIW, I looked for candidate .cpp files to fix here with the following shell command... for cppfile in *cpp; do hfile=`echo $cppfile | sed "s/.cpp/.h/"`; echo; echo "***$cppfile***"; grep -B4 $hfile $cppfile; done ...and I skimmed the output for chunks with other #includes in grep's before-context from "-B4".)
Assignee | ||
Comment 6•10 years ago
|
||
Try run: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=3d11f4026885
Assignee | ||
Comment 7•10 years ago
|
||
(Try run is green.)
Updated•10 years ago
|
Attachment #8516072 -
Flags: review?(ehsan.akhgari) → review+
Updated•10 years ago
|
Attachment #8516074 -
Flags: review?(ehsan.akhgari) → review+
Comment 8•10 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #3) > Comment on attachment 8516074 [details] [diff] [review] > part 2: add missing forward-decls / #includes > > >+++ b/editor/libeditor/nsHTMLEditUtils.h > > #ifndef nsHTMLEditUtils_h__ > > #define nsHTMLEditUtils_h__ > > > >+#include "mozilla/Types.h" > > > > (In case it's not clear, this ^ include is to give us "int32_t", which this > header uses in some function-signatures lower down.) You could just include <stdint.h> for that, right?
Updated•10 years ago
|
Attachment #8516075 -
Flags: review?(ehsan.akhgari) → review+
Assignee | ||
Comment 9•10 years ago
|
||
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #8) > You could just include <stdint.h> for that, right? Hmm, looks like it. Not sure why I'd thought I needed mfbt's Types.h for that. I'll sanity-check that w/ Try, and then land if all is well. Thanks for the review!
Assignee | ||
Updated•10 years ago
|
Flags: needinfo?(dholbert)
Assignee | ||
Comment 10•10 years ago
|
||
Try run with that fixed: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=19222b165039
Assignee | ||
Comment 11•10 years ago
|
||
Landed: https://hg.mozilla.org/integration/mozilla-inbound/rev/3361018e53e5 https://hg.mozilla.org/integration/mozilla-inbound/rev/f263abe1e116 https://hg.mozilla.org/integration/mozilla-inbound/rev/debcb0ca1fec
Flags: needinfo?(dholbert) → in-testsuite-
Comment 12•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/3361018e53e5 https://hg.mozilla.org/mozilla-central/rev/f263abe1e116 https://hg.mozilla.org/mozilla-central/rev/debcb0ca1fec
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in
before you can comment on or make changes to this bug.
Description
•