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,634259facc42df7a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!p79g2000cwp.googlegroups.com!not-for-mail From: "Martin Krischik" Newsgroups: comp.lang.ada Subject: Re: Conditional compilation of debug traces without cpp Date: 5 Jul 2006 22:53:18 -0700 Organization: http://groups.google.com Message-ID: <1152165198.400494.175100@p79g2000cwp.googlegroups.com> References: <44aaae35$0$5389$626a54ce@news.free.fr> <44ac1562$0$10269$636a55ce@news.free.fr> NNTP-Posting-Host: 194.41.216.139 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1152165203 30893 127.0.0.1 (6 Jul 2006 05:53:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 6 Jul 2006 05:53:23 +0000 (UTC) In-Reply-To: <44ac1562$0$10269$636a55ce@news.free.fr> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 fproxy.post.ch:3128 (squid/2.5.STABLE10) Complaints-To: groups-abuse@google.com Injection-Info: p79g2000cwp.googlegroups.com; posting-host=194.41.216.139; posting-account=2-0LkQwAAAAQMhPSoYwlMiUmi-6lYh44 Xref: g2news2.google.com comp.lang.ada:5527 Date: 2006-07-05T22:53:18-07:00 List-Id: guillaume.portail@grospied.enanglais.com wrote: > Jean-Pierre Rosen wrote: > > > Switching packages is then not more difficult than changing a #define... > > Nice, thank you ! And thank you for your Debug package, I already know > about it. > > But don't you think that the elaboration of the calls will still exist ? > Executing the statement : > > Null_Proc ("I was here" & Function_Call(A+12)); > > will always produce a call to Function_Call, even if Null_Proc has a > null body, I guess. > I have zillion of 'complicated' traces like this : > > Traces.Put_Info ("Mouse at home, ears=" & (+Mice.ears) > & "tong=" & (+Mice.tong) > ... > & "legs=" & (+Mice.legs)); > > where "+" is a rename of some kind of 'Image, may be a sophisticated > one. In general returning fixed-length strings, but not always. So I > suspect that theses traces call every "+" involved in the elaboration of > the call, maybe doing heap allocation, even when Trace.Put_info is null. Indeed. For simple cases "-O3" and "pragma Inline" will help. For GNAT you can take it furher with pragma "Pure_Function" but you are right: eventually you reach the point where functions will be called even when the result is not needed. You could use "GNAT PREPROCESS" - which gives you the same solution as C/C++: a text preprocessor. With all the advantages and disadvantages. Well not quite: "GNAT PREPROCESS" writes the preprocessed file to the drive - which has it's own set advantages and disadvantages. Martin