]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cobol: Handle -Wno options and -fPIC better in gcobc emulation script.
authorJames K. Lowden <jklowden@cobolworx.com>
Thu, 23 Jul 2026 14:59:20 +0000 (10:59 -0400)
committerJames K. Lowden <jklowden@cobolworx.com>
Thu, 23 Jul 2026 16:14:08 +0000 (12:14 -0400)
Make -fPIC the default except when producing an executable. Add
handling of -Wno- options.

gcc/cobol/ChangeLog:

* gcobc: Consolidate warning cases and update comments.

gcc/cobol/gcobc

index 754a2b4da4916aa61cfc10b14855dc37199f79c9..6e0741cd61fabbd69c91871ee28fd86818446ed8 100755 (executable)
@@ -173,8 +173,6 @@ EOF
 }
 
 dialect="mf gnu"
-out_set=""
-first=""
 
 #
 # Iterate over the command-line tokens.  We can't use getopts here
@@ -235,8 +233,6 @@ do
             opt="$(echo "$opt" | sed -E 's/-f(no-)?ec=/-f\1cobol-exceptions=EC-/g')"
              opts="$opts $opt"
              ;;
-        -fno-ec=*)
-             ;;  # just ignore for now to work around "sorry unimplemented" errors
          -ext)
             pending_arg="-copyext "
              ;;
@@ -515,7 +511,8 @@ do
                        ;;
          -v | --verbose) opts="$opts -V"
                          ;;
-         # note: we want -dumpversion to be passed to gcc
+         # -dumpversion, like all options not handled specifically, is
+         # passed by default.
          -V | --version | -version)
              $gcobol --version |
                  awk '1 == NR { ver = $3; 
@@ -524,12 +521,9 @@ do
              exit
              # opts="$opts --version"
             ;;
-        # pass through, strangely -Wall is not supported
-        # note that cobc does not support gcc's -Wl options, but they
-        # might be passed anyway for different reasons e.g.: -Wl,rpath.
-        -w | -W | -Wextra | -Wl,*) opts="$opts $opt"
-             ;;
-        -Wno-*) no_warn "$opt"
+        # pass through, -Wall support pending gcc to set for all front ends
+        # cobc does not support all gcc -Wl options
+        -w | -W | -Wextra | -Wno-* | -Wl,*) opts="$opts $opt"
              ;;
 
         -W*) warn "$opt"
@@ -554,7 +548,7 @@ do
                        output_name="$output_name".so
                        ;;
                esac
-               opts="$opts $cflags -o $output_name"
+               opts="$opts -o $output_name"
            fi    
            opts="$opts $opt" # pass through
            ;;
@@ -588,4 +582,4 @@ then
     set -x
 fi
 
-exec $gcobol $mode $dialect $opts
+exec $gcobol $mode $dialect $cflags $opts