浏览代码

objectivec: Quash -Wself-assign and -Wvla (#4897)

* objectivec: Quash -Wself-assign

* objectivec: Set -Wno-vla when building

Objective-C protobuf uses VLAs for performance reasons. Ensure Clang
doesn’t complain about them.
Benjamin Barenblat 7 年之前
父节点
当前提交
048f5c26a7
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 3 0
      BUILD
  2. 1 1
      objectivec/Tests/GPBTestUtilities.m

+ 3 - 0
BUILD

@@ -934,6 +934,9 @@ OBJC_SRCS = [
 objc_library(
     name = "objectivec",
     hdrs = OBJC_HDRS + OBJC_PRIVATE_HDRS,
+    copts = [
+        "-Wno-vla",
+    ],
     includes = [
         "objectivec",
     ],

+ 1 - 1
objectivec/Tests/GPBTestUtilities.m

@@ -85,7 +85,7 @@ const uint32_t kGPBDefaultRepeatCount = 2;
   NSLog(@"Wrote data file to %@", path);
 #else
   // Kill off the unused variable warning.
-  dataToWrite = dataToWrite;
+  (void)dataToWrite;
 #endif
   return data;
 }