Hi!

I was looking through options.cc diff between GCC 14 and 15, looking for
entries with added CL_Cobol where at least one other language is present
and was present before too.  Besides the -fsyntax-only changes this is
the only other one I found, COBOL adds Var(cobol_include) to something
which didn't have a Var at all before and IMHO it is actively harmful.
Because one can specify multiple -include file1 -include file2 options,
both in C/C++ etc. and in COBOL as well (as documented in the man
page).  A Var can track just one entry.  cobol_langhook_handle_option
should use arg instead.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2025-04-14  Jakub Jelinek  <ja...@redhat.com>

        PR cobol/119777
        * lang.opt (include): Remove Var(cobol_include).
        * cobol1.cc (cobol_langhook_handle_option) <case OPT_include>: Use
        arg instead of cobol_include.

--- gcc/cobol/lang.opt.jj       2025-04-14 10:56:28.739693026 +0200
+++ gcc/cobol/lang.opt  2025-04-14 11:08:31.808821317 +0200
@@ -114,7 +114,7 @@ Cobol Joined Separate
 ; Documented in C
 
 include
-Cobol Joined Separate Var(cobol_include)
+Cobol Joined Separate
 ; Documented in C
 
 isysroot
--- gcc/cobol/cobol1.cc.jj      2025-04-12 13:10:31.592523688 +0200
+++ gcc/cobol/cobol1.cc 2025-04-14 11:09:22.619126924 +0200
@@ -413,8 +413,8 @@ cobol_langhook_handle_option (size_t sco
           }
           return true;
         case OPT_include:
-          if( ! include_file_add(cobol_include) ) {
-            cbl_errx( "could not include %s", cobol_include);
+          if( ! include_file_add(arg) ) {
+            cbl_errx( "could not include %s", arg);
           }
             return true;
 

        Jakub

Reply via email to