HTCondor Project List Archives



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

[Condor-devel] Clang compatibility fixes



The attached patches are necessary to compile Condor with Clang. Only patch 2 is clearly correct (variable-length arrays are a GCC extension). Patch 1 could be Clang bug, but I don't think so. Patch 3 is odd because the comment above the ThreadInfo class definition strongly suggests that there should have been an operator== in the first place.

--
Florian Weimer / Red Hat Product Security Team
>From 347d49628797ddc53b73c4c65fe8de2ecd2993d8 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Mon, 9 Jul 2012 17:23:23 +0200
Subject: [PATCH 1/3] SharedPortEndpoint needs access to the
 Sock::sock_special enum constant

This is a clang compatibility fix.
---
 src/condor_includes/sock.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/condor_includes/sock.h b/src/condor_includes/sock.h
index 5a51c36..ca1b1c8 100644
--- a/src/condor_includes/sock.h
+++ b/src/condor_includes/sock.h
@@ -85,6 +85,7 @@ public:
 	friend class SecMan;
 	friend class SecManStartCommand;
 	friend class SharedPortListener;
+	friend class SharedPortEndpoint;
 
 	/*
 	**	Methods
-- 
1.7.7.6

>From c7a6432b3ba741fa6fa911e93a7ccc2d0c6b03ed Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Mon, 9 Jul 2012 17:24:20 +0200
Subject: [PATCH 2/3] find_file(): avoid variable-length array

This is a clang compatibility fix.
---
 src/condor_utils/condor_config.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/condor_utils/condor_config.cpp b/src/condor_utils/condor_config.cpp
index c61c53a..cfe806f 100644
--- a/src/condor_utils/condor_config.cpp
+++ b/src/condor_utils/condor_config.cpp
@@ -1107,7 +1107,7 @@ find_file(const char *env_name, const char *file_name)
 	if (!config_source) {
 			// List of condor_config file locations we'll try to open.
 			// As soon as we find one, we'll stop looking.
-		int locations_length = 4;
+		const int locations_length = 4;
 		MyString locations[locations_length];
 			// 1) $HOME/.condor/condor_config
 		struct passwd *pw = getpwuid( geteuid() );
-- 
1.7.7.6

>From 557091f3f8df50219615c3037afd1b136d514262 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Mon, 9 Jul 2012 17:25:17 +0200
Subject: [PATCH 3/3] ThreadInfo: implement operator==()

This is a clang compatibility fix.
---
 src/condor_utils/threads_implementation.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/condor_utils/threads_implementation.h b/src/condor_utils/threads_implementation.h
index bee5eae..a0664a1 100644
--- a/src/condor_utils/threads_implementation.h
+++ b/src/condor_utils/threads_implementation.h
@@ -48,6 +48,7 @@ public:
 	ThreadInfo() { pt_ = pthread_self(); }
 	ThreadInfo(pthread_t pt) { pt_ = pt; }	
 	pthread_t get_pthread() const { return pt_; }
+	bool operator==(const ThreadInfo &o) const { return pt_ == o.pt_; }
 private:
 	pthread_t pt_;
 };
-- 
1.7.7.6