Message ID | ydd386wkxws.fsf@lokon.CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
Rainer Orth wrote: > > Why don't you use MAX macro instead of std::max as everywhere else > > in the gcc sources? > > No idea, ask Tobias :-) No real reason - presumably, because I had MAX not in mind and thought of the general move towards standard features. > Anyway, the original patch would most likely > have worked: system.h already includes <algorithm>. It did on my system :-) > This one compiles just as well, of course. From my side, that patch (using MAX) is fine. Thanks for bearing the bootstrap failure and for the patch. Tobias > 2015-01-27 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> > > * interface.c: Remove <algorithm>. > (check_dummy_characteristics): Use MAX instead of std::max. > > # HG changeset patch > # Parent a742f8ce2a00e481ddf92dbecaf8d1ee01448911 > Avoid std::max > > diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c > --- a/gcc/fortran/interface.c > +++ b/gcc/fortran/interface.c > @@ -63,8 +63,6 @@ along with GCC; see the file COPYING3. > formal argument list points to symbols within the same namespace as > the program unit name. */ > > -#include <algorithm> /* For std::max. */ > - > #include "config.h" > #include "system.h" > #include "coretypes.h" > @@ -1215,7 +1213,7 @@ check_dummy_characteristics (gfc_symbol > } > > if (s1->as->type == AS_EXPLICIT) > - for (i = 0; i < s1->as->rank + std::max(0, s1->as->corank-1); i++) > + for (i = 0; i < s1->as->rank + MAX (0, s1->as->corank-1); i++) > { > shape1 = gfc_subtract (gfc_copy_expr (s1->as->upper[i]), > gfc_copy_expr (s1->as->lower[i]));
Tobias Burnus wrote: >> This one compiles just as well, of course. > From my side, that patch (using MAX) is fine. Thanks for > bearing the bootstrap failure and for the patch. I have now committed it (i.e. Rainer's patch) as Rev. 220182. I have also committed the fixed-up/combined patch to the 4.9 branch as Rev. 220184. (BTW: The original patch was approved by Paul on IRC.) Tobias
# HG changeset patch # Parent a742f8ce2a00e481ddf92dbecaf8d1ee01448911 Avoid std::max diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -63,8 +63,6 @@ along with GCC; see the file COPYING3. formal argument list points to symbols within the same namespace as the program unit name. */ -#include <algorithm> /* For std::max. */ - #include "config.h" #include "system.h" #include "coretypes.h" @@ -1215,7 +1213,7 @@ check_dummy_characteristics (gfc_symbol } if (s1->as->type == AS_EXPLICIT) - for (i = 0; i < s1->as->rank + std::max(0, s1->as->corank-1); i++) + for (i = 0; i < s1->as->rank + MAX (0, s1->as->corank-1); i++) { shape1 = gfc_subtract (gfc_copy_expr (s1->as->upper[i]), gfc_copy_expr (s1->as->lower[i]));