Message ID | ydd7fw8l1d6.fsf@lokon.CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
On Tue, Jan 27, 2015 at 03:55:17PM +0100, Rainer Orth wrote: > Steve Kargl <sgk@troutmask.apl.washington.edu> writes: > > > On Sat, Jan 24, 2015 at 06:13:04PM +0100, Tobias Burnus wrote: > >> if (s1->as->type == AS_EXPLICIT) > >> - for (i = 0; i < s1->as->rank + s1->as->corank; i++) > >> + for (i = 0; i < s1->as->rank + std::max(0, s1->as->corank-1); i++) > > > > Doesn't this require '#include <algorithms>'? > > I suspect that you are depending on namespace pollution > > via some other header (coretypes.h?). > > It was committed with that change, which unfortunately broke Solaris > bootstrap: > > In file included from ./config.h:6:0, > from /vol/gcc/src/hg/trunk/local/gcc/fortran/interface.c:68: > ./auto-host.h:2055:0: error: "_FILE_OFFSET_BITS" redefined [-Werror] > #define _FILE_OFFSET_BITS 64 > ^ > In file included from /usr/include/iso/stdlib_iso.h:24:0, > from /usr/include/stdlib.h:11, > from /var/gcc/regression/trunk/11-gcc/build/prev-i386-pc-solaris2.11/libstdc++-v3/include/cstdlib:72, > from /var/gcc/regression/trunk/11-gcc/build/prev-i386-pc-solaris2.11/libstdc++-v3/include/bits/stl_algo.h:59, > from /var/gcc/regression/trunk/11-gcc/build/prev-i386-pc-solaris2.11/libstdc++-v3/include/algorithm:62, > from /vol/gcc/src/hg/trunk/local/gcc/fortran/interface.c:66: > /var/gcc/regression/trunk/11-gcc/build/prev-gcc/include-fixed/sys/feature_tests.h:213:0: note: this is the location of the previous definition > #define _FILE_OFFSET_BITS 32 > ^ > > The problem is (as so often) that <algorithm> was included *before* > config.h. Moving it after the other includes allows interface.c to > compile without warnings. Why don't you use MAX macro instead of std::max as everywhere else in the gcc sources? Your change is wrong, you can't include system headers after including system.h and other headers. Jakub
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" @@ -73,6 +71,8 @@ along with GCC; see the file COPYING3. #include "match.h" #include "arith.h" +#include <algorithm> /* For std::max. */ + /* The current_interface structure holds information about the interface currently being parsed. This structure is saved and restored during recursive interfaces. */