Skip to content

Commit

Permalink
Disable -Wrange-loop-analysis for abseil (firebase#807)
Browse files Browse the repository at this point in the history
absl includes code like this:
```
void fn(std::initializer_list<absl::string_view> pieces) {
  ...
  for (const absl::string_view piece : pieces) total_size += piece.size();
```

clang objects, suggesting that a reference should be used instead, i.e.:
```
  for (const absl::string_view& piece : pieces) total_size += piece.size();
```

But:
a) we don't want to touch absl code
b) string_views are cheap to copy (and absl recommends copying
string_views rather than taking references as it may result in smaller
code)
c) some brief, naive benchmarking suggests there's no significant
different in this case (i.e. (b) is correct.)

Note that -Wrange-loop-analysis is already exlicitly enabled in our
cmake build.
  • Loading branch information
rsgowman authored Feb 16, 2018
1 parent c468c5a commit 3af3e03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
]

ss.library = 'c++'
ss.compiler_flags = '$(inherited) ' + '-Wno-comma'
ss.compiler_flags = '$(inherited) ' + '-Wno-comma -Wno-range-loop-analysis'
end
end

0 comments on commit 3af3e03

Please sign in to comment.