Auto merge of #13686 - bholley:fix_warnings, r=Manishearth

Fix warnings and make style and geckolib #![deny(warnings)]

Warnings have been piling up in the style system, and making it harder to tell when new warnings are introduced. I think we should tighten up on them.

CC @emilio @Manishearth @SimonSapin @heycam @pcwalton @metajack @larsbergstrom

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13686)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-10-11 06:17:44 -05:00 committed by GitHub
commit e597719b73
9 changed files with 4950 additions and 2487 deletions

View file

@ -195,9 +195,7 @@ COMPILATION_TARGETS = {
# Generation of the ffi bindings.
"bindings": {
"target_dir": "../gecko_bindings",
"raw_lines": [
"use heapsize::HeapSizeOf;",
],
"raw_lines": [],
"flags": [
"--ignore-methods",
],
@ -224,13 +222,13 @@ COMPILATION_TARGETS = {
"nsStyleImageLayers_Layer", "nsStyleImageLayers_LayerType",
"nsStyleUnit", "nsStyleUnion", "nsStyleCoord_CalcValue",
"nsStyleCoord_Calc", "nsRestyleHint", "ServoElementSnapshot",
"nsChangeHint", "SheetParsingMode", "nsMainThreadPtrHandle",
"nsMainThreadPtrHolder", "nscolor", "nsFont", "FontFamilyList",
"nsChangeHint", "SheetParsingMode",
"nsMainThreadPtrHolder", "nsFont", "FontFamilyList",
"FontFamilyType", "nsIAtom", "nsStyleContext", "StyleClipPath",
"StyleBasicShapeType", "StyleBasicShape", "nsCSSShadowArray",
"nsINode", "nsIDocument", "nsIPrincipal", "nsIURI",
"nsIPrincipal", "nsIURI",
"RawGeckoNode", "RawGeckoElement", "RawGeckoDocument",
"ServoNodeData", "nsString"
"nsString"
],
"servo_nullable_arc_types": [
"ServoComputedValues", "RawServoStyleSheet",

View file

@ -109,8 +109,8 @@ ATOM_TEMPLATE = (" #[link_name = \"{link_name}\"]\n"
" pub static {name}: *mut {type};")
UNSAFE_STATIC = ("#[inline(always)]\n"
"pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom {\n"
" unsafe { Atom::from_static(ptr) }\n"
"pub unsafe fn atom_from_static(ptr: *mut nsIAtom) -> Atom {\n"
" Atom::from_static(ptr)\n"
"}\n\n")
CFG_IF = '''
@ -131,9 +131,14 @@ cfg_if! {{
}}
'''
RULE_TEMPLATE = ('("{atom}") => '
'{{ $crate::string_cache::atom_macro::unsafe_atom_from_static'
'($crate::string_cache::atom_macro::{name} as *mut _) }};')
RULE_TEMPLATE = ('("{atom}") =>\n '
'{{ '
# FIXME(bholley): Uncomment this when rust 1.14 is released.
# See the comment in components/style/lib.rs.
# ' #[allow(unsafe_code)] #[allow(unused_unsafe)] '
'unsafe {{ $crate::string_cache::atom_macro::atom_from_static'
'($crate::string_cache::atom_macro::{name} as *mut _) }}'
' }};')
MACRO = '''
#[macro_export]

View file

@ -1,6 +1,5 @@
/* automatically generated by rust-bindgen */
use heapsize::HeapSizeOf;
pub type ServoComputedValuesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoComputedValues>;
pub type ServoComputedValuesBorrowedOrNull<'a> = Option<&'a ServoComputedValues>;
pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;
@ -147,9 +146,7 @@ use gecko_bindings::structs::nsRestyleHint;
use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::nsChangeHint;
use gecko_bindings::structs::SheetParsingMode;
use gecko_bindings::structs::nsMainThreadPtrHandle;
use gecko_bindings::structs::nsMainThreadPtrHolder;
use gecko_bindings::structs::nscolor;
use gecko_bindings::structs::nsFont;
use gecko_bindings::structs::FontFamilyList;
use gecko_bindings::structs::FontFamilyType;
@ -161,14 +158,11 @@ use gecko_bindings::structs::StyleClipPath;
use gecko_bindings::structs::StyleBasicShapeType;
use gecko_bindings::structs::StyleBasicShape;
use gecko_bindings::structs::nsCSSShadowArray;
use gecko_bindings::structs::nsINode;
use gecko_bindings::structs::nsIDocument;
use gecko_bindings::structs::nsIPrincipal;
use gecko_bindings::structs::nsIURI;
use gecko_bindings::structs::RawGeckoNode;
use gecko_bindings::structs::RawGeckoElement;
use gecko_bindings::structs::RawGeckoDocument;
use gecko_bindings::structs::ServoNodeData;
use gecko_bindings::structs::nsString;
extern "C" {

File diff suppressed because it is too large Load diff

View file

@ -32,7 +32,16 @@
#![cfg_attr(feature = "servo", plugin(heapsize_plugin))]
#![cfg_attr(feature = "servo", plugin(plugins))]
#![deny(unsafe_code)]
#![deny(warnings)]
// FIXME(bholley): We need to blanket-allow unsafe code in order to make the
// gecko atom!() macro work. When Rust 1.14 is released [1], we can uncomment
// the commented-out attributes in regen_atoms.py and go back to denying unsafe
// code by default.
//
// [1] https://github.com/rust-lang/rust/issues/15701#issuecomment-251900615
//#![deny(unsafe_code)]
#![allow(unused_unsafe)]
#![recursion_limit = "500"] // For match_ignore_ascii_case in PropertyDeclaration::parse

View file

@ -1178,8 +1178,8 @@ fn static_assert() {
use gecko_bindings::structs::{NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE, NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER};
use gecko_bindings::structs::{NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE, NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE};
use gecko_bindings::structs::nsStyleCoord;
use values::computed::{Image, Gradient, GradientKind, GradientShape, Length, LengthOrKeyword};
use values::computed::{LengthOrPercentage, LengthOrPercentageOrKeyword};
use values::computed::{Image, Gradient, GradientKind, GradientShape, LengthOrKeyword};
use values::computed::LengthOrPercentageOrKeyword;
use values::specified::AngleOrCorner;
use values::specified::{HorizontalDirection, SizeKeyword, VerticalDirection};
use cssparser::Color as CSSColor;
@ -1618,8 +1618,6 @@ fn static_assert() {
<%call expr="impl_coord_copy('letter_spacing', 'mLetterSpacing')"></%call>
pub fn set_word_spacing(&mut self, v: longhands::word_spacing::computed_value::T) {
use values::computed::LengthOrPercentage::*;
match v.0 {
Some(lop) => self.gecko.mWordSpacing.set(lop),
// https://drafts.csswg.org/css-text-3/#valdef-word-spacing-normal

View file

@ -1195,9 +1195,9 @@ ${helpers.predefined_type("opacity",
</%helpers:longhand>
pub struct OriginParseResult {
horizontal: Option<specified::LengthOrPercentage>,
vertical: Option<specified::LengthOrPercentage>,
depth: Option<specified::Length>
pub horizontal: Option<specified::LengthOrPercentage>,
pub vertical: Option<specified::LengthOrPercentage>,
pub depth: Option<specified::Length>
}
pub fn parse_origin(_: &ParserContext, input: &mut Parser) -> Result<OriginParseResult,()> {

View file

@ -30,7 +30,7 @@ use logical_geometry::WritingMode;
use parser::{ParserContext, ParserContextExtraData};
use selector_matching::{ApplicableDeclarationBlock, ApplicableDeclarationBlockReadGuard};
use stylesheets::Origin;
use values::LocalToCss;
#[cfg(feature = "servo")] use values::LocalToCss;
use values::HasViewportPercentage;
use values::computed::{self, ToComputedValue};
use cascade_info::CascadeInfo;