Commit 798f8341 authored by Yoni Fogel's avatar Yoni Fogel

refs #6286 Reorganized static asserts and status macros so c++11 features stay...

refs #6286 Reorganized static asserts and status macros so c++11 features stay out of exported headers

git-svn-id: file:///svn/toku/tokudb@54546 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6371d113
......@@ -20,6 +20,7 @@
#include <portability/toku_pthread.h>
#include <portability/toku_time.h>
#include <util/rwlock.h>
#include <util/status.h>
///////////////////////////////////////////////////////////////////////////////////
// Engine status
......
......@@ -50,7 +50,7 @@
#include "logger.h"
#include "checkpoint.h"
#include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
#include <util/status.h>
///////////////////////////////////////////////////////////////////////////////////
// Engine status
......
......@@ -11,7 +11,7 @@
#include <ft.h>
#include <toku_assert.h>
#include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
#include <util/status.h>
/* Status is intended for display to humans to help understand system behavior.
* It does not need to be perfectly thread-safe.
......
......@@ -10,7 +10,7 @@
#include <ft-internal.h>
#include <ft.h>
#include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
#include <util/status.h>
// Member Descirption:
// 1. highest_pivot_key - this is the key that corresponds to the
......
......@@ -133,7 +133,7 @@ basement nodes, bulk fetch, and partial fetch:
#include <portability/toku_atomic.h>
#include <util/mempool.h>
#include <util/partitioned_counter.h>
#include <util/status.h>
#include <util/rwlock.h>
#include <util/sort.h>
......
......@@ -11,7 +11,7 @@
#include <util/sort.h>
#include <util/threadpool.h>
#include "ft.h"
#include <util/partitioned_counter.h>
#include <util/status.h>
static FT_UPGRADE_STATUS_S ft_upgrade_status;
......
......@@ -14,7 +14,7 @@
#include "txn_manager.h"
#include "rollback_log_node_cache.h"
#include "huge_page_detection.h"
#include <util/partitioned_counter.h>
#include <util/status.h>
static const int log_format_version=TOKU_LOG_VERSION;
......
......@@ -13,7 +13,7 @@
#include "rollback-apply.h"
#include "txn_manager.h"
#include "txn_child_manager.h"
#include <util/partitioned_counter.h>
#include <util/status.h>
///////////////////////////////////////////////////////////////////////////////////
// Engine status
......
......@@ -29,7 +29,7 @@
#include "ule.h"
#include "txn_manager.h"
#include "ule-internal.h"
#include <util/partitioned_counter.h>
#include <util/status.h>
#define ULE_DEBUG 0
......
......@@ -9,7 +9,7 @@
#include <portability/toku_pthread.h>
#include "locktree.h"
#include <util/partitioned_counter.h>
#include <util/status.h>
namespace toku {
......
......@@ -28,7 +28,7 @@
#include <ft/checkpoint.h>
#include <portability/toku_atomic.h>
#include "loader.h"
#include <util/partitioned_counter.h>
#include <util/status.h>
///////////////////////////////////////////////////////////////////////////////////
// Engine status
......
......@@ -29,7 +29,7 @@
#include "ydb_load.h"
#include "loader.h"
#include <util/partitioned_counter.h>
#include <util/status.h>
enum {MAX_FILE_SIZE=256};
......
......@@ -25,7 +25,7 @@ const char *toku_copyright_string = "Copyright (c) 2007-2012 Tokutek Inc. All r
#include <sys/stat.h>
#include <sys/types.h>
#include <util/partitioned_counter.h>
#include <util/status.h>
#include <ft/ft-flusher.h>
#include <ft/cachetable.h>
......
......@@ -21,7 +21,7 @@
#include "ydb_load.h"
#include "indexer.h"
#include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
#include <util/status.h>
static YDB_DB_LAYER_STATUS_S ydb_db_layer_status;
#ifdef STATUS_VALUE
......
......@@ -13,7 +13,7 @@
#include "ydb_write.h"
#include "ydb_db.h"
#include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
#include <util/status.h>
static YDB_WRITE_LAYER_STATUS_S ydb_write_layer_status;
#ifdef STATUS_VALUE
......
......@@ -10,6 +10,12 @@
// Tokutek portability layer
#if defined(__clang__)
# define constexpr_static_assert(a, b)
#else
# define constexpr_static_assert(a, b) static_assert(a, b)
#endif
#if defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(__ICL))
#define TOKU_WINDOWS 1
......
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#pragma once
constexpr char UU() static_tolower(const char a) {
return a >= 'A' && a <= 'Z' ? a - 'A' + 'a' : a;
}
constexpr int UU() static_strncasecmp(const char *a, const char *b, size_t len) {
return len == 0 ? 0 : (
static_tolower(*a) != static_tolower(*b) || *a == '\0' ?
static_tolower(*a) - static_tolower(*b) :
static_strncasecmp(a+1, b+1, len-1)
);
}
......@@ -58,52 +58,6 @@ void partitioned_counters_init(void);
void partitioned_counters_destroy(void);
// Effect: Destroy any partitioned counters data structures.
/*
*/
#if defined(__clang__)
// clang does not yet support constexprs, so cannot use strcmp, strncmp, etc in static_asserts
#define TOKUDB_STATUS_INIT_CONSTEXPR_ASSERTS(c, inc) do { } while (0)
#else
constexpr char UU() static_tolower(const char a) {
return a >= 'A' && a <= 'Z' ? a - 'A' + 'a' : a;
}
constexpr int UU() static_strncasecmp(const char *a, const char *b, size_t len) {
return len == 0 ? 0 : (
static_tolower(*a) != static_tolower(*b) || *a == '\0' ?
static_tolower(*a) - static_tolower(*b) :
static_strncasecmp(a+1, b+1, len-1)
);
}
#define TOKUDB_STATUS_INIT_CONSTEXPR_ASSERTS(c, inc) do { \
static_assert(strcmp(#c, "NULL") && strcmp(#c, "0"), \
"Use nullptr for no column name instead of NULL, 0, etc..."); \
static_assert((inc) == TOKU_ENGINE_STATUS || strcmp(#c, "nullptr"), \
"Missing column name."); \
static_assert(static_strncasecmp(#c, "TOKU", strlen("TOKU")), \
"Do not start column names with toku/tokudb. Names get TOKUDB_ prefix automatically."); \
static_assert((inc) == TOKU_ENGINE_STATUS || \
(strcmp(#c, "nullptr") && strcmp(#c, "NULL") && strcmp(#c, "0")) \
, "Missing column name."); \
} while (0)
#endif
#define TOKUDB_STATUS_INIT(array,k,c,t,l,inc) do { \
array.status[k].keyname = #k; \
array.status[k].columnname = #c; \
array.status[k].type = t; \
array.status[k].legend = l; \
static_assert((inc) != 0, "Var must be included in at least one place"); \
TOKUDB_STATUS_INIT_CONSTEXPR_ASSERTS(c, inc); \
array.status[k].include = static_cast<toku_engine_status_include_type>(inc); \
if (t == PARCOUNT) { \
array.status[k].value.parcount = create_partitioned_counter(); \
} \
} while (0)
#if 0
#include <pthread.h>
#include "fttypes.h"
......
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#pragma once
#include <util/partitioned_counter.h>
#include <util/constexpr.h>
#define TOKUDB_STATUS_INIT(array,k,c,t,l,inc) do { \
array.status[k].keyname = #k; \
array.status[k].columnname = #c; \
array.status[k].type = t; \
array.status[k].legend = l; \
static_assert((inc) != 0, "Var must be included in at least one place"); \
constexpr_static_assert(strcmp(#c, "NULL") && strcmp(#c, "0"), \
"Use nullptr for no column name instead of NULL, 0, etc..."); \
constexpr_static_assert((inc) == TOKU_ENGINE_STATUS \
|| strcmp(#c, "nullptr"), "Missing column name."); \
constexpr_static_assert(static_strncasecmp(#c, "TOKU", strlen("TOKU")), \
"Do not start column names with toku/tokudb. Names get TOKUDB_ prefix automatically."); \
array.status[k].include = static_cast<toku_engine_status_include_type>(inc); \
if (t == PARCOUNT) { \
array.status[k].value.parcount = create_partitioned_counter(); \
} \
} while (0)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment