← Back to team overview

maria-developers team mailing list archive

Get rid of all 32 bit Visual Studio compiler warnings

 

Hi all,

I'm sending this patch again, since I didn't get any responses to the last two mails.

The patch is almost identical to the last version except that I have removed some parts of it - those warnings were fixed by someone else after I sent the last version of the patch.

Here is the patch description from the last mail:

This is a new version of the patch, and it removes all compiler warnings on a 32 bit build using Visual Studio 2008.

This patch sets a compiler flag on the bison and flex generated files that removes warnings on those. (That nothing uses the yyerrorlab label is fine.)

The libmysqld.def file: The description line isn't supported in the more recent compilers.

In fsp0fsp.c, there is an explicit cast to ullint. In this case, the
code does what's intended, and the compiler warning is one of the "are
you sure this is right" warnings. C4334 gives a warning if you make a
1u << 10 and store that in a 64 bit variable, because you could have
meant 1i64 << 10.

Can I push this to 5.1?

Bo Thorsen.
Monty Program AB.

--

MariaDB: MySQL replacement
Community developed. Feature enhanced. Backward compatible.
=== modified file 'libmysqld/CMakeLists.txt'
--- libmysqld/CMakeLists.txt	2010-07-01 14:35:50 +0000
+++ libmysqld/CMakeLists.txt	2010-07-08 14:34:03 +0000
@@ -95,6 +95,11 @@
   FOREACH(rpath ${${ENGINE_LIB_UPPER}_SOURCES})
     SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/${rpath})
   ENDFOREACH(rpath)
+  IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+    # Silence two warnings in generated flex and bison output
+    SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/pars/pars0grm.c PROPERTIES COMPILE_FLAGS "/wd4102")
+    SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/pars/lexyy.c PROPERTIES COMPILE_FLAGS "/wd4003")
+  ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
 ENDFOREACH(ENGINE_LIB)
 
 SET(SOURCE_SUBLIBS FALSE)

=== modified file 'libmysqld/libmysqld.def'
--- libmysqld/libmysqld.def	2010-01-15 15:27:55 +0000
+++ libmysqld/libmysqld.def	2010-07-07 14:24:17 +0000
@@ -1,5 +1,4 @@
 LIBRARY		LIBMYSQLD
-DESCRIPTION	'MySQL 5.1 Embedded Server Library'
 VERSION		5.1
 EXPORTS
 	mysql_thread_end

=== modified file 'storage/innobase/CMakeLists.txt.disabled'
--- storage/innobase/CMakeLists.txt.disabled	2010-06-01 06:40:36 +0000
+++ storage/innobase/CMakeLists.txt.disabled	2010-07-08 13:24:46 +0000
@@ -26,6 +26,12 @@
                               PROPERTIES COMPILE_FLAGS -Od)
 ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_SIZEOF_VOID_P MATCHES 8)
 
+IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+  # Silence two warnings in generated flex and bison output
+  SET_SOURCE_FILES_PROPERTIES(pars/pars0grm.c PROPERTIES COMPILE_FLAGS "/wd4102")
+  SET_SOURCE_FILES_PROPERTIES(pars/lexyy.c PROPERTIES COMPILE_FLAGS "/wd4003")
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
+
 INCLUDE_DIRECTORIES(
 					${CMAKE_SOURCE_DIR}/storage/innobase/include
 					${CMAKE_SOURCE_DIR}/storage/innobase/handler

=== modified file 'storage/innodb_plugin/CMakeLists.txt'
--- storage/innodb_plugin/CMakeLists.txt	2010-04-07 17:21:15 +0000
+++ storage/innodb_plugin/CMakeLists.txt	2010-07-08 13:26:54 +0000
@@ -19,6 +19,12 @@
 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
 
+IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+  # Silence two warnings in generated flex and bison output
+  SET_SOURCE_FILES_PROPERTIES(pars/pars0grm.c PROPERTIES COMPILE_FLAGS "/wd4102")
+  SET_SOURCE_FILES_PROPERTIES(pars/lexyy.c PROPERTIES COMPILE_FLAGS "/wd4003")
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
+
 # Starting at 5.1.38, MySQL CMake files are simplified. But the plugin
 # CMakeLists.txt still needs to work with previous versions of MySQL.
 IF (MYSQL_VERSION_ID GREATER "50137")

=== modified file 'storage/xtradb/CMakeLists.txt'
--- storage/xtradb/CMakeLists.txt	2010-08-04 08:39:53 +0000
+++ storage/xtradb/CMakeLists.txt	2010-08-16 08:29:27 +0000
@@ -19,6 +19,13 @@
 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
 
+IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+  # Silence two warnings in generated flex and bison output
+  SET_SOURCE_FILES_PROPERTIES(pars/pars0grm.c PROPERTIES COMPILE_FLAGS "/wd4102")
+  SET_SOURCE_FILES_PROPERTIES(pars/lexyy.c PROPERTIES COMPILE_FLAGS "/wd4003")
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
+
+
 # Starting at 5.1.38, MySQL CMake files are simplified. But the plugin
 # CMakeLists.txt still needs to work with previous versions of MySQL.
 IF (MYSQL_VERSION_ID GREATER "50137")

=== modified file 'storage/xtradb/buf/buf0flu.c'
--- storage/xtradb/buf/buf0flu.c	2010-08-04 08:39:53 +0000
+++ storage/xtradb/buf/buf0flu.c	2010-08-16 08:29:27 +0000
@@ -1265,7 +1265,7 @@
 					BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
 					then the caller must not own any
 					latches on pages */
-	ulint		min_n,		/*!< in: wished minimum mumber of blocks
+	ib_uint64_t		min_n,		/*!< in: wished minimum mumber of blocks
 					flushed (it is not guaranteed that the
 					actual number is that big, though) */
 	ib_uint64_t	lsn_limit)	/*!< in the case BUF_FLUSH_LIST all

=== modified file 'storage/xtradb/fsp/fsp0fsp.c'
--- storage/xtradb/fsp/fsp0fsp.c	2010-08-04 08:39:53 +0000
+++ storage/xtradb/fsp/fsp0fsp.c	2010-08-16 08:29:27 +0000
@@ -3180,13 +3180,14 @@
 		return(0);
 	}
 
+	// The ullint cast on FSP_EXTENT_SIZE removes VS warning C4334
 	if (!zip_size) {
 		return((ullint) (n_free - reserve)
-		       * FSP_EXTENT_SIZE
+		       * ((ullint) FSP_EXTENT_SIZE)
 		       * (UNIV_PAGE_SIZE / 1024));
 	} else {
 		return((ullint) (n_free - reserve)
-		       * FSP_EXTENT_SIZE
+		       * ((ullint) FSP_EXTENT_SIZE)
 		       * (zip_size / 1024));
 	}
 }

=== modified file 'storage/xtradb/include/buf0flu.h'
--- storage/xtradb/include/buf0flu.h	2010-08-03 10:54:05 +0000
+++ storage/xtradb/include/buf0flu.h	2010-08-16 08:29:27 +0000
@@ -92,7 +92,7 @@
 					BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
 					then the caller must not own any
 					latches on pages */
-	ulint		min_n,		/*!< in: wished minimum mumber of blocks
+	ib_uint64_t		min_n,		/*!< in: wished minimum mumber of blocks
 					flushed (it is not guaranteed that the
 					actual number is that big, though) */
 	ib_uint64_t	lsn_limit);	/*!< in the case BUF_FLUSH_LIST all


Follow ups