Changeset: 4246aacc1cde for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4246aacc1cde
Modified Files:
.clang-format
gdk/gdk.h
Branch: default
Log Message:
Some rearrangements and some layout.
diffs (truncated from 1590 to 300 lines):
diff --git a/.clang-format b/.clang-format
--- a/.clang-format
+++ b/.clang-format
@@ -40,9 +40,11 @@ ContinuationIndentWidth: 8
EnumTrailingComma: Leave
ForEachMacros:
- BATloop
+ - CAND_LOOP
+ - CAND_LOOP_IDX
+ - TIMEOUT_LOOP
- TIMEOUT_LOOP_IDX
- TIMEOUT_LOOP_IDX_DECL
- - TIMEOUT_LOOP
IfMacros:
- TRC_CRITICAL_IF
- TRC_ERROR_IF
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -119,6 +119,14 @@
#include "mstring.h"
#include "stream.h"
+/* library version */
+#define GDKLIBRARY_HASHASH 061044U /* first in Jul2021: hashash bit in
string heaps */
+#define GDKLIBRARY_HSIZE 061045U /* first in Jan2022: heap "size" values
*/
+#define GDKLIBRARY_JSON 061046U /* first in Sep2022: json storage
changes*/
+#define GDKLIBRARY_STATUS 061047U /* first in Dec2023: no status/filename
columns */
+#define GDKLIBRARY_USTR 061050U /* first in Aug2024: no ustr */
+#define GDKLIBRARY 061051U /* first after Dec2025 */
+
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
@@ -136,14 +144,22 @@
/* unreachable code */
#ifdef __has_builtin
#if __has_builtin(__builtin_unreachable)
-#define MT_UNREACHABLE() do { assert(0); __builtin_unreachable(); }
while (0)
+#define MT_UNREACHABLE() \
+ do { \
+ assert(0); \
+ __builtin_unreachable(); \
+ } while (0)
#endif
#endif
#ifndef MT_UNREACHABLE
#if defined(_MSC_VER)
#define MT_UNREACHABLE() do { assert(0); __assume(0); } while (0)
#else
-#define MT_UNREACHABLE() do { assert(0); GDKfatal("Unreachable C code
path reached"); } while (0)
+#define MT_UNREACHABLE() \
+ do { \
+ assert(0); \
+ GDKfatal("Unreachable C code path reached"); \
+ } while (0)
#endif
#endif
@@ -163,6 +179,99 @@ typedef int128_t hge;
typedef uint128_t uhge;
#endif
+#define SIZEOF_LNG 8
+#define LL_CONSTANT(val) INT64_C(val)
+#define PRIdLNG PRId64
+#define PRIuLNG PRIu64
+#define PRIxLNG PRIx64
+#define PRIoLNG PRIo64
+#define LLFMT "%" PRIdLNG
+#define ULLFMT "%" PRIuLNG
+#define LLSCN "%" SCNd64
+#define ULLSCN "%" SCNu64
+
+#ifdef HAVE_HGE
+#define SIZEOF_HGE 16
+/* constants, printf format, scanf format: not supported for 128 bit
+ * integers */
+#endif
+
+#define SIZEOF_OID SIZEOF_SIZE_T
+typedef size_t oid;
+/* macro in the style of <inttypes.h> for formatting oid */
+#define PRIuOID "zu"
+#define OIDFMT "%" PRIuOID
+
+typedef int bat; /* Index into BBP */
+typedef void *ptr; /* Internal coding of types */
+
+#define SIZEOF_PTR SIZEOF_VOID_P
+typedef float flt;
+typedef double dbl;
+typedef char *str;
+
+typedef union {
+ uint32_t align; /* force alignment, only used for equality */
+ uint8_t quad[4] __attribute__((__nonstring__));
+} inet4;
+
+typedef union {
+#ifdef HAVE_HGE
+ uint128_t align; /* force alignment, only used for equality */
+#else
+ uint64_t align[2]; /* force alignment, not otherwise used */
+#endif
+ uint8_t hex[16] __attribute__((__nonstring__));
+} inet6;
+
+#define UUID_SIZE 16 /* size of a UUID */
+#define UUID_STRLEN 36 /* length of string representation */
+
+typedef union {
+#ifdef HAVE_HGE
+ uint128_t h; /* force alignment, only used for equality */
+#else
+ uint64_t l[2]; /* force alignment, not otherwise used */
+#endif
+ uint8_t u[UUID_SIZE] __attribute__((__nonstring__));
+} uuid;
+
+typedef struct {
+ size_t nitems;
+ uint8_t data[] __attribute__((__nonstring__))
+ __attribute__((__counted_by__(nitems)));
+} blob;
+gdk_export size_t blobsize(size_t nitems) __attribute__((__const__));
+
+/* The types `oid`, `BUN` and `var_t` are all defined as `size_t`, but
+ * they serve different purposes. `oid` is the *logical* row number of
+ * a BAT; `BUN` is the *physical* row number of a BAT and is therefore
+ * also used for the total number of rows and the potential capacity of
+ * a BAT; `var_t` is an *offset* into the var-size heap (vheap). The
+ * difference between the *logical* and *physical* row number is the
+ * value of the head sequence base (`hseqbase`) of the BAT. */
+
+typedef oid var_t; /* type used for heap index of var-sized BAT */
+#define SIZEOF_VAR_T SIZEOF_OID
+#define VARFMT OIDFMT
+
+#if SIZEOF_VAR_T == SIZEOF_INT
+#define VAR_MAX ((var_t) INT_MAX)
+#else
+#define VAR_MAX ((var_t) INT64_MAX)
+#endif
+
+typedef oid BUN; /* BUN position */
+#define SIZEOF_BUN SIZEOF_OID
+#define PRIuBUN PRIuOID
+#define BUNFMT OIDFMT
+#if SIZEOF_BUN == SIZEOF_INT
+#define BUN_NONE ((BUN) INT_MAX)
+#else
+#define BUN_NONE ((BUN) INT64_MAX)
+#endif
+#define BUN_MAX (BUN_NONE - 1) /* maximum allowed size of a BAT */
+
typedef struct allocator allocator;
/* checkpoint or snapshot of allocator internal state we can use
* to restore to a point in time */
@@ -208,11 +317,11 @@ typedef struct allocator_state {
// ADAPTERS
#define TRC_FOREACH_ADPTR(ADPTR) \
- ADPTR( BASIC ) \
- ADPTR( PROFILER ) \
- ADPTR( MBEDDED ) \
+ ADPTR(BASIC) \
+ ADPTR(PROFILER) \
+ ADPTR(MBEDDED) \
\
- ADPTR( ADAPTERS_COUNT )
+ ADPTR(ADAPTERS_COUNT)
typedef enum {
TRC_FOREACH_ADPTR(TRC_GENERATE_ENUM)
@@ -222,13 +331,13 @@ typedef enum {
// LOG LEVELS
#define TRC_FOREACH_LEVEL(LEVEL) \
- LEVEL( M_CRITICAL ) \
- LEVEL( M_ERROR ) \
- LEVEL( M_WARNING ) \
- LEVEL( M_INFO ) \
- LEVEL( M_DEBUG ) \
+ LEVEL(M_CRITICAL) \
+ LEVEL(M_ERROR) \
+ LEVEL(M_WARNING) \
+ LEVEL(M_INFO) \
+ LEVEL(M_DEBUG) \
\
- LEVEL( LOG_LEVELS_COUNT )
+ LEVEL(LOG_LEVELS_COUNT)
typedef enum {
TRC_FOREACH_LEVEL(TRC_GENERATE_ENUM)
@@ -237,12 +346,12 @@ typedef enum {
// LAYERS
#define TRC_FOREACH_LAYER(LAYER) \
- LAYER( MDB_ALL ) \
- LAYER( SQL_ALL ) \
- LAYER( MAL_ALL ) \
- LAYER( GDK_ALL ) \
+ LAYER(MDB_ALL) \
+ LAYER(SQL_ALL) \
+ LAYER(MAL_ALL) \
+ LAYER(GDK_ALL) \
\
- LAYER( LAYERS_COUNT )
+ LAYER(LAYERS_COUNT)
typedef enum {
TRC_FOREACH_LAYER(TRC_GENERATE_ENUM)
@@ -253,45 +362,45 @@ typedef enum {
// COMPONENTS
#define TRC_FOREACH_COMP(COMP) \
- COMP( ACCELERATOR ) \
- COMP( ALGO ) \
- COMP( ALLOC ) \
- COMP( BAT ) \
- COMP( CHECK ) \
- COMP( DELTA ) \
- COMP( HEAP ) \
- COMP( IO ) \
- COMP( WAL ) \
- COMP( PAR ) \
- COMP( PERF ) \
- COMP( TEM ) \
- COMP( THRD ) \
- COMP( TM ) \
+ COMP(ACCELERATOR) \
+ COMP(ALGO) \
+ COMP(ALLOC) \
+ COMP(BAT) \
+ COMP(CHECK) \
+ COMP(DELTA) \
+ COMP(HEAP) \
+ COMP(IO) \
+ COMP(WAL) \
+ COMP(PAR) \
+ COMP(PERF) \
+ COMP(TEM) \
+ COMP(THRD) \
+ COMP(TM) \
\
- COMP( GEOM ) \
- COMP( FITS ) \
- COMP( SHP ) \
- COMP( PARQUET ) \
+ COMP(GEOM) \
+ COMP(FITS) \
+ COMP(SHP) \
+ COMP(PARQUET) \
\
- COMP( LOADER ) \
+ COMP(LOADER) \
\
- COMP( SQL_PARSER ) \
- COMP( SQL_TRANS ) \
- COMP( SQL_REWRITER ) \
- COMP( SQL_EXECUTION ) \
- COMP( SQL_STORE ) \
+ COMP(SQL_PARSER) \
+ COMP(SQL_TRANS) \
+ COMP(SQL_REWRITER) \
+ COMP(SQL_EXECUTION) \
+ COMP(SQL_STORE) \
\
- COMP( MAL_REMOTE ) \
- COMP( MAL_MAPI ) \
- COMP( MAL_SERVER ) \
- COMP( MAL_LOADER ) \
- COMP( MAL_INSTRUCTION ) \
+ COMP(MAL_REMOTE) \
+ COMP(MAL_MAPI) \
+ COMP(MAL_SERVER) \
+ COMP(MAL_LOADER) \
+ COMP(MAL_INSTRUCTION) \
\
- COMP( MAL_OPTIMIZER ) \
+ COMP(MAL_OPTIMIZER) \
\
- COMP( GDK ) \
+ COMP(GDK) \
\
- COMP( COMPONENTS_COUNT )
+ COMP(COMPONENTS_COUNT)
typedef enum {
TRC_FOREACH_COMP(TRC_GENERATE_ENUM)
@@ -406,11 +515,13 @@ gdk_export gdk_return GDKtracer_set_trac
gdk_export gdk_return GDKtracer_stop(void);
-gdk_export gdk_return GDKtracer_set_component_level(const char *comp, const
char *lvl);
+gdk_export gdk_return GDKtracer_set_component_level(const char *comp,
+ const char *lvl);
gdk_export const char *GDKtracer_get_component_level(const char *comp);
gdk_export gdk_return GDKtracer_reset_component_level(const char *comp);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]