Development Guidelines:MISRA C

From coreboot
Revision as of 00:43, 16 February 2014 by MrNuke (talk | contribs) (Created page with "== General Guidelines == * Encapsulate and isolate assembly language * Code shall not be "commented out" * No use of floating-point arithmetics * No hiding of identifiers def...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!

General Guidelines

  • Encapsulate and isolate assembly language
  • Code shall not be "commented out"
  • No use of floating-point arithmetics
  • No hiding of identifiers defined in outer scopes
  • Typedefs are unique (device_t?)
  • Functions shall have prototype declarations
  • Local functions should be declared static
  • No definitions in header files
  • All variables are assigned before use
  • All objects should have fully qualified types (unsigned int instead of unsigned)
  • We suggest trying to import more such rules, such as additional ones described in MISRA-C 2012 (Guidelines for the use of C in critical systems)