[Linux-ha-dev] gcc: an observation

David Lee t.d.lee at durham.ac.uk
Sat Feb 17 10:36:56 MST 2007


On Fri, 16 Feb 2007, Lars Ellenberg wrote:

> / 2007-02-16 16:00:03 +0000
> \ David Lee:
> > This is really just an observation, not (necessarily) a request for
> > fixing a problem.  (Although if someone could say "yes, that's trivially
> > fixable by doing XYZ", that would be nice.)
> >
> > Some of our systems share an old gcc compiler, version 2.95.2, on which
> > heartbeat has always built successfully until recently.  At some point in
> > the last six months or so, something has changed to stop this.  The code
> > in question is "include/crm/crm.h", around line 225:
> >    #define crm_err(fmt, args...)     do_crm_log(LOG_ERR,     fmt, ##args)
> >
> > (and similar lines) which now expand incorrectly, leaving a trailing ","
> > in that old version of gcc.
>
> iirc, this could be fixed by an extra space...
> #define crm_err(fmt, args...)     do_crm_log(LOG_ERR, fmt , ##args)
>                                                          ^^^
> so the comma is not the last "token" but the last "word" before the ##
> i may be wrong, though...

Hey, Lars, ... excellent!

I had spotted that possibility on a GNU webpage yesterday.  I had tried it
and it seemed not work on the gcc version that I had.  (The webpage hadn't
mentioned version numbers, so I attributed the failure to my old version.)

But when your email came through, I checked again, and realised that my
earlier test had only applied that ' , ' trick to one set of macros, not
to both parts of the nested pair.

So I tried it again, and it seems to work.  My test builds on a variety of
gcc versions on a variety of Redhat (FC) and Solaris seem all OK.

I've just applied a fix to the Hg 'dev' repository.

Many thanks.

-- 

:  David Lee                                I.T. Service          :
:  Senior Systems Programmer                Computer Centre       :
:  UNIX Team Leader                         Durham University     :
:                                           South Road            :
:  http://www.dur.ac.uk/t.d.lee/            Durham DH1 3LE        :
:  Phone: +44 191 334 2752                  U.K.                  :


More information about the Linux-HA-Dev mailing list