Changeset: 1111572f649d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1111572f649d
Modified Files:
        NT/monetdb_config.h.in
        clients/Tests/MAL-signatures_all.stable.out
        clients/Tests/MAL-signatures_fits_geom.stable.out
        clients/Tests/MAL-signatures_geom.stable.out
        clients/Tests/MAL-signatures_none.stable.out
        clients/Tests/exports.stable.out
        configure.ag
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_calc.c
        gdk/gdk_select.c
        sql/backends/monet5/sql_gencode.c
Branch: default
Log Message:

Merge with Oct2014 branch.


diffs (truncated from 977 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -993,6 +993,14 @@
 #endif
 #endif
 
+/* Define to `__restrict__' or `__restrict' if that's what the C compiler
+   calls it, or to nothing if 'restrict' is not supported under any name.  */
+#ifndef __cplusplus
+#ifndef restrict
+#define restrict __restrict
+#endif
+#endif
+
 /* Define to `long int' if <sys/types.h> does not define. */
 /* #undef off_t */
 
diff --git a/clients/Tests/MAL-signatures_all.stable.out 
b/clients/Tests/MAL-signatures_all.stable.out
--- a/clients/Tests/MAL-signatures_all.stable.out
+++ b/clients/Tests/MAL-signatures_all.stable.out
@@ -40406,6 +40406,10 @@ command mtime.date(X_1:date):date
 address MTIMEdate2date;
 comment generate the nil date
 
+command mtime.date_sub_month_interval(t:date,s:int):date 
+address MTIMEdate_submonths;
+comment Subtract months from a date
+
 command mtime.date_add_month_interval(t:date,s:int):date 
 address MTIMEdate_addmonths;
 comment Add months to a date
diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out 
b/clients/Tests/MAL-signatures_fits_geom.stable.out
--- a/clients/Tests/MAL-signatures_fits_geom.stable.out
+++ b/clients/Tests/MAL-signatures_fits_geom.stable.out
@@ -40323,6 +40323,10 @@ command mtime.date(X_1:date):date
 address MTIMEdate2date;
 comment generate the nil date
 
+command mtime.date_sub_month_interval(t:date,s:int):date 
+address MTIMEdate_submonths;
+comment Subtract months from a date
+
 command mtime.date_add_month_interval(t:date,s:int):date 
 address MTIMEdate_addmonths;
 comment Add months to a date
diff --git a/clients/Tests/MAL-signatures_geom.stable.out 
b/clients/Tests/MAL-signatures_geom.stable.out
--- a/clients/Tests/MAL-signatures_geom.stable.out
+++ b/clients/Tests/MAL-signatures_geom.stable.out
@@ -40299,6 +40299,10 @@ command mtime.date(X_1:date):date
 address MTIMEdate2date;
 comment generate the nil date
 
+command mtime.date_sub_month_interval(t:date,s:int):date 
+address MTIMEdate_submonths;
+comment Subtract months from a date
+
 command mtime.date_add_month_interval(t:date,s:int):date 
 address MTIMEdate_addmonths;
 comment Add months to a date
diff --git a/clients/Tests/MAL-signatures_none.stable.out 
b/clients/Tests/MAL-signatures_none.stable.out
--- a/clients/Tests/MAL-signatures_none.stable.out
+++ b/clients/Tests/MAL-signatures_none.stable.out
@@ -40112,6 +40112,10 @@ command mtime.date(X_1:date):date
 address MTIMEdate2date;
 comment generate the nil date
 
+command mtime.date_sub_month_interval(t:date,s:int):date 
+address MTIMEdate_submonths;
+comment Subtract months from a date
+
 command mtime.date_add_month_interval(t:date,s:int):date 
 address MTIMEdate_addmonths;
 comment Add months to a date
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -261,18 +261,18 @@ MT_Lock *volatile GDKlocklist;
 ATOMIC_FLAG volatile GDKlocklistlock;
 ATOMIC_TYPE volatile GDKlocksleepcnt;
 void GDKlockstatistics(int);
-void *GDKmalloc(size_t size);
+void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
 size_t GDKmem_cursize(void);
 void *GDKmmap(const char *path, int mode, size_t len);
 int GDKms(void);
 int GDKnr_threads;
 void GDKqsort(void *h, void *t, const void *base, size_t n, int hs, int ts, 
int tpe);
 void GDKqsort_rev(void *h, void *t, const void *base, size_t n, int hs, int 
ts, int tpe);
-void *GDKrealloc(void *pold, size_t size);
+void *GDKrealloc(void *pold, size_t size) 
__attribute__((__warn_unused_result__));
 void GDKsetenv(str name, str value);
 ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, ssize_t 
len);
-str GDKstrdup(const char *s);
-str GDKstrndup(const char *s, size_t n);
+str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
+str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
 int GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
 ThreadRec GDKthreads[THREADS];
 int GDKupgradevarheap(COLrec *c, var_t v, int copyall, int mayshare);
@@ -280,7 +280,7 @@ lng GDKusec(void);
 BAT *GDKval;
 const char *GDKversion(void);
 size_t GDKvm_cursize(void);
-void *GDKzalloc(size_t size);
+void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
 void HASHdestroy(BAT *b);
 BUN HASHlist(Hash *h, BUN i);
 BUN HASHprobe(Hash *h, const void *v);
@@ -1607,6 +1607,7 @@ str MTIMEdate_extract_year_bulk(bat *ret
 str MTIMEdate_fromstr(date *ret, const char *const *s);
 str MTIMEdate_sub_msec_interval_lng_wrap(date *ret, const date *t, const lng 
*msec);
 str MTIMEdate_sub_sec_interval_wrap(date *ret, const date *t, const int *sec);
+str MTIMEdate_submonths(date *ret, const date *v, const int *delta);
 str MTIMEday_from_str(int *ret, const char *const *day);
 str MTIMEday_to_str(str *ret, const int *day);
 str MTIMEdaytime1(daytime *ret, const int *h);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2847,6 +2847,7 @@ dnl     checks for structures
 dnl     checks for compiler characteristics
 AC_C_CONST
 AC_C_INLINE
+AC_C_RESTRICT
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo(int * restrict p) { return *p; }])],
        AC_DEFINE(HAVE_RESTRICT, 1,
                [Define if the compiler supports the restrict keyword]),
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2221,12 +2221,19 @@ gdk_export int  GDK_vm_trim;            /* allow tr
 gdk_export size_t GDKmem_cursize(void);        /* RAM/swapmem that MonetDB has 
claimed from OS */
 gdk_export size_t GDKvm_cursize(void); /* current MonetDB VM address space 
usage */
 
-gdk_export void *GDKmalloc(size_t size);
-gdk_export void *GDKzalloc(size_t size);
-gdk_export void *GDKrealloc(void *pold, size_t size);
+gdk_export void *GDKmalloc(size_t size)
+       __attribute__((__malloc__))
+       __attribute__ ((__warn_unused_result__));
+gdk_export void *GDKzalloc(size_t size)
+       __attribute__((__malloc__))
+       __attribute__ ((__warn_unused_result__));
+gdk_export void *GDKrealloc(void *pold, size_t size)
+       __attribute__ ((__warn_unused_result__));
 gdk_export void GDKfree(void *blk);
-gdk_export str GDKstrdup(const char *s);
-gdk_export str GDKstrndup(const char *s, size_t n);
+gdk_export str GDKstrdup(const char *s)
+       __attribute__ ((__warn_unused_result__));
+gdk_export str GDKstrndup(const char *s, size_t n)
+       __attribute__ ((__warn_unused_result__));
 
 #if !defined(NDEBUG) && !defined(STATIC_CODE_ANALYSIS)
 /* In debugging mode, replace GDKmalloc and other functions with a
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -156,7 +156,7 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e,
 #define AGGR_SUM(TYPE1, TYPE2)                                         \
        do {                                                            \
                TYPE1 x;                                                \
-               const TYPE1 *vals = (const TYPE1 *) values;             \
+               const TYPE1 *restrict vals = (const TYPE1 *) values;    \
                if (ngrp == 1 && cand == NULL) {                        \
                        /* single group, no candidate list */           \
                        TYPE2 sum;                                      \
@@ -305,16 +305,16 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e,
        } while (0)
 
 static BUN
-dosum(const void *values, int nonil, oid seqb, BUN start, BUN end,
-      void *results, BUN ngrp, int tp1, int tp2,
-      const oid *cand, const oid *candend, const oid *gids,
+dosum(const void *restrict values, int nonil, oid seqb, BUN start, BUN end,
+      void *restrict results, BUN ngrp, int tp1, int tp2,
+      const oid *restrict cand, const oid *candend, const oid *restrict gids,
       oid min, oid max, int skip_nils, int abort_on_error,
       int nil_if_empty, const char *func)
 {
        BUN nils = 0;
        BUN i;
        oid gid;
-       unsigned int *seen;     /* bitmask for groups that we've seen */
+       unsigned int *restrict seen; /* bitmask for groups that we've seen */
 
        /* allocate bitmap for seen group ids */
        seen = GDKzalloc(((ngrp + 31) / 32) * sizeof(int));
@@ -325,7 +325,7 @@ dosum(const void *values, int nonil, oid
 
        switch (tp2) {
        case TYPE_bte: {
-               bte *sums = (bte *) results;
+               bte *restrict sums = (bte *) results;
                switch (tp1) {
                case TYPE_bte:
                        AGGR_SUM(bte, bte);
@@ -336,7 +336,7 @@ dosum(const void *values, int nonil, oid
                break;
        }
        case TYPE_sht: {
-               sht *sums = (sht *) results;
+               sht *restrict sums = (sht *) results;
                switch (tp1) {
                case TYPE_bte:
                        AGGR_SUM(bte, sht);
@@ -353,7 +353,7 @@ dosum(const void *values, int nonil, oid
        case TYPE_wrd:
 #endif
        case TYPE_int: {
-               int *sums = (int *) results;
+               int *restrict sums = (int *) results;
                switch (tp1) {
                case TYPE_bte:
                        AGGR_SUM(bte, int);
@@ -376,7 +376,7 @@ dosum(const void *values, int nonil, oid
        case TYPE_wrd:
 #endif
        case TYPE_lng: {
-               lng *sums = (lng *) results;
+               lng *restrict sums = (lng *) results;
                switch (tp1) {
                case TYPE_bte:
                        AGGR_SUM(bte, lng);
@@ -427,7 +427,7 @@ dosum(const void *values, int nonil, oid
        }
 #endif
        case TYPE_flt: {
-               flt *sums = (flt *) results;
+               flt *restrict sums = (flt *) results;
                switch (tp1) {
                case TYPE_flt:
                        AGGR_SUM(flt, flt);
@@ -438,7 +438,7 @@ dosum(const void *values, int nonil, oid
                break;
        }
        case TYPE_dbl: {
-               dbl *sums = (dbl *) results;
+               dbl *restrict sums = (dbl *) results;
                switch (tp1) {
                case TYPE_flt:
                        AGGR_SUM(flt, dbl);
@@ -682,7 +682,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s
 
 #define AGGR_PROD(TYPE1, TYPE2, TYPE3)                                 \
        do {                                                            \
-               const TYPE1 *vals = (const TYPE1 *) values;             \
+               const TYPE1 *restrict vals = (const TYPE1 *) values;    \
                assert(gidincr == 0 || gidincr == 1);                   \
                gid = 0;        /* doesn't change if gidincr == 0 */    \
                for (;;) {                                              \
@@ -777,7 +777,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s
 #else
 #define AGGR_PROD_LNG(TYPE)                                            \
        do {                                                            \
-               const TYPE *vals = (const TYPE *) values;               \
+               const TYPE *restrict vals = (const TYPE *) values;      \
                assert(gidincr == 0 || gidincr == 1);                   \
                gid = 0;        /* doesn't change if gidincr == 0 */    \
                for (;;) {                                              \
@@ -826,7 +826,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s
 
 #define AGGR_PROD_FLOAT(TYPE1, TYPE2)                                  \
        do {                                                            \
-               const TYPE1 *vals = (const TYPE1 *) values;             \
+               const TYPE1 *restrict vals = (const TYPE1 *) values;    \
                assert(gidincr == 0 || gidincr == 1);                   \
                gid = 0;        /* doesn't change if gidincr == 0 */    \
                for (;;) {                                              \
@@ -877,15 +877,15 @@ BATsum(void *res, int tp, BAT *b, BAT *s
        } while (0)
 
 static BUN
-doprod(const void *values, oid seqb, BUN start, BUN end, void *results,
-       BUN ngrp, int tp1, int tp2, const oid *cand, const oid *candend,
-       const oid *gids, int gidincr, oid min, oid max,
+doprod(const void *restrict values, oid seqb, BUN start, BUN end, void 
*restrict results,
+       BUN ngrp, int tp1, int tp2, const oid *restrict cand, const oid 
*candend,
+       const oid *restrict gids, int gidincr, oid min, oid max,
        int skip_nils, int abort_on_error, int nil_if_empty, const char *func)
 {
        BUN nils = 0;
        BUN i;
        oid gid;
-       unsigned int *seen;     /* bitmask for groups that we've seen */
+       unsigned int *restrict seen; /* bitmask for groups that we've seen */
 
        /* allocate bitmap for seen group ids */
        seen = GDKzalloc(((ngrp + 31) / 32) * sizeof(int));
@@ -896,7 +896,7 @@ doprod(const void *values, oid seqb, BUN
 
        switch (tp2) {
        case TYPE_bte: {
-               bte *prods = (bte *) results;
+               bte *restrict prods = (bte *) results;
                switch (tp1) {
                case TYPE_bte:
                        AGGR_PROD(bte, bte, sht);
@@ -907,7 +907,7 @@ doprod(const void *values, oid seqb, BUN
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to