comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
Subject: Re: Conditional compilation of debug traces without cpp
Date: Fri, 07 Jul 2006 06:32:25 -0400
Date: 2006-07-07T06:32:25-04:00	[thread overview]
Message-ID: <ufyhdu2me.fsf@acm.org> (raw)
In-Reply-To: 1152165198.400494.175100@p79g2000cwp.googlegroups.com

"Martin Krischik" <krischik@users.sourceforge.net> writes:

> 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.

You seem to be implying that the C preprocessor does not write the
intermediate file to the disk.

The Gnu C preprocessor _does_ write the intermediate file, and deletes
it when it is done compiling. There is an option to preserve the file. 

I guess other C compilers could do it differently, and not use the
disk.

In any case, the act of writing the file to the disk is transparent to
the user, unless the option to preserve it is given. This transparency
is provided by gcc; it runs the preprocessor on _all_ files (as
required by the C standard), and it knows the naming conventions for
the original and preprocessed files.

In GNAT, the use of preprocessed files is not so transparent, because
gnatmake does not know how to run the preprocessor. 

In addition, you need different naming conventions for the original
and preprocessed files. If the preprocessed files follow the GNAT
convention (the simplest choice), then the editing environment (Emacs
or GPS or AdaGIDE) will still not understand the naming convention for
the original files.

With a proper makefile, you can run the GNAT preprocessor on _all_
files. If you use the GNAT default naming convention for the original
files (so the editor works nicely), and tell GNAT to use an alternate
naming convention for the preprocessed files (via project files),
using the GNAT preprocessor will be as transparent as using the Gnu C
preprocessor.

-- 
-- Stephe



  reply	other threads:[~2006-07-07 10:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04 18:06 Conditional compilation of debug traces without cpp guillaume.portail
2006-07-04 19:07 ` Ludovic Brenta
2006-07-04 19:14   ` guillaume.portail
2006-07-04 21:39     ` Björn Persson
2006-07-04 21:43       ` guillaume.portail
2006-07-04 22:01         ` Björn Persson
2006-07-05  3:10     ` Matthew Goulet
2006-07-04 20:24 ` Gautier
2006-07-04 20:54 ` Simon Wright
2006-07-05 13:03 ` Jean-Pierre Rosen
2006-07-05 19:39   ` guillaume.portail
2006-07-06  5:53     ` Martin Krischik
2006-07-07 10:32       ` Stephen Leake [this message]
2006-07-07 14:08         ` M E Leypold
2006-07-06  7:59     ` Jean-Pierre Rosen
2006-07-06 20:25       ` guillaume.portail
2006-07-07  5:00         ` Matthew Goulet
2006-07-07 13:57           ` Thierry Bernier
2006-07-07 21:08           ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox