Skip to content

Commit 783382a

Browse files
Add support for configuration pragma files
Note this also adds a configuration pragma file that is automatically including in --apex mode to support "1.ada" and "2.ada" naming schemes.
1 parent 151968f commit 783382a

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

experiments/list_unsupported.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
# Usage info
44
usage()
55
{
6-
echo "Usage:list_unsupported.sh [--help] [--apex] path_to_ada_source_folder"
6+
echo "Usage:list_unsupported.sh [--help] [--apex] [--adc pragmas.adc] path_to_ada_source_folder"
77
echo
88
echo "Run GNAT2Goto on an Ada repository."
99
echo
1010
echo "The output is an ordered list of currently unsupported features"
1111
echo "with the number of times they occur in the input repository."
1212
echo
1313
echo "Options:"
14-
echo " --help Display this usage information"
15-
echo " --apex Use Rational APEX style naming convention .1.ada and .2.ada"
14+
echo " --help Display this usage information"
15+
echo " --apex Use Rational APEX style naming convention .1.ada and .2.ada"
16+
echo " --adc pragmas.adc Use the specified 'pragmas.adc' file during compilation"
1617
}
1718

1819
# File extensions to expect for Specification files and Body files
@@ -111,6 +112,17 @@ while [ -n "$1" ] ; do
111112
--apex)
112113
spec_ext="1.ada"
113114
body_ext="2.ada"
115+
pragma_file="$(dirname ${0})/rational-apex.adc"
116+
;;
117+
--adc)
118+
shift
119+
if [ -r "${1}" ] ; then
120+
pragma_file="${1}"
121+
else
122+
usage >&2
123+
echo >&2 "--adc option must specify a configuration pragma file"
124+
exit 2
125+
fi
114126
;;
115127
--help)
116128
usage
@@ -162,6 +174,10 @@ for include_folder in `echo "$ADA_INCLUDE_PATH" | tr ':' ' '` ; do
162174
done
163175
done
164176

177+
if [ -n "${pragma_file}" ]; then
178+
pragma_file_opt="-gnatec=${pragma_file}"
179+
fi
180+
165181
# Before attempting to start compiling, make a clear log of the environment
166182
# we will be using:
167183
echo >&2 "-------------------------------------------------------"
@@ -179,7 +195,7 @@ compile_error_occured=0
179195
for filename in $(find ${path} -name "*.${body_ext}" | LC_ALL=posix sort); do
180196
printf "Compiling %s..." "${filename}" >&2
181197
echo "---------- COMPILING: $filename" >>"$file_name".txt
182-
"${GNAT2GOTO}" -gnatU ${include_path} "${filename}" > "$file_name".txt.compiling 2>&1
198+
"${GNAT2GOTO}" ${pragma_file_opt} -gnatU ${include_path} "${filename}" > "$file_name".txt.compiling 2>&1
183199
result=$?
184200
cat "$file_name".txt.compiling >> "$file_name".txt
185201

experiments/rational-apex.adc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pragma Source_File_Name
2+
(Spec_File_Name => "*.1.ada", Dot_Replacement => "-");
3+
pragma Source_File_Name
4+
(Body_File_Name => "*.2.ada", Dot_Replacement => "-");

0 commit comments

Comments
 (0)