THRIFT-5168 Useless generated code when .thrift file only has service type
Client: cpp
Patch: zeshuai007 <51382517@qq.com>

This closes #2095
diff --git a/test/cpp/CMakeLists.txt b/test/cpp/CMakeLists.txt
index 90af782..a136a48 100755
--- a/test/cpp/CMakeLists.txt
+++ b/test/cpp/CMakeLists.txt
@@ -52,8 +52,6 @@
 
 set(crossstressgencpp_SOURCES
     gen-cpp/Service.cpp
-    gen-cpp/StressTest_types.cpp
-    gen-cpp/StressTest_constants.cpp
 )
 add_library(crossstressgencpp STATIC ${crossstressgencpp_SOURCES})
 LINK_AGAINST_THRIFT_LIBRARY(crossstressgencpp thrift)
@@ -92,6 +90,6 @@
     COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style -r ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
 )
 
-add_custom_command(OUTPUT gen-cpp/StressTest_types.cpp gen-cpp/StressTest_constants.cpp gen-cpp/Service.cpp
+add_custom_command(OUTPUT gen-cpp/Service.cpp
     COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift
 )
diff --git a/test/cpp/Makefile.am b/test/cpp/Makefile.am
index 76ae82b..4f77c15 100755
--- a/test/cpp/Makefile.am
+++ b/test/cpp/Makefile.am
@@ -22,8 +22,6 @@
                 gen-cpp/ThriftTest_types.cpp \
                 gen-cpp/ThriftTest_constants.cpp \
                 gen-cpp/SecondService.cpp \
-                gen-cpp/StressTest_types.cpp \
-                gen-cpp/StressTest_constants.cpp \
                 gen-cpp/Service.cpp
 
 noinst_LTLIBRARIES = libtestgencpp.la libstresstestgencpp.la
@@ -44,9 +42,6 @@
 libtestgencpp_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la
 
 nodist_libstresstestgencpp_la_SOURCES = \
-	gen-cpp/StressTest_constants.cpp \
-	gen-cpp/StressTest_types.cpp \
-	gen-cpp/StressTest_constants.h \
 	gen-cpp/StressTest_types.h \
 	gen-cpp/Service.cpp \
 	gen-cpp/Service.h
@@ -105,7 +100,7 @@
 gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/SecondService.tcc: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
 	$(THRIFT) --gen cpp:templates,cob_style -r $<
 
-gen-cpp/StressTest_types.cpp gen-cpp/StressTest_constants.cpp gen-cpp/Service.cpp: $(top_srcdir)/test/StressTest.thrift $(THRIFT)
+gen-cpp/Service.cpp: $(top_srcdir)/test/StressTest.thrift $(THRIFT)
 	$(THRIFT) --gen cpp $<
 
 AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(LIBEVENT_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -Igen-cpp -I.