Bug 186219 - net-mgmt/libsmi - Clang / GCC issue
Summary: net-mgmt/libsmi - Clang / GCC issue
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-29 02:00 UTC by edwin
Modified: 2016-01-16 06:59 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description edwin 2014-01-29 02:00:00 UTC
Wireshark fails to compile with -WC++-compat on smi.h:

In file included from epan.c:63:
/usr/local/include/smi.h:319:1: error: empty struct has size 0 in C, size 1 in
      C++ [-Werror,-Wc++-compat]

Fix: 

In smi.h:

 /* SmiElement -- an item in a list (row index column, notification object)   */
 typedef struct SmiElement {
+#ifdef __clang__
+    char dummy;         /* CLANG complains about this with -WC++-compat */
+#endif
 #ifndef __GNUC__
     char dummy;         /* many compilers are unhappy with empty structures. */
 #endif
     /* no visible attributes */
 } SmiElement;
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-01-29 02:00:58 UTC
Maintainer of net-mgmt/libsmi,

Please note that PR ports/186219 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/186219

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2014-01-29 02:00:59 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Marcin Cieślak 2014-01-29 16:21:00 UTC
On Wed, 29 Jan 2014, Edwin Groothuis wrote:

> Maintainer of net-mgmt/libsmi,
> 
> Please note that PR ports/186219 has just been submitted.
> 
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.

Thanks, there is a fix in the SVN already,

===> Generating patch
===> Viewing diff with more
diff -ruN --exclude=CVS /usr/ports/net-mgmt/libsmi.orig/Makefile /usr/ports/net-mgmt/libsmi/Makefile
--- /usr/ports/net-mgmt/libsmi.orig/Makefile	2014-01-29 17:15:07.000000000 +0100
+++ /usr/ports/net-mgmt/libsmi/Makefile	2014-01-29 17:19:09.000000000 +0100
@@ -3,6 +3,7 @@
 
 PORTNAME=	libsmi
 PORTVERSION=	0.4.8
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	ftp://ftp.ibr.cs.tu-bs.de/pub/local/libsmi/ \
 		LOCAL/bms
diff -ruN --exclude=CVS /usr/ports/net-mgmt/libsmi.orig/files/patch-cppcompat /usr/ports/net-mgmt/libsmi/files/patch-cppcompat
--- /usr/ports/net-mgmt/libsmi.orig/files/patch-cppcompat	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/net-mgmt/libsmi/files/patch-cppcompat	2014-01-29 17:15:07.000000000 +0100
@@ -0,0 +1,32 @@
+--- lib/smi.h.in.orig	2008-04-18 14:56:31.000000000 +0200
++++ lib/smi.h.in	2014-01-29 17:11:40.000000000 +0100
+@@ -312,9 +312,10 @@
+ 
+ /* SmiElement -- an item in a list (row index column, notification object)   */
+ typedef struct SmiElement {
+-#ifndef __GNUC__
+-    char dummy;		/* many compilers are unhappy with empty structures. */
+-#endif
++    char dummy;		/* C99 does not allow empty structs; some compilers
++			   accept them (gcc) but there are size differences
++			   between C and C++. So for portability reasons,
++			   we have this unused struct member. */
+     /* no visible attributes */
+ } SmiElement;
+ 
+--- lib/smi.h.orig	2008-04-18 14:58:06.000000000 +0200
++++ lib/smi.h	2014-01-29 17:11:59.000000000 +0100
+@@ -312,9 +312,10 @@
+ 
+ /* SmiElement -- an item in a list (row index column, notification object)   */
+ typedef struct SmiElement {
+-#ifndef __GNUC__
+-    char dummy;		/* many compilers are unhappy with empty structures. */
+-#endif
++    char dummy;		/* C99 does not allow empty structs; some compilers
++			   accept them (gcc) but there are size differences
++			   between C and C++. So for portability reasons,
++			   we have this unused struct member. */
+     /* no visible attributes */
+ } SmiElement;
+ 
===> Done
Comment 4 John Marino freebsd_committer freebsd_triage 2014-06-19 11:24:52 UTC
Seems that this report is obsolete, libsmi is building everywhere:
http://portsmon.freebsd.org/portoverview.py?category=net-mgmt&portname=libsmi

Feel free to report this PR if I read this wrong.
Comment 5 John Marino freebsd_committer freebsd_triage 2014-06-19 11:26:06 UTC
btw, wireshark is also building everywhere:
http://portsmon.freebsd.org/portoverview.py?category=net&portname=wireshark
Comment 6 Edwin Groothuis freebsd_committer freebsd_triage 2015-05-15 10:42:50 UTC
Please note that this issue pops up again when compiling the head version of Wireshark, not the active one.

I've just shot a similar fix to the maintainers of libsmi.

Please consider committing the patch file.
Comment 7 Marcin Cieślak 2015-05-15 10:46:55 UTC
Thanks, will check it out.
Comment 8 Martin Wilke freebsd_committer freebsd_triage 2016-01-16 06:59:46 UTC
Another year have passed, I close here again during the maintainer timeout.