Skip to content

Fix CMake build and lint warnings in field_value.cc #677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Firestore/core/src/firebase/firestore/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

add_library(
cc_library(
firebase_firestore_model
field_value.cc
)
target_link_libraries(
firebase_firestore_model
firebase_firestore_util
SOURCES
field_value.cc
DEPENDS
firebase_firestore_util
)
5 changes: 3 additions & 2 deletions Firestore/core/src/firebase/firestore/model/field_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <algorithm>
#include <memory>
#include <utility>
#include <vector>

#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h"
Expand Down Expand Up @@ -159,15 +160,15 @@ void FieldValue::SwitchTo(const Type type) {
case Type::Array:
array_value_.~vector();
break;
default:; // The other types where there is nothing to worry about.
default: {} // The other types where there is nothing to worry about.
}
tag_ = type;
// Must call constructor explicitly for any non-POD type to initialize.
switch (tag_) {
case Type::Array:
new (&array_value_) std::vector<const FieldValue>();
break;
default:; // The other types where there is nothing to worry about.
default: {} // The other types where there is nothing to worry about.
}
}

Expand Down
9 changes: 4 additions & 5 deletions Firestore/core/test/firebase/firestore/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

cc_test(
firebase_firestore_model_test
field_value_test.cc
)
target_link_libraries(
firebase_firestore_model_test
firebase_firestore_model
SOURCES
field_value_test.cc
DEPENDS
firebase_firestore_model
)