Wed, 27 Jun 2001 17:14:18 -0400
> I have a requirement where in i have to port code from VADS Ada 83
> compiler to GNAT Ada 95 compiler. My query is, if there is any tool
> available for this work or any guideline sort of thing which helps in
> Thanks in advance
> Prabhath S
We recently completed converting ~750K SLOC of VADS Ada 83 code
to GNAT Ada 95. I know of no tool to do the heavy lifting for
you. Here are some tips that may prove useful. I concur with
David Hoos that the major difficulty is in how much you used
VADS-specific features (such as passive tasking) and VADS library
First and foremost, do NOT ignore any GNAT warning messages unless
you understand the warning and choose to leave it there. We tried
to eliminate all warning messages by correcting the code. Trust
the compiler; it's your best tool.
We didn't have the luxury to stop all development while doing
the conversion, so we preserved VADS implementations in package
bodies along with parallel Ada95 implementations for awhile.
1) Use gnatchop to separate compilation units into separate files
and to rename files as needed.
2) We created our own packages which mirrored the purpose of some
of the VADS packages. Each of these packages had two bodies,
the VADS/Ada83 body and the GNAT/Ada95 body. As it turns out,
very little code was GNAT-specific since there's lots more
predefined packages to handle things like unbounded strings,
command line arguments, environment variables, and random numbers,
and exception information in Ada95 than in Ada83.
3) We replaced all references to VADS Os_Files and File_Support
with our own Unix I/O packages rather than using GNAT-specific
packages. POSIX may have been a better choice, but this is
what we did.
4) Replace "pragma Optimize_Code" with "pragma Optimize."
5) Replace "System.No_Addr" with "System.Null_Address."
6) Replace "pragma Inline_Only" with "pragma Inline."
7) Replace "Natural'size" and "Positive'size" with "Integer'size."
This is because Naturalísize is 31 bits in Ada since you can fit
a Natural in 31 bits. The VADS implementors interpreted this
differently and we didn't know any better. You'll also want to
evaluate your use of Boolean'size.
8) Change all tasks with "pragma passive" to protected records.
Our experience is that GNAT protected records are VERY efficient.
Better than VADS passive tasks.
9) Examine all arrays of Boolean for whether or not you need
to use pragma Pack.
10) Access types to unconstrained types are 64 bits in GNAT. Watch
out for unchecked conversion of access types to System.ADDRESS.
Compiler will warn you. A workaround is to add a size representation
clause: for Some_Access_Typeísize use 32.
11) If your target is Solaris, you'll find that each exception handler
setup will cost some CPU time since there's no Solaris zero-cost
exception handling capability. "When others" is cheaper than
This certainly isn't comprehensive, but it may help a little.
[log in to unmask]