Enable clang's warning about implicit fallthrough.
This commit is contained in:
parent
ac2223b32d
commit
f00eb4f52d
|
@ -25,6 +25,7 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
|||
-Wmissing-prototypes
|
||||
-Wnewline-eof
|
||||
-Wshorten-64-to-32
|
||||
-Wimplicit-fallthrough
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ set(HEADERS
|
|||
parser/parser.hpp
|
||||
parser/query_builder.hpp
|
||||
util/atomic_shared_ptr.hpp
|
||||
util/compiler.hpp
|
||||
util/format.hpp
|
||||
util/thread_id.hpp
|
||||
util/thread_local.hpp)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "object_store.hpp"
|
||||
#include "schema.hpp"
|
||||
#include "util/compiler.hpp"
|
||||
#include "util/format.hpp"
|
||||
|
||||
#include <realm.hpp>
|
||||
|
@ -259,6 +260,7 @@ void add_link_constraint_to_query(realm::Query &query,
|
|||
switch (op) {
|
||||
case Predicate::Operator::NotEqual:
|
||||
query.Not();
|
||||
REALM_FALLTHROUGH;
|
||||
case Predicate::Operator::Equal: {
|
||||
size_t col = prop_expr.prop->table_column;
|
||||
query.links_to(col, query.get_table()->get_link_target(col)->get(row_index));
|
||||
|
@ -464,8 +466,8 @@ void do_add_null_comparison_to_query<Link>(Query &query, Predicate::Operator op,
|
|||
precondition(expr.indexes.empty(), "KeyPath queries not supported for object comparisons.");
|
||||
switch (op) {
|
||||
case Predicate::Operator::NotEqual:
|
||||
// for not equal we negate the query and then fallthrough
|
||||
query.Not();
|
||||
REALM_FALLTHROUGH;
|
||||
case Predicate::Operator::Equal:
|
||||
query.and_query(query.get_table()->column<Link>(expr.prop->table_column).is_null());
|
||||
break;
|
||||
|
|
|
@ -23,23 +23,12 @@
|
|||
#include "object_schema.hpp"
|
||||
#include "object_store.hpp"
|
||||
#include "util/format.hpp"
|
||||
#include "util/compiler.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace realm;
|
||||
|
||||
#ifdef __has_cpp_attribute
|
||||
#define REALM_HAS_CCP_ATTRIBUTE(attr) __has_cpp_attribute(attr)
|
||||
#else
|
||||
#define REALM_HAS_CCP_ATTRIBUTE(attr) 0
|
||||
#endif
|
||||
|
||||
#if REALM_HAS_CCP_ATTRIBUTE(clang::fallthrough)
|
||||
#define REALM_FALLTHROUGH [[clang::fallthrough]]
|
||||
#else
|
||||
#define REALM_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
Results::Results() = default;
|
||||
Results::~Results() = default;
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2015 Realm Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef REALM_UTIL_COMPILER_HPP
|
||||
#define REALM_UTIL_COMPILER_HPP
|
||||
|
||||
#ifdef __has_cpp_attribute
|
||||
#define REALM_HAS_CCP_ATTRIBUTE(attr) __has_cpp_attribute(attr)
|
||||
#else
|
||||
#define REALM_HAS_CCP_ATTRIBUTE(attr) 0
|
||||
#endif
|
||||
|
||||
#if REALM_HAS_CCP_ATTRIBUTE(clang::fallthrough)
|
||||
#define REALM_FALLTHROUGH [[clang::fallthrough]]
|
||||
#else
|
||||
#define REALM_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#endif // REALM_UTIL_COMPILER_HPP
|
Loading…
Reference in New Issue