From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c35edbbda4c7f58f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone-sf.pbi.net!151.164.30.34!cyclone.swbell.net!bos-service1.raytheon.com!dfw-service2.ext.ray.com.POSTED!53ab2750!not-for-mail Message-ID: <41A28F3D.2030008@acm.org> From: Arthur Schwarz User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Conditional compilation in Ada? References: <419b5ff6$0$25329$9b4e6d93@newsread2.arcor-online.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 22 Nov 2004 17:15:41 -0800 NNTP-Posting-Host: 192.199.68.158 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.ray.com 1101172542 192.199.68.158 (Mon, 22 Nov 2004 19:15:42 CST) NNTP-Posting-Date: Mon, 22 Nov 2004 19:15:42 CST Organization: Raytheon Company Xref: g2news1.google.com comp.lang.ada:6353 Date: 2004-11-22T17:15:41-08:00 List-Id: Dr. Adrian Wrigley wrote: >>pragma Ignore ( -- compiler warning >> DEBUG.put_line >> ( "Here " & Is.Something ("reasonable complex to evaluate") >> ) >>); > > > Maybe I'm being stupid, but how does this help? > Doesn't this always have no effect? > > I'd like to switch debugging on/off without editing every > DEBUG statement in the source... Same problem. What I usually do is use a flexible scheme to represent debug flags. If I want the code permanantly removed, I set the debug flags to: Debug_Flag : constant Boolean := FALSE; and if I want the conde permanently available, I set the debug flags to: Debug_Flag : constant Boolean := TRUE; and if I want to (interactive) change my mind, I set the debug flags to: Debug_Flag : Boolean := TRUE; The pragma inline (below) conserves code and enables identification of debug sections - it is for a maintainer's notification and does nothing in terms of code or code integrity. And I know, I know, 'pragma inline' is only a suggestion to the compiler - but a good one. The Is_Debug functions are tailored to suit. I've given only a clear (?) and simple presentation of principle. Forgive the Ada. Hope this provides a focus for conversation. It would be nice to see what debug things are out their. art Package one body is Debug_Flag : Boolean := TRUE; // Note: this is a variable // and placed in the spec file. function Is_Debug return Boolean is begin -- Is_Debug return Debug_Flag; end Is_Debug; pragma inline( Is_Debug ); end one; Package two body is Debug_Flag : Boolean := TRUE; // same as above function Is_Debug return boolean is begin -- Is_Debug return Debug_Flag and one.Is_Debug; end Is_Debug; procedure Some_Thing is begin -- Some_Thing if ( Is_Debug ) then null; end if; end Some_Thing; end two;