diff mbox

[4/5] fix test validation/div.c

Message ID 20170327141918.61151-5-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Luc Van Oostenryck March 27, 2017, 2:19 p.m. UTC
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>
---
 validation/div.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/validation/div.c b/validation/div.c
index 3dcbfd57c..3e6fb6988 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
  */