From: kronbichler Date: Wed, 19 Feb 2014 21:56:11 +0000 (+0000) Subject: Avoid compiler warning. Improve error message for parallel vector. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fe001ed2b61b3078c6488c013effe4e9059cfdb;p=dealii-svn.git Avoid compiler warning. Improve error message for parallel vector. git-svn-id: https://svn.dealii.org/trunk@32518 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/aligned_vector.h b/deal.II/include/deal.II/base/aligned_vector.h index 2916bcd0ba..0876e0f6fe 100644 --- a/deal.II/include/deal.II/base/aligned_vector.h +++ b/deal.II/include/deal.II/base/aligned_vector.h @@ -288,9 +288,13 @@ namespace internal virtual void apply_to_subrange (const std::size_t begin, const std::size_t end) const { - // for classes trivial assignment can use memcpy + // for classes trivial assignment can use memcpy. cast element to + // (void*) to silence compiler warning for virtual classes (they will + // never arrive here because they are non-trivial). + if (std_cxx1x::is_trivial::value == true) - std::memcpy (destination_+begin, source_+begin, (end-begin)*sizeof(T)); + std::memcpy ((void*)(destination_+begin), source_+begin, + (end-begin)*sizeof(T)); else if (copy_only_ == false) for (std::size_t i=begin; i::value == true) { const unsigned char zero [sizeof(T)] = {}; - if (std::memcmp(zero, &element, sizeof(T)) == 0) + // cast element to (void*) to silence compiler warning for virtual + // classes (they will never arrive here because they are + // non-trivial). + if (std::memcmp(zero, (void*)&element, sizeof(T)) == 0) trivial_element = true; } if (size < minimum_parallel_grain_size) @@ -356,9 +363,12 @@ namespace internal virtual void apply_to_subrange (const std::size_t begin, const std::size_t end) const { - // for classes with trivial assignment of zero can use memset + // for classes with trivial assignment of zero can use memset. cast + // element to (void*) to silence compiler warning for virtual + // classes (they will never arrive here because they are + // non-trivial). if (std_cxx1x::is_trivial::value == true && trivial_element) - std::memset (destination_+begin, 0, (end-begin)*sizeof(T)); + std::memset ((void*)(destination_+begin), 0, (end-begin)*sizeof(T)); else // initialize memory and set for (std::size_t i=begin; i::epsilon(), - ExcMessage("Inserted elements do not match.")); + ExcNonMatchingElements(*read_position, local_element(j), + part.this_mpi_process())); AssertDimension(read_position-import_data,part.n_import_indices()); }