Re: Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-15 Thread Steven M. Schweda
 # if defined(_POSIX_TIMERS)  _POSIX_TIMERS  0

   That's fine, if you prefer:

ptimer.c:95:46: operator '' has no right operand

   This doc makes it appear that the unistd.h here does not conform:
http://www.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html

   I fear that the test must be beaten into something much uglier, and I
have not yet thought of anything good to do the job.

   SMS.


Re: Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-15 Thread Hrvoje Niksic
[EMAIL PROTECTED] (Steven M. Schweda) writes:

 # if defined(_POSIX_TIMERS)  _POSIX_TIMERS  0

That's fine, if you prefer:

 ptimer.c:95:46: operator '' has no right operand

I suppose we should then use:

#ifdef _POSIX_TIMERS
# if _POSIX_TIMERS  0
... use POSIX timers ...

This doc makes it appear that the unistd.h here does not conform:
 http://www.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html

Not all platforms supported by Wget conform to POSIX.  Since the
platforms I use regularly do conform, your testing this is all the
more valuable.

(But in this case it might even conform -- the spec says IF the
symbol is defined, apparently leaving open the possibility of it
being undefined.)

 I fear that the test must be beaten into something much uglier, and
 I have not yet thought of anything good to do the job.

Would the above work for you without errors or warnings?


Re: Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-15 Thread Larry Jones
Hrvoje Niksic writes:
 
 I suppose we should then use:
 
 #ifdef _POSIX_TIMERS
 # if _POSIX_TIMERS  0

The usual solution to this problem is:

#if _POSIX_TIMERS - 0  0

That gets the right answer regardless of whether _POSIX_TIMERS is
undefined, defined as nothing, or defined as a number.

-Larry Jones

In a minute, you and I are going to settle this out of doors. -- Calvin


Re: Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-15 Thread Steven M. Schweda
 I suppose we should then use:
 
 #ifdef _POSIX_TIMERS
 # if _POSIX_TIMERS  0

   Doesn't help.  It's defined, but null.

   Mr, Jones is probably close to the right answer with:

 #if _POSIX_TIMERS - 0  0

   I was looking for a way to make null look like positive, but a little
more reading
(http://www.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html;)
suggests that zero is about as reasonable as anything:

  If a symbolic constant is defined with the value -1, the option is
  not supported. Headers, data types, and function interfaces
  required only for the option need not be supplied. An application
  that attempts to use anything associated only with the option is
  considered to be requiring an extension.

  If a symbolic constant is defined with a value greater than zero,
  the option shall always be supported when the application is
  executed. All headers, data types, and functions shall be present
  and shall operate as specified.

  If a symbolic constant is defined with the value zero, all
  headers, data types, and functions shall be present. The
  application can check at runtime to see whether the option is
  supported by calling fpathconf(), pathconf(), or sysconf() with
  the indicated name parameter.

   Pending a good counter argument, the best way out may be:

# if defined(_POSIX_TIMERS)  (_POSIX_TIMERS - 0 = 0)

Perhaps with a comment describing the (unknown) danger.  (Then wait for
the next complaint.)  Everything's complicated.

   SMS.


Re: Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-15 Thread Hrvoje Niksic
[EMAIL PROTECTED] (Larry Jones) writes:

 Hrvoje Niksic writes:
 
 I suppose we should then use:
 
 #ifdef _POSIX_TIMERS
 # if _POSIX_TIMERS  0

 The usual solution to this problem is:

   #if _POSIX_TIMERS - 0  0

Neat trick, thanks.

 That gets the right answer regardless of whether _POSIX_TIMERS is
 undefined, defined as nothing, or defined as a number.

I guess the defined as nothing case was losing.  BTW does the above
trick work with KR preprocessors?


Re: Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-15 Thread Hrvoje Niksic
[EMAIL PROTECTED] (Steven M. Schweda) writes:

Mr, Jones is probably close to the right answer with:

 #if _POSIX_TIMERS - 0  0

 I was looking for a way to make null look like positive, but a
 little more reading
 (http://www.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html;)
 suggests that zero is about as reasonable as anything:

If we supported _POSIX_TIMERS == 0, we'd need to check with sysconf
whether they are available and fall back to gettimeofday if not.  That
would complicate the code because the timer implementation could no
longer be chosen at compile-time.

Since we must support gettimeofday anyway, I opted to use
_POSIX_TIMERS only if they are always, and to just use gettimeofday
(which isn't really that bad) otherwise.

Pending a good counter argument, the best way out may be:

 # if defined(_POSIX_TIMERS)  (_POSIX_TIMERS - 0 = 0)

Checking for =0 without the sysconf check in the ==0 case seems
asking for trouble.


Re: Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-15 Thread Larry Jones
Hrvoje Niksic writes:
 
 I guess the defined as nothing case was losing.  BTW does the above
 trick work with KR preprocessors?

Yep.  (That's why it uses - 0 rather than + 0, the latter is only
valid for ANSI C.)

-Larry Jones

It's no fun to play games with a poor sport. -- Calvin


Build problem: ptimer.c (CVS 1.7), gcc 3.4.3, Tru64 UNIX V5.1B

2005-04-14 Thread Steven M. Schweda
urt# gcc -v
Reading specs from /usr/local/lib/gcc/alpha-dec-osf5.1/3.4.3/specs
Configured with: /usr1/local/gnu/gcc-3.4.3/configure
Thread model: posix
gcc version 3.4.3

urt# sizer -v
Compaq Tru64 UNIX V5.1B (Rev. 2650); Thu Mar  6 19:03:28 CST 2003

[...]
gcc -I. -I. -I/opt/include   -DHAVE_CONFIG_H -DSYSTEM_WGETRC=\/usr/local/etc/wg
etrc\ -DLOCALEDIR=\/usr/local/share/locale\ -O2 -Wall -Wno-implicit -c ptimer
.c
ptimer.c:95:20: operator '' has no left operand
[...]

   The offending code (line 95) is:

# if _POSIX_TIMERS  0

   There's no left operand because:

urt# grep POSIX_TIMERS /usr/include/*.h
/usr/include/unistd.h:#define _POSIX_TIMERS

   Is there any reason that # ifdef _POSIX_TIMERS would be worse?



   Steven M. Schweda   (+1) 651-699-9818
   382 South Warwick Street[EMAIL PROTECTED]
   Saint Paul  MN  55105-2547