[torquedev] -DNDEBUG

Glen Beane glen.beane at gmail.com
Thu Mar 13 11:14:39 MDT 2008


I found out torque will not compile if NDEBUG is defined from the person
that maintains the torqe ebuild for gentoo.  He got a bug report that
soemone couldn't emerge the latest torque 2.3

after a minute of looking at output from the build I noticed the problems
were related to defining NDEBUG, and I quickly reproduced the problem and
began to fix the code



I've got most of it fixed (all the common code, the resmom/darwin code, and
now working on resmom/linux code, other OS users will have to fix the code
in their OS specific dir for now if they want to define NDEBUG).


here are the main issues

In several files #include <stdio.h> was wrapped in #ifndef NDEBUG  but
sprintf was used in the file.  This caused an implicit declaration of
sprintf warning

In one file #include <stdlib.h> was wrapped in the same #ifdef, which caused
a warning for NULL being undefined

in man many functions we define a string called "id",  and in any function
where this is only used as an argument to DBPRT this causes an unused
variable warning because DBPRT expands to nothing if NDEBUG is defined, so
in these cases I needed to wrapp the id declaration in an #ifndef NDEBUG

and the last problem I saw was in this type of code:

if (something)
   DBPRT((...))

I had to chage this to

if  (something)
  {
  DBPRT((...))
  }



Gentoo users are funny.  They apparently worry about the speed impact of a
few asserts in torque :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.supercluster.org/pipermail/torquedev/attachments/20080313/9f5446d1/attachment.html


More information about the torquedev mailing list