/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef DISABLE_OPTIMIZE_H
#define DISABLE_OPTIMIZE_H 1

/* avoid wasting time trying to optimize those countless test functions */
#if defined(__clang__)


/*
 * Works for Alk since clang-3.5.
 * Unfortunately it looks like Apple have their own versioning scheme for
 * clang, because mine (Trond) reports itself as 5.1 and does not have
 * the pragma.
 */

#if ((__clang_major__ * 0x100 + __clang_minor) >= 0x305) && !defined(__APPLE__)
#pragma clang optimize off
#endif

#elif defined(__GNUC__)
/*
 * gcc docs indicate that pragma optimize is supported since 4.4. Earlier
 * versions will emit harmless warning.
 */
#if ((__GNUC__ * 0x100 + __GNUC_MINOR__) >= 0x0404)
#pragma GCC optimize ("O0")
#endif

#endif /* __GNUC__ */


#endif

/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef DISABLE_OPTIMIZE_H
#define DISABLE_OPTIMIZE_H 1

/* According to MB-11846 we have some misconfigured vm's unable to
 * compile the source code without enabling optimization. Add a workaround
 * for those vm's until they're fixed
 */
#ifndef COUCHBASE_OPTIMIZE_BREAKDANCER_TEST

/* avoid wasting time trying to optimize those countless test functions */
#if defined(__clang__)


/*
 * Works for Alk since clang-3.5.
 * Unfortunately it looks like Apple have their own versioning scheme for
 * clang, because mine (Trond) reports itself as 5.1 and does not have
 * the pragma.
 */

#if ((__clang_major__ * 0x100 + __clang_minor) >= 0x305) && !defined(__APPLE__)
#pragma clang optimize off
#endif

#elif defined(__GNUC__)
/*
 * gcc docs indicate that pragma optimize is supported since 4.4. Earlier
 * versions will emit harmless warning.
 */
#if ((__GNUC__ * 0x100 + __GNUC_MINOR__) >= 0x0404)
#pragma GCC optimize ("O0")
#endif

#endif /* __GNUC__ */

#endif /* COUCHBASE_OPTIMIZE_BREAKDANCER_TEST */

#endif

Add workaround for broken builders
MB-11846: Add workaround for broken builders

According to MB-11846 we have some misconfigured vm's unable to
compile the source code without enabling optimization. This
patch introduce a workaround to enable the optimization of the
breakdancer tests until the vm's is fixed. To use the workaround
define COUCHBASE_OPTIMIZE_BREAKDANCER_TEST during compilation.

Add -D CMAKE_C_FLAGS=-DCOUCHBASE_OPTIMIZE_BREAKDANCER_TEST to
the command line when invoking cmake.

Change-Id: I067548b39be9f52951afed0c30221e1d77926b93
Reviewed-on: http://review.couchbase.org/40165
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
