Changeset: 672507d72da2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/672507d72da2
Modified Files:
gdk/gdk.h
gdk/gdk_private.h
gdk/gdk_system.h
geom/lib/libgeom.h
monetdb5/mal/mal.h
Branch: default
Log Message:
Added some attributes.
The counted_by attributes specifies the member that holds the number of
elements in the flexible array to which the attribute is attached.
diffs (95 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -211,7 +211,8 @@ typedef union {
typedef struct {
size_t nitems;
- uint8_t data[] __attribute__((__nonstring__));
+ uint8_t data[] __attribute__((__nonstring__))
+ __attribute__((__counted_by__(nitems)));
} blob;
gdk_export size_t blobsize(size_t nitems) __attribute__((__const__));
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -409,12 +409,12 @@ extern struct BBPfarm_t {
uint32_t roles; /* bitmask of allowed roles */
const char *dirname; /* farm directory */
FILE *lock_file;
-} BBPfarms[MAXFARMS];
+} BBPfarms[MAXFARMS] __attribute__((__visibility__("hidden")));
-extern batlock_t GDKbatLock[BBP_BATMASK + 1];
-extern size_t GDK_mmap_minsize_persistent; /* size after which we use memory
mapped files for persistent heaps */
-extern size_t GDK_mmap_minsize_transient; /* size after which we use memory
mapped files for transient heaps */
-extern size_t GDK_mmap_pagesize; /* mmap granularity */
+extern batlock_t GDKbatLock[BBP_BATMASK + 1]
__attribute__((__visibility__("hidden")));
+extern size_t GDK_mmap_minsize_persistent
__attribute__((__visibility__("hidden"))); /* size after which we use memory
mapped files for persistent heaps */
+extern size_t GDK_mmap_minsize_transient
__attribute__((__visibility__("hidden"))); /* size after which we use memory
mapped files for transient heaps */
+extern size_t GDK_mmap_pagesize __attribute__((__visibility__("hidden"))); /*
mmap granularity */
#define BATcheck(tst, err) \
do { \
@@ -441,19 +441,19 @@ extern size_t GDK_mmap_pagesize; /* mmap
/* when the number of updates to a BAT is less than 1 in this number, we
* keep the unique_est property */
#define GDK_UNIQUE_ESTIMATE_KEEP_FRACTION 1000
-extern BUN gdk_unique_estimate_keep_fraction; /* should become a define once */
+extern BUN gdk_unique_estimate_keep_fraction
__attribute__((__visibility__("hidden"))); /* should become a define once */
/* if the number of unique values is less than 1 in this number, we
* destroy the hash rather than update it in HASH{append,insert,delete} */
#define HASH_DESTROY_UNIQUES_FRACTION 1000
-extern BUN hash_destroy_uniques_fraction; /* likewise */
+extern BUN hash_destroy_uniques_fraction
__attribute__((__visibility__("hidden"))); /* likewise */
/* if the estimated number of unique values is less than 1 in this
* number, don't build a hash table to do a hashselect */
#define NO_HASH_SELECT_FRACTION 1000
-extern dbl no_hash_select_fraction; /* same here */
+extern dbl no_hash_select_fraction __attribute__((__visibility__("hidden")));
/* same here */
/* if the hash chain is longer than this number, we delete the hash
* rather than maintaining it in HASHdelete */
#define HASH_DESTROY_CHAIN_LENGTH 1000
-extern BUN hash_destroy_chain_length;
+extern BUN hash_destroy_chain_length __attribute__((__visibility__("hidden")));
extern void (*GDKtriggerusr1)(void);
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -33,6 +33,9 @@
#if !__has_attribute(__constructor__)
#define __constructor__
#endif
+#if !__has_attribute(__counted_by__)
+#define __counted_by__(...)
+#endif
#if !__has_attribute(__designated_init__)
#define __designated_init__
#endif
diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -117,7 +117,7 @@ libgeom_export const char *geom_type2str
typedef struct wkb {
int len;
int srid;
- char data[];
+ char data[] __attribute__((__counted_by__(len)));
} wkb;
typedef struct {
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -159,7 +159,7 @@ typedef struct INSTR {
const char *modname; /* module context, reference into
namespace */
const char *fcnname; /* function name, reference into
namespace */
int argc, retc, maxarg; /* total and result argument count */
- int argv[]; /* at least a few
entries */
+ int argv[] __attribute__((__counted_by__(maxarg))); /* at least a
few entries */
} *InstrPtr, InstrRecord;
typedef struct MALBLK {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]