THRIFT-1462 add more strict compiler flags
Patch: Roger Meier
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 548dec7..606bfcd 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -152,9 +152,14 @@
# 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 52b9c61..ee28d0c 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -93,7 +93,7 @@
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 19b8272..8185391 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/generate/t_delphi_generator.cc
@@ -276,7 +276,7 @@
}
return str;
-};
+}
// XML encoding
string t_delphi_generator::xml_encode( string contents) {
@@ -321,7 +321,7 @@
"/// ", "<para>" + contents + "</para>",
"/// </summary>\n{$ENDREGION}\n");
}
-};
+}
void t_delphi_generator::generate_delphi_doc(ostream &out, t_field* field) {
if( xmldoc_) {
@@ -3479,5 +3479,5 @@
" 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 0246797..6acc6a9 100644
--- a/compiler/cpp/src/generate/t_lua_generator.cc
+++ b/compiler/cpp/src/generate/t_lua_generator.cc
@@ -1224,4 +1224,4 @@
throw "INVALID TYPE IN type_to_enum: " + type->get_name();
}
-THRIFT_REGISTER_GENERATOR(lua, "Lua", "");
+THRIFT_REGISTER_GENERATOR(lua, "Lua", "")
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 4bd40fb..668af0a 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -47,7 +47,7 @@
pkgconfig_DATA += thrift-qt.pc
endif
-AM_CXXFLAGS = -Wall
+AM_CXXFLAGS = -Wall -Wextra -pedantic
AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(srcdir)/src
AM_LDFLAGS = $(BOOST_LDFLAGS)
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
index 012d226..751b0b3 100755
--- a/lib/cpp/test/Makefile.am
+++ b/lib/cpp/test/Makefile.am
@@ -268,7 +268,7 @@
AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src
AM_LDFLAGS = $(BOOST_LDFLAGS)
-AM_CXXFLAGS = -Wall
+AM_CXXFLAGS = -Wall -Wextra
clean-local:
$(RM) -r gen-cpp
diff --git a/test/cpp/Makefile.am b/test/cpp/Makefile.am
index 3dbcaaa..3cf31a3 100755
--- a/test/cpp/Makefile.am
+++ b/test/cpp/Makefile.am
@@ -97,7 +97,7 @@
$(THRIFT) --gen cpp $<
AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(LIBEVENT_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -Igen-cpp
-AM_CXXFLAGS = -Wall
+AM_CXXFLAGS = -Wall -Wextra -pedantic
AM_LDFLAGS = $(BOOST_LDFLAGS) $(LIBEVENT_LDFLAGS)
clean-local:
diff --git a/tutorial/cpp/Makefile.am b/tutorial/cpp/Makefile.am
index 918adb2..bcc7654 100755
--- a/tutorial/cpp/Makefile.am
+++ b/tutorial/cpp/Makefile.am
@@ -63,7 +63,7 @@
$(THRIFT) --gen cpp -r $<
AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(LIBEVENT_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -Igen-cpp
-AM_CXXFLAGS = -Wall
+AM_CXXFLAGS = -Wall -Wextra -pedantic
AM_LDFLAGS = $(BOOST_LDFLAGS) $(LIBEVENT_LDFLAGS)
clean-local: