On 17/12/2019 18:04, Janne Blomqvist wrote:
On Tue, Dec 17, 2019 at 7:47 PM Steve Kargl
<s...@troutmask.apl.washington.edu> wrote:
On Tue, Dec 17, 2019 at 05:28:05PM +0000, Mark Eggleston wrote:
On 17/12/2019 17:06, Steve Kargl wrote:
On Tue, Dec 17, 2019 at 03:41:41PM +0000, Mark Eggleston wrote:
gcc/fortran/ChangeLog

       Mark Eggleston  <mark.eggles...@codethink.com>

       PR fortran/92896
       * array.c (walk_array_constructor): Replace call to cfg_convert_type
s/cfg_convert_type/gfc_convert_type

       with call to gfc_convert_type_warn with new argument set to true.
       (check_element_type): Replace call to cfg_convert_type with call to
       gfc_convert_type_warn with new argument set to true.
       * gfortran.h: Add argument "array" to gfc_convert_type_warn default
       value set to false.
Do all current uses of gfc_convert_type_warn need to be updated
to account for the new parameter?  That is, doesn't this introduce
a mismatch in the prototype and existing code?
I used a default value so all existing calls remain as they are and
default to false. So no mismatch.

% cat a.h
#ifndef _STDBOOL_H_
#include <stdbool.h>
#endif
float foo(int, float, bool tmp = false);
% cat a.c
#include "a.h"
void
bar(float x)
{
   int n;
   n = 1;
   x = foo(n, x);
}
% /usr/home/sgk/work/x/bin/gcc -Wall -c a.c
In file included from a.c:2:
a.h:1:32: error: expected ';', ',' or ')' before '=' token
     1 | float foo(int, float, bool tmp = false);
       |                                ^
a.c: In function 'bar':
a.c:8:7: warning: implicit declaration of function 'foo' 
[-Wimplicit-function-declaration]
     8 |   x = foo(n, x);
       |       ^~~
Well, frontends are nowadays C++, so

a) No need to include stdbool.h, bool is a builtin type.

b) optional arguments are a thing (they are also used elsewhere in the
Fortran frontend).

It is a bit confusing that the Fortran FE source files have the .c extension implying C when they are C++ and are compiled using C++.

After that aside back to the original question, OK to commit?

regards,

Mark

--
https://www.codethink.co.uk/privacy.html

Reply via email to