Skip to content

Commit

Permalink
CDRIVER-1432 Enable MongoDB 3.4 features
Browse files Browse the repository at this point in the history
  • Loading branch information
bjori committed Aug 11, 2016
1 parent d347c7e commit dc9fff2
Show file tree
Hide file tree
Showing 26 changed files with 51 additions and 230 deletions.
6 changes: 2 additions & 4 deletions .evergreen/unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ DEBUG_FLAGS="\
--enable-extra-align=no \
--enable-hardening=no \
--enable-maintainer-flags \
--enable-debug \
--enable-experimental-features"
--enable-debug"
RELEASE_FLAGS="
--enable-optimizations \
--enable-man-pages=no \
--enable-html-docs=no \
--enable-extra-align=no \
--enable-hardening \
--enable-experimental-features"
--enable-hardening"

# By default we build from git clone, which requires autotools
# This gets overwritten if we detect we should use the release archive
Expand Down
3 changes: 1 addition & 2 deletions .evergreen/windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ case "$CC" in
esac

CMAKE="/cygdrive/c/cmake/bin/cmake"
"$CMAKE" -G "$CC" "-DENABLE_EXPERIMENTAL_FEATURES=ON" \
"-DCMAKE_INSTALL_PREFIX=C:/libbson"
"$CMAKE" -G "$CC" "-DCMAKE_INSTALL_PREFIX=C:/libbson"
"$BUILD" /m ALL_BUILD.vcxproj
"$BUILD" /m INSTALL.vcxproj

Expand Down
54 changes: 12 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ cmake_minimum_required(VERSION 2.8)
project (libbson)

option(ENABLE_TESTS "Build libbson tests." ON)
option(ENABLE_EXPERIMENTAL_FEATURES
"Experimental support for future BSON features."
OFF)

include(CheckFunctionExists)
include(CheckIncludeFile)
Expand Down Expand Up @@ -34,12 +31,6 @@ set (CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/COPYING")
set (CPACK_PACKAGE_VERSION_MAJOR ${BSON_MAJOR_VERSION})
set (CPACK_PACKAGE_VERSION_MINOR ${BSON_MINOR_VERSION})

if (ENABLE_EXPERIMENTAL_FEATURES)
set (BSON_EXPERIMENTAL_FEATURES 1)
else ()
set (BSON_EXPERIMENTAL_FEATURES 0)
endif ()

include (CPack)
TEST_BIG_ENDIAN(BSON_BIG_ENDIAN)

Expand Down Expand Up @@ -147,6 +138,7 @@ set (SOURCES
${SOURCE_DIR}/src/bson/bson-atomic.c
${SOURCE_DIR}/src/bson/bson-clock.c
${SOURCE_DIR}/src/bson/bson-context.c
${SOURCE_DIR}/src/bson/bson-decimal128.c
${SOURCE_DIR}/src/bson/bson-error.c
${SOURCE_DIR}/src/bson/bson-iso8601.c
${SOURCE_DIR}/src/bson/bson-iter.c
Expand All @@ -173,10 +165,6 @@ set (SOURCES
${SOURCE_DIR}/src/yajl/yajl_version.c
)

if (ENABLE_EXPERIMENTAL_FEATURES)
set (SOURCES ${SOURCES} ${SOURCE_DIR}/src/bson/bson-decimal128.c)
endif ()

set (HEADERS
${PROJECT_BINARY_DIR}/src/bson/bson-config.h
${PROJECT_BINARY_DIR}/src/bson/bson-stdint.h
Expand All @@ -186,6 +174,7 @@ set (HEADERS
${SOURCE_DIR}/src/bson/bson-clock.h
${SOURCE_DIR}/src/bson/bson-compat.h
${SOURCE_DIR}/src/bson/bson-context.h
${SOURCE_DIR}/src/bson/bson-decimal128.h
${SOURCE_DIR}/src/bson/bson-endian.h
${SOURCE_DIR}/src/bson/bson-error.h
${SOURCE_DIR}/src/bson/bson.h
Expand All @@ -206,21 +195,8 @@ set (HEADERS
${SOURCE_DIR}/src/bson/bson-writer.h
)

if (ENABLE_EXPERIMENTAL_FEATURES)
set (HEADERS ${HEADERS} ${SOURCE_DIR}/src/bson/bson-decimal128.h)
endif ()

if (MSVC)
# Export the functions listed in a definitions file.
if (ENABLE_EXPERIMENTAL_FEATURES)
set (BSON_DEF_FILE
${PROJECT_SOURCE_DIR}/build/cmake/libbson-experimental.def)
else ()
set (BSON_DEF_FILE
${PROJECT_SOURCE_DIR}/build/cmake/libbson.def)
endif ()

set(BSON_SHARED_SOURCES ${SOURCES} ${BSON_DEF_FILE})
set(BSON_SHARED_SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/build/cmake/libbson.def)
else()
set(BSON_SHARED_SOURCES ${SOURCES})
endif()
Expand Down Expand Up @@ -259,18 +235,27 @@ if (ENABLE_TESTS)
set (BSON_TEST_SOURCES
${SOURCE_DIR}/tests/TestSuite.c
${SOURCE_DIR}/tests/TestSuite.h
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-1.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-2.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-3.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-4.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-5.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-6.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-7.json
${SOURCE_DIR}/tests/test-libbson.c
${SOURCE_DIR}/tests/test-atomic.c
${SOURCE_DIR}/tests/test-bson.c
${SOURCE_DIR}/tests/test-endian.c
${SOURCE_DIR}/tests/test-clock.c
${SOURCE_DIR}/tests/test-decimal128.c
${SOURCE_DIR}/tests/test-error.c
${SOURCE_DIR}/tests/test-iso8601.c
${SOURCE_DIR}/tests/test-iter.c
${SOURCE_DIR}/tests/test-json.c
${SOURCE_DIR}/tests/test-oid.c
${SOURCE_DIR}/tests/test-reader.c
${SOURCE_DIR}/tests/test-string.c
${SOURCE_DIR}/tests/test-type.c
${SOURCE_DIR}/tests/test-utf8.c
${SOURCE_DIR}/tests/test-value.c
${SOURCE_DIR}/tests/test-version.c
Expand All @@ -282,21 +267,6 @@ if (ENABLE_TESTS)
${SOURCE_DIR}/tests/json-test.h
)

if (ENABLE_EXPERIMENTAL_FEATURES)
set (BSON_TEST_SOURCES
${BSON_TEST_SOURCES}
${SOURCE_DIR}/tests/test-decimal128.c
${SOURCE_DIR}/tests/test-type.c
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-1.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-2.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-3.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-4.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-5.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-6.json
${SOURCE_DIR}/tests/json/type/decimal128/decimal128-7.json
)
endif ()

add_executable (test-libbson ${BSON_TEST_SOURCES})

target_link_libraries(test-libbson bson_static)
Expand Down
30 changes: 30 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
Libbson-1.5.0
=============

It is my pleasure to announce Libbson-1.5.0.

New features and bug fixes:

* New BSON Type, Decimal128 (bson_decimal128_t) along with the following
new functions and helpers:
* bson_decimal128_to_string ()
* bson_decimal128_from_string ()
* bson_decimal128_to_Decimal128 ()
* bson_Decimal128_to_decimal128
* bson_iter_decimal128 ()
* bson_iter_overwrite_decimal128 ()
* BSON_ITER_HOLDS_DECIMAL128()
* bson_append_decimal128 ()
* BSON_APPEND_DECIMAL128()
* BCON_DECIMAL128()
See the documentations for further details


Thanks to everyone who contributed to the development of this release.

* Everyone

Farewell,

A. Jesse Jiryu Davis

Libbson-1.4.0
=============

Expand Down
9 changes: 1 addition & 8 deletions build/autotools/PrintBuildConfiguration.m4
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
AC_OUTPUT

if test "$enable_experimental_features" = "yes"; then
enable_experimental_text="
Experimental support for future BSON features : yes"
else
enable_experimental_text=""
fi

if test -n "$BSON_PRERELEASE_VERSION"; then
cat << EOF
*** IMPORTANT ***
Expand Down Expand Up @@ -42,7 +35,7 @@ Build configuration:
Cross Compiling : ${enable_crosscompile}
Big endian : ${enable_bigendian}
Compile with native _Decimal128 (BID) support : ${enable_decimal}
Link Time Optimization (experimental) : ${enable_lto}${enable_experimental_text}
Link Time Optimization (experimental) : ${enable_lto}

Documentation:
man : ${enable_man_pages}
Expand Down
10 changes: 0 additions & 10 deletions build/autotools/ReadCommandLineArguments.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,6 @@ AC_ARG_ENABLE([maintainer-flags],
[],
[enable_maintainer_flags=maintainer_flags_default])

# Experimental BSON features
AC_ARG_ENABLE(experimental-features,
AC_HELP_STRING([--enable-experimental-features=@<:@no/yes@:>@],
[Experimental support for future BSON features [default=no]]),
[enable_experimental_features=$enableval])

AS_IF([test "$enable_experimental_features" = "yes"],
[AC_SUBST(BSON_EXPERIMENTAL_FEATURES, 1)],
[AC_SUBST(BSON_EXPERIMENTAL_FEATURES, 0)])

AC_ARG_ENABLE([html-docs],
[AS_HELP_STRING([--enable-html-docs=@<:@yes/no@:>@],
[Build HTML documentation.])],
Expand Down
2 changes: 0 additions & 2 deletions build/autotools/SetupAutomake.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AM_CONDITIONAL([COMPILER_CLANG],[test "$c_compiler" = "clang" && test "$cxx_comp

# Feature Conditionals
AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug" = "yes"])
AM_CONDITIONAL([ENABLE_EXPERIMENTAL_FEATURES],
[test "$enable_experimental_features" = "yes"])

# C99 Features
AM_CONDITIONAL([ENABLE_STDBOOL],[test "$enable_stdbool" = "yes"])
Expand Down
12 changes: 2 additions & 10 deletions src/bson/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ INST_H_FILES = \
src/bson/bson-clock.h \
src/bson/bson-compat.h \
src/bson/bson-context.h \
src/bson/bson-decimal128.h \
src/bson/bson-endian.h \
src/bson/bson-error.h \
src/bson/bson-iter.h \
Expand All @@ -30,11 +31,6 @@ INST_H_FILES = \
src/bson/bson-version-functions.h \
src/bson/bson-writer.h

if ENABLE_EXPERIMENTAL_FEATURES
INST_H_FILES += \
src/bson/bson-decimal128.h
endif

if OS_WIN32
INST_H_FILES += src/bson/bson-stdint-win32.h
else
Expand Down Expand Up @@ -72,6 +68,7 @@ libbson_la_SOURCES = \
src/bson/bson-atomic.c \
src/bson/bson-clock.c \
src/bson/bson-context.c \
src/bson/bson-decimal128.c \
src/bson/bson-error.c \
src/bson/bson-iter.c \
src/bson/bson-iso8601.c \
Expand All @@ -88,11 +85,6 @@ libbson_la_SOURCES = \
src/bson/bson-version-functions.c \
src/bson/bson-writer.c

if ENABLE_EXPERIMENTAL_FEATURES
libbson_la_SOURCES += \
src/bson/bson-decimal128.c
endif

libbson_la_LIBADD =

if !OS_WIN32
Expand Down
12 changes: 0 additions & 12 deletions src/bson/bcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ typedef union bcon_append {
} TIMESTAMP;

int64_t INT64;
#ifdef BSON_EXPERIMENTAL_FEATURES
bson_decimal128_t *DECIMAL128;
#endif
const bson_iter_t *ITER;
} bcon_append_t;

Expand Down Expand Up @@ -196,9 +194,7 @@ typedef union bcon_extract {
} TIMESTAMP;

int64_t *INT64;
#ifdef BSON_EXPERIMENTAL_FEATURES
bson_decimal128_t *DECIMAL128;
#endif
} bcon_extract_t;

static const char *gBconMagic = "BCON_MAGIC";
Expand Down Expand Up @@ -287,11 +283,9 @@ _bcon_append_single (bson_t *bson,
case BCON_TYPE_INT64:
bson_append_int64 (bson, key, -1, val->INT64);
break;
#ifdef BSON_EXPERIMENTAL_FEATURES
case BCON_TYPE_DECIMAL128:
bson_append_decimal128 (bson, key, -1, val->DECIMAL128);
break;
#endif
case BCON_TYPE_MAXKEY:
bson_append_maxkey (bson, key, -1);
break;
Expand Down Expand Up @@ -412,12 +406,10 @@ _bcon_extract_single (const bson_iter_t *iter,
CHECK_TYPE (BSON_TYPE_INT64);
*val->INT64 = bson_iter_int64 (iter);
break;
#ifdef BSON_EXPERIMENTAL_FEATURES
case BCON_TYPE_DECIMAL128:
CHECK_TYPE (BSON_TYPE_DECIMAL128);
bson_iter_decimal128 (iter, val->DECIMAL128);
break;
#endif
case BCON_TYPE_MAXKEY:
CHECK_TYPE (BSON_TYPE_MAXKEY);
break;
Expand Down Expand Up @@ -550,11 +542,9 @@ _bcon_append_tokenize (va_list *ap,
case BCON_TYPE_INT64:
u->INT64 = va_arg (*ap, int64_t);
break;
#ifdef BSON_EXPERIMENTAL_FEATURES
case BCON_TYPE_DECIMAL128:
u->DECIMAL128 = va_arg (*ap, bson_decimal128_t *);
break;
#endif
case BCON_TYPE_MAXKEY:
break;
case BCON_TYPE_MINKEY:
Expand Down Expand Up @@ -685,11 +675,9 @@ _bcon_extract_tokenize (va_list *ap,
case BCON_TYPE_INT64:
u->INT64 = va_arg (*ap, int64_t *);
break;
#ifdef BSON_EXPERIMENTAL_FEATURES
case BCON_TYPE_DECIMAL128:
u->DECIMAL128 = va_arg (*ap, bson_decimal128_t *);
break;
#endif
case BCON_TYPE_MAXKEY:
break;
case BCON_TYPE_MINKEY:
Expand Down
8 changes: 0 additions & 8 deletions src/bson/bcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ BCON_ENSURE_DECLARE (int32, int32_t)
BCON_ENSURE_DECLARE (int32_ptr, int32_t *)
BCON_ENSURE_DECLARE (int64, int64_t)
BCON_ENSURE_DECLARE (int64_ptr, int64_t *)
#ifdef BSON_EXPERIMENTAL_FEATURES
BCON_ENSURE_DECLARE (const_decimal128_ptr, const bson_decimal128_t *)
#endif
BCON_ENSURE_DECLARE (bool, bool)
BCON_ENSURE_DECLARE (bool_ptr, bool *)
BCON_ENSURE_DECLARE (bson_type, bson_type_t)
Expand Down Expand Up @@ -110,10 +108,8 @@ BCON_ENSURE_DECLARE (const_bson_iter_ptr, const bson_iter_t *)
BCON_ENSURE (int32, (_increment))
#define BCON_INT64(_val) \
BCON_MAGIC, BCON_TYPE_INT64, BCON_ENSURE (int64, (_val))
#ifdef BSON_EXPERIMENTAL_FEATURES
#define BCON_DECIMAL128(_val) \
BCON_MAGIC, BCON_TYPE_DECIMAL128, BCON_ENSURE (const_decimal128_ptr, (_val))
#endif /* BSON_EXPERIMENTAL_FEATURES */
#define BCON_MAXKEY BCON_MAGIC, BCON_TYPE_MAXKEY
#define BCON_MINKEY BCON_MAGIC, BCON_TYPE_MINKEY
#define BCON(_val) \
Expand Down Expand Up @@ -166,10 +162,8 @@ BCON_ENSURE_DECLARE (const_bson_iter_ptr, const bson_iter_t *)
BCON_ENSURE_STORAGE (int32_ptr, (_increment))
#define BCONE_INT64(_val) BCONE_MAGIC, BCON_TYPE_INT64, \
BCON_ENSURE_STORAGE (int64_ptr, (_val))
#ifdef BSON_EXPERIMENTAL_FEATURES
#define BCONE_DECIMAL128(_val) BCONE_MAGIC, BCON_TYPE_DECIMAL128, \
BCON_ENSURE_STORAGE (const_decimal128_ptr, (_val))
#endif
#define BCONE_MAXKEY BCONE_MAGIC, BCON_TYPE_MAXKEY
#define BCONE_MINKEY BCONE_MAGIC, BCON_TYPE_MINKEY
#define BCONE_SKIP(_val) BCONE_MAGIC, BCON_TYPE_SKIP, \
Expand Down Expand Up @@ -200,9 +194,7 @@ typedef enum
BCON_TYPE_INT32,
BCON_TYPE_TIMESTAMP,
BCON_TYPE_INT64,
#ifdef BSON_EXPERIMENTAL_FEATURES
BCON_TYPE_DECIMAL128,
#endif
BCON_TYPE_MAXKEY,
BCON_TYPE_MINKEY,
BCON_TYPE_BCON,
Expand Down
8 changes: 0 additions & 8 deletions src/bson/bson-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,4 @@
#endif


/*
* Define to 1 to support experimental future BSON or MongoDB features.
*/
#define BSON_EXPERIMENTAL_FEATURES @BSON_EXPERIMENTAL_FEATURES@
#if BSON_EXPERIMENTAL_FEATURES != 1
# undef BSON_EXPERIMENTAL_FEATURES
#endif

#endif /* BSON_CONFIG_H */
Loading

0 comments on commit dc9fff2

Please sign in to comment.