mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Added -Wextra-semi to Clang build.
Also fixed warnings this generated. Change-Id: If3607907b2dd609f854b7b81225d9cf66af75a60
This commit is contained in:
@@ -193,7 +193,7 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
|
||||
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8)
|
||||
list(APPEND FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wimplicit-fallthrough" "-Werror=unused-private-field") # enable warning
|
||||
list(APPEND FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wimplicit-fallthrough" "-Wextra-semi" "-Werror=unused-private-field") # enable warning
|
||||
endif()
|
||||
if(FLATBUFFERS_LIBCXX_WITH_CLANG)
|
||||
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
|
||||
@@ -132,7 +132,7 @@ extern void GenComment(const std::vector<std::string> &dc,
|
||||
|
||||
class FloatConstantGenerator {
|
||||
public:
|
||||
virtual ~FloatConstantGenerator(){};
|
||||
virtual ~FloatConstantGenerator() {}
|
||||
std::string GenFloatConstant(const FieldDef &field) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -329,7 +329,7 @@ inline size_t InlineAlignment(const Type &type) {
|
||||
|
||||
struct EnumVal {
|
||||
EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {}
|
||||
EnumVal() : value(0){};
|
||||
EnumVal() : value(0) {}
|
||||
|
||||
Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
|
||||
|
||||
|
||||
@@ -2169,7 +2169,7 @@ class CppGenerator : public BaseGenerator {
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
std::string GenUnpackFieldStatement(const FieldDef &field,
|
||||
const FieldDef *union_field) {
|
||||
|
||||
@@ -55,7 +55,7 @@ class DartGenerator : public BaseGenerator {
|
||||
|
||||
DartGenerator(const Parser &parser, const std::string &path,
|
||||
const std::string &file_name)
|
||||
: BaseGenerator(parser, path, file_name, "", "."){};
|
||||
: BaseGenerator(parser, path, file_name, "", ".") {}
|
||||
// Iterate through all definitions we haven't generate code for (enums,
|
||||
// structs, and tables) and output them to a single file.
|
||||
bool generate() {
|
||||
|
||||
@@ -113,12 +113,12 @@ class FlatBufService : public grpc_generator::Service {
|
||||
|
||||
int method_count() const {
|
||||
return static_cast<int>(service_->calls.vec.size());
|
||||
};
|
||||
}
|
||||
|
||||
std::unique_ptr<const grpc_generator::Method> method(int i) const {
|
||||
return std::unique_ptr<const grpc_generator::Method>(
|
||||
new FlatBufMethod(service_->calls.vec[i]));
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
const ServiceDef *service_;
|
||||
@@ -235,7 +235,7 @@ class FlatBufFile : public grpc_generator::File {
|
||||
|
||||
int service_count() const {
|
||||
return static_cast<int>(parser_.services_.vec.size());
|
||||
};
|
||||
}
|
||||
|
||||
std::unique_ptr<const grpc_generator::Service> service(int i) const {
|
||||
return std::unique_ptr<const grpc_generator::Service>(
|
||||
|
||||
@@ -79,7 +79,7 @@ class JsTsGenerator : public BaseGenerator {
|
||||
JsTsGenerator(const Parser &parser, const std::string &path,
|
||||
const std::string &file_name)
|
||||
: BaseGenerator(parser, path, file_name, "", "."),
|
||||
lang_(GetJsLangParams(parser_.opts.lang)){};
|
||||
lang_(GetJsLangParams(parser_.opts.lang)) {}
|
||||
// Iterate through all definitions we haven't generate code for (enums,
|
||||
// structs, and tables) and output them to a single file.
|
||||
bool generate() {
|
||||
@@ -127,8 +127,8 @@ class JsTsGenerator : public BaseGenerator {
|
||||
const auto &file = *it;
|
||||
const auto basename =
|
||||
flatbuffers::StripPath(flatbuffers::StripExtension(file));
|
||||
if (basename != file_name_) {
|
||||
code += GenPrefixedImport(file, basename);
|
||||
if (basename != file_name_) {
|
||||
code += GenPrefixedImport(file, basename);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,8 +310,8 @@ class JsTsGenerator : public BaseGenerator {
|
||||
}
|
||||
default: { result += " {" + type_name + "}"; }
|
||||
}
|
||||
if (!arg_name.empty()) {
|
||||
result += " " + arg_name;
|
||||
if (!arg_name.empty()) {
|
||||
result += " " + arg_name;
|
||||
}
|
||||
if (include_newline) {
|
||||
result += "\n";
|
||||
@@ -1271,7 +1271,7 @@ class JsTsGenerator : public BaseGenerator {
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
it != struct_def.fields.vec.end(); ++it) {
|
||||
const auto &field = **it;
|
||||
if (field.deprecated)
|
||||
if (field.deprecated)
|
||||
continue;
|
||||
paramDoc +=
|
||||
GenTypeAnnotation(kParam, GetArgType(field), GetArgName(field));
|
||||
@@ -1292,7 +1292,7 @@ class JsTsGenerator : public BaseGenerator {
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
it != struct_def.fields.vec.end(); ++it) {
|
||||
const auto &field = **it;
|
||||
if (field.deprecated)
|
||||
if (field.deprecated)
|
||||
continue;
|
||||
|
||||
if (lang_.language == IDLOptions::kTs) {
|
||||
@@ -1317,7 +1317,7 @@ class JsTsGenerator : public BaseGenerator {
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
it != struct_def.fields.vec.end(); ++it) {
|
||||
const auto &field = **it;
|
||||
if (field.deprecated)
|
||||
if (field.deprecated)
|
||||
continue;
|
||||
|
||||
code += " " + methodPrefix + ".add" + MakeCamel(field.name) + "(";
|
||||
@@ -1332,8 +1332,8 @@ class JsTsGenerator : public BaseGenerator {
|
||||
}
|
||||
|
||||
if (lang_.language == IDLOptions::kTs) {
|
||||
if (!object_namespace.empty()) {
|
||||
code += "}\n";
|
||||
if (!object_namespace.empty()) {
|
||||
code += "}\n";
|
||||
}
|
||||
code += "}\n";
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class PhpGenerator : public BaseGenerator {
|
||||
public:
|
||||
PhpGenerator(const Parser &parser, const std::string &path,
|
||||
const std::string &file_name)
|
||||
: BaseGenerator(parser, path, file_name, "\\", "\\"){};
|
||||
: BaseGenerator(parser, path, file_name, "\\", "\\") {}
|
||||
bool generate() {
|
||||
if (!GenerateEnums()) return false;
|
||||
if (!GenerateStructs()) return false;
|
||||
|
||||
Reference in New Issue
Block a user