1// -Wall -target-api 0 2#pragma version(1) 3#pragma rs java_package_name(fn) 4 5// Various ways halter can fail semantic checks. 6// Also see reduce_general_bad_function.rs for other constituent function semantic checks. 7// Also see reduce_general_bad_accumulator.rs for accumulator data type checks. 8 9// trivial accumulator for use multiple times later 10static void AccumInt(int *accum, int val) { } 11 12///////////////////////////////////////////////////////////////////////////// 13// halter 14///////////////////////////////////////////////////////////////////////////// 15 16// halter must return bool 17#pragma rs reduce(halt_void) accumulator(AccumInt) halter(halt_void) 18static void halt_void(const int *accum) { } 19 20// halter must return bool 21#pragma rs reduce(halt_int) accumulator(AccumInt) halter(halt_int) 22static int halt_int(const int *accum) { return 0; } 23 24// halter must take exactly 1 parameter 25#pragma rs reduce(halt0) accumulator(AccumInt) halter(halt0) 26static bool halt0() { return false; } 27 28// halter must take exactly 1 parameter 29#pragma rs reduce(halt2) accumulator(AccumInt) halter(halt2) 30static bool halt2(const int *accum, const int *accum2) { return false; } 31 32// halter cannot take special parameter 33#pragma rs reduce(halt_special) accumulator(AccumInt) halter(halt_special) 34static bool halt_special(const int *context) { return false; } 35 36// halter and accumulator must take pointers to same type 37#pragma rs reduce(halt_vs_accum) accumulator(AccumInt) halter(hva_halt) 38static bool hva_halt(const unsigned *accum) { return false; } 39 40// halter may be overloadable . . . 41#pragma rs reduce(halt_over) accumulator(AccumInt) halter(halt_over) 42static __attribute__((overloadable)) bool halt_over(const int *accum) { return false; } 43 44// . . . but halter must not have duplicate definitions 45#pragma rs reduce(halt_dup) accumulator(AccumInt) halter(halt_dup) 46static __attribute__((overloadable)) bool halt_dup(const int *accum) { return false; } 47static __attribute__((overloadable)) bool halt_dup(const unsigned int *accum) { return false; } 48 49// halter must be present 50#pragma rs reduce(halt_missing) accumulator(AccumInt) halter(halt_missing) 51 52// halter must be static 53#pragma rs reduce(halt_nonstatic) accumulator(AccumInt) halter(halt_nonstatic) 54bool halt_nonstatic(const int *accum) { return false; } 55 56// halter parameter must point to const 57#pragma rs reduce(halt_const) accumulator(AccumInt) halter(halt_const) 58static bool halt_const(int *accum) { return false; } 59