Iurii Chernyi | 1 Jul 2012 17:13

Re: scenario transition refactoring gsoc project - commits ahead


On Jun 30, 2012 9:31 PM, "Mark de Wever" <koraq <at> xs4all.nl> wrote:
> Not really happy to leave style issues when they occur. Is there a
> reason why the main development isn't happening in trunk in the first
> place?
The main development *is* happening in trunk. The merges that I talked about are potentital merges between upstream trunk code and student's working copy.

I agree that it's not good to leave style issues in place. Still, if a style issue appears in student's code, it's far better to tell him/her about it, describing the issue, and asking to fix, than to fix it yourself. The student is here to learn ;)

_______________________________________________
Wesnoth-dev mailing list
Wesnoth-dev <at> gna.org
https://mail.gna.org/listinfo/wesnoth-dev
Mark de Wever | 4 Jul 2012 21:28
Picon
Picon
Favicon

Re: scenario transition refactoring gsoc project - commits ahead

On Sun, Jul 01, 2012 at 05:13:11PM +0200, Iurii Chernyi wrote:
> On Jun 30, 2012 9:31 PM, "Mark de Wever" <koraq <at> xs4all.nl> wrote:
> > Not really happy to leave style issues when they occur. Is there a
> > reason why the main development isn't happening in trunk in the first
> > place?
> The main development *is* happening in trunk. The merges that I talked
> about are potentital merges between upstream trunk code and student's
> working copy.

Ok from the original mail I concluded it was developped in another
repository.

> I agree that it's not good to leave style issues in place. Still, if a
> style issue appears in student's code, it's far better to tell him/her
> about it, describing the issue, and asking to fix, than to fix it yourself.
> The student is here to learn ;)

In general I agree, however I tend to fix several pedantic style issues.
I don't mind to explain them, but I don't think I should really bother
students with it; I also don't bother other developers with it.

On the bright side, I haven't had complains from my tests on this code
yet.

--

-- 
Regards,
Mark de Wever aka Mordante/SkeletonCrew
Mark de Wever | 8 Jul 2012 09:34
Picon
Picon
Favicon

Changing the CMake compiler flags

Hi,

A small heads up for a CMake change I'll be committing in a short while,
the patch is attached.

I've been fiddling with the way CMake defines the compiler flags and
have a patch to change their implementation.

At the moment the flags are determined on the first run and stored in
CMAKE_CXX_FLAGS, CMAKE_CXX_FLAGS_DEBUG and CMAKE_CXX_FLAGS_RELEASE[*].
This was actuall not a good idea, since CMake combines CMAKE_CXX_FLAGS
with the CMAKE_CXX_FLAGS_≤BUILD_TYPE>. The problem with this setup is
when the compiler is changed the flags are reset to their defaults and
the user made changes to the flags are lost. The second issue with the
old implementation is that the ENABLE_STRICT_COMPILATION CMake option
must be directly set; changing its value after the initial generation
had no effect. 

The change will only set CMAKE_CXX_FLAGS, based on the environment
variable $CXXFLAGS, this is stored in its own variable, named
CXX_FLAGS_USER, in CMake and can be changed later. This flag is only
initialised on the first run. It is also based on the default flags we
use for Wesnoth and the _current_ state of the ENABLE_STRICT_COMPILATION
option. For the transition from the old to the new system the old
CMAKE_CXX_FLAGS are used as initial value for the CXX_FLAGS_USER. This
means no flags are lost, but some extra flags are added, will CMake to
cause a recompilation. So it's advised to regenerate the project files
or change the CXX_FLAGS_USER after CMake as updated the flags.

Since several people seem to be interested in the extra compiler flags I
use I'll add a configuration option ENABLE_PENDANTIC_COMPILATION. This
option will be disabled by default. I only tested these flags with
GCC-4.3 and GCC-4.4, before committing them I'll also run them along
GCC-4.6, GCC-4.7, Clang 3.1 and the current GCC snapshot.

[*] Note I removed the CFlags since all C based code has been removed,
with the removal of the poolallocator.

-- 
Regards,
Mark de Wever aka Mordante/SkeletonCrew
Index: INSTALL
===================================================================
--- INSTALL	(revision 54608)
+++ INSTALL	(working copy)
 <at>  <at>  -277,3 +277,23  <at>  <at> 

 Debug builds:
 Set CMAKE_BUILD_TYPE to "debug"
+
+Compiler flags:
+CMake determines the compiler flags by combining CMAKE_CXX_FLAGS and
+CMAKE_CXX_FLAGS_≤CMAKE_BUILD_TYPE>. If no CMAKE_BUILD_TYPE is specified only the
+CMAKE_CXX_FLAGS are used.
+
+The CMAKE_CXX_FLAGS are controlled by CMake and should not be set by the user.
+They are generated by the following parts:
+- CXX_FLAGS_PROJECT The default flags for all programs in the Wesnoth. These
+  flags are determined by the Wesnoth developers.
+- CXX_FLAGS_STRICT_COMPILATION The flags used for strict compilation. Whether
+  these flags are used depends on the configuration option
+  ENABLE_STRICT_COMPILATION.  When this option is changed the CMAKE_CXX_FLAGS
+  will be changed to reflect the change. (Starting from Wesnoth 1.11.0 the flag
+  can be changed after the initial generation.) What flags are set when choosing
+  this option is determined by the Wesnoth developers.
+- CXX_FLAGS_USER These flags set when configuring Wesnoth. The initial value of
+  this variable depends on the CXXFLAGS in the environment or defined by
+  -DCXX_FLAGS_USER. These flags are stored and can be changed later by running
+  ccmake and changing the value of CXX_FLAGS_USER.
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 54608)
+++ CMakeLists.txt	(working copy)
 <at>  <at>  -117,6 +117,8  <at>  <at> 
 # Handle options (set paths/definitions/etc...)
 #

+##### Set the compiler flags.
+
 # This macro checks whether a compiler supports a compiler flag.
 #
 # If the flag is supported the flag will be added to the target compiler flags.
 <at>  <at>  -144,77 +146,124  <at>  <at> 
 	endif(${variable})
 endmacro(check_compiler_has_flag)

-# If UNIX Assume Clang.
-if(CMAKE_COMPILER_IS_GNUCXX OR UNIX)
-	# Set our own default flags at first run.
-	if(NOT CONFIGURED)

-		if(ENABLE_STRICT_COMPILATION)
-			# The current unit test code breaks strict aliasing with g++ 4.4.
-			set(STRICT_FLAGS "-Werror -Wno-strict-aliasing")
+### Set the environment compiler flags.

-			# This flag is/will be added in gcc-4.8 and fails with BOOST_STATIC_ASSERT
-			check_compiler_has_flag(
-					STRICT_FLAGS
-					"-Wunused-local-typedefs"
-					HAS_COMPILER_FLAG_WUNUSED_LOCAL_TYPEDEFS
-					"-Wno-unused-local-typedefs")
+if(CONFIGURED)
+	# The CONFIGURED flag was replaced when trunk `was' 1.11, before the release of 1.11.0
+	message("Builed files depending on 'CONFIGURED' found, please regenerate your build files.")
+	set(CXX_FLAGS_USER
+		"${CMAKE_CXX_FLAGS}"
+		CACHE
+		STRING
+		"The CXXFLAGS environment variable used for the initial generation."
+		FORCE
+	)
+	unset(CONFIGURED CACHE)
+endif(CONFIGURED)

-			# This flag is/will be added in gcc-4.8 and fails with png in C++11 mode
-			check_compiler_has_flag(
-					STRICT_FLAGS
-					"-Wliteral-suffix"
-					HAS_COMPILER_FLAG_WLITERAL_SUFFIX
-					"-Wno-literal-suffix")
+if(NOT DEFINED CXX_FLAGS_USER)

-			# This flag is needed for Clang to silence its complains about
-			# unused command line arguments.
-			check_compiler_has_flag(
-					STRICT_FLAGS
-					"-Qunused-arguments"
-					HAS_COMPILER_FLAG_QUNUSED_ARGUMENTS)
+	message(STATUS "Environment compiler flags set to »${CXX_FLAGS_USER}«")
+	set(CXX_FLAGS_USER
+		"$ENV{CXXFLAGS}"
+		CACHE
+		STRING
+		"The CXXFLAGS environment variable used for the initial generation."
+		FORCE
+	)

-			# Silences Clang warnings about declaring a class a class first and
-			# a struct later.
-			check_compiler_has_flag(
-					STRICT_FLAGS
-					"-Wmismatched-tags"
-					HAS_COMPILER_FLAG_WMISMATCHED_TAGS
-					"-Wno-mismatched-tags")
+endif(NOT DEFINED CXX_FLAGS_USER)

-			if(NOT CMAKE_COMPILER_IS_GNUCXX)
-				# Silences warnings about overloaded virtuals.
-			   	# (GCC doesn't complaing Clang does.)
-				check_compiler_has_flag(
-						STRICT_FLAGS
-						"-Woverloaded-virtual"
-						HAS_COMPILER_FLAG_WOVERLOADED_VIRTUAL
-						"-Wno-overloaded-virtual")
-			endif(NOT CMAKE_COMPILER_IS_GNUCXX)

-		else(ENABLE_STRICT_COMPILATION)
-			set(STRICT_FLAGS "")
-		endif(ENABLE_STRICT_COMPILATION)
+### Set default Wesnoth project compiler flags

-		# Strict compilation for C files is disabled until somebody wants to clean them.
-		set(CMAKE_C_FLAGS "-O2 -W -Wall -ansi $ENV{CFLAGS}"
-				CACHE STRING "Flags used by the C compiler during normal builds." FORCE)
-		set(CMAKE_C_FLAGS_DEBUG "-O0 -DDEBUG -ggdb3 -W -Wall -ansi $ENV{CFLAGS}"
-				CACHE STRING "Flags used by the C compiler during debug builds." FORCE)
-		set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -W -Wall -ansi $ENV{CFLAGS} -Wno-unused"
-				CACHE STRING "Flags used by the C compiler during release builds." FORCE)
+set(CXX_FLAGS_PROJECT)
+check_compiler_has_flag(CXX_FLAGS_PROJECT "-std=c++98" HAS_COMPILER_FLAG_STD)
+check_compiler_has_flag(CXX_FLAGS_PROJECT "-W" HAS_COMPILER_FLAG_W)
+check_compiler_has_flag(CXX_FLAGS_PROJECT "-Wall" HAS_COMPILER_FLAG_WALL)

-		set(CMAKE_CXX_FLAGS "-O2 -W -Wall -std=c++98 ${STRICT_FLAGS} $ENV{CXXFLAGS}"
-				CACHE STRING "Flags used by the CXX compiler during normal builds." FORCE)
-		set(CMAKE_CXX_FLAGS_DEBUG "-O0 -DDEBUG -ggdb3 -W -Wall -std=c++98 ${STRICT_FLAGS} $ENV{CXXFLAGS}"
-				CACHE STRING "Flags used by the CXX compiler during debug builds." FORCE)
-		set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -W -Wall -std=c++98 ${STRICT_FLAGS} $ENV{CXXFLAGS} -Wno-unused"
-				CACHE STRING "Flags used by the CXX compiler during release builds." FORCE)

-	endif(NOT CONFIGURED)
+### Set strict compilern flags.

-endif(CMAKE_COMPILER_IS_GNUCXX OR UNIX)
+set(CXX_FLAGS_STRICT_COMPILATION)
+check_compiler_has_flag(
+	CXX_FLAGS_STRICT_COMPILATION
+	"-Werror"
+	HAS_COMPILER_FLAG_WERROR
+)

+# The current unit test code breaks strict aliasing with g++ 4.4.
+check_compiler_has_flag(
+	CXX_FLAGS_STRICT_COMPILATION
+	"-Wstrict-aliasing"
+	HAS_COMPILER_FLAG_WERROR_STRICT_ALIASING
+	"-Wno-strict-aliasing"
+)
+
+# This flag is/will be added in gcc-4.8 and fails with BOOST_STATIC_ASSERT
+check_compiler_has_flag(
+	CXX_FLAGS_STRICT_COMPILATION
+	"-Wunused-local-typedefs"
+	HAS_COMPILER_FLAG_WUNUSED_LOCAL_TYPEDEFS
+	"-Wno-unused-local-typedefs"
+)
+
+# This flag is/will be added in gcc-4.8 and fails with png in C++11 mode
+check_compiler_has_flag(
+	CXX_FLAGS_STRICT_COMPILATION
+	"-Wliteral-suffix"
+	HAS_COMPILER_FLAG_WLITERAL_SUFFIX
+	"-Wno-literal-suffix"
+)
+
+# This removes a lot of warnings from Clang regarding unused -I arguments
+check_compiler_has_flag(
+	CXX_FLAGS_STRICT_COMPILATION
+	"-Qunused-arguments"
+	HAS_COMPILER_FLAG_QUNUSED_ARGUMENTS
+)
+
+# Silences Clang warnings about declaring a class a class first and
+# a struct later.
+check_compiler_has_flag(
+	CXX_FLAGS_STRICT_COMPILATION
+	"-Wmismatched-tags"
+	HAS_COMPILER_FLAG_WMISMATCHED_TAGS
+	"-Wno-mismatched-tags"
+)
+
+if(NOT CMAKE_COMPILER_IS_GNUCXX)
+	# Silences warnings about overloaded virtuals.
+	# (GCC doesn't complain Clang does.)
+	check_compiler_has_flag(
+		CXX_FLAGS_STRICT_COMPILATION
+		"-Woverloaded-virtual"
+		HAS_COMPILER_FLAG_WOVERLOADED_VIRTUAL
+		"-Wno-overloaded-virtual"
+	)
+endif(NOT CMAKE_COMPILER_IS_GNUCXX)
+
+
+### Set the final compiler flags.
+
+set(COMPILER_FLAGS "${CXX_FLAGS_PROJECT}")
+if(ENABLE_STRICT_COMPILATION)
+	set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_STRICT_COMPILATION}")
+endif(ENABLE_STRICT_COMPILATION)
+set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_USER}")
+
+if(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "${COMPILER_FLAGS}")
+	message(STATUS "CMake compiler flags set to »${COMPILER_FLAGS}«") 
+	set(CMAKE_CXX_FLAGS
+		"${COMPILER_FLAGS}"
+		CACHE
+		STRING
+		"Global flags used by the CXX compiler during all builds."
+		FORCE
+	)
+endif(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "${COMPILER_FLAGS}")
+
 if(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
 	# Assume the compiler is the clang compiler.
 	set(CMAKE_EXE_LINKER_FLAGS "-lstdc++ -lm ${CMAKE_EXE_LINKER_FLAGS}")
 <at>  <at>  -406,5 +455,3  <at>  <at> 
 include(CPack)
 set(CPACK_GENERATOR "TGZ")
 set(CPACK_SOURCE_GENERATOR "TGZ")
-
-set(CONFIGURED ON CACHE INTERNAL "")
Index: RELEASE_NOTES
===================================================================
--- RELEASE_NOTES	(revision 54608)
+++ RELEASE_NOTES	(working copy)
 <at>  <at>  -33,6 +33,10  <at>  <at> 
 The Clang compiler now also defaults to strict compilation when building with CMake. Also the default
flags have changed to the ones used for GCC. This has only be tested with Clang 3.1, please file bug reports
if it breaks older versions of Clang.
 [/section]

+[section="CMake compiler flags"]
+The part to determine the CMake compiler flags has been rewritten and now has better support for compiler
specific enabling of targets. Therefore it is recommended to regenerate your CMake build.
+[/section]
+
 [section="Another Change"]
 [/section]

_______________________________________________
Wesnoth-dev mailing list
Wesnoth-dev <at> gna.org
https://mail.gna.org/listinfo/wesnoth-dev
Scott Klempner | 9 Jul 2012 16:49
Picon
Favicon

for mans

http://ethan1.com/wp-includes/14.html?coupon=443411 http://healingandteachinghaven.com.au/wp-includes/79.html?coupon=4432
_______________________________________________
Wesnoth-dev mailing list
Wesnoth-dev <at> gna.org
https://mail.gna.org/listinfo/wesnoth-dev
Mark de Wever | 10 Jul 2012 21:08
Picon
Picon
Favicon

Re: Changing the CMake compiler flags

On Sun, Jul 08, 2012 at 09:34:13AM +0200, Mark de Wever wrote:
> Hi,
> 
> A small heads up for a CMake change I'll be committing in a short while,
> the patch is attached.

The patch has been committed as r54685.

--

-- 
Regards,
Mark de Wever aka Mordante/SkeletonCrew

Gmane