[Scummvm-cvs-logs] scummvm master -> 78a0db127ab5ccbe53adf86dde1f040364ad3282

lordhoto lordhoto at gmail.com
Thu Apr 28 16:48:06 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7f889c6101 CREATE_PROJECT: Get rid of variadic macro usage.
78a0db127a CREATE_PROJECT: Add a FIXME related to our warning lists.


Commit: 7f889c61011e0d780e190e5aecdb4c157862560c
    https://github.com/scummvm/scummvm/commit/7f889c61011e0d780e190e5aecdb4c157862560c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-04-28T07:47:11-07:00

Commit Message:
CREATE_PROJECT: Get rid of variadic macro usage.

Variadic macros are C99 and ugly in C++. If we would want to do it differently
we should rather rely on C++0x's initializer lists. But since we cannot assume
all compilers we want create_project to build support that we cannot do that.

Changed paths:
    devtools/create_project/create_project.cpp
    devtools/create_project/create_project.h



diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index aa3960d..475a18b 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -295,19 +295,6 @@ int main(int argc, char *argv[]) {
 	setup.libraries.push_back(ADDITIONAL_LIBRARY);
 #endif
 
-// Initialize global & project-specific warnings
-#define SET_GLOBAL_WARNINGS(...) \
-	{ \
-		std::string global[PP_NARG(__VA_ARGS__)] = { __VA_ARGS__ }; \
-		globalWarnings.assign(global, global + (sizeof(global) / sizeof(global[0]))); \
-	}
-
-#define SET_WARNINGS(name, ...) \
-	{ \
-		std::string project[PP_NARG(__VA_ARGS__)] = { __VA_ARGS__ }; \
-		projectWarnings[name].assign(project, project + (sizeof(project) / sizeof(project[0]))); \
-	}
-
 	// List of global warnings and map of project-specific warnings
 	StringList globalWarnings;
 	std::map<std::string, StringList> projectWarnings;
@@ -342,9 +329,23 @@ int main(int argc, char *argv[]) {
 		//
 		////////////////////////////////////////////////////////////////////////////
 
-		SET_GLOBAL_WARNINGS("-Wall", "-Wno-long-long", "-Wno-multichar", "-Wno-unknown-pragmas", "-Wno-reorder",
-		                    "-Wpointer-arith", "-Wcast-qual", "-Wcast-align", "-Wshadow", "-Wimplicit",
-		                    "-Wnon-virtual-dtor", "-Wwrite-strings", "-fno-rtti", "-fno-exceptions", "-fcheck-new");
+		globalWarnings.push_back("-Wall");
+		globalWarnings.push_back("-Wno-long-long");
+		globalWarnings.push_back("-Wno-multichar");
+		globalWarnings.push_back("-Wno-unknown-pragmas");
+		globalWarnings.push_back("-Wno-reorder");
+		globalWarnings.push_back("-Wpointer-arith");
+		globalWarnings.push_back("-Wcast-qual");
+		globalWarnings.push_back("-Wcast-align");
+		globalWarnings.push_back("-Wshadow");
+		globalWarnings.push_back("-Wimplicit");
+		globalWarnings.push_back("-Wnon-virtual-dtor");
+		globalWarnings.push_back("-Wwrite-strings");
+		// The following are not warnings at all... We should consider adding them to
+		// a different list of parameters.
+		globalWarnings.push_back("-fno-rtti");
+		globalWarnings.push_back("-fno-exceptions");
+		globalWarnings.push_back("-fcheck-new");
 
 		provider = new CreateProjectTool::CodeBlocksProvider(globalWarnings, projectWarnings);
 
@@ -421,12 +422,35 @@ int main(int argc, char *argv[]) {
 		//
 		////////////////////////////////////////////////////////////////////////////
 
-		SET_GLOBAL_WARNINGS("4068", "4100", "4103", "4127", "4244", "4250", "4310", "4351", "4512", "4702", "4706", "4800", "4996", "6204", "6211", "6385", "6386");
-		SET_WARNINGS("agi", "4510", "4610");
-		SET_WARNINGS("agos", "4511");
-		SET_WARNINGS("lure", "4189", "4355");
-		SET_WARNINGS("kyra", "4355");
-		SET_WARNINGS("m4", "4355");
+		globalWarnings.push_back("4068");
+		globalWarnings.push_back("4100");
+		globalWarnings.push_back("4103");
+		globalWarnings.push_back("4127");
+		globalWarnings.push_back("4244");
+		globalWarnings.push_back("4250");
+		globalWarnings.push_back("4310");
+		globalWarnings.push_back("4351");
+		globalWarnings.push_back("4512");
+		globalWarnings.push_back("4702");
+		globalWarnings.push_back("4706");
+		globalWarnings.push_back("4800");
+		globalWarnings.push_back("4996");
+		globalWarnings.push_back("6204");
+		globalWarnings.push_back("6211");
+		globalWarnings.push_back("6385");
+		globalWarnings.push_back("6386");
+
+		projectWarnings["agi"].push_back("4510");
+		projectWarnings["agi"].push_back("4610");
+
+		projectWarnings["agos"].push_back("4511");
+
+		projectWarnings["lure"].push_back("4189");
+		projectWarnings["lure"].push_back("4355");
+
+		projectWarnings["kyra"].push_back("4355");
+
+		projectWarnings["m4"].push_back("4355");
 
 		if (msvcVersion == 8 || msvcVersion == 9)
 			provider = new CreateProjectTool::VisualStudioProvider(globalWarnings, projectWarnings, msvcVersion);
diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h
index c228c34..f4d2a0a 100644
--- a/devtools/create_project/create_project.h
+++ b/devtools/create_project/create_project.h
@@ -32,34 +32,6 @@
 
 #include <cassert>
 
-// The PP_NARG macro returns the number of arguments that have been passed to it.
-#define PP_NARG(...) \
-         PP_NARG_(__VA_ARGS__,PP_RSEQ_N())
-#define PP_NARG_(...) \
-         PP_ARG_N(__VA_ARGS__)
-#define PP_ARG_N( \
-          _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \
-         _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \
-         _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \
-         _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \
-         _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \
-         _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \
-         _61,_62,_63,N,...) N
-#define PP_RSEQ_N() \
-         63,62,61,60,                   \
-         59,58,57,56,55,54,53,52,51,50, \
-         49,48,47,46,45,44,43,42,41,40, \
-         39,38,37,36,35,34,33,32,31,30, \
-         29,28,27,26,25,24,23,22,21,20, \
-         19,18,17,16,15,14,13,12,11,10, \
-         9,8,7,6,5,4,3,2,1,0
-
-#define SET_VALUES(list, ...) \
-	{ \
-		std::string values[PP_NARG(__VA_ARGS__)] = { __VA_ARGS__ }; \
-		list.assign(values, values + (sizeof(values) / sizeof(values[0]))); \
-	}
-
 typedef std::list<std::string> StringList;
 
 /**


Commit: 78a0db127ab5ccbe53adf86dde1f040364ad3282
    https://github.com/scummvm/scummvm/commit/78a0db127ab5ccbe53adf86dde1f040364ad3282
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-04-28T07:47:11-07:00

Commit Message:
CREATE_PROJECT: Add a FIXME related to our warning lists.

Changed paths:
    devtools/create_project/create_project.cpp



diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index 475a18b..35f68a1 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -296,6 +296,11 @@ int main(int argc, char *argv[]) {
 #endif
 
 	// List of global warnings and map of project-specific warnings
+	// FIXME: As shown below these two structures have different behavior for
+	// Code::Blocks and MSVC. In Code::Blocks this is used to enable *and*
+	// disable certain warnings (and some other not warning related flags
+	// actually...). While in MSVC this is solely for disabling warnings.
+	// That is really not nice. We should consider a nicer way of doing this.
 	StringList globalWarnings;
 	std::map<std::string, StringList> projectWarnings;
 






More information about the Scummvm-git-logs mailing list