# HG changeset patch # User Simon Sapin # Date 1547211824 -3600 # Node ID f63ebd7e9e281f22e71c268151337178de2c246a # Parent 4f2e84dc490dbbac2a35799b6b9230c105f2cd35 Bug 1519729 - Document public macros. r=emilio Undocumented public macros emit warnings in nightly-2019-01-11, and we #![deny] that warning. Cherry-picks a commit from https://github.com/servo/servo/pull/22674 diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -3816,17 +3816,24 @@ impl AliasId { % for property in data.all_aliases(): AliasId::${property.camel_case} => "${property.camel_case}", % endfor }; formatter.write_str(name) } } -// NOTE(emilio): Callers are responsible to deal with prefs. +/// Call the given macro with tokens like this for each longhand and shorthand properties +/// that is enabled in content: +/// +/// ``` +/// [CamelCaseName, SetCamelCaseName, PropertyId::Longhand(LonghandId::CamelCaseName)], +/// ``` +/// +/// NOTE(emilio): Callers are responsible to deal with prefs. #[macro_export] macro_rules! css_properties_accessors { ($macro_name: ident) => { $macro_name! { % for kind, props in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]: % for property in props: % if property.enabled_in_content(): % for name in [property.name] + property.alias: @@ -3839,16 +3846,24 @@ macro_rules! css_properties_accessors { % endfor % endif % endfor % endfor } } } +/// Call the given macro with tokens like this for each longhand properties: +/// +/// ``` +/// { snake_case_ident, true } +/// ``` +/// +/// … where the boolean indicates whether the property value type +/// is wrapped in a `Box<_>` in the corresponding `PropertyDeclaration` variant. #[macro_export] macro_rules! longhand_properties_idents { ($macro_name: ident) => { $macro_name! { % for property in data.longhands: { ${property.ident}, ${"true" if property.boxed else "false"} } % endfor } # HG changeset patch # User Emilio Cobos Álvarez # Date 1547412158 -3600 # Node ID 1a1d8b9f1a3ab704ab277407823f6f42dd63a3d4 # Parent a2f691714d70fa6a9119503270809fa0eb8df6c6 Bug 1519629 - Document a few more macros. diff --git a/servo/components/style/gecko/regen_atoms.py b/servo/components/style/gecko/regen_atoms.py --- a/servo/components/style/gecko/regen_atoms.py +++ b/servo/components/style/gecko/regen_atoms.py @@ -125,16 +125,17 @@ PRELUDE = ''' RULE_TEMPLATE = ('("{atom}") =>\n ' '{{{{ ' '#[allow(unsafe_code)] #[allow(unused_unsafe)]' 'unsafe {{ $crate::string_cache::atom_macro::atom_from_static' '($crate::string_cache::atom_macro::{name} as *mut _) }}' ' }}}};') MACRO = ''' +/// Returns a static atom by passing the literal string it represents. #[macro_export] macro_rules! atom {{ {} }} ''' def write_atom_macro(atoms, file_name): --- firefox-60.6.1/servo/components/style/properties/properties.mako.rs.orig 2019-03-22 06:01:07.000000000 +0100 +++ firefox-60.6.1/servo/components/style/properties/properties.mako.rs 2019-04-14 12:19:55.687706977 +0200 @@ -55,6 +55,7 @@ pub use self::declaration_block::*; +/// doc stub #[cfg(feature = "gecko")] #[macro_export] macro_rules! property_name {