Problem building diskd - Opinion needed

From: Serassio Guido <guido.serassio@dont-contact.us>
Date: Sat, 02 Jul 2005 00:13:51 +0200

Hi,

Building Squid 3.0 on HP Tru64 I have got the following error:

depbase=`echo DiskIO/DiskDaemon/diskd.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; \
if g++ -DHAVE_CONFIG_H
-DDEFAULT_CONFIG_FILE=\"/usr/local/squid3/etc/squid.conf\" -I. -I.
-I../include -I.
  -I. -I../include -I../include -I../lib/libTrie/include
-I../lib/cppunit-1.10.0/include -I ../lib/cppunit-
1.10.0/include -I/usr/local/include -I/usr/local/include/libxml2
-Werror -Wall -Wpointer-arith -Wwrite-s
trings -Wcomments -D_REENTRANT -g -O2 -MT DiskIO/DiskDaemon/diskd.o
-MD -MP -MF "$depbase.Tpo" -c -o Disk
IO/DiskDaemon/diskd.o DiskIO/DiskDaemon/diskd.cc; \
then mv -f "$depbase.Tpo" "$depbase.Po"; else rm -f "$depbase.Tpo"; exit 1; fi
DiskIO/DiskDaemon/diskd.cc: In function `void msg_handle(diomsg*,
int, diomsg*)':
DiskIO/DiskDaemon/diskd.cc:286: error: `assert' undeclared (first use
this function)
DiskIO/DiskDaemon/diskd.cc:286: error: (Each undeclared identifier is
reported only once for each function
  it appears in.)
DiskIO/DiskDaemon/diskd.cc: In function `int main(int, char**)':
DiskIO/DiskDaemon/diskd.cc:329: error: `assert' undeclared (first use
this function)
make[2]: *** [DiskIO/DiskDaemon/diskd.o] Error 1
make[2]: Leaving directory `/home/users/serassio/3.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/users/serassio/3.0/src'
make: *** [all] Error 2

The problems seems to be related to the following code in diskd.cc:

#include "DiskIO/DiskDaemon/diomsg.h"

#undef assert
#include <assert.h>

To avoid xassert() link problems, assert() is undefined and
redefined, but on HP Tru64 the redefinition doesn't work. With the
following solution the build process is fine:

Index: diskd.cc
===================================================================
RCS file: /squid/squid3/src/DiskIO/DiskDaemon/diskd.cc,v
retrieving revision 1.2
diff -u -p -r1.2 diskd.cc
--- diskd.cc 21 Dec 2004 15:47:33 -0000 1.2
+++ diskd.cc 1 Jul 2005 22:10:02 -0000
@@ -41,9 +41,12 @@

  #include "DiskIO/DiskDaemon/diomsg.h"

-#undef assert
-#include <assert.h>
+void
+xassert(const char *msg, const char *file, int line) {
+ fprintf(stderr,"assertion failed: %s:%d: \"%s\"\n", file, line, msg);

+ abort();
+}

  const int diomsg::msg_snd_rcv_sz = sizeof(diomsg) - sizeof(mtyp_t);
  #define DEBUG(LEVEL) if ((LEVEL) <= DebugLevel)

This solution could be fine ?

Regards

Guido

-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: guido.serassio@acmeconsulting.it
WWW: http://www.acmeconsulting.it/
Received on Fri Jul 01 2005 - 16:14:11 MDT

This archive was generated by hypermail pre-2.1.9 : Mon Aug 01 2005 - 12:00:03 MDT