Wireshark-dev: [Wireshark-dev] "Type-punned pointer... breaks anti-aliasing rules" in dfilter-m
From: Stephen Fisher <[email protected]>
Date: Tue, 18 Jun 2013 17:14:54 -0600
When trying to compile Wireshark (SVN trunk) on FreeBSD for the first time in a long time, I ran across a familiar error:

    dfilter-macro.c: In function 'dfilter_macro_init':
    dfilter-macro.c:614: warning: dereferencing type-punned pointer will break strict-aliasing rules

However, line 614 has a history of being changed between this:

    (void*) &macros,

and this (as it currently is):

    (void**) &macros,

Which is the fifth parameter in a call to uat_new() where parameter five's type is "void** data_ptr" and macros is type dfilter_macro_t*.  

This was most recently changed with SVN revision 48355 that Anders committed in response to bug 8416 ("remove C++ incompatibilities") according to the SVN log.  Before that, judging by the "svn annotate" output in Emacs of a few lines earlier, I changed it from (void**) to (void*) way back in 2007 as SVN revision 21330 to "Fix warnings on Linux/gcc 4.1.1" and it may have changed at other times as well.

What should the fix ultimately be if one way breaks FreeBSD/gcc 4.2.1 compiles and if it introduces C++ compatibility issues (which I'm not familiar with since I haven't been following development for a while lately).