Skip to content
Snippets Groups Projects
Commit b579833b authored by James K. Lowden's avatar James K. Lowden :anchor:
Browse files

Merge branch 'master+cobol' into 'master+cobol'

fix cobc compiler driver

See merge request !1
UDF directory needs further TLC.  
parents 65dc4c31 a1e2b009
No related branches found
No related tags found
1 merge request!1fix cobc compiler driver
Pipeline #2462 failed
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
# #
# User-defined variables, and their defaults: # User-defined variables, and their defaults:
# #
# Variable Default Effect # Variable Default Effect
# echo none If defined, echo the gcobol command # echo none If defined, echo the gcobol command
# gcobcx none Produce verbose messages # gcobcx none Produce verbose messages
# gcobol ./gcobol Name of the gcobol binary # gcobol ./gcobol Name of the gcobol binary
# GCOBCUDF PREFIX/share/cobol/udf/ Location of UDFs to be prepended to input # GCOBCUDF PREFIX/share/cobol/udf/ Location of UDFs to be prepended to input
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# By default, this script includes all files in $GCOBCUDF. To defeat # By default, this script includes all files in $GCOBCUDF. To defeat
# that behavior, use GCOBCUDF=none. # that behavior, use GCOBCUDF=none.
# #
# A list of supported options is produced with "gcobc -HELP". # A list of supported options is produced with "gcobc -HELP".
# #
## Maintainer note. In modifying this file, the following may make ## Maintainer note. In modifying this file, the following may make
## your life easier: ## your life easier:
...@@ -46,20 +46,26 @@ then ...@@ -46,20 +46,26 @@ then
copydir="-I$COB_COPY_DIR" copydir="-I$COB_COPY_DIR"
fi fi
udf_default="${0%/*}/../share/cobol/udf" # TODO: this file likely needs to query gcobol for its shared path instead
udf_default="${0%/*}/../share/gcobol/udf"
if [ ! -d "$udfdir" ]
then
# the one above is the installed one from the packages this one was previously used
udf_default="${0%/*}/../share/cobol/udf"
fi
udfdir="${GCOBCUDF:-$udf_default}" udfdir="${GCOBCUDF:-$udf_default}"
if [ -d "$udfdir" ] if [ -d "$udfdir" ]
then then
for F in "$udfdir"/* for F in "$udfdir"/*
do do
if [ -f $F ] if [ -f "$F" ]
then then
includes="$includes -include $F " includes="$includes -include $F "
fi fi
done done
else else
if [ "$GCOBCUDF" -a "$GCOBCUDF" != "none" ] if [ "${GCOBCUDF:-none}" != "none" ]
then then
echo warning: no such directory: "'$GCOBCUDF'" echo warning: no such directory: "'$GCOBCUDF'"
fi fi
...@@ -92,16 +98,19 @@ no_warn() { :; } # silence is golden ...@@ -92,16 +98,19 @@ no_warn() { :; } # silence is golden
help() { help() {
cat<<EOF cat<<EOF
$0 recognizes the following GnuCOBOL cobc output mode options: $0 recognizes the following GnuCOBOL cobc output mode options:
-b, -c, -m, -S, -x -b, -c, -m, -S, -x
$0 recognizes the following GnuCOBOL cobc compilation options: $0 recognizes the following GnuCOBOL cobc compilation options:
-C -C
-d, --debug -d, --debug
-E -E
-g
--coverage
-ext -ext
-fec=exception-name, -fno-ec=exception-name -fec=exception-name, -fno-ec=exception-name
-fixed -fformat
-F, -free --fixed
-F, --free
-fimplicit-init -fimplicit-init
-h, --help -h, --help
-save-temps= -save-temps=
...@@ -110,10 +119,10 @@ $0 recognizes the following GnuCOBOL cobc compilation options: ...@@ -110,10 +119,10 @@ $0 recognizes the following GnuCOBOL cobc compilation options:
-std=mf -std=mf
Options that are the same in gcobol and cobc are passed through verbatim. Options that are the same in gcobol and cobc are passed through verbatim.
Options that have no analog in gcobol produce a warning message. Options that have no analog in gcobol produce a warning message.
To produce this message, use -HELP. To produce this message, use -HELP.
To see the constructed cobc command-line, use -echo. To see the constructed cobc command-line, use -echo.
To override the default cobc, set the "cobc" environment variable. To override the default cobc, set the "cobc" environment variable.
By default, gcobc invokes the gcobol the same directory the gcobc resides. By default, gcobc invokes the gcobol the same directory the gcobc resides.
To override, set the gcobol environment variable. To override, set the gcobol environment variable.
EOF EOF
} }
...@@ -137,7 +146,7 @@ do ...@@ -137,7 +146,7 @@ do
pending_arg= pending_arg=
continue continue
fi fi
case $opt in case $opt in
-A | -Q) warn "$opt" -A | -Q) warn "$opt"
;; ;;
...@@ -147,7 +156,7 @@ do ...@@ -147,7 +156,7 @@ do
;; ;;
--conf=*) warn "$opt" --conf=*) warn "$opt"
;; ;;
-C) error "$opt $incomparable" -C) error "$opt $incomparable"
;; ;;
-d | --debug) opts="$opts -fcobol-exceptions=EC-ALL" -d | --debug) opts="$opts -fcobol-exceptions=EC-ALL"
warn "$opt implies -fstack-check:" warn "$opt implies -fstack-check:"
...@@ -165,7 +174,7 @@ do ...@@ -165,7 +174,7 @@ do
-ext) -ext)
pending_arg=$opt pending_arg=$opt
;; ;;
-ext=*) opts="$opts $(echo $opt | sed 's/-ext=/-copyext ./')" -ext=*) opts="$opts $(echo "$opt" | sed 's/-ext=/-copyext ./')"
;; ;;
# A.3 Compiler options # A.3 Compiler options
...@@ -337,28 +346,39 @@ do ...@@ -337,28 +346,39 @@ do
-fassign-disk-from=*) warn "$opt" ;; -fassign-disk-from=*) warn "$opt" ;;
-fvsam-status=*) warn "$opt" ;; -fvsam-status=*) warn "$opt" ;;
-fself-call-recursive=*) warn "$opt" ;; -fself-call-recursive=*) warn "$opt" ;;
# TODO: create a temporary COBOL file with COBOL-WORDS directives
# and force-include it
-fnot-reserved=*) warn "$opt" ;; -fnot-reserved=*) warn "$opt" ;;
-freserved=*) warn "$opt" ;; -freserved=*) warn "$opt" ;;
-fnot-register=*) warn "$opt" ;; -fnot-register=*) warn "$opt" ;;
-fregister=*) warn "$opt" ;; -fregister=*) warn "$opt" ;;
-fixed) opts="$opts -ffixed-form" -fformat=auto ) ;; # gcobol and gnucobol default
-fixed | --fixed | -fformat=fixed | -fformat=variable | -fformat=xcard)
# note: variable + xcard are only _more similar_ to fixed than free,
# (with changing right-column to 250/255, which isn't supported in gcobol, yet)
opts="$opts -ffixed-form"
;; ;;
-F | -free) opts="$opts -ffree-form"
-F | -free | --free | -fformat=free | -fformat=* )
# note: "all other formats" are only _more similar_ to free than fixed
opts="$opts -ffree-form"
;; ;;
# -g
-h | --help) opts="$opts --help" -h | --help) opts="$opts --help"
;; ;;
-HELP) help && exit -HELP) help && exit
;; ;;
-i | --info) warn "$opt" -i | --info) warn "$opt"
;; ;;
# -I # -I
-fimplicit-init) warn "$opt" -fimplicit-init) warn "$opt"
;; ;;
-j | -job) warn "$opt" -j | -job) warn "$opt"
;; ;;
-K) ignore_arg "$opt" -K) ignore_arg "$opt"
;; ;;
...@@ -371,14 +391,14 @@ do ...@@ -371,14 +391,14 @@ do
-m) mode="-shared" -m) mode="-shared"
;; ;;
# -main # -main
# -nomain # -nomain
# -o # -o
# -O0, -Ox # -O0, -Ox
-O | -O2 | -Os) warn "$opt" -O | -O2 | -Os) warn "$opt"
;; ;;
-S) mode="$opt" -S) mode="$opt"
;; ;;
-save-temps=*) opt="$(echo $opt | sed -E 's/^.+=//')" -save-temps=*) opt="$(echo "$opt" | sed -E 's/^.+=//')"
export GCOBOL_TEMPDIR="$opt" export GCOBOL_TEMPDIR="$opt"
;; ;;
-save-temps) export GCOBOL_TEMPDIR="${PWD:-$(pwd)}" -save-temps) export GCOBOL_TEMPDIR="${PWD:-$(pwd)}"
...@@ -387,7 +407,7 @@ do ...@@ -387,7 +407,7 @@ do
-std=mvs) opts="$opts -dialect ibm" -std=mvs) opts="$opts -dialect ibm"
;; ;;
-std=mf) opts="$opts -dialect mf" -std=mf) opts="$opts -dialect mf"
;; ;;
-t | -T | -tlines=* | -P | -P=* | -X | --Xref) -t | -T | -tlines=* | -P | -P=* | -X | --Xref)
warn "$opt (no listing)" warn "$opt (no listing)"
...@@ -396,16 +416,19 @@ do ...@@ -396,16 +416,19 @@ do
;; ;;
-v | --verbose) opts="$opts -V" -v | --verbose) opts="$opts -V"
;; ;;
-V | --version | --dumpversion) opts="$opts --version" # note: we want -dumpversion to be passed to gcc
-V | --version | -version) opts="$opts --version"
;; ;;
-w) opts="$opts $opt" # pass through, strangely -Wall is not supported
;; -w | -W | -Wextra) opts="$opts $opt"
;;
-Wno-*) no_warn "$opt" -Wno-*) no_warn "$opt"
;; ;;
-W*) ignore_arg "$opt" -W*) ignore_arg "$opt"
;; ;;
-x) mode= -x) mode=
;; ;;
...@@ -440,4 +463,3 @@ then ...@@ -440,4 +463,3 @@ then
fi fi
exec $gcobol $mode $opts exec $gcobol $mode $opts
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment