On Sat, 6 Nov 2021 20:22:53 +0100 Harald Anlauf <anl...@gmx.de> wrote:
> Hi Bernhard, > > I cannot comment on the gcc/ parts, but > > > diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c > > index e86386c8b17..04fe8fe460b 100644 > > --- a/gcc/fortran/cpp.c > > +++ b/gcc/fortran/cpp.c > > @@ -728,12 +728,20 @@ gfc_cpp_done (void) > > cpp_clear_file_cache (cpp_in); > > } > > why do you introduce a wrapper for something outside of fortran > that is used only once, > > > -/* PATH must be malloc-ed and NULL-terminated. */ > > +/* Free all cpp include dirs. */ > > +void > > +gfc_cpp_free_cpp_dirs (void) > > +{ > > + free_cpp_dirs (); > > +} > > diff --git a/gcc/fortran/cpp.h b/gcc/fortran/cpp.h > > index 44644a2a333..963b9a9c89e 100644 > > --- a/gcc/fortran/cpp.h > > +++ b/gcc/fortran/cpp.h > > @@ -46,6 +46,7 @@ void gfc_cpp_post_options (bool); > > bool gfc_cpp_preprocess (const char *source_file); > > > > void gfc_cpp_done (void); > > +void gfc_cpp_free_cpp_dirs (void); > > > > void gfc_cpp_add_include_path (char *path, bool user_supplied); > > void gfc_cpp_add_include_path_after (char *path, bool user_supplied); > > diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c > > index 58dcaf01d75..ec4c2cf01d9 100644 > > --- a/gcc/fortran/f95-lang.c > > +++ b/gcc/fortran/f95-lang.c > > @@ -275,7 +275,7 @@ gfc_finish (void) > > gfc_cpp_done (); > > gfc_done_1 (); > > gfc_release_include_path (); > > - return; > > namely here? > > > + gfc_cpp_free_cpp_dirs (); > > } > > Why not call free_cpp_dirs () here directly, omit all unnecessary > stuff, and maybe only add a brief comment here? cpp.c includes incpath.h, f95-lang.c does not and should not. So the cleanest thing is to keep the cpp handling in cpp.[ch] and have the language frontend call into it's cpp bits. It would be rather rogue to extern void free_cpp_dirs (void); in f95-lang.c and directly call it in gfc_finish, i'd say? thanks,