Skip to content

Instantly share code, notes, and snippets.

@jimblandy
Last active October 30, 2017 17:28
Show Gist options
  • Save jimblandy/df3837f3567dad4fd5b7e30e6fbe892b to your computer and use it in GitHub Desktop.
Save jimblandy/df3837f3567dad4fd5b7e30e6fbe892b to your computer and use it in GitHub Desktop.
Doc fix for `MOZ_NON_PARAM`
diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -571,17 +571,22 @@
* or via functions called from the constructor body.
* MOZ_IS_CLASS_INIT: Applies to class method declarations. Occasionally the
* constructor doesn't initialize all of the member variables and another function
* is used to initialize the rest. This marker is used to make the static analysis
* tool aware that the marked function is part of the initialization process
* and to include the marked function in the scan mechanism that determines witch
* member variables still remain uninitialized.
* MOZ_NON_PARAM: Applies to types. Makes it compile time error to use the type
- * in parameter without pointer or reference.
+ * in parameter without pointer or reference. Visual Studio does not permit
+ * extra alignment requirements on parameters, so passing a type by value that
+ * uses alignas(T) causes an error (C2719). Types like Vector and Maybe use
+ * alignas on the inline buffers that hold their values; marking them with
+ * this attribute helps us catch attempts to pass them earlier on other
+ * platforms, without waiting for a Windows build to fail.
* MOZ_NON_AUTOABLE: Applies to class declarations. Makes it a compile time error to
* use `auto` in place of this type in variable declarations. This is intended to
* be used with types which are intended to be implicitly constructed into other
* other types before being assigned to variables.
* MOZ_REQUIRED_BASE_METHOD: Applies to virtual class method declarations.
* Sometimes derived classes override methods that need to be called by their
* overridden counterparts. This marker indicates that the marked method must
* be called by the method that it overrides.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment