Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Do we still need/want -Wc++-compat?

From: João Valverde <joao.valverde@xxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Oct 2015 14:25:03 +0100
GTK build breaks for 3.18 with Werror=c++-compat ('and' is a reserved C++ keyword).

It should arguably be fixed upstream, I patched my GTK installation, but can this warning be removed?

On 10/09/2015 06:47 PM, Evan Huus wrote:
On Fri, Oct 9, 2015 at 1:40 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:

On Sep 30, 2015, at 9:59 PM, Evan Huus <eapache@xxxxxxxxx> wrote:

On Thu, Oct 1, 2015 at 12:38 AM, Guy Harris <guy@xxxxxxxxxxxx> wrote:

On Sep 30, 2015, at 6:53 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:

I think the intent was to be able to run Wireshark's C code through C++ compilers; I can't find the mail where this was discussed, but, as I remember, the issue was that Microsoft were dragging their feet on C99 support, and we wanted to be able to use at least some features present in both C99 and the versions of C++ supported by the Microsoft compiler.

Microsoft have gotten more receptive to C99 features; is this something we still want to contemplate - and to try to keep open as a possibility, by compiling with -Wc++-compat?

If I try to build what's currently in master, it fails on my Yosemite machine, with Xcode 7.0.1

Not after rebuilding and reinstalling all the development libraries and doing make maintainer-clean/autogen/configure/make.

But what was the reason for adding checks for C++ compatibility, and does it still apply?

My memory matches yours: it was about MSVC (and other more obscure
compilers we theoretically support, on platforms I have never actually
used**) not having C99 features.

Part of me would like to take a hard line and say: "these are the C99
features we require, deal with it" but I don't know how much screaming
that would entail. Another part of me would like to just switch to use
C++ compilers on all our common platforms and start gradually
introducing some of the useful, not-insanely-complex bits of C++ into
the code-base, but I already know how much screaming that would entail
:P

** `doc/README.developer` references IBM's compiler for AIX as one
which lacks even basic C99 support like // comments.

Some experimenting with The Written Word's machines found that:

         XL C on AIX, with -qlanglvl=extc89, accepts variadic macros, but does *not* accept // comments;

         XL C on AIX, with -qlanglvl=extc99, accepts variadic macros and // comments.

Looking at the XL C 7.0 documentation:

         http://www-01.ibm.com/support/docview.wss?uid=swg27005410&aid=1

indicates that -qlanglvl=extc89 -qcpluscmt should also handle // comments.

There are probably old enough versions of XL C that cannot be made to handle // comments, but, unless they handle macros with a variable number of arguments, they can't handle the current 2.x Wireshark source.

We're now using AC_PROG_CC_STDC rather than AC_PROG_CC in the configure script in 2.x, and, at least for versions of XL C that support C99, that will enable all C99 features.

I think, at this point, that the only compiler we'll be dealing with that's limited in its C99 capabilities is MSVC, and, so far, we haven't used anything it can't handle.

My inclination is to keep using AC_PROG_CC_STDC, let whatever C99isms that lets get through remain as long as MSVC can handle them (if it can't, that'll show up in the build), and allow // comments.

+1
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe