[gcc r17-2673] cobol: Handle -Wno options and -fPIC better in gcobc emulation script.

"James K. Lowden via Gcc-cvs" <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:eb25d3e4806a331ac51dfbc0b306d7deaea43b85

commit r17-2673-geb25d3e4806a331ac51dfbc0b306d7deaea43b85
Author: James K. Lowden <[email protected]>
Date:   Thu Jul 23 10:59:20 2026 -0400

    cobol: Handle -Wno options and -fPIC better in gcobc emulation script.
    
    Make -fPIC the default except when producing an executable. Add
    handling of -Wno- options.
    
    gcc/cobol/ChangeLog:
    
            * gcobc: Consolidate warning cases and update comments.

Diff:
---
 gcc/cobol/gcobc | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/gcc/cobol/gcobc b/gcc/cobol/gcobc
index 754a2b4da491..6e0741cd61fa 100755
--- a/gcc/cobol/gcobc
+++ b/gcc/cobol/gcobc
@@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.