bug-gnulib
[Top][All Lists]
Advanced

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

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


From: John E. Malmberg
Subject: tar 1.19 - vms time_t is unsigned long. [partial patch[
Date: Sat, 08 Mar 2008 14:32:08 -0600
User-agent: Mozilla/5.0 (X11; U; OpenVMS AlphaServer_DS10_617_MHz; en-US; rv:1.7) Gecko/20040621

I believe that this attached patch gets intprops.h TYPE_MAXIMUM to handle unsigned types.

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.

This still leaves me a problem with getdate.y which asserts a compiler error if I set the time_t type to be an unsigned long.

If I set the time_t type to be a signed long, it causes problems as the definition of struct timespec in the VMS headers is unsigned long instead of time_t. This is not detected at compile time, but at run time as it cause no files to be selected for the archive.

As a work around, I can compile getdate.c with time_t set to being a signed type, and the rest of tar with it being unsigned. That gets the first test to work, but I do not know what the other impacts of this are.

-John
address@hidden
Personal Opinion Only
--- lib/intprops.h_hide Fri Sep 28 08:11:36 2007
+++ lib/intprops.h      Sun Dec 16 19:13:54 2007
@@ -50,7 +50,7 @@
        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
 #define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) -1 \
+       ? ((t) -1) & LONG_MAX \
        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
 
 /* Return zero if T can be determined to be an unsigned type.

reply via email to

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