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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Any Suggestion How To Accomplish A Debug Macro? Date: Tue, 30 Dec 2014 11:14:52 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="da19c0dc8eec016b1dd8c302a793eb7c"; logging-data="27340"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jrId5yrn8Hxb7Pkz87hbRMvt/aiC+zlU=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:2ZR50vyfG7n/ew2OjjrMyNQR2iI= sha1:V2Lkbf/WLK6OzxCLF9h+9Mduma0= Xref: news.eternal-september.org comp.lang.ada:24290 Date: 2014-12-30T11:14:52+00:00 List-Id: Hubert writes: > I know there is no such thing as C #define's in Ada, but isn't there a > way to make some sort of debug macro? > In my C++ code I use a lot of statements like > > PRINT(DEBUG_CHANNEL, "TEXT" ); > > to print out debug messages and in release code, these defines aren't > compiled. Is there any way to achieve something like this in Ada > without surrounding it with an IF statement and a boolean flag? GNAT has pragma Debug[1]. I was always annoyed that this is controlled by -gnata, which also controls assertions, but I see there's a pragma Debug_Policy - stated to be equivalent to pragma Check_Policy (Debug). [1] https://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Debugging---A-Special-Case.html