]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cobol: Fix up COBOL -include [PR119777]
authorJakub Jelinek <jakub@redhat.com>
Mon, 14 Apr 2025 17:32:43 +0000 (19:32 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 14 Apr 2025 17:32:43 +0000 (19:32 +0200)
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.

2025-04-14  Jakub Jelinek  <jakub@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/cobol1.cc
gcc/cobol/lang.opt

index 98d15a8d1eda82dd46e3c2babca0aaf7898d2d33..7d742b907764528211934164b3266df25fc2d4b7 100644 (file)
@@ -413,8 +413,8 @@ cobol_langhook_handle_option (size_t scode,
           }
           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;
 
index 142ec4f34bf247cefa3c70618629e1ff760e8afe..1d33f34aceebf564d6a59b4beadd162cd93c5d14 100644 (file)
@@ -114,7 +114,7 @@ Cobol Joined Separate
 ; Documented in C
 
 include
-Cobol Joined Separate Var(cobol_include)
+Cobol Joined Separate
 ; Documented in C
 
 isysroot