[llvm-commits] [127825] Fix previous patch.

dpatel at apple.com dpatel at apple.com
Wed May 30 11:47:22 PDT 2007


Revision: 127825
Author:   dpatel
Date:     2007-05-30 11:47:21 -0700 (Wed, 30 May 2007)

Log Message:
-----------
Fix previous patch.
Make it safer.  Return after defining APPLE_CC.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/c-cppbuiltin.c

Modified: apple-local/branches/llvm/gcc/c-cppbuiltin.c
===================================================================
--- apple-local/branches/llvm/gcc/c-cppbuiltin.c	2007-05-30 18:17:46 UTC (rev 127824)
+++ apple-local/branches/llvm/gcc/c-cppbuiltin.c	2007-05-30 18:47:21 UTC (rev 127825)
@@ -346,20 +346,27 @@
     const char *vt;
 
     vt = strstr (version_string, "build ");
-    if (vt == NULL)
-      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);      
+    if (vt == NULL) {
+      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);
+      return;
+    }
 
     vt += strlen ("build ");
-    if (! ISDIGIT (*vt))
-      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);      
+    if (! ISDIGIT (*vt)) {
+      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);
+      return;
+    }
     for (q = vt; *q != 0 && ISDIGIT (*q); q++)
       ;
-    if (q == vt || *q != ')')
-      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);      
+    if (q == vt || *q != ')') {
+      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);
+      return;
+    }
 
     if ((q - vt != 4 && q - vt != 5) || *vt == '0')
-      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);      
-    builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt);
+      builtin_define_with_value_n ("__APPLE_CC__", "1", 1);
+    else
+      builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt);
   }
 #endif /*CONFIG_DARWIN_H*/
 #endif /*LLVM_VERSION_INFO*/





More information about the llvm-commits mailing list