task-errors.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* GCC-StarPU
  2. Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
  3. GCC-StarPU is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. GCC-StarPU is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with GCC-StarPU. If not, see <http://www.gnu.org/licenses/>. */
  13. /* Test error handling for the `task' and `task_implementation' attributes. */
  14. static void my_task (int foo, char *bar) __attribute__ ((task));
  15. static void my_task_cpu (int foo, float *bar) /* (error "type differs") */
  16. __attribute__ ((task_implementation ("cpu", my_task)));
  17. static void my_task_opencl (long foo, char *bar) /* (error "type differs") */
  18. __attribute__ ((task_implementation ("opencl", my_task)));
  19. static void my_task_nowhere (int foo, char *bar)
  20. __attribute__ ((task_implementation ("does-not-exist", my_task)));
  21. static void my_task_not_quite (int foo, char *bar) /* (error "lacks the 'task' attribute") */
  22. __attribute__ ((task_implementation ("cpu", my_task_nowhere)));
  23. static int foo /* (error "only applies to function") */
  24. __attribute__ ((task_implementation ("cpu", my_task)));
  25. static int bar /* (error "only applies to function") */
  26. __attribute__ ((task, unused));
  27. static int not_a_task __attribute__ ((unused));
  28. static void my_task_almost (int foo, char *bar) /* (error "not a function") */
  29. __attribute__ ((task_implementation ("cpu", not_a_task)));
  30. static void my_task_wrong_task_arg (int foo, char *bar) /* (error "not a function") */
  31. __attribute__ ((task_implementation ("cpu", 123)));
  32. static void my_task_wrong_target_arg (int foo, char *bar) /* (error "string constant expected") */
  33. __attribute__ ((task_implementation (123, my_task)));
  34. static void
  35. my_task_cpu (int foo, float *bar)
  36. {
  37. }
  38. static void
  39. my_task_opencl (long foo, char *bar)
  40. {
  41. }
  42. static void
  43. my_task_nowhere (int foo, char *bar) /* (warning "unsupported target") */
  44. {
  45. }
  46. static void
  47. my_task_not_quite (int foo, char *bar)
  48. {
  49. }
  50. static void
  51. my_task_almost (int foo, char *bar)
  52. {
  53. }
  54. static void
  55. my_task_wrong_task_arg (int foo, char *bar)
  56. {
  57. }
  58. static void
  59. my_task_wrong_target_arg (int foo, char *bar)
  60. {
  61. }