]> git.ozlabs.org Git - ccan/commitdiff
strgrp: Optionally include OpenMP pragma
authorAndrew Jeffery <andrew@aj.id.au>
Sat, 5 Sep 2015 14:33:05 +0000 (00:03 +0930)
committerAndrew Jeffery <andrew@aj.id.au>
Wed, 9 Sep 2015 14:32:35 +0000 (00:02 +0930)
ccan/strgrp/_info
ccan/strgrp/strgrp.c

index fcf2fb263b6a74337ede2e98695c3f3e2d49604b..b58344fcf017909c6faa5ed1b0310e02f1134f0e 100644 (file)
@@ -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;
 }
index 1f3d2822694f907f2c93541ff2f3e57c061843ab..bc2cc83ae12b0672fbf8dedbff9d22a249f8d3b1 100644 (file)
@@ -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);