Closed Bug 986794 Opened 10 years ago Closed 10 years ago

Suppress clang warnings in third-party code: libopus and libtheora

Categories

(Core :: Audio/Video, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31
Tracking Status
firefox30 --- wontfix
firefox31 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

clang reports the following warnings in a --disable-optimize build for OS X:

The libtheora code has a comment saying, "It's better to live with the spurious warnings."

media/libopus/celt/pitch.c:262:4 [-Wdeclaration-after-statement] ISO C90 forbids mixed declarations and code
media/libopus/src/opus_decoder.c:37:10 [-W#pragma-messages] You appear to be compiling without optimization, if so opus will be very slow.

media/libtheora/lib/state.c:717:4 [-Wtype-limits] comparison of unsigned expression < 0 is always false                                                                     
media/libtheora/lib/state.c:718:4 [-Wtype-limits] comparison of unsigned expression < 0 is always false
Attachment #8395179 - Flags: review?(tterribe)
Comment on attachment 8395179 [details] [diff] [review]
suppress-libopus-libtheora-warnings.patch

Review of attachment 8395179 [details] [diff] [review]:
-----------------------------------------------------------------

> media/libopus/celt/pitch.c:262:4 [-Wdeclaration-after-statement] ISO C90 forbids mixed declarations and code

This one was fixed upstream in January, FWIW.

::: media/libopus/moz.build
@@ +70,5 @@
> +
> +# Suppress warnings in third-party code.
> +if CONFIG['GNU_CC']:
> +    CFLAGS += ['-Wno-declaration-after-statement']
> +    if CONFIG['CLANG_CXX']:

Is CLANG_CXX really a proper subset of GNU_CC? That seems moderately crazy.
Attachment #8395179 - Flags: review?(tterribe) → review+
(In reply to Timothy B. Terriberry (:derf) from comment #1)
> > +# Suppress warnings in third-party code.
> > +if CONFIG['GNU_CC']:
> > +    CFLAGS += ['-Wno-declaration-after-statement']
> > +    if CONFIG['CLANG_CXX']:
> 
> Is CLANG_CXX really a proper subset of GNU_CC? That seems moderately crazy.

Proper subset in what way? The flags or the CXX/CC suffix? The CLANG_CC macro is defined in some mach files, but only CLANG_CXX is defined in moz.build files. (See bug 981507.) Both GNU_CC and GNU_CXX are defined moz.build files.

clang does not understand all gcc -W flags, but it does understand -Wno-declaration-after-statement. In another patch from my "suppress clang and gcc warnings in third-party code" series, I had to `if not CONFIG['CLANG_CXX'] then pass clang-incompatible gcc flags`.
> Proper subset in what way?

I meant that CLANG_CXX is set only if GNU_CC is set.
(In reply to Timothy B. Terriberry (:derf) from comment #3)
> > Proper subset in what way?
> 
> I meant that CLANG_CXX is set only if GNU_CC is set.

clang pretends to be gcc in many cases, including defining preprocessor macros like __GNUC__ and this affects our moz.build macros. We have to check !clang for gcc-specific features, e.g. https://hg.mozilla.org/mozilla-central/file/c69c55582faa/mfbt/Compiler.h#l12
https://hg.mozilla.org/mozilla-central/rev/fabc466d8703
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: