fix -Wunused-variable
authorIgor Sugak <sugak@fb.com>
Tue, 7 Nov 2017 23:59:54 +0000 (15:59 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 8 Nov 2017 00:25:33 +0000 (16:25 -0800)
Summary:
Exposed by the latest clang:
```lang=bash
folly/test/FixedStringTest.cpp:52:36: error: unused variable 's' [-Werror,-Wunused-variable]
  constexpr folly::FixedString<42> s{"hello world"};
                                   ^
folly/gen/test/StringBenchmark.cpp:176:15: error: unused variable 'line' [-Werror,-Wunused-variable]
  StringPiece line(kLine);
              ^
```

Reviewed By: yfeldblum

Differential Revision: D6264853

fbshipit-source-id: 5cf4b0a8c99eaa31c2499746c70ddc49fdd73074

folly/gen/test/StringBenchmark.cpp
folly/test/FixedStringTest.cpp

index 1300335fd373614effd93f821bfe9c3590e9238c..96143b081ea63cae55993f67eb769896cd089298 100644 (file)
@@ -173,7 +173,6 @@ BENCHMARK_RELATIVE(StringUnsplit_Old_ReusedBuffer, iters) {
 
 BENCHMARK_RELATIVE(StringUnsplit_Gen, iters) {
   size_t s = 0;
-  StringPiece line(kLine);
   while (iters--) {
     fbstring joined = from(testStrVector) | unsplit(',');
     s += joined.size();
index 437bd67ce82b5205f463dfeee9d5f7827d087c0a..bf3e943d9d8f5a57ef77e19b7e2a9a20f30c84ff 100644 (file)
@@ -50,6 +50,7 @@ TEST(FixedStringCtorTest, Default) {
 
 TEST(FixedStringCtorTest, FromLiterals) {
   constexpr folly::FixedString<42> s{"hello world"};
+  static_assert(s[0] == 'h', "");
   constexpr folly::FixedString<11> s2{"hello world"};
   static_assert(s2[0] == 'h', "");
   static_assert(s2[10] == 'd', "");