From 70fc7c71a66d087f937cbb3d5905d96bb90dd40d Mon Sep 17 00:00:00 2001 From: Pietro Incardona <incardon@mpi-cbg.de> Date: Mon, 2 Nov 2015 01:03:58 +0100 Subject: [PATCH] moved se_util.hpp --- configure.ac | 73 +++++++++++++++++++++++++++++++++++++++++++ src/Memleak_check.hpp | 2 +- src/util/se_util.hpp | 21 +++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/util/se_util.hpp diff --git a/configure.ac b/configure.ac index 929c24f..bd29a12 100755 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,64 @@ else NVCCFLAGS+="$NVCCFLAGS -O3 " fi +###### Check for se-class1 + +AC_MSG_CHECKING(whether to build with security enhancement class1) +se_class1=no +AC_ARG_ENABLE(se-class1, + AC_HELP_STRING( + [--enable-se-class1], + [enable security enhancement class1] + ), + se_class1="$enableval" +) + + + +AC_MSG_RESULT($se_class1) +if test x"$se_class1" = x"yes"; then + AC_DEFINE([SE_CLASS1],[],[Security enhancement class 1]) +fi + + +###### Check for se-class 2 + +AC_MSG_CHECKING(whether to build with security enhancement class 2) +se_class2=no +AC_ARG_ENABLE(se-class2, + AC_HELP_STRING( + [--enable-se-class2], + [enable security enhancement class 2] + ), + se_class2="$enableval" +) + + +AC_MSG_RESULT($se_class2) +if test x"$se_class2" = x"yes"; then + AC_DEFINE([SE_CLASS2],[],[Security enhancement class 2]) +fi + +###### Check for se-class 3 + +AC_MSG_CHECKING(whether to build with security enhancement class 3) +se_class3=no +AC_ARG_ENABLE(se-class3, + AC_HELP_STRING( + [--enable-se-class3], + [enable security enhancement class 3] + ), + se_class3="$enableval" +) + + + +AC_MSG_RESULT($se_class3) +if test x"$se_class3" = x"yes"; then + AC_DEFINE([SE_CLASS3],[],[Security enhancement class 3]) +fi + + ##### CHECK FOR BOOST ############## AX_BOOST([1.52],[],[]) @@ -158,6 +216,21 @@ if [ test x"$debuger" = x"yes" ]; then else echo "* debug: no *" fi +if [ test x"$se_class1" = x"yes" ]; then + echo "* se-class1: yes *" +else + echo "* se-class1: no *" +fi +if [ test x"$se_class2" = x"yes" ]; then + echo "* se-class2: yes *" +else + echo "* se-class2: no *" +fi +if [ test x"$se_class3" = x"yes" ]; then + echo "* se-class3: yes *" +else + echo "* se-class3: no *" +fi if [ test x"$gpu_support" = x"no" ]; then echo "* gpu: no *" else diff --git a/src/Memleak_check.hpp b/src/Memleak_check.hpp index 24afa91..e96f3e3 100644 --- a/src/Memleak_check.hpp +++ b/src/Memleak_check.hpp @@ -38,7 +38,7 @@ static bool remove_ptr(const void * ptr) // if the element does not exist, print that something wrong happened and return if ( it == active_ptr.end() ) { - std::cout << "Error pointer not found " << ptr << "\n"; + std::cout << "Error " << __FILE__ << ":" << __LINE__ << " pointer not found " << ptr << "\n"; ACTION_ON_ERROR(MEM_ERROR); return false; } diff --git a/src/util/se_util.hpp b/src/util/se_util.hpp new file mode 100644 index 0000000..8d884e5 --- /dev/null +++ b/src/util/se_util.hpp @@ -0,0 +1,21 @@ +/* + * se_util.hpp + * + * Created on: Oct 22, 2015 + * Author: i-bird + */ + +#ifndef OPENFPM_DATA_SRC_UTIL_SE_UTIL_HPP_ +#define OPENFPM_DATA_SRC_UTIL_SE_UTIL_HPP_ + +// Macro that decide what to do in case of error +#ifdef STOP_ON_ERROR +#define ACTION_ON_ERROR(error) exit(1); +#elif defined(THROW_ON_ERROR) +#define ACTION_ON_ERROR(error) if (!std::uncaught_exception()) throw error; +#else +#define ACTION_ON_ERROR(error) +#endif + + +#endif /* OPENFPM_DATA_SRC_UTIL_SE_UTIL_HPP_ */ -- GitLab