Browse Source

gcc: Add warning/error tests for `#pragma starpu register'.

* gcc-plugin/tests/Makefile.am (gcc_tests): Add `register-junk.c',
  `register-size-mismatch.c', `register-unbound.c', and
  `register-unterminated.c'.

* gcc-plugin/tests/register-junk.c,
  gcc-plugin/tests/register-size-mismatch.c,
  gcc-plugin/tests/register-unbound.c,
  gcc-plugin/tests/register-unterminated.c: New files.
Ludovic Courtès 14 years ago
parent
commit
c1e086abc4

+ 4 - 0
gcc-plugin/tests/Makefile.am

@@ -18,6 +18,10 @@ gcc_tests =					\
   base.c					\
   pointers.c					\
   register.c					\
+  register-junk.c				\
+  register-size-mismatch.c			\
+  register-unbound.c				\
+  register-unterminated.c			\
   scalar-tasks.c				\
   pointer-tasks.c
 

+ 29 - 0
gcc-plugin/tests/register-junk.c

@@ -0,0 +1,29 @@
+/* GCC-StarPU
+   Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
+
+   GCC-StarPU is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   GCC-StarPU is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC-StarPU.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Test whether `#pragma starpu register ...' leads to suitable errors.  */
+
+#undef NDEBUG
+
+#include <lib.h>
+
+int
+main (int argc, char *argv[])
+{
+#pragma starpu register argv 234 junk right here /* (error "junk after") */
+
+  return EXIT_SUCCESS;
+}

+ 31 - 0
gcc-plugin/tests/register-size-mismatch.c

@@ -0,0 +1,31 @@
+/* GCC-StarPU
+   Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
+
+   GCC-StarPU is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   GCC-StarPU is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC-StarPU.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Test whether `#pragma starpu register ...' leads to suitable errors.  */
+
+#undef NDEBUG
+
+#include <lib.h>
+
+int
+main (int argc, char *argv[])
+{
+  static int x[123];
+
+#pragma starpu register x 234 /* (note "can be omitted") *//* (error "differs from actual size") */
+
+  return EXIT_SUCCESS;
+}

+ 29 - 0
gcc-plugin/tests/register-unbound.c

@@ -0,0 +1,29 @@
+/* GCC-StarPU
+   Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
+
+   GCC-StarPU is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   GCC-StarPU is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC-StarPU.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Test whether `#pragma starpu register ...' leads to suitable errors.  */
+
+#undef NDEBUG
+
+#include <lib.h>
+
+int
+main (int argc, char *argv[])
+{
+#pragma starpu register does_not_exit 123 /* (error "unbound variable") */
+
+  return EXIT_SUCCESS;
+}

+ 29 - 0
gcc-plugin/tests/register-unterminated.c

@@ -0,0 +1,29 @@
+/* GCC-StarPU
+   Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
+
+   GCC-StarPU is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   GCC-StarPU is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC-StarPU.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Test whether `#pragma starpu register ...' leads to suitable errors.  */
+
+#undef NDEBUG
+
+#include <lib.h>
+
+int
+main (int argc, char *argv[])
+{
+#pragma starpu register /* (error "unterminated") */
+
+  return EXIT_SUCCESS;
+}