This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, Fortran] New warning flag -Wargument-mismatch to control argument mismatch warnings
- From: Fritz Reese <fritzoreese at gmail dot com>
- To: fortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 1 Nov 2016 15:43:41 -0400
- Subject: Re: [PATCH, Fortran] New warning flag -Wargument-mismatch to control argument mismatch warnings
- Authentication-results: sourceware.org; auth=none
- References: <CAE4aFAntKcWmQm-5MnVQH_S6qEJLT=hDaqU+97O=O+oO5RrL0w@mail.gmail.com> <CAE4aFAm2bJjn6+DfYvdo5c8oHTZDqT2Hhypni--pL6KRY2W2Og@mail.gmail.com>
And changelog....
From: Fritz O. Reese <fritzoreese@gmail.com>
Date: Tue, 1 Nov 2016 10:54:39 -0400
Subject: [PATCH] New warning -Wargument-mismatch for function argument
mismatches.
gcc/fortran/
* lang.opt, invoke.texi: New argument -Wargument-mismatch.
* interface.c (compare_parameter, compare_actual_formal,
gfc_check_typebound_override, argument_rank_mismatch): Control argument
mismatch warnings with -Wargument-mismatch.
* resolve.c (resolve_structure_cons, resolve_global_procedure): Ditto.
gcc/testsuite/gfortran.dg/
* warn_argument_mismatch_1.f90: New test.
---
Fritz Reese
On Tue, Nov 1, 2016 at 3:38 PM, Fritz Reese <fritzoreese@gmail.com> wrote:
> See attached.......
>
> ---
> Fritz Reese
>
>
> On Tue, Nov 1, 2016 at 11:24 AM, Fritz Reese <fritzoreese@gmail.com> wrote:
>> All,
>>
>> Here I propose a new warning flag -Wargument-mismatch to control
>> warnings emitted when the type, rank, or some other property of actual
>> arguments does not match that of a function's formal parameters
>> according to its declaration or interface specification. The warnings
>> are of course enabled by default, as they should be. Note also with
>> -Wno-argument-mismatch, only _warnings_ are suppressed. In such cases
>> where an argument mismatch is an error, the error is still properly
>> emitted.
>>
>> This simple patch depends on the recently-submitted patch [1] "Allow
>> warnings given through gfc_error to associate with warning flags".
>> Since the argument mismatch warnings are sometimes errors, they are
>> currently emitted through gfc_error with `warnings_not_errors` set.
>> Without the solution in [1], awkward code changes may be required to
>> work around this fact.
>>
>> The new flag is supplied for the benefit of those users which believe
>> that suppression of any given warning generated by a compiler should
>> be possible. Such users may be frustrated with the current GNU Fortran
>> front-end, in which there is no way to suppress this class of
>> warnings, even if the user "knows what he is doing" and refuses to
>> change his/her code.
>>
>> [1] https://gcc.gnu.org/ml/fortran/2016-11/msg00003.html
>>
>> Bootstraps and regtests on x86_64-redhat-linux.
>>
>> if (gfc_accepted ([1]))
>> {
>> gfc_ask_ok_for_trunk ($0);
>> }
>>
>> ---
>> Fritz Reese