[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: gnetlist in a Makefile



El sáb, 05-02-2005 a las 17:44 -0500, Dan McMahill escribió:
[snip]
> that is correct.  when a program returns a nonzero exit code make stops.
> Thats exactly why I thought it would be good to have a flag to say 'warnings
> don't give nonzero exit codes'.

That's fine. See attached patch. 
If there are errors, gnetlist will raise an error. If there are only
warnings, then gnetlist will raise an error ONLY if it's in non-quiet
mode. 
I mean that if you don't want gnetlist to generate an error when there
are only warnings, then use the -q flag when executing gnetlist.

Remember that the drc2 backend is highly configurable: you can specify,
for example, what tests are not desired and disable them. See
documentation in the backend.

Regards,

Carlos


--- gnet-drc2.scm.orig	2005-02-06 12:30:44.000000000 +0100
+++ gnet-drc2.scm	2005-02-06 13:47:21.000000000 +0100
@@ -1,6 +1,6 @@
 ;;; gEDA - GNU Electronic Design Automation
 ;;; gnetlist - GNU Netlist
-;;; Copyright (C) 1998-2000 Ales V. Hvezda
+;;; Copyright (C) 1998-2005 Ales V. Hvezda
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
@@ -21,6 +21,10 @@
 ;; DRC backend written by Carlos Nieves Onega starts here.
 ;;
 ;;
+;;  2005-02-06: Make gnetlist return a non-zero value when errors or warnings
+;;              are found. If there is only warnings, the non-zero return value
+;;              can be disabled using the "quiet mode" option of gnetlist.
+;;  2005-02-06: Fixed bug when packages list is empty.
 ;;  2005-01-23: Added check for duplicated references.
 ;;  2003-10-24: Added numslots and slot attributes check.
 ;;  2003-06-17: Added configuration support and slots check.
@@ -873,7 +877,8 @@
 		(begin
 		  (display "Checking unconnected pins..." port)
 		  (newline port)
-		  (drc2:check-unconnected-pins port packages (gnetlist:get-pins-nets (car packages)))
+		  (if (not (null? packages))
+		      (drc2:check-unconnected-pins port packages (gnetlist:get-pins-nets (car packages))))
 		  (newline port)))
 
 	    ;; Check slots   
@@ -922,7 +927,18 @@
 		  (display "No errors found. " port)
 		  (newline port)))
 
-         (close-output-port port)))))
+         (close-output-port port)
+	 
+	 ;; Make gnetlist return an error if there are DRC errors.
+	 ;; If there are only warnings and it's in quiet mode, then
+	 ;; do not return an error.
+	 (if (> errors_number 0)
+	     (error "DRC errors found. See output file.")
+	     (if (> warnings_number 0)
+		 (if (not (calling-flag? "quiet_mode" (gnetlist:get-calling-flags)))
+		     (error "DRC warnings found. See output file."))))
+
+	 ))))
 
 
 ;;