This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, Fortran] New warning flag -Wargument-mismatch to control argument mismatch warnings


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]