monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Log warning!


From: Jan-Henrik Haukeland
Subject: Re: Log warning!
Date: 06 Jun 2003 18:40:28 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service)

Christian Hopp <address@hidden> writes:

> On Thu, 5 Jun 2003, Jan-Henrik Haukeland wrote:
> 
> > I mean, how is it possible to have log from math.h included if you
> > do not ask for it!?
> 
> Compiler bug c/9482: math builtins are always visible
> 
> FYI:
> http://gcc.gnu.org/ml/gcc-prs/2003-01/msg01599.html

Thanks for the link! I understand now. The new GCC version, that is,
version 3.3 *reserve* 'log' as a keyword for math.h and it's the
compiler, gcc, itself that does this. I had to check for myself and
yes, I also got the 'log' identifier warning when I compiled monit
with gcc version 3.3. The warning seems not to be present in earlier
gcc versions and the reason it was included in the latest, is because
the gcc project aims to be *very* (mindlessly so) compliant with the
C99 standard. The C99 standard is nice, but damn, thieving identifiers
from the users namespace is a bit over the top :)

> .. if we change it, we could avoid later name clashes or clashes on
> systems which might have a combined m-c lib (is there any?).

Yep, looks like we just have to change it at least if we want to
compile monit with gcc v. 3.3 and later. I'll use the following trick
to allow us to keep on using log and mask out the C99 namespace.

log() is changed to log_log() and the following define is placed in
monitor.h.

/*
 * Mask the C99 standard built-in namespace and reserved
 * identifiers. This allows us to use our own identifiers.
 */
#define log  log_log

#

Notice also that I have added some other macros to monitor.h to make
life easier:

#define DEBUG if(Run.debug) log

 Instead of writing if(Run.debug) log(blablabalbal) it is now possible
 to simply write: DEBUG(blablbalabla)

-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]