mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-01 11:51:38 +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")
|
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
|
||||||
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
|
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8)
|
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()
|
endif()
|
||||||
if(FLATBUFFERS_LIBCXX_WITH_CLANG)
|
if(FLATBUFFERS_LIBCXX_WITH_CLANG)
|
||||||
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ extern void GenComment(const std::vector<std::string> &dc,
|
|||||||
|
|
||||||
class FloatConstantGenerator {
|
class FloatConstantGenerator {
|
||||||
public:
|
public:
|
||||||
virtual ~FloatConstantGenerator(){};
|
virtual ~FloatConstantGenerator() {}
|
||||||
std::string GenFloatConstant(const FieldDef &field) const;
|
std::string GenFloatConstant(const FieldDef &field) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ inline size_t InlineAlignment(const Type &type) {
|
|||||||
|
|
||||||
struct EnumVal {
|
struct EnumVal {
|
||||||
EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {}
|
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;
|
Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
|
||||||
|
|
||||||
|
|||||||
@@ -2169,7 +2169,7 @@ class CppGenerator : public BaseGenerator {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
std::string GenUnpackFieldStatement(const FieldDef &field,
|
std::string GenUnpackFieldStatement(const FieldDef &field,
|
||||||
const FieldDef *union_field) {
|
const FieldDef *union_field) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class DartGenerator : public BaseGenerator {
|
|||||||
|
|
||||||
DartGenerator(const Parser &parser, const std::string &path,
|
DartGenerator(const Parser &parser, const std::string &path,
|
||||||
const std::string &file_name)
|
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,
|
// Iterate through all definitions we haven't generate code for (enums,
|
||||||
// structs, and tables) and output them to a single file.
|
// structs, and tables) and output them to a single file.
|
||||||
bool generate() {
|
bool generate() {
|
||||||
|
|||||||
@@ -113,12 +113,12 @@ class FlatBufService : public grpc_generator::Service {
|
|||||||
|
|
||||||
int method_count() const {
|
int method_count() const {
|
||||||
return static_cast<int>(service_->calls.vec.size());
|
return static_cast<int>(service_->calls.vec.size());
|
||||||
};
|
}
|
||||||
|
|
||||||
std::unique_ptr<const grpc_generator::Method> method(int i) const {
|
std::unique_ptr<const grpc_generator::Method> method(int i) const {
|
||||||
return std::unique_ptr<const grpc_generator::Method>(
|
return std::unique_ptr<const grpc_generator::Method>(
|
||||||
new FlatBufMethod(service_->calls.vec[i]));
|
new FlatBufMethod(service_->calls.vec[i]));
|
||||||
};
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ServiceDef *service_;
|
const ServiceDef *service_;
|
||||||
@@ -235,7 +235,7 @@ class FlatBufFile : public grpc_generator::File {
|
|||||||
|
|
||||||
int service_count() const {
|
int service_count() const {
|
||||||
return static_cast<int>(parser_.services_.vec.size());
|
return static_cast<int>(parser_.services_.vec.size());
|
||||||
};
|
}
|
||||||
|
|
||||||
std::unique_ptr<const grpc_generator::Service> service(int i) const {
|
std::unique_ptr<const grpc_generator::Service> service(int i) const {
|
||||||
return std::unique_ptr<const grpc_generator::Service>(
|
return std::unique_ptr<const grpc_generator::Service>(
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class JsTsGenerator : public BaseGenerator {
|
|||||||
JsTsGenerator(const Parser &parser, const std::string &path,
|
JsTsGenerator(const Parser &parser, const std::string &path,
|
||||||
const std::string &file_name)
|
const std::string &file_name)
|
||||||
: BaseGenerator(parser, path, 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,
|
// Iterate through all definitions we haven't generate code for (enums,
|
||||||
// structs, and tables) and output them to a single file.
|
// structs, and tables) and output them to a single file.
|
||||||
bool generate() {
|
bool generate() {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class PhpGenerator : public BaseGenerator {
|
|||||||
public:
|
public:
|
||||||
PhpGenerator(const Parser &parser, const std::string &path,
|
PhpGenerator(const Parser &parser, const std::string &path,
|
||||||
const std::string &file_name)
|
const std::string &file_name)
|
||||||
: BaseGenerator(parser, path, file_name, "\\", "\\"){};
|
: BaseGenerator(parser, path, file_name, "\\", "\\") {}
|
||||||
bool generate() {
|
bool generate() {
|
||||||
if (!GenerateEnums()) return false;
|
if (!GenerateEnums()) return false;
|
||||||
if (!GenerateStructs()) return false;
|
if (!GenerateStructs()) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user