Closed
Bug 856108
Opened 12 years ago
Closed 7 years ago
Port the remaining dehydra analyses to clang
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: jcranmer, Assigned: jcranmer)
References
Details
(Whiteboard: [leave open])
Attachments
(12 files, 1 obsolete file)
10.88 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
27.15 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
11.11 KB,
patch
|
Ms2ger
:
review+
|
Details | Diff | Splinter Review |
10.94 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
4.39 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
37.87 KB,
patch
|
MatsPalmgren_bugz
:
review+
|
Details | Diff | Splinter Review |
8.24 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
6.40 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
11.39 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
6.90 KB,
patch
|
glandium
:
feedback+
|
Details | Diff | Splinter Review |
93.30 KB,
patch
|
Details | Diff | Splinter Review | |
1.19 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
Patches to be uploaded shortly.
Assignee | ||
Comment 1•12 years ago
|
||
I decided to try a different approach for stack classes, using the AST matcher library instead of the RAV. It's nice since I can encapsulate "this is a stack class" in a matcher and then use that to filter down to all the uses... but AST matchers aren't quite powerful enough to do all the logic together.
Attachment #731236 -
Flags: review?(ehsan)
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #731237 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #731238 -
Flags: review?(khuey)
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #731240 -
Flags: review?(ehsan)
Comment 5•12 years ago
|
||
Comment on attachment 731237 [details] [diff] [review]
Part 2a: Use MOZ_STACK_CLASS in content
r=me
Attachment #731237 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 6•12 years ago
|
||
Attachment #731241 -
Flags: review?(roc)
Assignee | ||
Comment 7•12 years ago
|
||
Attachment #731243 -
Flags: review?(dbaron)
Assignee | ||
Comment 8•12 years ago
|
||
Attachment #731245 -
Flags: review?(benjamin)
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #731246 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 10•12 years ago
|
||
Attachment #731250 -
Flags: review?(benjamin)
Assignee | ||
Comment 11•12 years ago
|
||
Everything is migrated, so this declaration is dead...
Attachment #731251 -
Flags: review?(benjamin)
Assignee | ||
Comment 12•12 years ago
|
||
On closer inspection, the logic here seems wrong. At present, including <algorithm> will nab you a lot of extra warnings thanks to the random number generators.
So feedback for now, if this is a wanted analysis.
Attachment #731252 -
Flags: feedback?(benjamin)
Assignee | ||
Comment 13•12 years ago
|
||
The other analyses are the outparams analysis, must-flow-through, and frame verification, which had been previously decided to be not worth migrating over. So there's no point keeping around horribly broken stuff in our build system.
Comment 14•12 years ago
|
||
Comment on attachment 731246 [details] [diff] [review]
Part 2g: Use MOZ_STACK_CLASS in xpconnect
Review of attachment 731246 [details] [diff] [review]:
-----------------------------------------------------------------
I don't really know what those NS_SUPPRESS_STACK_CHECK things are about, but presumably you do. rs=me
Attachment #731246 -
Flags: review?(bobbyholley+bmo) → review+
Assignee | ||
Comment 15•12 years ago
|
||
A note on all the Part 2* patches: most of that stuff is a fairly mechanical s/NS_STACK_CLASS/MOZ_STACK_CLASS/ change, plus necessary fixes to get the tree to build. Mostly, that was adding MOZ_STACK_CLASS attributes, but two were removed, one on nsAutoString and one on ... something with SVG, I forgot :-)
Attachment #731241 -
Flags: review?(roc) → review+
Comment 16•12 years ago
|
||
Comment on attachment 731238 [details] [diff] [review]
Part 2b: Use MOZ_STACK_CLASS in dom
Review of attachment 731238 [details] [diff] [review]:
-----------------------------------------------------------------
I'm going to claim I can do this...
Attachment #731238 -
Flags: review?(khuey) → review+
Comment 17•12 years ago
|
||
Comment on attachment 731252 [details] [diff] [review]
Part 4: Move clang static-initializers detection over
Review of attachment 731252 [details] [diff] [review]:
-----------------------------------------------------------------
::: build/clang-plugin/tests/TestStaticInit.cpp
@@ +1,1 @@
> +__attribute__((constructor)) void foo() { // expected-warning {{function 'foo' called during static initialization}}
This isn't called anymore
Comment 18•12 years ago
|
||
Comment on attachment 731236 [details] [diff] [review]
Part 1: Implement the MOZ_STACK_CLASS analysis
Review of attachment 731236 [details] [diff] [review]:
-----------------------------------------------------------------
Nice!
Attachment #731236 -
Flags: review?(ehsan) → review+
Updated•12 years ago
|
Attachment #731240 -
Flags: review?(ehsan) → review+
Attachment #731243 -
Flags: review?(dbaron) → review?(matspal)
Comment 19•12 years ago
|
||
Comment on attachment 731243 [details] [diff] [review]
Part 2e: Use MOZ_STACK_CLASS in layout
r=mats
Attachment #731243 -
Flags: review?(matspal) → review+
Updated•12 years ago
|
Attachment #731245 -
Flags: review?(benjamin) → review+
Updated•12 years ago
|
Attachment #731250 -
Flags: review?(benjamin) → review+
Comment 20•12 years ago
|
||
Comment on attachment 731251 [details] [diff] [review]
Part 3: Remove NS_STACK_CLASS
I really very much want the NS_STACK_CLASS tests to continue to exist, even if they move to build/clang-plugin/tests
Attachment #731251 -
Flags: review?(benjamin) → review-
Comment 21•12 years ago
|
||
Perhaps I marked r+ too quickly. It appears that there is a fundamental difference between NS_STACK_CLASS and MOZ_STACK_CLASS, and I'm not sure it's good! It appears that MOZ_STACK_CLASS does not automatically propagate to classes that inherit or include an instance member of the marked class? Instead you have to explicitly annotate every class in the tree as a stack class? That seems pretty unfortunate.
Comment 22•12 years ago
|
||
Comment on attachment 731252 [details] [diff] [review]
Part 4: Move clang static-initializers detection over
I believe that static-initializer checking was added for performance reasons in bug 573786. I have no particular love nor hate for it, so glandium should probably decide whether it is still relevant/useful.
Attachment #731252 -
Flags: feedback?(benjamin) → feedback?(mh+mozilla)
Updated•12 years ago
|
Attachment #731252 -
Flags: feedback?(mh+mozilla) → feedback+
Comment 23•12 years ago
|
||
(In reply to :Ms2ger from comment #17)
> Comment on attachment 731252 [details] [diff] [review]
> Part 4: Move clang static-initializers detection over
>
> Review of attachment 731252 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: build/clang-plugin/tests/TestStaticInit.cpp
> @@ +1,1 @@
> > +__attribute__((constructor)) void foo() { // expected-warning {{function 'foo' called during static initialization}}
>
> This isn't called anymore
It doesn't matter (and it wasn't called before)
Assignee | ||
Comment 24•12 years ago
|
||
(In reply to Benjamin Smedberg [:bsmedberg] from comment #20)
> I really very much want the NS_STACK_CLASS tests to continue to exist, even
> if they move to build/clang-plugin/tests
They are retained, in similar form, by the code in part 1.
(In reply to Benjamin Smedberg [:bsmedberg] from comment #21)
> Perhaps I marked r+ too quickly. It appears that there is a fundamental
> difference between NS_STACK_CLASS and MOZ_STACK_CLASS, and I'm not sure it's
> good! It appears that MOZ_STACK_CLASS does not automatically propagate to
> classes that inherit or include an instance member of the marked class?
> Instead you have to explicitly annotate every class in the tree as a stack
> class? That seems pretty unfortunate.
The decision for the latter point is that, since most of the MOZ_STACK_CLASS values are basically RAII things, it's probably better to explicitly annotate that a class must be located on the stack rather than having it be automatically inferred and getting surprised later. I'm personally of the opinion that's it better to be explicit about what should be going on than letting the compiler infer it and get a mysterious error later down the line.
Assignee | ||
Comment 25•12 years ago
|
||
This just removes the attributes from nscore.h
Attachment #731251 -
Attachment is obsolete: true
Attachment #734910 -
Flags: review?(benjamin)
Updated•12 years ago
|
Attachment #734910 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 26•12 years ago
|
||
Parts 1-3 checked in:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d565aefe20b9
https://hg.mozilla.org/integration/mozilla-inbound/rev/772ef35c06d3
https://hg.mozilla.org/integration/mozilla-inbound/rev/a0d3abbee125
https://hg.mozilla.org/integration/mozilla-inbound/rev/250fc9026b5a
https://hg.mozilla.org/integration/mozilla-inbound/rev/abc42da07933
https://hg.mozilla.org/integration/mozilla-inbound/rev/8b5bc945e72f
https://hg.mozilla.org/integration/mozilla-inbound/rev/3a772aaaa017
https://hg.mozilla.org/integration/mozilla-inbound/rev/2a343ec4a75c
https://hg.mozilla.org/integration/mozilla-inbound/rev/ece8b0253775
https://hg.mozilla.org/integration/mozilla-inbound/rev/13c33b6d787d
Whiteboard: [leave open]
Comment 27•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d565aefe20b9
https://hg.mozilla.org/mozilla-central/rev/772ef35c06d3
https://hg.mozilla.org/mozilla-central/rev/a0d3abbee125
https://hg.mozilla.org/mozilla-central/rev/250fc9026b5a
https://hg.mozilla.org/mozilla-central/rev/abc42da07933
https://hg.mozilla.org/mozilla-central/rev/8b5bc945e72f
https://hg.mozilla.org/mozilla-central/rev/3a772aaaa017
https://hg.mozilla.org/mozilla-central/rev/2a343ec4a75c
https://hg.mozilla.org/mozilla-central/rev/ece8b0253775
https://hg.mozilla.org/mozilla-central/rev/13c33b6d787d
Assignee | ||
Comment 29•11 years ago
|
||
(In reply to :Ehsan Akhgari (lagging on bugmail, needinfo? me!) from comment #28)
> Is there anything else to be done here?
I never ported the detecting static constructors patch to the clang-based approach, since I could never quite get it working without false positives. As a result, I also never checked in the cleanup of the dehydra analyses.
Flags: needinfo?(Pidgeot18)
Comment 30•11 years ago
|
||
(In reply to Joshua Cranmer [:jcranmer] from comment #29)
> (In reply to :Ehsan Akhgari (lagging on bugmail, needinfo? me!) from comment
> #28)
> > Is there anything else to be done here?
>
> I never ported the detecting static constructors patch to the clang-based
> approach, since I could never quite get it working without false positives.
Weren't you also getting false negatives due to the difference in how gcc and clang emit static constructors? (gcc emitting more)
Assignee | ||
Comment 31•11 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #30)
> (In reply to Joshua Cranmer [:jcranmer] from comment #29)
> > (In reply to :Ehsan Akhgari (lagging on bugmail, needinfo? me!) from comment
> > #28)
> > > Is there anything else to be done here?
> >
> > I never ported the detecting static constructors patch to the clang-based
> > approach, since I could never quite get it working without false positives.
>
> Weren't you also getting false negatives due to the difference in how gcc
> and clang emit static constructors? (gcc emitting more)
I don't recall. I know the patch on this bug for that topic has a false positive in an STL file which fired on about 2/3 of our code (or, basically, any templated class).
Updated•7 years ago
|
Product: Core → Firefox Build System
Comment 33•7 years ago
|
||
Yeah, I think we can close this one out now.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(nika)
Resolution: --- → WONTFIX
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•