]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cobol: Fix -fmax-errors option [PR119776]
authorJakub Jelinek <jakub@redhat.com>
Mon, 14 Apr 2025 17:33:11 +0000 (19:33 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 14 Apr 2025 17:33:11 +0000 (19:33 +0200)
There seems to be inconsistency in the -fmax-errors option
naming.  It is a generic option in common.opt (so applies
to all languages) but with the = character in it.
The gcobol.1 man page in one spot documents the generic
option (in the syntax, -fmax-errors=nerror) but in another
spot without the = character.

In common.opt it is
fmax-errors=
Common Joined RejectNegative UInteger Var(flag_max_errors)
-fmax-errors=<number>   Maximum number of errors to report.

I hope the cobol addition is just a mistake, having -fmax-errors variant
without = character when Joined Separate would allow to specify
-fmax-errors 10 with the same meaning as -fmax-errors=10
but also -fmax-errors10 with the same meaning which is just weird.
Also, there is no UInteger and RejectNegative on it, so one can
also specific -fno-max-errors42 or -fmax-errors blah.

So, unless the spelling without = is intentional, here is a patch
to just remove it, the common option already should have arranged
for flag_max_errors to be set to the right number.

Or if it is intentional, I guess we'd need to at least add
RejectNegative UInteger (plus using atoi is generally undesirable
anywhere in the compiler because it does no error checking).
And the man page would need to be updated to specify both forms.

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

PR cobol/119776
* lang.opt (fmax-errors): Remove.
* lang.opt.urls: Regenerate.
* cobol1.cc (cobol_langhook_handle_option) <case OPT_fmax_errors>:
Remove.
* gcobol.1: Document -fmax-errors=nerror rather than
-fmax-errors nerror.

gcc/cobol/cobol1.cc
gcc/cobol/gcobol.1
gcc/cobol/lang.opt
gcc/cobol/lang.opt.urls

index 7d742b907764528211934164b3266df25fc2d4b7..3bd21c783dedf4e764dbaee09822eace8a6b47ba 100644 (file)
@@ -385,10 +385,6 @@ cobol_langhook_handle_option (size_t scode,
             return true;
         }
 
-        case OPT_fmax_errors:
-            flag_max_errors = atoi(arg);
-            return true;
-
         case OPT_ffixed_form:
             cobol_set_indicator_column(-7);
             return true;
index 64c017c221449a2aa3977c314dceee987146d47a..4377c1401efee4189f3a214c0e36e28292e78ff9 100644 (file)
@@ -224,7 +224,7 @@ had appeared.
 Not all exception conditions are implemented.  Any that are not
 produce a warning message.
 .
-.It Fl fmax-errors Ar nerror
+.It Fl fmax-errors Ns Li = Ns Ar nerror
 .Ar nerror
 represents the number of error messages produced.  Without this option,
 .Nm
index 1d33f34aceebf564d6a59b4beadd162cd93c5d14..59278a147e991d29d4c4c04933df1eed9d416be2 100644 (file)
@@ -89,10 +89,6 @@ finternal-ebcdic
 Cobol Var(cobol_ebcdic, 1) Init(0)
 -finternal-ebcdic      Internal processing is in EBCDIC Code Page 1140
 
-fmax-errors
-Cobol Joined Separate
-; Documented in C
-
 fstatic-call
 Cobol Var(cobol_static_call, 1) Init(1)
 Enable/disable static linkage for CALL literals
index 75df59643eaba4c944e881d1c6c3f41f53da06e4..69f52973c0256c1089226250df0382758c19723b 100644 (file)
@@ -16,9 +16,6 @@ LangUrlSuffix_Fortran(gfortran/Fortran-Dialect-Options.html#index-ffixed-form)
 ffree-form
 LangUrlSuffix_Fortran(gfortran/Fortran-Dialect-Options.html#index-ffree-form)
 
-fmax-errors
-UrlSuffix(gcc/Warning-Options.html#index-fmax-errors) LangUrlSuffix_D(gdc/Warnings.html#index-fmax-errors)
-
 iprefix
 UrlSuffix(gcc/Directory-Options.html#index-iprefix) LangUrlSuffix_D(gdc/Directory-Options.html#index-iprefix) LangUrlSuffix_Fortran(gfortran/Preprocessing-Options.html#index-iprefix)