Reviewed by Dave Harrison.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2005 00:22:55 +0000 (00:22 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2005 00:22:55 +0000 (00:22 +0000)
        - fixed problems preventing us from compiling with gcc 4.0

        * JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from
        WARNING_CPLUSPLUSFLAGS since it's now a C-only warning.

        * bindings/jni/jni_jsobject.cpp:
        (JSObject::getSlot): Changed some %d to %ld where the parameters where long ints.
        (JSObject::setSlot): Ditto.
        * bindings/jni/jni_utility.cpp:
        (KJS::Bindings::getJavaVM): Ditto.
        (KJS::Bindings::getJNIEnv): Ditto.
        * bindings/objc/objc_utility.mm: Fixed include of <JavascriptCore/internal.h> that needed the
        letter "S" capitalized.
        * kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to
        avoid incorrect gcc 4.0 warning.
        * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check
        the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment.
        Prevents a crash on garbage collect when compiled with gcc 4.0.
        * kjs/nodes.cpp:
        (WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning.
        (ForNode::execute): Ditto.
        (SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning.
        (LabelNode::execute): Ditto.
        * kjs/string_object.cpp: (replace): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9078 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj
JavaScriptCore/bindings/jni/jni_jsobject.cpp
JavaScriptCore/bindings/jni/jni_utility.cpp
JavaScriptCore/bindings/objc/objc_utility.mm
JavaScriptCore/kjs/bool_object.cpp
JavaScriptCore/kjs/collector.cpp
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/string_object.cpp

index 6e9ed2542b7e7363f3b1cc0323766f7f08cfea56..d59fdade30738964ba1b0eabcf16b9c3ada5f60c 100644 (file)
@@ -1,3 +1,32 @@
+2005-04-28  Darin Adler  <darin@apple.com>
+
+        Reviewed by Dave Harrison.
+
+        - fixed problems preventing us from compiling with gcc 4.0
+
+        * JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from
+        WARNING_CPLUSPLUSFLAGS since it's now a C-only warning.
+
+        * bindings/jni/jni_jsobject.cpp:
+        (JSObject::getSlot): Changed some %d to %ld where the parameters where long ints.
+        (JSObject::setSlot): Ditto.
+        * bindings/jni/jni_utility.cpp:
+        (KJS::Bindings::getJavaVM): Ditto.
+        (KJS::Bindings::getJNIEnv): Ditto.
+        * bindings/objc/objc_utility.mm: Fixed include of <JavascriptCore/internal.h> that needed the
+        letter "S" capitalized.
+        * kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to
+        avoid incorrect gcc 4.0 warning.
+        * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check
+        the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment.
+        Prevents a crash on garbage collect when compiled with gcc 4.0.
+        * kjs/nodes.cpp:
+        (WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning.
+        (ForNode::execute): Ditto.
+        (SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning.
+        (LabelNode::execute): Ditto.
+        * kjs/string_object.cpp: (replace): Ditto.
+
 2005-04-26  Richard Williamson   <rjw@apple.com>
 
        Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla
index 0bfff49610231041ad54cfe74ce1b2fedddd21bb..2ecf872359ecb1abef54bd4a6e812b9d3e9a2479 100644 (file)
                                SECTORDER_FLAGS = "-sectorder __TEXT __text /AppleInternal/OrderFiles/JavaScriptCore.order";
                                STYLE_LDFLAGS = "-umbrella WebKit -allowable_client JavaScriptGlue";
                                USE_GCC3_PFE_SUPPORT = YES;
-                               WARNING_CFLAGS = "-Werror -Wall -W -Wcast-align -Wchar-subscripts -Wformat-security -Wmissing-format-attribute -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Wno-format-y2k -Wno-unused-parameter -Wno-long-double";
+                               WARNING_CFLAGS = "$(WARNING_COMMONFLAGS) -Wmissing-prototypes";
+                               WARNING_COMMONFLAGS = "-Werror -Wall -W -Wcast-align -Wchar-subscripts -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-format-y2k -Wno-unused-parameter -Wno-long-double";
+                               WARNING_CPLUSPLUSFLAGS = "$(WARNING_COMMONFLAGS)";
                                WRAPPER_EXTENSION = framework;
                        };
                        dependencies = (
index 0f862832150b3aab523ad3b981eb3f3c9bfc3503..43c329e75f3bbe37fa33c19d2b3f704f001d1ff4 100644 (file)
@@ -254,7 +254,7 @@ void JSObject::removeMember(jstring memberName) const
 
 jobject JSObject::getSlot(jint index) const
 {
-    JS_LOG ("index = %d\n", index);
+    JS_LOG ("index = %ld\n", index);
 
     ExecState *exec = _root->interpreter()->globalExec();
     Interpreter::lock();
@@ -267,7 +267,7 @@ jobject JSObject::getSlot(jint index) const
 
 void JSObject::setSlot(jint index, jobject value) const
 {
-    JS_LOG ("index = %d, value = %p\n", index, value);
+    JS_LOG ("index = %ld, value = %p\n", index, value);
 
     ExecState *exec = _root->interpreter()->globalExec();
     Interpreter::lock();
index 314c8ee683ec71dc1f0a89cc68d4deb62987e2e2..ec323bb86140158f83b9ae06d449306e522c1081 100644 (file)
@@ -50,7 +50,7 @@ JavaVM *KJS::Bindings::getJavaVM()
         jvm = jvmArray[0];
     }
     else 
-        fprintf(stderr, "%s: JNI_GetCreatedJavaVMs failed, returned %d\n", __PRETTY_FUNCTION__, jniError);
+        fprintf(stderr, "%s: JNI_GetCreatedJavaVMs failed, returned %ld\n", __PRETTY_FUNCTION__, jniError);
         
     return jvm;
 }
@@ -64,7 +64,7 @@ JNIEnv *KJS::Bindings::getJNIEnv()
     if ( jniError == JNI_OK )
         return env;
     else
-        fprintf(stderr, "%s: AttachCurrentThread failed, returned %d\n", __PRETTY_FUNCTION__, jniError);
+        fprintf(stderr, "%s: AttachCurrentThread failed, returned %ld\n", __PRETTY_FUNCTION__, jniError);
     return NULL;
 }
 
index 82113dfcab45bf0a52320e4d8f1d09a1f2aff0db..e9af26524b074dfa864a44691a625db890605e1a 100644 (file)
@@ -24,7 +24,7 @@
  */
 #include <Foundation/Foundation.h>
 
-#include <JavascriptCore/internal.h>
+#include <JavaScriptCore/internal.h>
 
 #include <objc_instance.h>
 #include <objc_utility.h>
index d9722fed0d22b69abfebf3dad151142c264d727d..d17dce57856a676e5e32a926b255b897094c56eb 100644 (file)
@@ -93,8 +93,7 @@ Value BooleanProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &/*
 
   if (id == ToString)
     return String(v.toString(exec));
-  else
-    return Boolean(v.toBoolean(exec)); /* TODO: optimize for bool case */
+  return Boolean(v.toBoolean(exec)); /* TODO: optimize for bool case */
 }
 
 // ------------------------------ BooleanObjectImp -----------------------------
index 01da57fd28f7ca188caa1603931f6f36f4d3e4f8..f37010fe58c1223ac6897773e8478a56b6d4385a 100644 (file)
@@ -214,9 +214,10 @@ void Collector::registerThread()
   }
 }
 
+#define IS_POINTER_ALIGNED(p) (((int)(p) & (sizeof(char *) - 1)) == 0)
 
-// cells are 8-byte aligned 
-#define IS_POINTER_ALIGNED(p) (((int)(p) & 7) == 0)
+// cells are 8-byte aligned
+#define IS_CELL_ALIGNED(p) (((int)(p) & 7) == 0)
 
 void Collector::markStackObjectsConservatively(void *start, void *end)
 {
@@ -235,7 +236,7 @@ void Collector::markStackObjectsConservatively(void *start, void *end)
   
   while (p != e) {
     char *x = *p++;
-    if (IS_POINTER_ALIGNED(x) && x) {
+    if (IS_CELL_ALIGNED(x) && x) {
       bool good = false;
       for (int block = 0; block < heap.usedBlocks; block++) {
        size_t offset = x - (char *)heap.blocks[block];
index 8dd48d4950a9b4bc4e32c90c2421a0e658fe0326..e55d8d36ec5c865f8ae34e75bdfadcfabb0a90b7 100644 (file)
@@ -1932,6 +1932,8 @@ Completion WhileNode::execute(ExecState *exec)
     if (c.complType() != Normal)
       return c;
   }
+
+  return Completion(); // work around gcc 4.0 bug
 }
 
 void WhileNode::processVarDecls(ExecState *exec)
@@ -2000,6 +2002,8 @@ Completion ForNode::execute(ExecState *exec)
       KJS_CHECKEXCEPTION
     }
   }
+  
+  return Completion(); // work around gcc 4.0 bug
 }
 
 void ForNode::processVarDecls(ExecState *exec)
@@ -2457,8 +2461,7 @@ Completion SwitchNode::execute(ExecState *exec)
 
   if ((res.complType() == Break) && ls.contains(res.target()))
     return Completion(Normal, res.value());
-  else
-    return res;
+  return res;
 }
 
 void SwitchNode::processVarDecls(ExecState *exec)
@@ -2496,8 +2499,7 @@ Completion LabelNode::execute(ExecState *exec)
 
   if ((e.complType() == Break) && (e.target() == label))
     return Completion(Normal, e.value());
-  else
-    return e;
+  return e;
 }
 
 void LabelNode::processVarDecls(ExecState *exec)
index 816917f6c7ad140be5d9e7c2434437f51c418c86..3bbff1d49b3309dc7752b66535f08994175c1583 100644 (file)
@@ -318,17 +318,16 @@ static Value replace(ExecState *exec, const UString &source, const Value &patter
     delete [] replacements;
 
     return String(result);
-  } else { // First arg is a string
-    UString patternString = pattern.toString(exec);
-    int matchPos = source.find(patternString);
-    int matchLen = patternString.size();
-    // Do the replacement
-    if (matchPos == -1)
-      return String(source);
-    else {
-      return String(source.substr(0, matchPos) + replacement.toString(exec) + source.substr(matchPos + matchLen));
-    }
   }
+  
+  // First arg is a string
+  UString patternString = pattern.toString(exec);
+  int matchPos = source.find(patternString);
+  int matchLen = patternString.size();
+  // Do the replacement
+  if (matchPos == -1)
+    return String(source);
+  return String(source.substr(0, matchPos) + replacement.toString(exec) + source.substr(matchPos + matchLen));
 }
 
 // ECMA 15.5.4.2 - 15.5.4.20