Building Git on a Tru64 V4.0G system (for the purpose of running a CMake
dashboard) was a bit of a challenge, and required numerous changes to
the source. It was a good exercise, however, in maintaining
compatibility with systems on which many modern facilities are missing.
A patch against 1.7.0.5 is attached, though parts of it are intended
more for reference than actual committing---some of the changes are system-
specific, and need to be integrated in a more generalized form.
A summary of the changes:
* Enum lists can't have a comma after the last element. (This was
actually more for the benefit of the Solaris compiler, but Tru64
complained as well.) I took out the comma, though for the sake of
future diffs it may be preferable to add a last-element sentinel.
* Can't have C++-style comments in C code.
* Quelled a couple of control-reaches-end-of-non-void-function warnings
by adding "return 0;" after an "exit(0);".
* compat/{hstrerror.c,inet_ntop.c,inet_pton.c} don't do any kind of feature-
macro setup at the top, and a bit of this was necessary to get these
files to compile.
* In daemon.c, the compiler complained about the last argument to
accept() being the wrong size (32 bits instead of the expected 64).
* On Tru64, MAP_FAILED is #defined as (-1L), and the compiler chokes if
you directly compare a pointer to an integer. So, need to cast
MAP_FAILED to (void *), redundant as that may seem.
* Most of the modern features in the system headers are enabled by
#defining _OSF_SOURCE. AES_SOURCE is needed to get setenv() and
unsetenv().
* This rev of Tru64 doesn't have an inttypes.h header, so the #include
has to be conditional, and you have to provide your own definitions of
uint{16,32,64}_t and {,u}intptr_t. (These types are not present at all
in the system headers.)
* The "inline" keyword is not supported.
Some additional necessities, handled in config.mak.autogen:
* The following options are needed:
NO_HSTRERROR ...That one may be better handled at one place (git-compat-util.h?) with something like: #ifdef Tru64 #define MAP_FAILED ((void *)MAP_FAILED) #endif P.S. You may consider reading Documentation/SubmittingPatches. The way you did it is a little unconventional. --
The patch isn't meant to be committed as-is, at least not all of it. Some of these things need to be massaged in a little (e.g. having hstrerror.c #include git-compat-util.h instead of just sticking #define _OSF_SOURCE at the top), but I need to hear from others on how to go about this. --Daniel (Please Cc: any replies to me, as I am not subscribed to this list.) -- NAME = Daniel Richard G. _\|/_ Remember, skunks MAIL = skunk@iSKUNK.ORG (/o|o\) _- don't smell bad--- MAIL+= skunk@alum.MIT.EDU < (^),> it's the people who WWW = (not there yet!) / \ annoy us that do! --
you may undefine and redefine it appropriately instead. Nicolas --
Yes, the macro should have included the cast in the first place. (I was going to say "you can't assume the value is always going to be -1 casted," but then this is only for Tru64, not for those weird platforms that #define NULL as something other than (void*)0...) --Daniel -- NAME = Daniel Richard G. _\|/_ Remember, skunks MAIL = skunk@iSKUNK.ORG (/o|o\) _- don't smell bad--- MAIL+= skunk@alum.MIT.EDU < (^),> it's the people who WWW = (not there yet!) / \ annoy us that do! --
It can. From (cpp.info)
3.10.5 Self-Referential Macros
------------------------------
A "self-referential" macro is one whose name appears in its definition.
Recall that all macro definitions are rescanned for more macros to
replace. If the self-reference were considered a use of the macro, it
would produce an infinitely large expansion. To prevent this, the
self-reference is not considered a macro call. It is passed into the
preprocessor output unchanged.
[...]
One common, useful use of self-reference is to create a macro which
expands to itself. If you write
#define EPERM EPERM
--
Jakub Narebski
Poland
ShadeHawk on #git
--
Not very useful in this case, no? $ echo "#define MAP_FAILED (-1L) #define MAP_FAILED ((void *)MAP_FAILED) void *v = MAP_FAILED" | gcc -x c - <stdin>:2:1: warning: "MAP_FAILED" redefined <stdin>:1:1: warning: this is the location of the previous definition <stdin>:3: error: 'MAP_FAILED' undeclared here (not in a function) <stdin>:3: error: expected ',' or ';' at end of input $ echo "#define MAP_FAILED (-1L) #define MAP_FAILED ((void *)MAP_FAILED) void *v = MAP_FAILED" | cpp # 1 "<stdin>" # 1 "<built-in>" # 1 "<command-line>" # 1 "<stdin>" <stdin>:2:1: warning: "MAP_FAILED" redefined <stdin>:1:1: warning: this is the location of the previous definition void *v = ((void *)MAP_FAILED) $ -- Erik "kusma" Faye-Lund --
