From 3d8e7a0d23e3608b3bc464c9ba329eecb3906a75 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Mon, 5 Dec 2011 17:10:05 -0500 Subject: [PATCH] Bug 707352 - Remove NS_FINAL_CLASS completely. r=cjones --- xpcom/analysis/final.js | 37 ------------------- xpcom/base/nscore.h | 3 -- xpcom/glue/nsCOMPtr.h | 1 - xpcom/tests/static-checker/Makefile.in | 8 ---- xpcom/tests/static-checker/TestFinal.cpp | 11 ------ .../static-checker/TestFinalFunction.cpp | 9 ----- .../TestFinalGrandparentFunction.cpp | 12 ------ .../static-checker/TestFinalTemplate.cpp | 12 ------ 8 files changed, 93 deletions(-) delete mode 100644 xpcom/analysis/final.js delete mode 100644 xpcom/tests/static-checker/TestFinal.cpp delete mode 100644 xpcom/tests/static-checker/TestFinalFunction.cpp delete mode 100644 xpcom/tests/static-checker/TestFinalGrandparentFunction.cpp delete mode 100644 xpcom/tests/static-checker/TestFinalTemplate.cpp diff --git a/xpcom/analysis/final.js b/xpcom/analysis/final.js deleted file mode 100644 index a0a880a268a..00000000000 --- a/xpcom/analysis/final.js +++ /dev/null @@ -1,37 +0,0 @@ -function process_type(c) -{ - if ((c.kind == 'class' || c.kind == 'struct') && !c.isIncomplete) { - for each (let base in c.bases) - if (isFinal(base.type)) - error("Class '" + c.name + "' derives from final class '" + base.type.name + "'.", c.loc); - } -} - -function process_function(decl, body) -{ - if (!decl.memberOf) - return; - - let c = decl.memberOf; - if ((c.kind == 'class' || c.kind == 'struct') && !c.isIncomplete) { - for each (let base in ancestorTypes(c)) - for each (let member in base.members) - if (member.isFunction && isFinal(member) && member.shortName == decl.shortName) - error("Function '" + decl.name + "' overrides final ancestor in '" + - base.name + "'.", c.loc); - } -} - -function ancestorTypes(c) -{ - for each (let base in c.bases) { - yield base.type; - for (let bb in ancestorTypes(base.type)) - yield bb; - } -} - -function isFinal(c) -{ - return hasAttribute(c, 'NS_final'); -} diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index 5ff864b5ab4..a74f61c3420 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -473,7 +473,6 @@ typedef PRUint32 nsrefcnt; * Static type annotations, enforced when static-checking is enabled: * * NS_STACK_CLASS: a class which must only be instantiated on the stack - * NS_FINAL_CLASS: a class which may not be subclassed * * NS_MUST_OVERRIDE: * a method which every immediate subclass of this class must @@ -490,13 +489,11 @@ typedef PRUint32 nsrefcnt; #define NS_STACK_CLASS __attribute__((user("NS_stack"))) #define NS_OKONHEAP __attribute__((user("NS_okonheap"))) #define NS_SUPPRESS_STACK_CHECK __attribute__((user("NS_suppress_stackcheck"))) -#define NS_FINAL_CLASS __attribute__((user("NS_final"))) #define NS_MUST_OVERRIDE __attribute__((user("NS_must_override"))) #else #define NS_STACK_CLASS #define NS_OKONHEAP #define NS_SUPPRESS_STACK_CHECK -#define NS_FINAL_CLASS #define NS_MUST_OVERRIDE #endif diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h index b58ab33b11d..5caec9e638d 100644 --- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -431,7 +431,6 @@ nsCOMPtr_base template class - NS_FINAL_CLASS NS_STACK_CLASS nsDerivedSafe : public T /* diff --git a/xpcom/tests/static-checker/Makefile.in b/xpcom/tests/static-checker/Makefile.in index 0b47ad6d665..ce9af5ef864 100644 --- a/xpcom/tests/static-checker/Makefile.in +++ b/xpcom/tests/static-checker/Makefile.in @@ -46,13 +46,6 @@ NEED_MDDEPDIR = 1 include $(DEPTH)/config/autoconf.mk -FINAL_FAILURE_TESTCASES = \ - TestFinal.cpp \ - TestFinalTemplate.cpp \ - TestFinalFunction.cpp \ - TestFinalGrandparentFunction.cpp \ - $(NULL) - STACK_FAILURE_TESTCASES = \ TestStack.cpp \ TestStackTemplate.cpp \ @@ -152,7 +145,6 @@ STATIC_INIT_WARNING_TESTCASES = \ $(NULL) STATIC_FAILURE_TESTCASES = \ - $(FINAL_FAILURE_TESTCASES) \ $(FLOW_FAILURE_TESTCASES) \ $(MUST_OVERRIDE_FAILURE_TESTCASES) \ $(OVERRIDE_FAILURE_TESTCASES) \ diff --git a/xpcom/tests/static-checker/TestFinal.cpp b/xpcom/tests/static-checker/TestFinal.cpp deleted file mode 100644 index 31e641a9cbf..00000000000 --- a/xpcom/tests/static-checker/TestFinal.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "nscore.h" - -struct NS_FINAL_CLASS A -{ - int i; -}; - -struct B : A -{ - int j; -}; diff --git a/xpcom/tests/static-checker/TestFinalFunction.cpp b/xpcom/tests/static-checker/TestFinalFunction.cpp deleted file mode 100644 index d2008b4e94a..00000000000 --- a/xpcom/tests/static-checker/TestFinalFunction.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "nscore.h" - -class Base { - virtual void NS_FINAL final() {} -}; - -class Derived : public Base { - virtual void final() {} -}; diff --git a/xpcom/tests/static-checker/TestFinalGrandparentFunction.cpp b/xpcom/tests/static-checker/TestFinalGrandparentFunction.cpp deleted file mode 100644 index 66f117f2b20..00000000000 --- a/xpcom/tests/static-checker/TestFinalGrandparentFunction.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "nscore.h" - -class Base { - virtual void NS_FINAL final() {} -}; - -class Derived : public Base { -}; - -class VeryDerived : public Derived { - void final() {} -}; diff --git a/xpcom/tests/static-checker/TestFinalTemplate.cpp b/xpcom/tests/static-checker/TestFinalTemplate.cpp deleted file mode 100644 index e274036818b..00000000000 --- a/xpcom/tests/static-checker/TestFinalTemplate.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "nscore.h" - -template -struct NS_FINAL_CLASS A -{ - T i; -}; - -struct Bint : A -{ - int j; -};