Skip to content

Commit 604f306

Browse files
committed
Bug #20316320 - DEBUG BUILD ON WINDOWS SHOULD REPLACE /OB0 WITH /OB1 TO SPEED UP TEST RUNS
Replace /Ob0 which CMake automatically adds for debug builds, with /Ob1 This caused linking error due to some functions in my_time.c which were declared inline there but not in my_time.h. This makes little sense, so I removed the inline. Added new CMake option WIN_DEBUG_NO_INLINE which is default OFF. If this is turned ON, inlining will again be disabled as before.
1 parent 60a651a commit 604f306

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

cmake/os/Windows.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -64,6 +64,8 @@ IF(WITH_MSCRT_DEBUG)
6464
ADD_DEFINITIONS(-D_CRTDBG_MAP_ALLOC)
6565
ENDIF()
6666

67+
OPTION(WIN_DEBUG_NO_INLINE "Disable inlining for debug builds on Windows" OFF)
68+
6769
IF(MSVC)
6870
# Enable debug info also in Release build,
6971
# and create PDB to be able to analyze crashes.
@@ -86,6 +88,13 @@ IF(MSVC)
8688
# information for use with the debugger. The symbolic debugging
8789
# information includes the names and types of variables, as well as
8890
# functions and line numbers. No .pdb file is produced by the compiler.
91+
# - Enable explicit inline:
92+
# /Ob1
93+
# Expands explicitly inlined functions. By default /Ob0 is used,
94+
# meaning no inlining. But this impacts test execution time.
95+
# Allowing inline reduces test time using the debug server by
96+
# 30% or so. If you do want to keep inlining off, set the
97+
# cmake flag WIN_DEBUG_NO_INLINE.
8998
FOREACH(lang C CXX)
9099
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7")
91100
ENDFOREACH()
@@ -96,6 +105,9 @@ IF(MSVC)
96105
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
97106
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
98107
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
108+
IF (NOT WIN_DEBUG_NO_INLINE)
109+
STRING(REPLACE "/Ob0" "/Ob1" "${flag}" "${${flag}}")
110+
ENDIF()
99111
SET("${flag}" "${${flag}} /EHsc")
100112
ENDFOREACH()
101113

sql-common/my_time.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ uint calc_days_in_year(uint year)
6565
@param tm[OUT] The value to set.
6666
@param time_type Timestasmp type
6767
*/
68-
inline void set_zero_time(MYSQL_TIME *tm,
69-
enum enum_mysql_timestamp_type time_type)
68+
void set_zero_time(MYSQL_TIME *tm,
69+
enum enum_mysql_timestamp_type time_type)
7070
{
7171
memset(tm, 0, sizeof(*tm));
7272
tm->time_type= time_type;
@@ -77,7 +77,7 @@ inline void set_zero_time(MYSQL_TIME *tm,
7777
Set hour, minute and second of a MYSQL_TIME variable to maximum time value.
7878
Unlike set_max_time(), does not touch the other structure members.
7979
*/
80-
inline void set_max_hhmmss(MYSQL_TIME *tm)
80+
void set_max_hhmmss(MYSQL_TIME *tm)
8181
{
8282
tm->hour= TIME_MAX_HOUR;
8383
tm->minute= TIME_MAX_MINUTE;
@@ -153,7 +153,7 @@ my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
153153
@retval TRUE if the value is fatally bad.
154154
@retval FALSE if the value is Ok.
155155
*/
156-
inline my_bool check_time_mmssff_range(const MYSQL_TIME *ltime)
156+
my_bool check_time_mmssff_range(const MYSQL_TIME *ltime)
157157
{
158158
return ltime->minute >= 60 || ltime->second >= 60 ||
159159
ltime->second_part > 999999;
@@ -172,7 +172,7 @@ inline my_bool check_time_mmssff_range(const MYSQL_TIME *ltime)
172172
@retval FALSE if value is Ok.
173173
@retval TRUE if value is out of range.
174174
*/
175-
inline my_bool check_time_range_quick(const MYSQL_TIME *ltime)
175+
my_bool check_time_range_quick(const MYSQL_TIME *ltime)
176176
{
177177
longlong hour= (longlong) ltime->hour + 24LL * ltime->day;
178178
/* The input value should not be fatally bad */

0 commit comments

Comments
 (0)