Closed Bug 1443402 Opened 2 years ago Closed 2 years ago

Fix some -Wmissing-prototypes warnings in layout

Categories

(Core :: Layout, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox58 --- wontfix
firefox59 --- wontfix
firefox60 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

-Wmissing-prototypes is a new optional warning available in clang ToT. It warns about global functions that have no previous function declaration (e.g. from an #included header file). These functions can probably be made static (allowing the compiler to better optimize them) or they may be unused.

Confusingly, clang's -Wmissing-prototypes is equivalent to gcc's -Wmissing-declarations, not gcc's -Wmissing-prototypes. A function prototype is a function declaration that specifies the function's argument types. C++ requires that all function declarations specify their argument types, but C does not. As such, gcc's -Wmissing-prototypes is a C-only warning about C functions that have no previous function *prototypes* (with argument types), even if a previous function *declaration* (without argument types) was seen.

https://clang.llvm.org/docs/DiagnosticsReference.html#wmissing-prototypes

https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Warning-Options.html

We won't be able to enable -Wmissing-prototypes warnings by default for a long time because there are still about a thousand warnings remaining. We should also wait until this warning to ride from clang ToT to Xcode's clang.
Comment on attachment 8956349 [details]
Bug 1443402 - Fix some -Wmissing-prototypes warnings in layout.

https://reviewboard.mozilla.org/r/225220/#review231198

Seems fine! r=me
Attachment #8956349 - Flags: review?(dholbert) → review+
Comment on attachment 8956349 [details]
Bug 1443402 - Fix some -Wmissing-prototypes warnings in layout.

https://reviewboard.mozilla.org/r/225220/#review231200

::: commit-message-709ea:1
(Diff revision 1)
> +Bug 1443402 - Fix some -Wmissing-prototypes warnings in layout. r?dholbert

Oh, just noticed one non-crucial nit: you should probably mention clang in the first line.

e.g. maybe "Fix some clang -Wmissing-prototypes warnings in layout"

Since: as you note further down, "-Wmissing-prototypes" means something completely different in clang vs. gcc, so it's helpful to add a few extra characters to make it clear which flavor you're talking about.
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6650c3db53ec
Fix some -Wmissing-prototypes warnings in layout. r=dholbert
https://hg.mozilla.org/mozilla-central/rev/6650c3db53ec
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Blocks: 536427
You need to log in before you can comment on or make changes to this bug.