It may be time I updated gccint.texi.  I found an error and a mystery. 

The error seems to be: 

> 'Warning'
>      This is a warning option and should be shown as such in '--help'
>      output.  This flag does not currently affect anything other than
>      '--help'.

In fact, experimentation today shows that without the Warning property,
a warning cannot be elevated to an error: 

$ gcobol -Werror=move-corresponding nist/NC/NC209A.cbl 
cobol1: error: ?-Werror=move-corresponding?: ?-Wmove-corresponding? is
not an option that controls warnings

IIUC this flag indicates whether the option controls a warning.  

The mystery is how kind to be.  

I haven't found any documentation for <lang>_langhook_handle_option
and its parameters. Many FEs mark some of the parameters with
ATTRIBUTE_UNUSED.  (I note that if a parameter is so marked, but is
used, I see no diagnostic.)  ISTR reading documentation, but maybe I
just remember comments somewhere.  

In gdb I see with -Werror=move-corresponding on the command line,
cobol_langhook_handle_option gets the option and its
variable, with the "kind" parameter set to 4.  It seems to be set from
enable_warning_as_error() which casts diagnostics::kind as an int. If I
cast it back, sure enough I have diagnostics::kind::error.  That's what
I'm depending on now.  

A spot check with my favorite example, m2/gm2-lang.cc, shows that it
doesn't use "kind".  That means either it doesn't support -Werror= or
that there's another way.  

I would like to know:

1.  Is testing "kind" as good a way as any?  
2.  Is now a good time to document the function or point me to the
documentation? 

Solving this will allow me to close a couple PRs and make happy at
least one user.  

--jkl

Reply via email to