git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Building Git on Tru64
@ 2010-04-15 19:09 Daniel Richard G.
  2010-04-15 19:29 ` Alex Riesen
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Richard G. @ 2010-04-15 19:09 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 3948 bytes --]

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 = 1
        NO_INET_NTOP = 1
        NO_INET_PTON = 1
        NO_NSEC = 1
        NO_SOCKADDR_STORAGE = 1
        NO_STRTOULL = 1

  Could checks for these be added to the configure script?

* Prototypes are not provided for the compat/* implementations of
  {,v}snprintf(), inet_ntop() and inet_pton() (and maybe others). This
  can potentially be an issue for at least inet_ntop(), which returns a
  pointer (that is truncated if the compiler assumes the function
  returns int).

* Need to define _POSIX_C_SOURCE with a value of at least 199506L, or
  else you don't get MAP_FAILED or various pthread-related types
  (pthread_attr_t, pthread_mutex_t et al.).

* Need to define _POSIX_PII_SOCKET to get socklen_t.


Even after all that, installing via DESTDIR doesn't work:

> gmake install DESTDIR=/tmp/foo
    SUBDIR perl
perl.mak:691: *** ExtUtils::MakeMaker version "6.03" is older than 6.11 and so is likely incompatible with the DESTDIR mechanism.  Try setting NO_PERL_MAKEMAKER=1 instead.  Stop.
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2

> gmake install DESTDIR=/tmp/foo NO_PERL_MAKEMAKER=1 
    SUBDIR perl
perl.mak:691: *** ExtUtils::MakeMaker version "6.03" is older than 6.11 and so is likely incompatible with the DESTDIR mechanism.  Try setting NO_PERL_MAKEMAKER=1 instead.  Stop.
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2

(Configuring with --without-perl prevents the build from even starting,
so is there any way to sidestep the above error?)

Comments are welcome, as well as requests for further testing. I'd like
to get Git to the point where it builds out-of-the-box on this system.


--Daniel


P.S.: 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!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: git-tru64-fixes.patch --]
[-- Type: text/x-diff; name="git-tru64-fixes.patch", Size: 20855 bytes --]

diff -ru git-1.7.0.5/attr.h git-1.7.0.5-tru64/attr.h
--- git-1.7.0.5/attr.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/attr.h	2010-04-14 20:01:41.000000000 -0400
@@ -34,7 +34,7 @@
 enum git_attr_direction {
 	GIT_ATTR_CHECKIN,
 	GIT_ATTR_CHECKOUT,
-	GIT_ATTR_INDEX,
+	GIT_ATTR_INDEX
 };
 void git_attr_set_direction(enum git_attr_direction, struct index_state *);
 
diff -ru git-1.7.0.5/builtin-apply.c git-1.7.0.5-tru64/builtin-apply.c
--- git-1.7.0.5/builtin-apply.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-apply.c	2010-04-14 20:01:45.000000000 -0400
@@ -56,7 +56,7 @@
 	nowarn_ws_error,
 	warn_on_ws_error,
 	die_on_ws_error,
-	correct_ws_error,
+	correct_ws_error
 } ws_error_action = warn_on_ws_error;
 static int whitespace_error;
 static int squelch_whitespace_errors = 5;
@@ -64,7 +64,7 @@
 
 static enum ws_ignore {
 	ignore_ws_none,
-	ignore_ws_change,
+	ignore_ws_change
 } ws_ignore_action = ignore_ws_none;
 
 
diff -ru git-1.7.0.5/builtin-blame.c git-1.7.0.5-tru64/builtin-blame.c
--- git-1.7.0.5/builtin-blame.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-blame.c	2010-04-14 19:25:21.000000000 -0400
@@ -1589,7 +1589,7 @@
 	strcpy(hex, sha1_to_hex(suspect->commit->object.sha1));
 	printf("%s%c%d %d %d\n",
 	       hex,
-	       ent->guilty ? ' ' : '*', // purely for debugging
+	       ent->guilty ? ' ' : '*', /* purely for debugging */
 	       ent->s_lno + 1,
 	       ent->lno + 1,
 	       ent->num_lines);
diff -ru git-1.7.0.5/builtin-branch.c git-1.7.0.5-tru64/builtin-branch.c
--- git-1.7.0.5/builtin-branch.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-branch.c	2010-04-14 20:01:49.000000000 -0400
@@ -43,13 +43,13 @@
 	BRANCH_COLOR_PLAIN = 1,
 	BRANCH_COLOR_REMOTE = 2,
 	BRANCH_COLOR_LOCAL = 3,
-	BRANCH_COLOR_CURRENT = 4,
+	BRANCH_COLOR_CURRENT = 4
 };
 
 static enum merge_filter {
 	NO_FILTER = 0,
 	SHOW_NOT_MERGED,
-	SHOW_MERGED,
+	SHOW_MERGED
 } merge_filter;
 static unsigned char merge_filter_ref[20];
 
diff -ru git-1.7.0.5/builtin-commit.c git-1.7.0.5-tru64/builtin-commit.c
--- git-1.7.0.5/builtin-commit.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-commit.c	2010-04-14 20:01:54.000000000 -0400
@@ -57,7 +57,7 @@
 static enum {
 	COMMIT_AS_IS = 1,
 	COMMIT_NORMAL,
-	COMMIT_PARTIAL,
+	COMMIT_PARTIAL
 } commit_style;
 
 static const char *logfile, *force_author;
@@ -77,7 +77,7 @@
 static enum {
 	CLEANUP_SPACE,
 	CLEANUP_NONE,
-	CLEANUP_ALL,
+	CLEANUP_ALL
 } cleanup_mode;
 static char *cleanup_arg;
 
@@ -89,7 +89,7 @@
 static enum {
 	STATUS_FORMAT_LONG,
 	STATUS_FORMAT_SHORT,
-	STATUS_FORMAT_PORCELAIN,
+	STATUS_FORMAT_PORCELAIN
 } status_format = STATUS_FORMAT_LONG;
 
 static int opt_parse_m(const struct option *opt, const char *arg, int unset)
diff -ru git-1.7.0.5/builtin-for-each-ref.c git-1.7.0.5-tru64/builtin-for-each-ref.c
--- git-1.7.0.5/builtin-for-each-ref.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-for-each-ref.c	2010-04-14 19:25:21.000000000 -0400
@@ -538,10 +538,10 @@
 		grab_person("committer", val, deref, obj, buf, sz);
 		break;
 	case OBJ_TREE:
-		// grab_tree_values(val, deref, obj, buf, sz);
+		/* grab_tree_values(val, deref, obj, buf, sz); */
 		break;
 	case OBJ_BLOB:
-		// grab_blob_values(val, deref, obj, buf, sz);
+		/* grab_blob_values(val, deref, obj, buf, sz); */
 		break;
 	default:
 		die("Eh?  Object of type %d?", obj->type);
diff -ru git-1.7.0.5/builtin-help.c git-1.7.0.5-tru64/builtin-help.c
--- git-1.7.0.5/builtin-help.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-help.c	2010-04-14 20:01:56.000000000 -0400
@@ -26,7 +26,7 @@
 	HELP_FORMAT_NONE,
 	HELP_FORMAT_MAN,
 	HELP_FORMAT_INFO,
-	HELP_FORMAT_WEB,
+	HELP_FORMAT_WEB
 };
 
 static int show_all = 0;
diff -ru git-1.7.0.5/builtin-mailinfo.c git-1.7.0.5-tru64/builtin-mailinfo.c
--- git-1.7.0.5/builtin-mailinfo.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-mailinfo.c	2010-04-14 20:02:01.000000000 -0400
@@ -17,10 +17,10 @@
 static struct strbuf email = STRBUF_INIT;
 
 static enum  {
-	TE_DONTCARE, TE_QP, TE_BASE64,
+	TE_DONTCARE, TE_QP, TE_BASE64
 } transfer_encoding;
 static enum  {
-	TYPE_TEXT, TYPE_OTHER,
+	TYPE_TEXT, TYPE_OTHER
 } message_type;
 
 static struct strbuf charset = STRBUF_INIT;
diff -ru git-1.7.0.5/builtin-merge-ours.c git-1.7.0.5-tru64/builtin-merge-ours.c
--- git-1.7.0.5/builtin-merge-ours.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-merge-ours.c	2010-04-14 20:55:12.000000000 -0400
@@ -31,4 +31,6 @@
 	if (cmd_diff_index(NARGS, diff_index_args, prefix))
 		exit(2);
 	exit(0);
+
+	return 0; /* never reached */
 }
diff -ru git-1.7.0.5/builtin-mktree.c git-1.7.0.5-tru64/builtin-mktree.c
--- git-1.7.0.5/builtin-mktree.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-mktree.c	2010-04-14 20:55:46.000000000 -0400
@@ -187,4 +187,6 @@
 	}
 	strbuf_release(&sb);
 	exit(0);
+
+	return 0; /* never reached */
 }
diff -ru git-1.7.0.5/builtin-receive-pack.c git-1.7.0.5-tru64/builtin-receive-pack.c
--- git-1.7.0.5/builtin-receive-pack.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-receive-pack.c	2010-04-14 20:02:03.000000000 -0400
@@ -16,7 +16,7 @@
 	DENY_UNCONFIGURED,
 	DENY_IGNORE,
 	DENY_WARN,
-	DENY_REFUSE,
+	DENY_REFUSE
 };
 
 static int deny_deletes;
diff -ru git-1.7.0.5/builtin-remote.c git-1.7.0.5-tru64/builtin-remote.c
--- git-1.7.0.5/builtin-remote.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/builtin-remote.c	2010-04-14 20:02:05.000000000 -0400
@@ -317,7 +317,7 @@
 		PUSH_STATUS_UPTODATE,
 		PUSH_STATUS_FASTFORWARD,
 		PUSH_STATUS_OUTOFDATE,
-		PUSH_STATUS_NOTQUERIED,
+		PUSH_STATUS_NOTQUERIED
 	} status;
 };
 
diff -ru git-1.7.0.5/cache.h git-1.7.0.5-tru64/cache.h
--- git-1.7.0.5/cache.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/cache.h	2010-04-14 19:25:21.000000000 -0400
@@ -361,7 +361,7 @@
 	OBJ_OFS_DELTA = 6,
 	OBJ_REF_DELTA = 7,
 	OBJ_ANY,
-	OBJ_MAX,
+	OBJ_MAX
 };
 
 static inline enum object_type object_type(unsigned int mode)
@@ -553,7 +553,7 @@
 enum safe_crlf {
 	SAFE_CRLF_FALSE = 0,
 	SAFE_CRLF_FAIL = 1,
-	SAFE_CRLF_WARN = 2,
+	SAFE_CRLF_WARN = 2
 };
 
 extern enum safe_crlf safe_crlf;
@@ -564,21 +564,21 @@
 	BRANCH_TRACK_REMOTE,
 	BRANCH_TRACK_ALWAYS,
 	BRANCH_TRACK_EXPLICIT,
-	BRANCH_TRACK_OVERRIDE,
+	BRANCH_TRACK_OVERRIDE
 };
 
 enum rebase_setup_type {
 	AUTOREBASE_NEVER = 0,
 	AUTOREBASE_LOCAL,
 	AUTOREBASE_REMOTE,
-	AUTOREBASE_ALWAYS,
+	AUTOREBASE_ALWAYS
 };
 
 enum push_default_type {
 	PUSH_DEFAULT_NOTHING = 0,
 	PUSH_DEFAULT_MATCHING,
 	PUSH_DEFAULT_TRACKING,
-	PUSH_DEFAULT_CURRENT,
+	PUSH_DEFAULT_CURRENT
 };
 
 extern enum branch_track git_branch_track;
@@ -587,7 +587,7 @@
 
 enum object_creation_mode {
 	OBJECT_CREATION_USES_HARDLINKS = 0,
-	OBJECT_CREATION_USES_RENAMES = 1,
+	OBJECT_CREATION_USES_RENAMES = 1
 };
 
 extern enum object_creation_mode object_creation_mode;
@@ -667,7 +667,7 @@
 	OLD_PERM_GROUP      = 1,
 	OLD_PERM_EVERYBODY  = 2,
 	PERM_GROUP          = 0660,
-	PERM_EVERYBODY      = 0664,
+	PERM_EVERYBODY      = 0664
 };
 int git_config_perm(const char *var, const char *value);
 int set_shared_perm(const char *path, int mode);
@@ -876,7 +876,7 @@
 		REF_STATUS_REJECT_NODELETE,
 		REF_STATUS_UPTODATE,
 		REF_STATUS_REMOTE_REJECT,
-		REF_STATUS_EXPECTING_REPORT,
+		REF_STATUS_EXPECTING_REPORT
 	} status;
 	char *remote_status;
 	struct ref *peer_ref; /* when renaming */
diff -ru git-1.7.0.5/commit.h git-1.7.0.5-tru64/commit.h
--- git-1.7.0.5/commit.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/commit.h	2010-04-14 19:25:21.000000000 -0400
@@ -60,7 +60,7 @@
 	CMIT_FMT_EMAIL,
 	CMIT_FMT_USERFORMAT,
 
-	CMIT_FMT_UNSPECIFIED,
+	CMIT_FMT_UNSPECIFIED
 };
 
 struct pretty_print_context
diff -ru git-1.7.0.5/compat/hstrerror.c git-1.7.0.5-tru64/compat/hstrerror.c
--- git-1.7.0.5/compat/hstrerror.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/compat/hstrerror.c	2010-04-14 21:01:17.000000000 -0400
@@ -1,3 +1,5 @@
+#define _OSF_SOURCE
+
 #include <string.h>
 #include <stdio.h>
 #include <netdb.h>
diff -ru git-1.7.0.5/compat/inet_ntop.c git-1.7.0.5-tru64/compat/inet_ntop.c
--- git-1.7.0.5/compat/inet_ntop.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/compat/inet_ntop.c	2010-04-14 19:25:21.000000000 -0400
@@ -15,6 +15,8 @@
  * SOFTWARE.
  */
 
+#define _OSF_SOURCE
+
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
diff -ru git-1.7.0.5/compat/inet_pton.c git-1.7.0.5-tru64/compat/inet_pton.c
--- git-1.7.0.5/compat/inet_pton.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/compat/inet_pton.c	2010-04-14 19:25:21.000000000 -0400
@@ -15,6 +15,8 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#define _OSF_SOURCE
+
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
diff -ru git-1.7.0.5/connect.c git-1.7.0.5-tru64/connect.c
--- git-1.7.0.5/connect.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/connect.c	2010-04-14 20:02:06.000000000 -0400
@@ -131,7 +131,7 @@
 enum protocol {
 	PROTO_LOCAL = 1,
 	PROTO_SSH,
-	PROTO_GIT,
+	PROTO_GIT
 };
 
 static enum protocol get_protocol(const char *name)
diff -ru git-1.7.0.5/ctype.c git-1.7.0.5-tru64/ctype.c
--- git-1.7.0.5/ctype.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/ctype.c	2010-04-14 20:02:14.000000000 -0400
@@ -10,7 +10,7 @@
 	A = GIT_ALPHA,
 	D = GIT_DIGIT,
 	G = GIT_GLOB_SPECIAL,	/* *, ?, [, \\ */
-	R = GIT_REGEX_SPECIAL,	/* $, (, ), +, ., ^, {, | */
+	R = GIT_REGEX_SPECIAL	/* $, (, ), +, ., ^, {, | */
 };
 
 unsigned char sane_ctype[256] = {
diff -ru git-1.7.0.5/daemon.c git-1.7.0.5-tru64/daemon.c
--- git-1.7.0.5/daemon.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/daemon.c	2010-04-14 20:57:19.000000000 -0400
@@ -888,7 +888,7 @@
 		for (i = 0; i < socknum; i++) {
 			if (pfd[i].revents & POLLIN) {
 				struct sockaddr_storage ss;
-				unsigned int sslen = sizeof(ss);
+				socklen_t sslen = sizeof(ss);
 				int incoming = accept(pfd[i].fd, (struct sockaddr *)&ss, &sslen);
 				if (incoming < 0) {
 					switch (errno) {
@@ -904,6 +904,8 @@
 			}
 		}
 	}
+
+	return 0;
 }
 
 /* if any standard file descriptor is missing open it to /dev/null */
diff -ru git-1.7.0.5/diff.h git-1.7.0.5-tru64/diff.h
--- git-1.7.0.5/diff.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/diff.h	2010-04-14 20:02:16.000000000 -0400
@@ -131,7 +131,7 @@
 	DIFF_FILE_NEW = 5,
 	DIFF_COMMIT = 6,
 	DIFF_WHITESPACE = 7,
-	DIFF_FUNCINFO = 8,
+	DIFF_FUNCINFO = 8
 };
 const char *diff_get_color(int diff_use_color, enum color_diff ix);
 #define diff_get_color_opt(o, ix) \
diff -ru git-1.7.0.5/diffcore-order.c git-1.7.0.5-tru64/diffcore-order.c
--- git-1.7.0.5/diffcore-order.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/diffcore-order.c	2010-04-14 19:25:21.000000000 -0400
@@ -29,7 +29,7 @@
 	sz = xsize_t(st.st_size);
 	map = mmap(NULL, sz, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
 	close(fd);
-	if (map == MAP_FAILED)
+	if (map == (void *)MAP_FAILED)
 		return;
 	endp = (char *) map + sz;
 	for (pass = 0; pass < 2; pass++) {
diff -ru git-1.7.0.5/dir.c git-1.7.0.5-tru64/dir.c
--- git-1.7.0.5/dir.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/dir.c	2010-04-14 20:02:21.000000000 -0400
@@ -465,7 +465,7 @@
 enum exist_status {
 	index_nonexistent = 0,
 	index_directory,
-	index_gitdir,
+	index_gitdir
 };
 
 /*
@@ -533,7 +533,7 @@
 enum directory_treatment {
 	show_directory,
 	ignore_directory,
-	recurse_into_directory,
+	recurse_into_directory
 };
 
 static enum directory_treatment treat_directory(struct dir_struct *dir,
@@ -684,7 +684,7 @@
 enum path_treatment {
 	path_ignored,
 	path_handled,
-	path_recurse,
+	path_recurse
 };
 
 static enum path_treatment treat_one_path(struct dir_struct *dir,
diff -ru git-1.7.0.5/fast-import.c git-1.7.0.5-tru64/fast-import.c
--- git-1.7.0.5/fast-import.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/fast-import.c	2010-04-14 20:06:04.000000000 -0400
@@ -267,7 +267,7 @@
 typedef enum {
 	WHENSPEC_RAW = 1,
 	WHENSPEC_RFC2822,
-	WHENSPEC_NOW,
+	WHENSPEC_NOW
 } whenspec_type;
 
 struct recent_command
diff -ru git-1.7.0.5/git-compat-util.h git-1.7.0.5-tru64/git-compat-util.h
--- git-1.7.0.5/git-compat-util.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/git-compat-util.h	2010-04-14 20:49:09.000000000 -0400
@@ -64,6 +64,8 @@
 #define _BSD_SOURCE 1
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
+#define _OSF_SOURCE 1
+#define AES_SOURCE 1
 
 #ifdef WIN32 /* Both MinGW and MSVC */
 #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
@@ -105,7 +107,9 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <pwd.h>
+#ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
+#endif
 #if defined(__CYGWIN__)
 #undef _XOPEN_SOURCE
 #include <grp.h>
@@ -189,6 +193,55 @@
 #endif
 #endif
 
+#ifndef HAVE_UINT16_T
+#  undef uint16_t
+#  if defined(SIZEOF_SHORT) && SIZEOF_SHORT == 2
+typedef unsigned short uint16_t;
+#  elif defined(HAVE_U_INT16_T)
+typedef u_int16_t uint16_t;
+#  elif defined(HAVE_UINT16)
+typedef uint16 uint16_t;
+#  else
+typedef unsigned short uint16_t;
+#  endif
+#endif /* !HAVE_UINT16_T */
+
+#ifndef HAVE_UINT32_T
+#  undef uint32_t
+#  if defined(SIZEOF_INT) && SIZEOF_INT == 4
+typedef unsigned int uint32_t;
+#  elif defined(HAVE_U_INT32_T)
+typedef u_int32_t uint32_t;
+#  elif defined(HAVE_UINT32)
+typedef uint32 uint32_t;
+#  else
+typedef unsigned int uint32_t;
+#  endif
+#endif /* !HAVE_UINT32_T */
+
+#ifndef HAVE_UINT64_T
+#  undef uint64_t
+#  if defined(SIZEOF_LONG) && SIZEOF_LONG == 8
+typedef unsigned long uint64_t;
+#  elif defined(HAVE_U_INT64_T)
+typedef u_int64_t uint64_t;
+#  elif defined(HAVE_UINT64)
+typedef uint64 uint64_t;
+#  else
+typedef unsigned long long uint64_t;
+#  endif
+#endif /* !HAVE_UINT64_T */
+
+#ifndef HAVE_INTPTR_T
+typedef ssize_t intptr_t;
+#endif
+
+#ifndef HAVE_UINTPTR_T
+typedef size_t uintptr_t;
+#endif
+
+#define inline
+
 #include "compat/bswap.h"
 
 /* General helper functions */
diff -ru git-1.7.0.5/grep.h git-1.7.0.5-tru64/grep.h
--- git-1.7.0.5/grep.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/grep.h	2010-04-14 20:02:28.000000000 -0400
@@ -10,17 +10,17 @@
 	GREP_OPEN_PAREN,
 	GREP_CLOSE_PAREN,
 	GREP_NOT,
-	GREP_OR,
+	GREP_OR
 };
 
 enum grep_context {
 	GREP_CONTEXT_HEAD,
-	GREP_CONTEXT_BODY,
+	GREP_CONTEXT_BODY
 };
 
 enum grep_header_field {
 	GREP_HEADER_AUTHOR = 0,
-	GREP_HEADER_COMMITTER,
+	GREP_HEADER_COMMITTER
 };
 
 struct grep_pat {
@@ -40,7 +40,7 @@
 	GREP_NODE_ATOM,
 	GREP_NODE_NOT,
 	GREP_NODE_AND,
-	GREP_NODE_OR,
+	GREP_NODE_OR
 };
 
 struct grep_expr {
diff -ru git-1.7.0.5/imap-send.c git-1.7.0.5-tru64/imap-send.c
--- git-1.7.0.5/imap-send.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/imap-send.c	2010-04-14 20:02:30.000000000 -0400
@@ -212,7 +212,7 @@
 	UIDPLUS,
 	LITERALPLUS,
 	NAMESPACE,
-	STARTTLS,
+	STARTTLS
 };
 
 static const char *cap_list[] = {
diff -ru git-1.7.0.5/merge-recursive.h git-1.7.0.5-tru64/merge-recursive.h
--- git-1.7.0.5/merge-recursive.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/merge-recursive.h	2010-04-14 20:02:32.000000000 -0400
@@ -9,7 +9,7 @@
 	enum {
 		MERGE_RECURSIVE_NORMAL = 0,
 		MERGE_RECURSIVE_OURS,
-		MERGE_RECURSIVE_THEIRS,
+		MERGE_RECURSIVE_THEIRS
 	} recursive_variant;
 	const char *subtree_shift;
 	unsigned buffer_output : 1;
diff -ru git-1.7.0.5/parse-options.h git-1.7.0.5-tru64/parse-options.h
--- git-1.7.0.5/parse-options.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/parse-options.h	2010-04-14 20:02:36.000000000 -0400
@@ -25,7 +25,7 @@
 	PARSE_OPT_STOP_AT_NON_OPTION = 2,
 	PARSE_OPT_KEEP_ARGV0 = 4,
 	PARSE_OPT_KEEP_UNKNOWN = 8,
-	PARSE_OPT_NO_INTERNAL_HELP = 16,
+	PARSE_OPT_NO_INTERNAL_HELP = 16
 };
 
 enum parse_opt_option_flags {
@@ -36,7 +36,7 @@
 	PARSE_OPT_LASTARG_DEFAULT = 16,
 	PARSE_OPT_NODASH = 32,
 	PARSE_OPT_LITERAL_ARGHELP = 64,
-	PARSE_OPT_NEGHELP = 128,
+	PARSE_OPT_NEGHELP = 128
 };
 
 struct option;
@@ -156,7 +156,7 @@
 enum {
 	PARSE_OPT_HELP = -1,
 	PARSE_OPT_DONE,
-	PARSE_OPT_UNKNOWN,
+	PARSE_OPT_UNKNOWN
 };
 
 /*
diff -ru git-1.7.0.5/pretty.c git-1.7.0.5-tru64/pretty.c
--- git-1.7.0.5/pretty.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/pretty.c	2010-04-14 20:02:38.000000000 -0400
@@ -824,7 +824,7 @@
 	enum {
 		NO_MAGIC,
 		ADD_LF_BEFORE_NON_EMPTY,
-		DEL_LF_BEFORE_EMPTY,
+		DEL_LF_BEFORE_EMPTY
 	} magic = NO_MAGIC;
 
 	switch (placeholder[0]) {
diff -ru git-1.7.0.5/read-cache.c git-1.7.0.5-tru64/read-cache.c
--- git-1.7.0.5/read-cache.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/read-cache.c	2010-04-14 19:25:21.000000000 -0400
@@ -1296,7 +1296,7 @@
 
 	mmap = xmmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
 	close(fd);
-	if (mmap == MAP_FAILED)
+	if (mmap == (void *)MAP_FAILED)
 		die_errno("unable to map index file");
 
 	hdr = mmap;
diff -ru git-1.7.0.5/remote.c git-1.7.0.5-tru64/remote.c
--- git-1.7.0.5/remote.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/remote.c	2010-04-14 19:25:21.000000000 -0400
@@ -476,7 +476,7 @@
 	unsigned char sha1[20];
 	const char *head_ref;
 	int flag;
-	if (default_remote_name) // did this already
+	if (default_remote_name) /* did this already */
 		return;
 	default_remote_name = xstrdup("origin");
 	current_branch = NULL;
diff -ru git-1.7.0.5/remote.h git-1.7.0.5-tru64/remote.h
--- git-1.7.0.5/remote.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/remote.h	2010-04-14 20:02:39.000000000 -0400
@@ -145,7 +145,7 @@
 enum match_refs_flags {
 	MATCH_REFS_NONE		= 0,
 	MATCH_REFS_ALL 		= (1 << 0),
-	MATCH_REFS_MIRROR	= (1 << 1),
+	MATCH_REFS_MIRROR	= (1 << 1)
 };
 
 /* Reporting of tracking info */
diff -ru git-1.7.0.5/rerere.c git-1.7.0.5-tru64/rerere.c
--- git-1.7.0.5/rerere.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/rerere.c	2010-04-14 20:02:41.000000000 -0400
@@ -153,7 +153,7 @@
 	git_SHA_CTX ctx;
 	int hunk_no = 0;
 	enum {
-		RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL,
+		RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL
 	} hunk = RR_CONTEXT;
 	struct strbuf one = STRBUF_INIT, two = STRBUF_INIT;
 	struct strbuf buf = STRBUF_INIT;
diff -ru git-1.7.0.5/revision.c git-1.7.0.5-tru64/revision.c
--- git-1.7.0.5/revision.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/revision.c	2010-04-14 20:02:43.000000000 -0400
@@ -1761,7 +1761,7 @@
 enum rewrite_result {
 	rewrite_one_ok,
 	rewrite_one_noparents,
-	rewrite_one_error,
+	rewrite_one_error
 };
 
 static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)
diff -ru git-1.7.0.5/sha1_file.c git-1.7.0.5-tru64/sha1_file.c
--- git-1.7.0.5/sha1_file.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/sha1_file.c	2010-04-14 19:25:21.000000000 -0400
@@ -768,7 +768,7 @@
 			win->base = xmmap(NULL, win->len,
 				PROT_READ, MAP_PRIVATE,
 				p->pack_fd, win->offset);
-			if (win->base == MAP_FAILED)
+			if (win->base == (void *)MAP_FAILED)
 				die("packfile %s cannot be mapped: %s",
 					p->pack_name,
 					strerror(errno));
diff -ru git-1.7.0.5/test-delta.c git-1.7.0.5-tru64/test-delta.c
--- git-1.7.0.5/test-delta.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/test-delta.c	2010-04-14 19:25:21.000000000 -0400
@@ -34,7 +34,7 @@
 	}
 	from_size = st.st_size;
 	from_buf = mmap(NULL, from_size, PROT_READ, MAP_PRIVATE, fd, 0);
-	if (from_buf == MAP_FAILED) {
+	if (from_buf == (void *)MAP_FAILED) {
 		perror(argv[2]);
 		close(fd);
 		return 1;
@@ -48,7 +48,7 @@
 	}
 	data_size = st.st_size;
 	data_buf = mmap(NULL, data_size, PROT_READ, MAP_PRIVATE, fd, 0);
-	if (data_buf == MAP_FAILED) {
+	if (data_buf == (void *)MAP_FAILED) {
 		perror(argv[3]);
 		close(fd);
 		return 1;
diff -ru git-1.7.0.5/wrapper.c git-1.7.0.5-tru64/wrapper.c
--- git-1.7.0.5/wrapper.c	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/wrapper.c	2010-04-14 19:25:21.000000000 -0400
@@ -97,12 +97,12 @@
 	int prot, int flags, int fd, off_t offset)
 {
 	void *ret = mmap(start, length, prot, flags, fd, offset);
-	if (ret == MAP_FAILED) {
+	if (ret == (void *)MAP_FAILED) {
 		if (!length)
 			return NULL;
 		release_pack_memory(length, fd);
 		ret = mmap(start, length, prot, flags, fd, offset);
-		if (ret == MAP_FAILED)
+		if (ret == (void *)MAP_FAILED)
 			die_errno("Out of memory? mmap failed");
 	}
 	return ret;
diff -ru git-1.7.0.5/wt-status.h git-1.7.0.5-tru64/wt-status.h
--- git-1.7.0.5/wt-status.h	2010-04-12 11:23:36.000000000 -0400
+++ git-1.7.0.5-tru64/wt-status.h	2010-04-14 20:02:45.000000000 -0400
@@ -11,7 +11,7 @@
 	WT_STATUS_CHANGED,
 	WT_STATUS_UNTRACKED,
 	WT_STATUS_NOBRANCH,
-	WT_STATUS_UNMERGED,
+	WT_STATUS_UNMERGED
 };
 
 enum untracked_status_type {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Building Git on Tru64
  2010-04-15 19:09 [PATCH] Building Git on Tru64 Daniel Richard G.
@ 2010-04-15 19:29 ` Alex Riesen
  2010-04-15 19:46   ` Daniel Richard G.
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Riesen @ 2010-04-15 19:29 UTC (permalink / raw)
  To: Daniel Richard G.; +Cc: git

On Thu, Apr 15, 2010 at 21:09, Daniel Richard G. <skunk@iskunk.org> wrote:
> * 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.

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Building Git on Tru64
  2010-04-15 19:29 ` Alex Riesen
@ 2010-04-15 19:46   ` Daniel Richard G.
  2010-04-15 20:04     ` Nicolas Pitre
  2010-04-15 21:24     ` Jakub Narebski
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Richard G. @ 2010-04-15 19:46 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

On Thu, 2010 Apr 15 21:29+0200, Alex Riesen wrote:
>
> 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

I agree with the sentiment, but you can't have a macro refer to itself
:]

> 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!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Building Git on Tru64
  2010-04-15 19:46   ` Daniel Richard G.
@ 2010-04-15 20:04     ` Nicolas Pitre
  2010-04-15 20:21       ` Daniel Richard G.
  2010-04-15 21:24     ` Jakub Narebski
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Pitre @ 2010-04-15 20:04 UTC (permalink / raw)
  To: Daniel Richard G.; +Cc: Alex Riesen, git

On Thu, 15 Apr 2010, Daniel Richard G. wrote:

> On Thu, 2010 Apr 15 21:29+0200, Alex Riesen wrote:
> >
> > 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
> 
> I agree with the sentiment, but you can't have a macro refer to itself
> :]

you may undefine and redefine it appropriately instead.


Nicolas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Building Git on Tru64
  2010-04-15 20:04     ` Nicolas Pitre
@ 2010-04-15 20:21       ` Daniel Richard G.
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Richard G. @ 2010-04-15 20:21 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: git

On Thu, 2010 Apr 15 16:04-0400, Nicolas Pitre wrote:
> >
> > I agree with the sentiment, but you can't have a macro refer to
> > itself :]
>
> you may undefine and redefine it appropriately instead.

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!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Building Git on Tru64
  2010-04-15 19:46   ` Daniel Richard G.
  2010-04-15 20:04     ` Nicolas Pitre
@ 2010-04-15 21:24     ` Jakub Narebski
  2010-04-16  6:58       ` Erik Faye-Lund
  1 sibling, 1 reply; 7+ messages in thread
From: Jakub Narebski @ 2010-04-15 21:24 UTC (permalink / raw)
  To: Daniel Richard G.; +Cc: Alex Riesen, git

"Daniel Richard G." <skunk@iSKUNK.ORG> writes:

> On Thu, 2010 Apr 15 21:29+0200, Alex Riesen wrote:
> >
> > 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
> 
> I agree with the sentiment, but you can't have a macro refer to itself

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Building Git on Tru64
  2010-04-15 21:24     ` Jakub Narebski
@ 2010-04-16  6:58       ` Erik Faye-Lund
  0 siblings, 0 replies; 7+ messages in thread
From: Erik Faye-Lund @ 2010-04-16  6:58 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Daniel Richard G., Alex Riesen, git

On Thu, Apr 15, 2010 at 11:24 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> "Daniel Richard G." <skunk@iSKUNK.ORG> writes:
>
>> On Thu, 2010 Apr 15 21:29+0200, Alex Riesen wrote:
>> >
>> > 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
>>
>> I agree with the sentiment, but you can't have a macro refer to itself
>
> It can.  From (cpp.info)
>
>  3.10.5 Self-Referential Macros
>  ------------------------------
>
>  <snip>  It is passed into the
>  preprocessor output unchanged.
>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-04-16  6:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-15 19:09 [PATCH] Building Git on Tru64 Daniel Richard G.
2010-04-15 19:29 ` Alex Riesen
2010-04-15 19:46   ` Daniel Richard G.
2010-04-15 20:04     ` Nicolas Pitre
2010-04-15 20:21       ` Daniel Richard G.
2010-04-15 21:24     ` Jakub Narebski
2010-04-16  6:58       ` Erik Faye-Lund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).