Project
Loading...
Searching...
No Matches
fpu.cxx
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
// To enable check for problematic LIBXML version uncomment this
13
// #define _PROTECT_LIBXML_
14
15
#ifdef __linux
16
#ifdef _PROTECT_LIBXML_
17
#include <libxml/xmlversion.h>
18
#if LIBXML_VERSION > 20912
19
#define _DUMMY_FEE_TRAP_
20
#endif
// LIBXML_VERSION > 20912
21
#endif
// _PROTECT_LIBXML_
22
#else
// __linux
23
#define _DUMMY_FEE_TRAP_
24
#endif
// __linux
25
26
#ifdef _DUMMY_FEE_TRAP_
27
void
trapfpe
() {}
28
#else
// _DUMMY_FEE_TRAP_
29
#define _GNU_SOURCE 1
30
#include <cfenv>
31
#include <cstdlib>
32
static
void
__attribute__
((constructor))
trapfpe
()
33
{
34
// allows to disable set of particular FE's by setting corresponding bit of the O2_DISABLE_FPE_TRAP,
35
// i.e. to enable only FE_DIVBYZERO use O2_DISABLE_FPE_TRAP=9
36
// const char* ev = std::getenv("O2_DISABLE_FPE_TRAP");
37
// int enabledFE = (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW) & ~(ev ? atoi(ev) : 0);
38
const
char
* ev = std::getenv(
"O2_ENABLE_FPE_TRAP"
);
39
int
enabledFE = (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW) & (ev ? atoi(ev) : 0);
40
if
(enabledFE) {
41
feenableexcept(enabledFE);
42
}
43
}
44
#endif
// _DUMMY_FEE_TRAP_
trapfpe
void trapfpe()
Definition
fpu.cxx:27
__attribute__
Definition
RawDataFormat.h:57
Common
Utils
src
fpu.cxx
Generated on Tue Feb 25 2025 23:16:08 for Project by
1.9.8