Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2012 03:15:58 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/174214: [patch] OFED userspace fails to build with clang
Message-ID:  <201212060315.qB63FwVh040901@red.freebsd.org>
Resent-Message-ID: <201212060320.qB63K0cs088081@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         174214
>Category:       bin
>Synopsis:       [patch] OFED userspace fails to build with clang
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 06 03:20:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9.1-RC2
>Organization:
EMC Isilon
>Environment:
FreeBSD gran-tourismo.west.isilon.com 9.1-RC2 FreeBSD 9.1-RC2 #0 r241106: Mon Oct  1 18:26:44 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
When trying to upgrade one of the dev boxes I have at my disposal to CURRENT with WITH_OFED defined in /etc/src.conf, I ran into a handful of trivial compilation issues with clang, dealing with printf(3)/variable buffers, and GCCisms. The attached patch fixes them.

I need to check and see whether or not a newer version of OFED fixes this, but this gets things to work again. If it's still an issue, I'll push for integration upstream.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

>From 4b40ec9924c1f509637284f5dfb745517c024608 Mon Sep 17 00:00:00 2001
From: Garrett Cooper <yanegomi@gmail.com>
Date: Wed, 5 Dec 2012 18:51:14 -0800
Subject: [PATCH] Make ofed userspace build with clang

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
---
 contrib/ofed/management/infiniband-diags/src/sminfo.c | 8 ++++----
 contrib/ofed/management/opensm/opensm/osm_console.c   | 5 ++++-
 contrib/ofed/management/opensm/opensm/osm_subnet.c    | 4 ++--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/contrib/ofed/management/infiniband-diags/src/sminfo.c b/contrib/ofed/management/infiniband-diags/src/sminfo.c
index c811057..61d88e1 100644
--- a/contrib/ofed/management/infiniband-diags/src/sminfo.c
+++ b/contrib/ofed/management/infiniband-diags/src/sminfo.c
@@ -72,10 +72,10 @@ enum {
 };
 
 char *statestr[] = {
-	[SMINFO_NOTACT] "SMINFO_NOTACT",
-	[SMINFO_DISCOVER] "SMINFO_DISCOVER",
-	[SMINFO_STANDBY] "SMINFO_STANDBY",
-	[SMINFO_MASTER] "SMINFO_MASTER",
+	"SMINFO_NOTACT",
+	"SMINFO_DISCOVER",
+	"SMINFO_STANDBY",
+	"SMINFO_MASTER",
 };
 
 #define STATESTR(s)	(((unsigned)(s)) < SMINFO_STATE_LAST ? statestr[s] : "???")
diff --git a/contrib/ofed/management/opensm/opensm/osm_console.c b/contrib/ofed/management/opensm/opensm/osm_console.c
index c6e8e59..5c494a8 100644
--- a/contrib/ofed/management/opensm/opensm/osm_console.c
+++ b/contrib/ofed/management/opensm/opensm/osm_console.c
@@ -67,7 +67,10 @@ static struct {
 	time_t previous;
 	void (*loop_function) (osm_opensm_t * p_osm, FILE * out);
 } loop_command = {
-on: 0, delay_s: 2, loop_function:NULL};
+	.on = 0,
+	.delay_s = 2,
+	.loop_function = NULL,
+};
 
 static const struct command console_cmds[];
 
diff --git a/contrib/ofed/management/opensm/opensm/osm_subnet.c b/contrib/ofed/management/opensm/opensm/osm_subnet.c
index c41962d..558027c 100644
--- a/contrib/ofed/management/opensm/opensm/osm_subnet.c
+++ b/contrib/ofed/management/opensm/opensm/osm_subnet.c
@@ -482,7 +482,7 @@ static void log_report(const char *fmt, ...)
 	va_start(args, fmt);
 	vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
-	printf(buf);
+	printf("%s", buf);
 	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
 }
 
@@ -500,7 +500,7 @@ static void log_config_value(char *name, const char *fmt, ...)
 		n = sizeof(buf);
 	snprintf(buf + n, sizeof(buf) - n, "\n");
 	va_end(args);
-	printf(buf);
+	printf("%s", buf);
 	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
 }
 
-- 
1.8.0.1



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212060315.qB63FwVh040901>