Skip to contentSkip to conversation

Building Git on Tru64

PATCH In review Daniel Richard G. 5 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Building Git on Tru64

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:

Quoted 1 line

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

Quoted 1 line

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.

Signature · 4 lines
NAME = Daniel Richard G.     _\|/_    Remember, skunks
MAIL = [email protected]     (/o|o\) _- don't smell bad---
MAIL+= [email protected]   < (^),>     it's the people who
WWW  = (not there yet!)      /   \      annoy us that do!
attr.h +1 -1
diff -ru git-1.7.0.5/attr.h git-1.7.0.5-tru64/attr.h
@@ -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 *);
 
builtin-apply.c +2 -2
diff -ru git-1.7.0.5/builtin-apply.c git-1.7.0.5-tru64/builtin-apply.c
@@ -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;
 
 
builtin-blame.c +1 -1
diff -ru git-1.7.0.5/builtin-blame.c git-1.7.0.5-tru64/builtin-blame.c
@@ -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);
builtin-branch.c +2 -2
diff -ru git-1.7.0.5/builtin-branch.c git-1.7.0.5-tru64/builtin-branch.c
@@ -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];
 
builtin-commit.c +3 -3
diff -ru git-1.7.0.5/builtin-commit.c git-1.7.0.5-tru64/builtin-commit.c
@@ -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)
builtin-for-each-ref.c +2 -2
diff -ru git-1.7.0.5/builtin-for-each-ref.c git-1.7.0.5-tru64/builtin-for-each-ref.c
@@ -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);
builtin-help.c +1 -1
diff -ru git-1.7.0.5/builtin-help.c git-1.7.0.5-tru64/builtin-help.c
@@ -26,7 +26,7 @@
 	HELP_FORMAT_NONE,
 	HELP_FORMAT_MAN,
 	HELP_FORMAT_INFO,
-	HELP_FORMAT_WEB,
+	HELP_FORMAT_WEB
 };
 
 static int show_all = 0;
builtin-mailinfo.c +2 -2
diff -ru git-1.7.0.5/builtin-mailinfo.c git-1.7.0.5-tru64/builtin-mailinfo.c
@@ -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;
builtin-merge-ours.c +2 -0
diff -ru git-1.7.0.5/builtin-merge-ours.c git-1.7.0.5-tru64/builtin-merge-ours.c
@@ -31,4 +31,6 @@
 	if (cmd_diff_index(NARGS, diff_index_args, prefix))
 		exit(2);
 	exit(0);
+
+	return 0; /* never reached */
 }
builtin-mktree.c +2 -0
diff -ru git-1.7.0.5/builtin-mktree.c git-1.7.0.5-tru64/builtin-mktree.c
@@ -187,4 +187,6 @@
 	}
 	strbuf_release(&sb);
 	exit(0);
+
+	return 0; /* never reached */
 }
builtin-receive-pack.c +1 -1
diff -ru git-1.7.0.5/builtin-receive-pack.c git-1.7.0.5-tru64/builtin-receive-pack.c
@@ -16,7 +16,7 @@
 	DENY_UNCONFIGURED,
 	DENY_IGNORE,
 	DENY_WARN,
-	DENY_REFUSE,
+	DENY_REFUSE
 };
 
 static int deny_deletes;
builtin-remote.c +1 -1
diff -ru git-1.7.0.5/builtin-remote.c git-1.7.0.5-tru64/builtin-remote.c
@@ -317,7 +317,7 @@
 		PUSH_STATUS_UPTODATE,
 		PUSH_STATUS_FASTFORWARD,
 		PUSH_STATUS_OUTOFDATE,
-		PUSH_STATUS_NOTQUERIED,
+		PUSH_STATUS_NOTQUERIED
 	} status;
 };
 
cache.h +8 -8
diff -ru git-1.7.0.5/cache.h git-1.7.0.5-tru64/cache.h
@@ -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 */
commit.h +1 -1
diff -ru git-1.7.0.5/commit.h git-1.7.0.5-tru64/commit.h
@@ -60,7 +60,7 @@
 	CMIT_FMT_EMAIL,
 	CMIT_FMT_USERFORMAT,
 
-	CMIT_FMT_UNSPECIFIED,
+	CMIT_FMT_UNSPECIFIED
 };
 
 struct pretty_print_context
compat/hstrerror.c +2 -0
diff -ru git-1.7.0.5/compat/hstrerror.c git-1.7.0.5-tru64/compat/hstrerror.c
@@ -1,3 +1,5 @@
+#define _OSF_SOURCE
+
 #include <string.h>
 #include <stdio.h>
 #include <netdb.h>
compat/inet_ntop.c +2 -0
diff -ru git-1.7.0.5/compat/inet_ntop.c git-1.7.0.5-tru64/compat/inet_ntop.c
@@ -15,6 +15,8 @@
  * SOFTWARE.
  */
 
+#define _OSF_SOURCE
+
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
compat/inet_pton.c +2 -0
diff -ru git-1.7.0.5/compat/inet_pton.c git-1.7.0.5-tru64/compat/inet_pton.c
@@ -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>
connect.c +1 -1
diff -ru git-1.7.0.5/connect.c git-1.7.0.5-tru64/connect.c
@@ -131,7 +131,7 @@
 enum protocol {
 	PROTO_LOCAL = 1,
 	PROTO_SSH,
-	PROTO_GIT,
+	PROTO_GIT
 };
 
 static enum protocol get_protocol(const char *name)
ctype.c +1 -1
diff -ru git-1.7.0.5/ctype.c git-1.7.0.5-tru64/ctype.c
@@ -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] = {
daemon.c +3 -1
diff -ru git-1.7.0.5/daemon.c git-1.7.0.5-tru64/daemon.c
@@ -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.h +1 -1
diff -ru git-1.7.0.5/diff.h git-1.7.0.5-tru64/diff.h
@@ -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) \
diffcore-order.c +1 -1
diff -ru git-1.7.0.5/diffcore-order.c git-1.7.0.5-tru64/diffcore-order.c
@@ -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++) {
dir.c +3 -3
diff -ru git-1.7.0.5/dir.c git-1.7.0.5-tru64/dir.c
@@ -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,
fast-import.c +1 -1
diff -ru git-1.7.0.5/fast-import.c git-1.7.0.5-tru64/fast-import.c
@@ -267,7 +267,7 @@
 typedef enum {
 	WHENSPEC_RAW = 1,
 	WHENSPEC_RFC2822,
-	WHENSPEC_NOW,
+	WHENSPEC_NOW
 } whenspec_type;
 
 struct recent_command
git-compat-util.h +53 -0

72 lines not on this page · raw message

grep.h +4 -4
diff -ru git-1.7.0.5/grep.h git-1.7.0.5-tru64/grep.h
@@ -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 {
imap-send.c +1 -1
diff -ru git-1.7.0.5/imap-send.c git-1.7.0.5-tru64/imap-send.c
@@ -212,7 +212,7 @@
 	UIDPLUS,
 	LITERALPLUS,
 	NAMESPACE,
-	STARTTLS,
+	STARTTLS
 };
 
 static const char *cap_list[] = {
merge-recursive.h +1 -1
diff -ru git-1.7.0.5/merge-recursive.h git-1.7.0.5-tru64/merge-recursive.h
@@ -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;
parse-options.h +3 -3
diff -ru git-1.7.0.5/parse-options.h git-1.7.0.5-tru64/parse-options.h
@@ -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
 };
 
 /*
pretty.c +1 -1
diff -ru git-1.7.0.5/pretty.c git-1.7.0.5-tru64/pretty.c
@@ -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]) {
read-cache.c +1 -1
diff -ru git-1.7.0.5/read-cache.c git-1.7.0.5-tru64/read-cache.c
@@ -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;
remote.c +1 -1
diff -ru git-1.7.0.5/remote.c git-1.7.0.5-tru64/remote.c
@@ -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;
remote.h +1 -1
diff -ru git-1.7.0.5/remote.h git-1.7.0.5-tru64/remote.h
@@ -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 */
rerere.c +1 -1
diff -ru git-1.7.0.5/rerere.c git-1.7.0.5-tru64/rerere.c
@@ -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;
revision.c +1 -1
diff -ru git-1.7.0.5/revision.c git-1.7.0.5-tru64/revision.c
@@ -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)
sha1_file.c +1 -1
diff -ru git-1.7.0.5/sha1_file.c git-1.7.0.5-tru64/sha1_file.c
@@ -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));
test-delta.c +2 -2
diff -ru git-1.7.0.5/test-delta.c git-1.7.0.5-tru64/test-delta.c
@@ -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;
wrapper.c +2 -2
diff -ru git-1.7.0.5/wrapper.c git-1.7.0.5-tru64/wrapper.c
@@ -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;
wt-status.h +1 -1
diff -ru git-1.7.0.5/wt-status.h git-1.7.0.5-tru64/wt-status.h
@@ -11,7 +11,7 @@
 	WT_STATUS_CHANGED,
 	WT_STATUS_UNTRACKED,
 	WT_STATUS_NOBRANCH,
-	WT_STATUS_UNMERGED,
+	WT_STATUS_UNMERGED
 };
 
 enum untracked_status_type {
#1 lore raw
Quoted 3 lines · Daniel Richard G.

* 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.

#2 lore raw
Quoted 7 lines · Alex Riesen

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 :]

Quoted 2 lines

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.)

Signature · 4 lines
NAME = Daniel Richard G.     _\|/_    Remember, skunks
MAIL = [email protected]     (/o|o\) _- don't smell bad---
MAIL+= [email protected]   < (^),>     it's the people who
WWW  = (not there yet!)      /   \      annoy us that do!
#3 lore raw
Quoted 11 lines · Daniel Richard G.
Quoted 7 lines · Alex Riesen

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

#4 lore raw
Quoted 5 lines · Nicolas Pitre
Quoted 3 lines

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

Signature · 4 lines
NAME = Daniel Richard G.     _\|/_    Remember, skunks
MAIL = [email protected]     (/o|o\) _- don't smell bad---
MAIL+= [email protected]   < (^),>     it's the people who
WWW  = (not there yet!)      /   \      annoy us that do!
#5 lore raw
In reply to Daniel Richard G.
Quoted 10 lines · Daniel Richard G.
Quoted 7 lines · Alex Riesen

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
Signature · 3 lines
Jakub Narebski
Poland
ShadeHawk on #git
#6 lore raw
Quoted 13 lines · Jakub Narebski
Quoted 10 lines · Daniel Richard G.
Quoted 7 lines · Alex Riesen

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

Quoted 8 lines

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)
$

Signature · 1 line
Erik "kusma" Faye-Lund