From ec300e33d49bc57d8cc3b744ea16e5af615c8f94 Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Mon, 13 Oct 2014 02:13:35 +0200 Subject: THRIFT-1462 add more strict compiler flags Patch: Roger Meier --- compiler/cpp/CMakeLists.txt | 7 ++++++- compiler/cpp/Makefile.am | 2 +- compiler/cpp/src/generate/t_delphi_generator.cc | 6 +++--- compiler/cpp/src/generate/t_lua_generator.cc | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'compiler/cpp') diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt index 548dec73b..606bfcd5b 100644 --- a/compiler/cpp/CMakeLists.txt +++ b/compiler/cpp/CMakeLists.txt @@ -152,9 +152,14 @@ install(TARGETS thrift DESTINATION bin) # mingw32 does not support c++0x features if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") -set(CMAKE_CXX_FLAGS "-std=c++0x") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") endif() +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") +endif() + + # create a Distribution Package for the Apache Thrift Compiler set(CPACK_PACKAGE_NAME "Apache Thrift") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Thrift Compiler") diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am index 52b9c61dc..ee28d0c1f 100644 --- a/compiler/cpp/Makefile.am +++ b/compiler/cpp/Makefile.am @@ -93,7 +93,7 @@ thrift_SOURCES += src/generate/t_c_glib_generator.cc \ src/generate/t_lua_generator.cc thrift_CPPFLAGS = -I$(srcdir)/src -thrift_CXXFLAGS = -Wall +thrift_CXXFLAGS = -Wall -Wextra -pedantic thrift_LDADD = @LEXLIB@ libparse.a libparse_a_CPPFLAGS = -I$(srcdir)/src diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/generate/t_delphi_generator.cc index 19b827243..81853918c 100644 --- a/compiler/cpp/src/generate/t_delphi_generator.cc +++ b/compiler/cpp/src/generate/t_delphi_generator.cc @@ -276,7 +276,7 @@ string t_delphi_generator::replace_all( string contents, string search, string r } return str; -}; +} // XML encoding string t_delphi_generator::xml_encode( string contents) { @@ -321,7 +321,7 @@ void t_delphi_generator::generate_delphi_docstring_comment(ostream &out, string "/// ", "" + contents + "", "/// \n{$ENDREGION}\n"); } -}; +} void t_delphi_generator::generate_delphi_doc(ostream &out, t_field* field) { if( xmldoc_) { @@ -3479,5 +3479,5 @@ THRIFT_REGISTER_GENERATOR(delphi, "delphi", " and container instances by interface or TypeInfo()\n" " constprefix: Name TConstants classes after IDL to reduce ambiguities\n" " events: Enable and use processing events in the generated code.\n" -" xmldoc: Enable XMLDoc comments for Help Insight etc.\n"); +" xmldoc: Enable XMLDoc comments for Help Insight etc.\n") diff --git a/compiler/cpp/src/generate/t_lua_generator.cc b/compiler/cpp/src/generate/t_lua_generator.cc index 02467977d..6acc6a99c 100644 --- a/compiler/cpp/src/generate/t_lua_generator.cc +++ b/compiler/cpp/src/generate/t_lua_generator.cc @@ -1224,4 +1224,4 @@ string t_lua_generator::type_to_enum(t_type* type) { throw "INVALID TYPE IN type_to_enum: " + type->get_name(); } -THRIFT_REGISTER_GENERATOR(lua, "Lua", ""); +THRIFT_REGISTER_GENERATOR(lua, "Lua", "") -- cgit v1.2.1