Skip to content

Commit

Permalink
BUG 13898319 - -WERROR GETS TURNED OFF IN MAINTAINER MODE IF
Browse files Browse the repository at this point in the history
WITH_INNODB_MEMCACHED IS SELECTED 

In fact, the affected warning options are not only
-Wdeclaration-after-statement, but also other 8 warnings for innodb
memcached plugin.

So instead of turning off these options thoroughly, I just turn off
-Werror for innodb memcached plugin. When we introduce new files
with or without new warnings in the future, we don't have to modify these
CMakeLists.txt again.

Also, to reduce the number of warnings, I turn off
-Wdeclaration-after-statement too. This patch also fix 2 issues which would
introduce warnings.

rb://3979, approved by Jimmy.
  • Loading branch information
[email protected] committed Dec 3, 2013
2 parents fbf66c6 + 7396e82 commit 6c737c8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 28 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,7 @@ OPTION(MYSQL_MAINTAINER_MODE
# Whether the maintainer mode compiler options should be enabled.
IF(MYSQL_MAINTAINER_MODE)
IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
IF(WITH_INNODB_MEMCACHED)
SET_MYSQL_MAINTAINER_GNU_C_OPTIONS_NO_WERROR()
ELSE()
SET_MYSQL_MAINTAINER_GNU_C_OPTIONS()
ENDIF()
SET_MYSQL_MAINTAINER_GNU_C_OPTIONS()
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS()
Expand Down
19 changes: 1 addition & 18 deletions cmake/maintainer.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -38,23 +38,6 @@ MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
ENDMACRO()

MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS_NO_WERROR)
SET(MY_MAINTAINER_WARNINGS
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing")

CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement"
HAVE_DECLARATION_AFTER_STATEMENT)
IF(HAVE_DECLARATION_AFTER_STATEMENT)
SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT
"-Wdeclaration-after-statement")
ENDIF()
SET(MY_MAINTAINER_C_WARNINGS
"${MY_MAINTAINER_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}"
CACHE STRING "C warning options used in maintainer builds.")
# Do not make warnings in checks into errors.
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
ENDMACRO()


# Setup G++ (GNU C++ compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS)
Expand Down
10 changes: 8 additions & 2 deletions plugin/innodb_memcached/daemon_memcached/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -30,6 +30,13 @@ INCLUDE_DIRECTORIES(${LIBEVENT_INCLUDE_DIR}

SET(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS} -I${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/daemon_memcached/utilities")

# If current CMAKE_C_FLAGS is with Werror, turn it off to compile successfully
IF(CMAKE_C_FLAGS MATCHES "-Werror")
STRING(REGEX REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# Turn -Wdeclaration-after-statement off to reduce the number of warnings
STRING(REGEX REPLACE "-Wdeclaration-after-statement" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
ENDIF(CMAKE_C_FLAGS MATCHES "-Werror")

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS} -std=gnu99")

SET(LIBMEMCACHED_UTILITIES_SOURCES
Expand All @@ -47,7 +54,6 @@ SET(LIBMEMCACHED_UTILITIES_SOURCES
ADD_LIBRARY(memcached_utilities STATIC ${LIBMEMCACHED_UTILITIES_SOURCES})

SET(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS} -I${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/daemon_memcached/daemon")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS} -std=gnu99")

SET(MEMCACHED_SOURCES
daemon/memcached_mysql.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ mysql_declare_plugin(daemon_memcached)
0x0100 /* 1.0 */,
NULL, /* status variables */
daemon_memcached_sys_var, /* system variables */
NULL /* config options */
NULL, /* config options */
0 /* flags */
}
mysql_declare_plugin_end;
10 changes: 8 additions & 2 deletions plugin/innodb_memcached/innodb_memcache/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -24,6 +24,13 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/innodb_memcache
${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/innodb_memcache/cache-src
${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/daemon_memcached/include)

# If current CMAKE_C_FLAGS is with Werror, turn it off to compile successfully
IF(CMAKE_C_FLAGS MATCHES "-Werror")
STRING(REGEX REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# Turn -Wdeclaration-after-statement off to reduce the number of warnings
STRING(REGEX REPLACE "-Wdeclaration-after-statement" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
ENDIF(CMAKE_C_FLAGS MATCHES "-Werror")

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS} -std=gnu99")

SET(MCD__UTILITITY_SOURCES
Expand All @@ -35,7 +42,6 @@ ADD_LIBRARY(libmcd_util STATIC ${MCD__UTILITITY_SOURCES})
SET(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS}
-I${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/innodb_memcache/include
-I${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/innodb_memcache/cache-src")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS} -std=gnu99")

SET(INNODB_ENGINE_SOURCES
src/innodb_config.c
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/fts/fts0plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ fts_parse_query_internal(

info.prev = ' ';
info.quot = 0;
memset(&w, 0, sizeof(w));
/* Note: We don't handle simple parser mode here,
but user supplied plugin parser should handler it. */
while (ft_get_word(cs, start, end, &w, &info)) {
Expand Down

0 comments on commit 6c737c8

Please sign in to comment.