Hi Wilko,
Ok, I committed:
diff -r1.7 XrdClientReadCache.hh
26c26
< #define min(a, b) (a < b ? a : b)
---
> #define xrdmin(a, b) (a < b ? a : b)
89c89
< e = min(end_offs, fEndOffset);
---
> e = xrdmin(end_offs, fEndOffset);
and
diff -r1.16 XrdOssConfig.cc
109c109
< #define max(a,b) (a < b ? b : a)
---
> #define xrdmax(a,b) (a < b ? b : a)
842c842
< max(fence,XrdOssFDMINLIM))) return -EINVAL;
---
> xrdmax(fence,XrdOssFDMINLIM))) return -EINVAL;
to the HEAD of CVS. Someone else can argue whether it should be std::max
and std:min if Andy has some aversion to using that.
Pete
On Sat, Feb 26, 2005 at 03:27:32AM +0100, Peter Elmer wrote:
> Hi Wilko,
>
> Ah, you are right, I see several instances of this in the xrootd code:
>
> src/XrdOss/XrdOssConfig.cc:#define max(a,b) (a < b ? b : a)
>
> and
>
> src/XrdClient/XrdClientReadCache.hh:#define min(a, b) (a < b ? a : b)
>
> So this isn't a compiler bug, but redefinition of a keyword. We can change
> them to "xrdmax" and "xrdmin". I'll do that (since I'm fixing a bunch of
> other stupid things) unless somebody complains soon.
>
> Pete
>
> On Fri, Feb 25, 2005 at 06:18:08PM -0800, Wilko Kroeger wrote:
> > Hello Pete
> >
> > I am not sure if I was brave, but I installed gcc 3.4.3, but I still see
> > the error.
> > There is a gcc bugzilla report:
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16605
> >
> > The problem is that min and max are defined as macros (where ?)
> > which confuses the compiler because std::min/max don't make sense anymore.
> > This report also says that in the standard min and max are reserved which,
> > I assume, means that there should be no min/max macros.
> > I have no idea where these macros are defined but might hunt around a
> > little bit.
> >
> >
> > Cheers,
> > Wilko
> >
> >
> > On Sat, 26 Feb 2005, Peter Elmer wrote:
> >
> > > Hi Wilko,
> > >
> > > As we discussed in the meeting the other day, we wonder if this is a
> > > problem (i.e. bug) with the latest version compiler itself.
> > >
> > > I see that there is a gcc 3.4.3 out and that it is there in the Fedora
> > > development release:
> > >
> > > http://download.fedora.redhat.com/pub/fedora/linux/core/development/i386/Fedora/RPMS/
> > >
> > > How brave are you? ;-)
> > >
> > > Pete
> > >
> > > On Sun, Feb 13, 2005 at 03:21:11PM -0800, Wilko Kroeger wrote:
> > > > I tried to compile Xrootd (from the HEAD) on Fedora Core3 using
> > > > gcc 3.4.2 and './configure --build=debug'.
> > > >
> > > > It fails with the following error:
> > > >
> > > > Compiling XrdClientAbs.cc
> > > > In file included from
> > > > /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/sstream:640,
> > > > from ../XrdClient/XrdClientDebug.hh:23,
> > > > from XrdClientAbs.cc:17:
> > > > /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/sstream.tcc:
> > > > In member function `virtual typename std::basic_stringbuf<_CharT, _Traits,
> > > > _Alloc>::int_type std::basic_stringbuf<_CharT, _Traits,
> > > > _Alloc>::overflow(typename _Traits::int_type)':
> > > > /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/sstream.tcc:104:
> > > > error: expected unqualified-id before '(' token
> > > > gmake[4]: *** [../../obj/i386_linux26_dbg/XrdClientAbs.o] Error 1
> > > >
> > > >
> > > > I could fix the problem by modifying ./src/XrdClientDebug.hh,
> > > > adding
> > > >
> > > > #undef min
> > > > #undef max
> > > >
> > > > before the include statements (it has to be before #include <sstream>),
> > > > but I don't understand why I have to do this.
> > > > Is this something that has to be fixed ?
> > > >
> > > >
> > > > Cheers,
> > > > Wilko
> > > >
-------------------------------------------------------------------------
Peter Elmer E-mail: [log in to unmask] Phone: +41 (22) 767-4644
Address: CERN Division PPE, Bat. 32 2C-14, CH-1211 Geneva 23, Switzerland
-------------------------------------------------------------------------
|