File: safe_math_support.cmake

package info (click to toggle)
igraph 0.10.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 16,176 kB
  • sloc: ansic: 121,500; cpp: 21,699; xml: 2,734; python: 411; makefile: 147; javascript: 20; sh: 9
file content (18 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
include(CheckCXXSourceCompiles)

# Check whether the compiler supports the __builtin_add_overflow() and __builtin_mul_overflow()
# builtins. These are present in recent GCC-compatible compilers.
cmake_push_check_state(RESET)

check_cxx_source_compiles("
    int main(void) {
        long long a=1, b=2, c;
        __builtin_add_overflow(a, b, &c);
        __builtin_mul_overflow(a, b, &c);
        return 0;
    }
    "
    HAVE_BUILTIN_OVERFLOW
)

cmake_pop_check_state()