From d771d09d23b0f14791c45f3009ecd12d974ff81c Mon Sep 17 00:00:00 2001 From: "mikhail.naganov@gmail.com" Date: Mon, 14 Nov 2011 11:36:04 +0000 Subject: [PATCH] Fix static const weirdness in both gcc and msvs compatible way. Afterpatch for r9985. Review URL: http://codereview.chromium.org/8565005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9986 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/objects.cc b/src/objects.cc index 88efc3c..0a3508d 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -205,13 +205,6 @@ MaybeObject* Object::GetPropertyWithReceiver(Object* receiver, } -// This may seem strange but the standard requires inline static const -// definition, and w/o these the code doesn't link when being built in debug -// mode using gcc. -const int JSObject::kGetterIndex; -const int JSObject::kSetterIndex; - - MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver, Object* structure, String* name) { @@ -4638,7 +4631,11 @@ Object* JSObject::LookupAccessor(String* name, bool is_getter) { } // Make the lookup and include prototypes. - int accessor_index = is_getter ? kGetterIndex : kSetterIndex; + // Introducing constants below makes static constants usage purely static + // and avoids linker errors in debug build using gcc. + const int getter_index = kGetterIndex; + const int setter_index = kSetterIndex; + int accessor_index = is_getter ? getter_index : setter_index; uint32_t index = 0; if (name->AsArrayIndex(&index)) { for (Object* obj = this; -- 2.7.4