Closed Bug 537313 Opened 15 years ago Closed 15 years ago

Disable MSVC "warning C4355: 'this' : used in base member initializer list" in SVG's consumers of nsReferencedElement

Categories

(Core :: SVG, defect)

All
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(1 file)

As discussed in bug 474743 comment 62 & 63, we trigger this warning: warning C4355: 'this' : used in base member initializer list" in Microsoft Visual Studio's compiler, on the nsReferencedElement-owning classes in SVG. (nsSVGAnimationElement, nsSVGUseElement, nsSVGEffectsElement). In the init list for these classes' constructors, we pass the |this| pointer to a member variable (which happens to be a subclass of nsReferencedElement). The MSVC warning lets us know that it's unsafe to dereference the passed-in |this| pointer at this time -- however, we can safely ignore it, since we know that these nsReferencedElement subclasses don't dereference the pointer in their own constructors. Since we know what we're doing is safe here, I think we should explicitly disable the warning in these spots, to reduce warning-spam. Patch coming up.
Hardware: x86 → All
Attached patch fix (deleted) — Splinter Review
Here's the fix. I'm going to run this through the tryserver before requesting review, to verify that it fixes the warnings in these classes.
Yup, fixes the warnings on tryserver. Log from an earlier TryServer build (without fix): http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1262211088.1262218220.8487.gz&fulltext=1 Log from TryServer build with fix: http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1262213728.1262218501.11509.gz&fulltext=1 Warnings removed by this patch: >e:/builds/moz2_slave/win32-hg/build/content/svg/content/src/nsSVGUseElement.cpp(99) : warning C4355: 'this' : used in base member initializer list >e:/builds/moz2_slave/win32-hg/build/content/svg/content/src/nsSVGAnimationElement.cpp(74) : warning C4355: 'this' : used in base member initializer list >e:/builds/moz2_slave/win32-hg/build/layout/svg/base/src/nsSVGEffects.cpp(53) : warning C4355: 'this' : used in base member initializer list
Attachment #419616 - Flags: review?(roc)
FWIW: I'm waiting to land this until after bug 474743 lands, to prevent bitrot in that bug's patches. (I think there are conflicting chunks of contextual code in nsSVGAnimationElement.cpp between this bug's patch and some of that bug's patches)
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: