bug-gnulib
[Top][All Lists]
Advanced

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

Re: tar 1.19 - vms time_t is unsigned long. [partial patch[


From: John E. Malmberg
Subject: Re: tar 1.19 - vms time_t is unsigned long. [partial patch[
Date: Sat, 08 Mar 2008 16:51:19 -0600
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)

Eric Blake wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to John E. Malmberg on 3/8/2008 1:32 PM:
| I believe that this attached patch gets intprops.h TYPE_MAXIMUM to
| handle unsigned types.

TYPE_MAXIMUM already handles unsigned types.  It seems like you have a
buggy compiler, instead.

I should have re-read the comments in the module.

|
| A mask is needed because of an extension that most C compilers have that
| allow ((unsigned int) -1)  to be tested as being less than 0 through
| operand promotion.

Huh?  C99 6.3.1.8 states: "Otherwise, if the operand that has unsigned
integer type has rank greater or equal to the rank of the type of the
<ship>

Yes, I worded that wrong. The compiler is fine in that regard, my verbage was not that precise.

I did this change over 2 months to get things to compile.

Furthermore, masking with LONG_MAX would break the macro when used with
'unsigned long long'.  But since your compiler appears to have a bug, what
if we do something like this to work around it, instead?

#define TYPE_MAXIMUM(t) \
~  ((t) (! TYPE_SIGNED (t) \
    ? (t) -1 \
- -     : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+     : ~ (t) (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))

I will take my change out and recompile getdate to see if it is really needed, and if it is, will look at the output.


But the real problem that I am having is getdate.y is throwing an assert if time_t is an unsigned type. And since my time_t is 32 bits, having it signed introduces the Y2038 issue.

Is there some way to change getdate.y to accept an unsigned time_t?

Thanks,
-John




reply via email to

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