diff mbox

[RFC,v2,21/21] ui/vnc: silent unuseful OSX clang warning

Message ID 20170622033231.19344-22-f4bug@amsat.org
State New
Headers show

Commit Message

Philippe Mathieu-Daudé June 22, 2017, 3:32 a.m. UTC
ui/vnc.c:3945:20: warning: 'sasl_server_init' is deprecated: first deprecated in OS X 10.11 [-Wdeprecated-declarations]
        if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
                       ^
    /usr/include/sasl/sasl.h:1016:17: note: 'sasl_server_init' has been explicitly marked deprecated here
    LIBSASL_API int sasl_server_init(const sasl_callback_t *callbacks,
                    ^

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 ui/Makefile.objs | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Peter Maydell June 22, 2017, 7:28 a.m. UTC | #1
On 22 June 2017 at 04:32, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>     ui/vnc.c:3945:20: warning: 'sasl_server_init' is deprecated: first deprecated in OS X 10.11 [-Wdeprecated-declarations]
>         if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
>                        ^
>     /usr/include/sasl/sasl.h:1016:17: note: 'sasl_server_init' has been explicitly marked deprecated here
>     LIBSASL_API int sasl_server_init(const sasl_callback_t *callbacks,
>                     ^

Mmm, I've been vaguely wondering what to do about those warnings
for a while. The difficulty is that applying -Wno-deprecated-declarations
silences all deprecation warnings, not just the SASL ones, so we
lose a bit of warning coverage. Maybe that's just a hit we have
to take, though.

thanks
-- PMM
Gerd Hoffmann June 22, 2017, 7:33 a.m. UTC | #2
diff --git a/ui/Makefile.objs b/ui/Makefile.objs
> index 3369451285..08fb573a48 100644
> --- a/ui/Makefile.objs
> +++ b/ui/Makefile.objs
> @@ -6,6 +6,14 @@ vnc-obj-y += vnc-auth-vencrypt.o
>  vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
>  vnc-obj-y += vnc-ws.o
>  vnc-obj-y += vnc-jobs.o
> +ifeq ($(CONFIG_VNC_SASL),y)
> +# silent OSX SASL warnings (from https://stackoverflow.com/a/7406994
> ):
> +# because OpenSSL doesn’t offer API compatibility between versions,
> [...] Apple
> +# can't provide security updates without breaking existing apps, so
> is migrating
> +# from OpenSSL to Common Crypto.
> +vnc.o-cflags := -Wno-deprecated-declarations
> +vnc-auth-sasl.o-cflags := -Wno-deprecated-declarations
> +endif

Hmm, does clang understand "#pragma GCC diagnostic" ?

If so, then this can be done in in the code not the makefiles, and also
selectively for osx only.

See include/ui/gtk.h for an example.

cheers,
  Gerd
Peter Maydell June 22, 2017, 7:35 a.m. UTC | #3
On 22 June 2017 at 08:33, Gerd Hoffmann <kraxel@redhat.com> wrote:
> diff --git a/ui/Makefile.objs b/ui/Makefile.objs
>> index 3369451285..08fb573a48 100644
>> --- a/ui/Makefile.objs
>> +++ b/ui/Makefile.objs
>> @@ -6,6 +6,14 @@ vnc-obj-y += vnc-auth-vencrypt.o
>>  vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
>>  vnc-obj-y += vnc-ws.o
>>  vnc-obj-y += vnc-jobs.o
>> +ifeq ($(CONFIG_VNC_SASL),y)
>> +# silent OSX SASL warnings (from https://stackoverflow.com/a/7406994
>> ):
>> +# because OpenSSL doesn’t offer API compatibility between versions,
>> [...] Apple
>> +# can't provide security updates without breaking existing apps, so
>> is migrating
>> +# from OpenSSL to Common Crypto.
>> +vnc.o-cflags := -Wno-deprecated-declarations
>> +vnc-auth-sasl.o-cflags := -Wno-deprecated-declarations
>> +endif
>
> Hmm, does clang understand "#pragma GCC diagnostic" ?
>
> If so, then this can be done in in the code not the makefiles, and also
> selectively for osx only.

It does have some diagnostic pragma support. The awkward part is
that it has to  be in force at the point where the deprecated
function is used, not where it's declared. So you can't just wrap
the #include of the ssl header in pragmas, you'd have to either
do it at every callsite or else over the whole .c file.

thanks
-- PMM
Gerd Hoffmann June 22, 2017, 1:50 p.m. UTC | #4
On Thu, 2017-06-22 at 08:35 +0100, Peter Maydell wrote:
> On 22 June 2017 at 08:33, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > diff --git a/ui/Makefile.objs b/ui/Makefile.objs
> > > index 3369451285..08fb573a48 100644
> > > --- a/ui/Makefile.objs
> > > +++ b/ui/Makefile.objs
> > > @@ -6,6 +6,14 @@ vnc-obj-y += vnc-auth-vencrypt.o
> > >  vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
> > >  vnc-obj-y += vnc-ws.o
> > >  vnc-obj-y += vnc-jobs.o
> > > +ifeq ($(CONFIG_VNC_SASL),y)
> > > +# silent OSX SASL warnings (from https://stackoverflow.com/a/740
> > > 6994
> > > ):
> > > +# because OpenSSL doesn’t offer API compatibility between
> > > versions,
> > > [...] Apple
> > > +# can't provide security updates without breaking existing apps,
> > > so
> > > is migrating
> > > +# from OpenSSL to Common Crypto.
> > > +vnc.o-cflags := -Wno-deprecated-declarations
> > > +vnc-auth-sasl.o-cflags := -Wno-deprecated-declarations
> > > +endif
> > 
> > Hmm, does clang understand "#pragma GCC diagnostic" ?
> > 
> > If so, then this can be done in in the code not the makefiles, and
> > also
> > selectively for osx only.
> 
> It does have some diagnostic pragma support. The awkward part is
> that it has to  be in force at the point where the deprecated
> function is used, not where it's declared. So you can't just wrap
> the #include of the ssl header in pragmas, you'd have to either
> do it at every callsite or else over the whole .c file.

Do it on the whole file on osx only is still better because we continue
to get the warnings on non-osx then, which should be enough to avoid
the code bitroting unnoticed.

cheers,
  Gerd
diff mbox

Patch

diff --git a/ui/Makefile.objs b/ui/Makefile.objs
index 3369451285..08fb573a48 100644
--- a/ui/Makefile.objs
+++ b/ui/Makefile.objs
@@ -6,6 +6,14 @@  vnc-obj-y += vnc-auth-vencrypt.o
 vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
 vnc-obj-y += vnc-ws.o
 vnc-obj-y += vnc-jobs.o
+ifeq ($(CONFIG_VNC_SASL),y)
+# silent OSX SASL warnings (from https://stackoverflow.com/a/7406994):
+# because OpenSSL doesn’t offer API compatibility between versions, [...] Apple
+# can't provide security updates without breaking existing apps, so is migrating
+# from OpenSSL to Common Crypto.
+vnc.o-cflags := -Wno-deprecated-declarations
+vnc-auth-sasl.o-cflags := -Wno-deprecated-declarations
+endif
 
 common-obj-y += keymaps.o console.o cursor.o qemu-pixman.o
 common-obj-y += input.o input-keymap.o input-legacy.o