bug 527590: make it an error to hide a virtual method declaration by overloading it in a derived class. (use |using base::method;| if you really mean to do that). rs=bsmedberg
☠☠ backed out by daac462ec718 ☠ ☠
authorChris Jones <jones.chris.g@gmail.com>
Mon, 16 Nov 2009 17:57:21 -0600
changeset 34919 b68f602ce9499195c1d340838ae6c64f96efac7b
parent 34918 fd4c859d08bd502a5678f77d4b8122073bff06d6
child 34920 5b2432ac33258fa6f0b990304c19acd9115b7af3
child 34931 daac462ec71816005dbc9c90d45a4d0e4a1d7c9c
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs527590
milestone1.9.3a1pre
bug 527590: make it an error to hide a virtual method declaration by overloading it in a derived class. (use |using base::method;| if you really mean to do that). rs=bsmedberg
accessible/src/base/nsBaseWidgetAccessible.h
accessible/src/base/nsOuterDocAccessible.h
accessible/src/html/nsHTMLAreaAccessible.h
accessible/src/xul/nsXULTreeAccessible.h
accessible/src/xul/nsXULTreeGridAccessible.h
configure.in
content/base/src/nsDocument.h
content/html/content/src/nsHTMLAnchorElement.cpp
content/html/content/src/nsHTMLBodyElement.cpp
content/html/content/src/nsHTMLOptionElement.cpp
content/html/content/src/nsHTMLScriptElement.cpp
content/html/content/src/nsHTMLTitleElement.cpp
dom/interfaces/xul/nsIDOMXULMultSelectCntrlEl.idl
layout/generic/nsVideoFrame.h
layout/tables/nsTableOuterFrame.h
widget/src/gtk2/nsPrintSettingsGTK.h
--- a/accessible/src/base/nsBaseWidgetAccessible.h
+++ b/accessible/src/base/nsBaseWidgetAccessible.h
@@ -52,16 +52,18 @@ class nsIDOMNode;
   */
 
 /** 
   * Leaf version of DOM Accessible -- has no children
   */
 class nsLeafAccessible : public nsAccessibleWrap
 {
 public:
+  using nsAccessible::GetChildAtPoint;
+
   nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
   virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
                                    PRBool aDeepestChild,
--- a/accessible/src/base/nsOuterDocAccessible.h
+++ b/accessible/src/base/nsOuterDocAccessible.h
@@ -46,16 +46,18 @@ class nsIWeakReference;
 
 class nsOuterDocAccessible : public nsAccessibleWrap
 {
   // XXX: why is it private?
   // CVS comment: <aaronl@netscape.com> 2003-04-01 14:15 Fixing bustage
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
+  using nsAccessible::GetChildAtPoint;
+
   nsOuterDocAccessible(nsIDOMNode* aNode, 
                        nsIWeakReference* aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString& aDescription);
   NS_IMETHOD DoAction(PRUint8 aIndex);
--- a/accessible/src/html/nsHTMLAreaAccessible.h
+++ b/accessible/src/html/nsHTMLAreaAccessible.h
@@ -43,16 +43,18 @@
 
 /**
  * Accessible for image map areas - must be child of image.
  */
 class nsHTMLAreaAccessible : public nsHTMLLinkAccessible
 {
 
 public:
+  using nsAccessible::GetChildAtPoint;
+
   nsHTMLAreaAccessible(nsIDOMNode *domNode, nsIAccessible *accParent,
                        nsIWeakReference* aShell);
 
   // nsIAccessible
   NS_IMETHOD GetDescription(nsAString& aDescription);
 
   NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
 
--- a/accessible/src/xul/nsXULTreeAccessible.h
+++ b/accessible/src/xul/nsXULTreeAccessible.h
@@ -59,16 +59,18 @@ const PRUint32 kDefaultTreeCacheSize = 2
   0x6176,                                               \
   0x42ee,                                               \
   { 0xb8, 0xe1, 0x2c, 0x44, 0xb0, 0x41, 0x85, 0xe3 }    \
 }
 
 class nsXULTreeAccessible : public nsXULSelectableAccessible
 {
 public:
+  using nsAccessible::GetChildAtPoint;
+
   nsXULTreeAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeAccessible,
                                            nsAccessible)
 
   // nsIAccessible
--- a/accessible/src/xul/nsXULTreeGridAccessible.h
+++ b/accessible/src/xul/nsXULTreeGridAccessible.h
@@ -72,16 +72,18 @@ protected:
 
 /**
  * Represents accessible for XUL tree item in the case when XUL tree has
  * multiple columns.
  */
 class nsXULTreeGridRowAccessible : public nsXULTreeItemAccessibleBase
 {
 public:
+  using nsAccessible::GetChildAtPoint;
+
   nsXULTreeGridRowAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
                              nsIAccessible *aParent, nsITreeBoxObject *aTree,
                              nsITreeView *aTreeView, PRInt32 aRow);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridRowAccessible,
                                            nsAccessible)
--- a/configure.in
+++ b/configure.in
@@ -1472,17 +1472,17 @@ else
     DSO_PIC_CFLAGS='-KPIC'
     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
 fi
 
 if test "$GNU_CXX"; then
     # FIXME: Let us build with strict aliasing. bug 414641.
     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
     # Turn on GNU specific features
-    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
+    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
     if test -z "$INTEL_CC"; then
        # Don't use -Wcast-align with ICC
        case "$CPU_ARCH" in
            # And don't use it on hppa, ia64, sparc, since it's noisy there
            hppa | ia64 | sparc)
            ;;
            *)
         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
@@ -1502,19 +1502,44 @@ if test "$GNU_CXX"; then
             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
             AC_TRY_COMPILE([],
                            [return(0);],
                            ac_has_wno_invalid_offsetof="yes",
                            ac_has_wno_invalid_offsetof="no")
             CXXFLAGS="$_SAVE_CXXFLAGS"
             AC_LANG_RESTORE
         ])
+
     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
     fi
+
+    AC_CACHE_CHECK(whether the compiler supports -Werror=overloaded-virtual,
+                   ac_has_werror_overloaded_virtual,
+        [
+            AC_LANG_SAVE
+            AC_LANG_CPLUSPLUS
+            _SAVE_CXXFLAGS="$CXXFLAGS"
+            CXXFLAGS="$CXXFLAGS -Werror=overloaded-virtual"
+            AC_TRY_COMPILE([],
+                           [return(0);],
+                           ac_has_werror_overloaded_virtual="yes",
+                           ac_has_werror_overloaded_virtual="no")
+            CXXFLAGS="$_SAVE_CXXFLAGS"
+            AC_LANG_RESTORE
+        ])
+
+    if test "$ac_has_werror_overloaded_virtual" = "yes"; then
+        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=overloaded-virtual"
+    else
+        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual"
+    fi
+
+ 
+
 else
     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
 fi
 
 dnl gcc can come with its own linker so it is better to use the pass-thru calls
 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
 dnl normal behavior.
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -576,16 +576,18 @@ class nsDocument : public nsIDocument,
                    public nsIScriptObjectPrincipal,
                    public nsIRadioGroupContainer,
                    public nsIDOMNodeSelector,
                    public nsIApplicationCacheContainer,
                    public nsIDOMXPathNSResolver,
                    public nsStubMutationObserver
 {
 public:
+  using nsINode::GetScriptTypeID;
+
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   virtual void Reset(nsIChannel *aChannel, nsILoadGroup *aLoadGroup);
   virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
                           nsIPrincipal* aPrincipal);
 
   // StartDocumentLoad is pure virtual so that subclasses must override it.
   // The nsDocument StartDocumentLoad does some setup, but does NOT set
--- a/content/html/content/src/nsHTMLAnchorElement.cpp
+++ b/content/html/content/src/nsHTMLAnchorElement.cpp
@@ -63,16 +63,18 @@ nsresult NS_NewPreContentIterator(nsICon
 
 class nsHTMLAnchorElement : public nsGenericHTMLElement,
                             public nsIDOMHTMLAnchorElement,
                             public nsIDOMNSHTMLAnchorElement2,
                             public nsILink,
                             public Link
 {
 public:
+  using nsGenericElement::GetText;
+
   nsHTMLAnchorElement(nsINodeInfo *aNodeInfo);
   virtual ~nsHTMLAnchorElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
--- a/content/html/content/src/nsHTMLBodyElement.cpp
+++ b/content/html/content/src/nsHTMLBodyElement.cpp
@@ -80,16 +80,19 @@ public:
 };
 
 //----------------------------------------------------------------------
 
 class nsHTMLBodyElement : public nsGenericHTMLElement,
                           public nsIDOMHTMLBodyElement
 {
 public:
+  using nsGenericHTMLElement::GetText;
+  using nsGenericElement::SetText;
+
   nsHTMLBodyElement(nsINodeInfo *aNodeInfo);
   virtual ~nsHTMLBodyElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
--- a/content/html/content/src/nsHTMLOptionElement.cpp
+++ b/content/html/content/src/nsHTMLOptionElement.cpp
@@ -76,16 +76,19 @@
  */
 class nsHTMLOptionElement : public nsGenericHTMLElement,
                             public nsIDOMHTMLOptionElement,
                             public nsIDOMNSHTMLOptionElement,
                             public nsIJSNativeInitializer,
                             public nsIOptionElement
 {
 public:
+  using nsGenericElement::GetText;
+  using nsGenericElement::SetText;
+
   nsHTMLOptionElement(nsINodeInfo *aNodeInfo);
   virtual ~nsHTMLOptionElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
--- a/content/html/content/src/nsHTMLScriptElement.cpp
+++ b/content/html/content/src/nsHTMLScriptElement.cpp
@@ -304,16 +304,19 @@ nsHTMLScriptEventHandler::Invoke(nsISupp
 
 
 class nsHTMLScriptElement : public nsGenericHTMLElement,
                             public nsIDOMHTMLScriptElement,
                             public nsIDOMNSHTMLScriptElement,
                             public nsScriptElement
 {
 public:
+  using nsGenericElement::GetText;
+  using nsGenericElement::SetText;
+
   nsHTMLScriptElement(nsINodeInfo *aNodeInfo, PRBool aFromParser);
   virtual ~nsHTMLScriptElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
--- a/content/html/content/src/nsHTMLTitleElement.cpp
+++ b/content/html/content/src/nsHTMLTitleElement.cpp
@@ -46,16 +46,19 @@
 #include "nsContentUtils.h"
 #include "nsPLDOMEvent.h"
 
 class nsHTMLTitleElement : public nsGenericHTMLElement,
                            public nsIDOMHTMLTitleElement,
                            public nsStubMutationObserver
 {
 public:
+  using nsGenericElement::GetText;
+  using nsGenericElement::SetText;
+
   nsHTMLTitleElement(nsINodeInfo *aNodeInfo);
   virtual ~nsHTMLTitleElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
--- a/dom/interfaces/xul/nsIDOMXULMultSelectCntrlEl.idl
+++ b/dom/interfaces/xul/nsIDOMXULMultSelectCntrlEl.idl
@@ -37,16 +37,20 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMXULSelectCntrlEl.idl"
 
 [scriptable, uuid(82c72eca-9886-473e-94cd-9de5694b3f88)]
 interface nsIDOMXULMultiSelectControlElement : nsIDOMXULSelectControlElement
 {
+%{C++
+  using nsIDOMXULSelectControlElement::GetSelectedItem;
+%}C++
+
   attribute DOMString selType;
 
   attribute nsIDOMXULSelectControlItemElement currentItem;
   attribute long currentIndex;
 
   readonly attribute nsIDOMNodeList selectedItems;
   
   void addItemToSelection(in nsIDOMXULSelectControlItemElement item);
--- a/layout/generic/nsVideoFrame.h
+++ b/layout/generic/nsVideoFrame.h
@@ -50,16 +50,18 @@
 #include "nsTArray.h"
 #include "nsIAnonymousContentCreator.h"
 
 nsIFrame* NS_NewVideoFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 class nsVideoFrame : public nsContainerFrame, public nsIAnonymousContentCreator
 {
 public:
+  using nsFrame::GetIntrinsicSize;
+
   nsVideoFrame(nsStyleContext* aContext);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
--- a/layout/tables/nsTableOuterFrame.h
+++ b/layout/tables/nsTableOuterFrame.h
@@ -83,16 +83,18 @@ 1. decide if we'll allow subclassing.  I
 /**
  * main frame for an nsTable content object, 
  * the nsTableOuterFrame contains 0 or one caption frame, and a nsTableFrame
  * pseudo-frame (referred to as the "inner frame').
  */
 class nsTableOuterFrame : public nsHTMLContainerFrame, public nsITableLayout
 {
 public:
+  using nsBox::GetMargin;
+
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   /** instantiate a new instance of nsTableRowFrame.
     * @param aPresShell the pres shell for this frame
     *
     * @return           the frame that was created
     */
--- a/widget/src/gtk2/nsPrintSettingsGTK.h
+++ b/widget/src/gtk2/nsPrintSettingsGTK.h
@@ -53,16 +53,18 @@ extern "C" {
 
 //*****************************************************************************
 //***    nsPrintSettingsGTK
 //*****************************************************************************
 
 class nsPrintSettingsGTK : public nsPrintSettings
 {
 public:
+  using nsPrintSettings::operator=;
+
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_PRINTSETTINGSGTK_IID)
 
   nsPrintSettingsGTK();
   virtual ~nsPrintSettingsGTK();
 
   // We're overriding these methods because we want to read/write with GTK objects,
   // not local variables. This allows a simpler settings implementation between