1
1
/* FUNCTION: abs */
2
2
3
+ #ifndef __CPROVER_LIMITS_H_INCLUDED
4
+ # include <limits.h>
5
+ # define __CPROVER_LIMITS_H_INCLUDED
6
+ #endif
7
+
3
8
#undef abs
4
9
5
10
int abs (int i )
6
11
{
12
+ // C99 Section 7.20.6.1:
13
+ // "If the result cannot be represented, the behavior is undefined."
14
+ __CPROVER_precondition (i != INT_MIN , "argument to abs must not be INT_MIN" );
7
15
return __CPROVER_abs (i );
8
16
}
9
17
10
18
/* FUNCTION: labs */
11
19
20
+ #ifndef __CPROVER_LIMITS_H_INCLUDED
21
+ # include <limits.h>
22
+ # define __CPROVER_LIMITS_H_INCLUDED
23
+ #endif
24
+
12
25
#undef labs
13
26
14
27
long int labs (long int i )
15
28
{
29
+ // C99 Section 7.20.6.1:
30
+ // "If the result cannot be represented, the behavior is undefined."
31
+ __CPROVER_precondition (
32
+ i != LONG_MIN , "argument to labs must not be LONG_MIN" );
16
33
return __CPROVER_labs (i );
17
34
}
18
35
19
36
/* FUNCTION: llabs */
20
37
38
+ #ifndef __CPROVER_LIMITS_H_INCLUDED
39
+ # include <limits.h>
40
+ # define __CPROVER_LIMITS_H_INCLUDED
41
+ #endif
42
+
21
43
#undef llabs
22
44
23
45
long long int llabs (long long int i )
24
46
{
47
+ // C99 Section 7.20.6.1:
48
+ // "If the result cannot be represented, the behavior is undefined."
49
+ __CPROVER_precondition (
50
+ i != LLONG_MIN , "argument to llabs must not be LLONG_MIN" );
25
51
return __CPROVER_llabs (i );
26
52
}
27
53
@@ -32,12 +58,19 @@ long long int llabs(long long int i)
32
58
# define __CPROVER_INTTYPES_H_INCLUDED
33
59
#endif
34
60
61
+ #ifndef __CPROVER_LIMITS_H_INCLUDED
62
+ # include <limits.h>
63
+ # define __CPROVER_LIMITS_H_INCLUDED
64
+ #endif
65
+
35
66
#undef imaxabs
36
67
37
68
intmax_t __CPROVER_imaxabs (intmax_t );
38
69
39
70
intmax_t imaxabs (intmax_t i )
40
71
{
72
+ __CPROVER_precondition (
73
+ i != INTMAX_MIN , "argument to imaxabs must not be INTMAX_MIN" );
41
74
return __CPROVER_imaxabs (i );
42
75
}
43
76
0 commit comments