Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Houman Mirzaalian Dastjerdi
waLBerla
Commits
0977b2b7
Commit
0977b2b7
authored
Nov 08, 2017
by
Dominik Thoennes
Browse files
Added Sanitizer.h to suppress undefined behaviours
parent
b09aaf8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/core/Sanitizer.h
0 → 100644
View file @
0977b2b7
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla 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.
//
// waLBerla 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 waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file Sanitizer.h
//! \ingroup core
//! \author Dominik Thoennes <dominik.thoennes@fau.de>
//
//======================================================================================================================
#pragma once
#if (( defined WALBERLA_CXX_COMPILER_IS_CLANG ) && ( __clang_major__ >=4 ) ) \
|| (( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( __GNUC__ >= 5 ) )
# define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
# define ATTRIBUTE_NO_SANITIZE_ADDRESS
#endif
#if ( ( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( __GNUC__ >= 5 ) )
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined))
#elif (( defined WALBERLA_CXX_COMPILER_IS_CLANG ) && ( __clang_major__ >= 4 ) )
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
#else
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
#endif
\ No newline at end of file
src/core/mpi/RecvBuffer.h
View file @
0977b2b7
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// This file is part of waLBerla. waLBerla 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
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla 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
//
// waLBerla 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 waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
...
...
@@ -30,6 +30,7 @@
#include "SendBuffer.h"
#include "core/debug/Debug.h"
#include "core/Sanitizer.h"
#include <boost/mpl/logical.hpp>
#include <boost/type_traits/is_enum.hpp>
...
...
@@ -388,6 +389,7 @@ inline bool GenericRecvBuffer<T>::isEmpty() const
*/
template
<
typename
T
>
// Element type
template
<
typename
V
>
// Type of the built-in data value
ATTRIBUTE_NO_SANITIZE_UNDEFINED
typename
boost
::
enable_if
<
boost
::
mpl
::
or_
<
boost
::
is_arithmetic
<
V
>
,
boost
::
is_enum
<
V
>
>
,
GenericRecvBuffer
<
T
>
&
>::
type
GenericRecvBuffer
<
T
>::
get
(
V
&
value
)
...
...
src/core/mpi/SendBuffer.h
View file @
0977b2b7
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// This file is part of waLBerla. waLBerla 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
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla 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
//
// waLBerla 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 waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
...
...
@@ -32,6 +32,7 @@
#include "growPolicies/OptimalGrowth.h"
#include "core/debug/Debug.h"
#include "core/Sanitizer.h"
#include <boost/mpl/logical.hpp>
#include <boost/type_traits/is_enum.hpp>
...
...
@@ -442,6 +443,7 @@ inline bool GenericSendBuffer<T,G>::isEmpty() const
template
<
typename
T
// Element type
,
typename
G
>
// Growth policy
template
<
typename
V
>
// Type of the built-in data value
ATTRIBUTE_NO_SANITIZE_UNDEFINED
typename
boost
::
enable_if
<
boost
::
mpl
::
or_
<
boost
::
is_arithmetic
<
V
>
,
boost
::
is_enum
<
V
>
>
,
GenericSendBuffer
<
T
,
G
>&
>::
type
GenericSendBuffer
<
T
,
G
>::
put
(
V
value
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment