diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index b6ff20c5..25bc294f 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -2,9 +2,9 @@ set(cilk_header_files cilk/cilk.h cilk/cilk_api.h cilk/cilk_stub.h - cilk/holder.h - cilk/opadd_reducer.h - cilk/ostream_reducer.h + cilk/holder + cilk/opadd_reducer + cilk/ostream_reducer cilk/reducer) set(output_dir ${CHEETAH_OUTPUT_DIR}/include) diff --git a/include/cilk/cilk.h b/include/cilk/cilk.h index 7014987a..c5fcde2f 100644 --- a/include/cilk/cilk.h +++ b/include/cilk/cilk.h @@ -1,6 +1,8 @@ #ifndef _CILK_H #define _CILK_H +#if __cilk < 301 + #define cilk_spawn _Cilk_spawn #define cilk_sync _Cilk_sync #define cilk_for _Cilk_for @@ -8,4 +10,6 @@ #define cilk_reducer _Hyperobject +#endif + #endif /* _CILK_H */ diff --git a/include/cilk/holder.h b/include/cilk/holder similarity index 79% rename from include/cilk/holder.h rename to include/cilk/holder index 2f36e770..1a8a743d 100644 --- a/include/cilk/holder.h +++ b/include/cilk/holder @@ -1,8 +1,6 @@ #ifndef _HOLDER_H #define _HOLDER_H -#ifdef __cplusplus - #include namespace cilk { @@ -16,10 +14,8 @@ template static void reduce(void *left, void *right) { } template -using holder = A _Hyperobject(init, reduce); +using holder = A cilk_reducer(init, reduce); } // namespace cilk -#endif // __cplusplus - #endif // _HOLDER_H diff --git a/include/cilk/opadd_reducer.h b/include/cilk/opadd_reducer similarity index 75% rename from include/cilk/opadd_reducer.h rename to include/cilk/opadd_reducer index be7c2696..b8118ff2 100644 --- a/include/cilk/opadd_reducer.h +++ b/include/cilk/opadd_reducer @@ -1,8 +1,6 @@ #ifndef _OPADD_REDUCER_H #define _OPADD_REDUCER_H -#ifdef __cplusplus - namespace cilk { template static void zero(void *v) { @@ -13,10 +11,8 @@ template static void plus(void *l, void *r) { *static_cast(l) += *static_cast(r); } -template using opadd_reducer = T _Hyperobject(zero, plus); +template using opadd_reducer = T cilk_reducer(zero, plus); } // namespace cilk -#endif // #ifdef __cplusplus - #endif // _OPADD_REDUCER_H diff --git a/include/cilk/ostream_reducer.h b/include/cilk/ostream_reducer similarity index 91% rename from include/cilk/ostream_reducer.h rename to include/cilk/ostream_reducer index 88113132..07449c17 100644 --- a/include/cilk/ostream_reducer.h +++ b/include/cilk/ostream_reducer @@ -1,8 +1,6 @@ #ifndef _OSTREAM_REDUCER_H #define _OSTREAM_REDUCER_H -#ifdef __cplusplus - #include #include @@ -64,11 +62,9 @@ class ostream_view : public std::basic_ostream template> using ostream_reducer = ostream_view - _Hyperobject(&ostream_view>::identity, - &ostream_view>::reduce); + cilk_reducer(&ostream_view::identity, + &ostream_view::reduce); } // namespace cilk -#endif // __cplusplus - #endif // _OSTREAM_REDUCER_H