aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-03-27 03:04:53 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-03-27 16:11:58 +0200
commit369cbea4b37692bfd93ca23c1991d002354d2219 (patch)
tree0e4d8cc52514a4dc4b0514fb4826777ac40cdd44
parent5466cf8f31f82cc78dd0e7d9056ef0d224dd3be8 (diff)
downloadsparse-dev-369cbea4b37692bfd93ca23c1991d002354d2219.tar.gz
fix test validation/div.c
This test, which test the diagnostics given at the boundary conditions of division, depends on the header <limits.h> which itself depends on some macros being defined by the compiler. Now these macros are predefined (at least the obvious ones) but it's annoying for the tests to depends on external things like this header. Remove this dependence by rewriting the test to use the predefined macros directly. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--validation/div.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/validation/div.c b/validation/div.c
index 3dcbfd57..3e6fb698 100644
--- a/validation/div.c
+++ b/validation/div.c
@@ -1,4 +1,6 @@
-#include <limits.h>
+#define INT_MIN (-__INT_MAX__ - 1)
+#define LONG_MIN (-__LONG_MAX__ - 1)
+#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
static int xd = 1 / 0;
static int xl = 1L / 0;
@@ -16,14 +18,14 @@ static long long zll = LLONG_MIN % -1;
* check-name: division constants
*
* check-error-start
-div.c:3:19: warning: division by zero
-div.c:4:20: warning: division by zero
-div.c:5:22: warning: division by zero
-div.c:7:25: warning: constant integer operation overflow
-div.c:8:27: warning: constant integer operation overflow
-div.c:9:34: warning: constant integer operation overflow
-div.c:11:25: warning: constant integer operation overflow
-div.c:12:27: warning: constant integer operation overflow
-div.c:13:34: warning: constant integer operation overflow
+div.c:5:19: warning: division by zero
+div.c:6:20: warning: division by zero
+div.c:7:22: warning: division by zero
+div.c:9:25: warning: constant integer operation overflow
+div.c:10:27: warning: constant integer operation overflow
+div.c:11:34: warning: constant integer operation overflow
+div.c:13:25: warning: constant integer operation overflow
+div.c:14:27: warning: constant integer operation overflow
+div.c:15:34: warning: constant integer operation overflow
* check-error-end
*/