Skip to content

Reducer callbacks trigger spurious -Wunneeded-internal-declaration warnings #154

@VoxSciurorum

Description

@VoxSciurorum

The compiler incorrectly says static reducer callbacks used inside a template have not been emitted.

/* Unwanted warnings:

   unused.cpp:9:13: warning: function 'identity_64' is not needed and will not be emitted [-Wunneeded-internal-declaration]
   unused.cpp:13:13: warning: function 'sum_64' is not needed and will not be emitted [-Wunneeded-internal-declaration]
*/

#include <cilk/cilk.h>

static void identity_64(void *p) { *(long *)p = 0; }
static void sum_64(void *l, void *r) { *(long *)l += *(long *)r; }

template <class T>
T sum_cilk(){
  long cilk_reducer(identity_64, sum_64) sum = 0;
  return sum;
}

long f() {
  long total = sum_cilk<long>();
  return total;
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions