From: Daniel Arndt Date: Fri, 5 Jul 2019 19:12:49 +0000 (-0400) Subject: Avoid warnings in device code X-Git-Tag: v9.2.0-rc1~1403^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c61dab9348e13b10fa5f2128421c2fbc5380e2b0;p=dealii.git Avoid warnings in device code --- diff --git a/include/deal.II/base/point.h b/include/deal.II/base/point.h index 93b14f0bb0..3afb0fa319 100644 --- a/include/deal.II/base/point.h +++ b/include/deal.II/base/point.h @@ -353,12 +353,14 @@ template inline DEAL_II_CUDA_HOST_DEV Point::Point(const Number x) { +# ifndef __CUDA_ARCH__ Assert(dim == 1, ExcMessage( "You can only initialize Point<1> objects using the constructor " "that takes only one argument. Point objects with dim!=1 " "require initialization with the constructor that takes 'dim' " "arguments.")); +# endif // we can only get here if we pass the assertion. use the switch anyway so // as to avoid compiler warnings about uninitialized elements or writing @@ -379,12 +381,15 @@ template inline DEAL_II_CUDA_HOST_DEV Point::Point(const Number x, const Number y) { +# ifndef __CUDA_ARCH__ Assert(dim == 2, ExcMessage( "You can only initialize Point<2> objects using the constructor " "that takes two arguments. Point objects with dim!=2 " "require initialization with the constructor that takes 'dim' " "arguments.")); +# endif + // we can only get here if we pass the assertion. use the indirection anyway // so as to avoid compiler warnings about uninitialized elements or writing // beyond the end of the 'values' array @@ -399,12 +404,14 @@ template inline DEAL_II_CUDA_HOST_DEV Point::Point(const Number x, const Number y, const Number z) { +# ifndef __CUDA_ARCH__ Assert(dim == 3, ExcMessage( "You can only initialize Point<3> objects using the constructor " "that takes three arguments. Point objects with dim!=3 " "require initialization with the constructor that takes 'dim' " "arguments.")); +# endif // we can only get here if we pass the assertion. use the indirection anyway // so as to avoid compiler warnings about uninitialized elements or writing @@ -454,7 +461,9 @@ template inline DEAL_II_CUDA_HOST_DEV Number Point::operator()(const unsigned int index) const { +# ifndef __CUDA_ARCH__ AssertIndexRange(index, dim); +# endif return this->values[index]; } @@ -464,7 +473,9 @@ template inline DEAL_II_CUDA_HOST_DEV Number & Point::operator()(const unsigned int index) { +# ifndef __CUDA_ARCH__ AssertIndexRange(index, dim); +# endif return this->values[index]; }