summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2015-09-06 00:03:05 +0930
committerAndrew Jeffery <andrew@aj.id.au>2015-09-10 00:02:35 +0930
commit9722c4a494b66b9e06ade1ac3c4a5a9c947eedf3 (patch)
treef215ca2c80c30c9831f58a45c07ddfc14ee136e3
parent9e207bca5bf5e0a1e3653a91649414fab793c801 (diff)
strgrp: Optionally include OpenMP pragma
-rw-r--r--ccan/strgrp/_info7
-rw-r--r--ccan/strgrp/strgrp.c4
2 files changed, 11 insertions, 0 deletions
diff --git a/ccan/strgrp/_info b/ccan/strgrp/_info
index fcf2fb26..b58344fc 100644
--- a/ccan/strgrp/_info
+++ b/ccan/strgrp/_info
@@ -103,5 +103,12 @@ int main(int argc, char *argv[]) {
return 0;
}
+#if HAVE_OPENMP
+ if (strcmp(argv[1], "cflags") == 0) {
+ printf("-fopenmp\n");
+ return 0;
+ }
+#endif
+
return 1;
}
diff --git a/ccan/strgrp/strgrp.c b/ccan/strgrp/strgrp.c
index 1f3d2822..bc2cc83a 100644
--- a/ccan/strgrp/strgrp.c
+++ b/ccan/strgrp/strgrp.c
@@ -25,6 +25,7 @@
#include "ccan/tal/tal.h"
#include "ccan/tal/str/str.h"
#include "strgrp.h"
+#include "config.h"
typedef darray(struct strgrp_grp *) darray_grp;
typedef darray(struct strgrp_item *) darray_item;
@@ -224,7 +225,10 @@ grp_for(struct strgrp *const ctx, const char *const str) {
}
}
int i;
+// Keep ccanlint happy in reduced feature mode
+#if HAVE_OPENMP
#pragma omp parallel for schedule(dynamic)
+#endif
for (i = 0; i < ctx->n_grps; i++) {
ctx->scores[i].grp = darray_item(ctx->grps, i);
const bool ss = should_grp_score(ctx, ctx->scores[i].grp, str);