SlideShare ist ein Scribd-Unternehmen logo
1 von 37
© Programming Research
www.programmingresearch.com
An Introduction to MISRA C:2012
Paul Burden
Webinar will start shortly
© Programming Research
2
Welcome
• A warm welcome to all our visitors
• The Webinar will last for approx 50 minutes
• We will take 10 minutes of questions at the end
© Programming Research
3
GoToWebinar Attendee Interface
© Programming Research
4
Paul Burden
• Technical Consultant working for
PRQA
• Expert in coding standards
enforcement
• Product Manager for PRQA’s
leading static analysis tool QA·C
• Prominent member of the MISRA C
Working Group since its formation
more than 10 years ago.
© Programming Research
5
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
6
MISRA C
MISRA C:1998
• Derived from PRQA standards developed for Ford and Rover
• Developed in UK for automotive applications
MISRA C:2004
• Amended and extended
• Supplemented with an Exemplar suite
MISRA C:2012
• A committee of 10 representing many years of experience
• 4 years of effort
• Released 18th March 2013
• A further step forward …
© Programming Research
7
Coding standard adoption
VDC Research
White Paper* April 2011:
“Re-evaluation of Development and Testing Practices April 2011”
Available at:
www.programmingresearch.com/whitepapers
Data obtained from 600 respondents
in Embedded and Enterprise/IT
software and systems development.
0.0%
10.0%
20.0%
30.0%
40.0%
Coding Standard Adoption
by % of Respondents
© Programming Research
8
MISRA C
• Automotive
• Aerospace
• Defence
• Medical
• Nuclear power
• Railways
• Consumer electronics
• Process control
• etc.
MISRA C is now the most widely used coding
standard for the C language - worldwide
© Programming Research
9
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
10
The Changes in MISRA C:2012
MISRA C:2012 compared to MISRA C:2004
• It's bigger
– a few more rules (159 instead of 142 )
– and the content is better
• Many guidelines are unchanged
– they may be reworded and better specified
– guideline/rule numbering has changed
• Legacy code may not be compliant
– there are new requirements – not many
– but some restrictions have been removed
© Programming Research
11
C language support
ISO:C90
• Well supported by compilers and tools
• The dangers are well understood
• Limitations – e.g. absence of Boolean type
ISO:C99
• More features, e.g. _Bool and inline functions
• More dangers, e.g. additional undefined behaviour
• Most compilers do not support all features of C99
ISO:C11
• Still relatively new
• Very limited tool support
MISRA C:1998
MISRA C:2004
MISRA C:2012
MISRA C:2012
© Programming Research
12
Guideline specification
An expanded
explanation of the
requirement
Why the guideline
is necessary
More extensive
code examples
Headline text
clarification
Exceptions
© Programming Research
13
Terminology
MISRA terminology has changed
These terms were
loosely defined and
have been replaced
The new terms are fully
defined and used to
describe expressions
of any arithmetic type
MISRA C:2004 MISRA C:2012
underlying type essential type
complex expression composite expression
effectively Boolean essentially Boolean
© Programming Research
14
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
15
Guideline classification
Category
• Advisory
• Required
• Mandatory Decidability
• Decidable
• Undecidable
Language
• C90
• C99
• C90, C99
Guideline Type
• Directive
• Rule Analysis Scope
• Single Translation Unit
• System
© Programming Research
16
Rules and Directives
Rules
– Have well defined requirements
– Are statically enforceable (subject to certain limitations)
Directives
– May be loosely defined – allowing alternative interpretations
– May address "process" or "documentation" requirements
There are now 2 types of guideline:
© Programming Research
17
Rules and Directives - examples
Rules
Rule 8.5 An external object or function shall be declared once in
one and only one file
Rule 11.3 A cast shall not be performed between a pointer to object
type and a different pointer to object type
Dir 3.1 All code shall be traceable to documented requirements
Dir 4.3 Assembly language shall be encapsulated and isolated
Directives
© Programming Research
18
Guideline categories
• Advisory guidelines
– These are recommendations
– Non-compliance is permitted at the user's discretion
– Non-compliance should be documented
– Formal deviations are not required
• Required guidelines
– Non-compliance must be supported by a formal "deviation"
• Mandatory guidelines
– Must always be obeyed
– Compliance is always required
Mandatory guidelines
were not a feature of
previous versions of
MISRA C
There are now 3 guideline categories:
© Programming Research
19
Rule decidability
A rule is decidable if it is always possible, in any program,
for a tool to determine whether code is compliant. Otherwise
the rule is undecidable
Rules are either "decidable" or "undecidable"
Rule 12.4 Evaluation of constant expressions should not lead to
unsigned integer wrap-around
Decidable …
Undecidable …
Rule 13.5 The right hand operand of a logical && or || operator shall not
contain persistent side effects
© Programming Research
20
Analysis scope
There are 2 types of "analysis scope"
Single Translation Unit Rules
System Rules
Rule 8.2 Function types shall be in prototype form with named parameters
Rule 16.4 Every switch statement shall have a default label
Rule 8.7 Functions and objects should not be defined with external
linkage if they are referenced in only one translation unit
Rule 13.5 The right hand operand of a logical && or || operator shall not
contain persistent side efects
© Programming Research
21
Guideline Classification Summary
CLASSIFICATION SUMMARY
DIRECTIVES
(16)
RULES
(143)
CATEGORY Advisory 7 32
Required 9 101
Mandatory 0 10
LANGUAGE C90 0 2
C99 0 11
C90 or C99 16 130
DECIDABILITY Decidable - 117
Undecidable - 26
ANALYSIS SCOPE Single Translation Unit - 104
System - 39
Some rules are now classified
as "mandatory"
Some rules are only relevant
for a specific language version
Some rules cannot be statically
enforced with certainty
Rules that can be enforced
within a single translation unit
are decidable
© Programming Research
22
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
23
MISRA C Compliance
• Enforceability
• Decidability
• Deviations
What do we mean by "MISRA Compliant Code" ?
© Programming Research
24
Enforceability
143
16
"The vision for the third edition of MISRA C is therefore to:
…
Increase the number of guidelines that can be processed by static analysis tools"
…
MISRA C:2012 Chapter 1 – The Vision
Rules - can be
automatically
enforced
Directives – tools can
sometimes assist with
enforcement
© Programming Research
25
Enforceability
Independent Research performed by
TERA-Labs, a new research division of
the Karel de Grote university college in
Antwerp, Belgium.
• Test code was written for 11 key rules
in MISRA C:2004 - selected by a panel
of industrial partners
• The test code was analysed using a
number of analysis tools claiming to
enforce compliancy with MISRA C
• Two tool attributes were examined
– Effectiveness in identifying rule violations
– Incidence of false positive messages
No False
Positives
Many False
Positives
All
violations
reported
No
violations
reported
GOOD
BAD
"The ability to detect the maximum number of violations possible, while minimizing the number of
false positive messages, is therefore an important factor in choosing a tool."
MISRA C:2012 Chapter 3.2 Analysis Tools
© Programming Research
26
Tool Enforcement
Tool
XYZ
The author of the TERA-Labs
report observed:
“On paper all the selected tools
claimed to provide comprehensive
MISRA C compliance checking
– but the reality was different.”
www.programmingresearch.com/resources/white-papers
© Programming Research
27
MISRA C Compliance
• Enforceability
• Decidability
• Deviations
© Programming Research
28
Decidability
"In order to use MISRA C, it is necessary to develop and document …
• A compliance matrix, showing how compliance with each MISRA C guideline will be checked"
MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C
"Where a guideline cannot be completely checked by a tool, then a manual review will be required."
MISRA C:2012 Chapter 5.3 – Compliance
117
26
16
MISRA C:2012 Guidelines
Decidable Rules
Undecidable Rules
Directives
© Programming Research
29
MISRA C Compliance
• Enforceability
• Decidability
• Deviations
What do we mean by "MISRA Compliant Code" ?
© Programming Research
30
Deviations
"In order to use MISRA C, it is necessary to develop and document …
• A deviation process by which justifiable non-compliances can be authorized and recorded "
MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C
" It is important that such deviations are properly recorded and authorized."
MISRA C:2012 Chapter 5.4 – Deviation procedure
Deviations are often necessary …
… but the process can also be abused
MISRA C ADC: Approved deviation compliance for MISRA C:2004
ISBN 978-906400-09-5 (PDF), February 2013.
Freely downloadable from www.misra.org.uk
© Programming Research
31
Deviation Management
• Deviation support
• Documentation
• Collaborative code review
• Baselining
© Programming Research
32
Agenda
In Conclusion …
© Programming Research
33
In conclusion …
• Effective, accurate, automatic enforcement
MISRA C
2012
QA
C
• Disciplined compliance and deviation management
• Enforceable, decidable, well-specified coding rules
© Programming Research
34
Do you have any questions?
© Programming Research
35
MISRA C:2012 microsite
www.programmingresearch.com/mc3
• Download our MISRA C:2012 whitepaper
• Share our 1-page MISRA C:2012 summary
• Watch our videos about coding standards
• Access the MISRA webstore
© Programming Research
36
Do you have any questions?
© Programming Research
37
Thank you
Thank you for tuning in and giving an hour of your valuable time !
We will email the video link of this presentation and a summary of
the Q&A shortly.
Email us to ask any questions or for any follow-up points of interest.
Paul Burden
paul_burden@programmingresearch.com
Please don’t forget to fill in our short survey to tell us how we did !

Weitere ähnliche Inhalte

Was ist angesagt?

SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...
SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...
SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...Embitel Technologies (I) PVT LTD
 
Formal Method for Avionics Software Verification
 Formal Method for Avionics Software Verification Formal Method for Avionics Software Verification
Formal Method for Avionics Software VerificationAdaCore
 
Formal Verification
Formal VerificationFormal Verification
Formal VerificationIlia Levin
 
How to Apply Functional Safety to Autosar ECU's
How to Apply Functional Safety to Autosar ECU'sHow to Apply Functional Safety to Autosar ECU's
How to Apply Functional Safety to Autosar ECU'sRenesas America
 
Coding standards
Coding standardsCoding standards
Coding standardsMimoh Ojha
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingSivant Kolhe
 
AUTOSAR 403 CAN Stack
AUTOSAR 403 CAN StackAUTOSAR 403 CAN Stack
AUTOSAR 403 CAN StackRania Nabil
 
MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines - MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines - Automotive IQ
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy CodeEyal Golan
 
Automotive embedded systems part5 v1
Automotive embedded systems part5 v1Automotive embedded systems part5 v1
Automotive embedded systems part5 v1Keroles karam khalil
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 
Basics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow DevicesBasics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow DevicesArrow Devices
 
Autosar software component
Autosar software componentAutosar software component
Autosar software componentFarzad Sadeghi
 

Was ist angesagt? (20)

Frequently Asked Questions on AUTOSAR Services
Frequently Asked Questions on AUTOSAR ServicesFrequently Asked Questions on AUTOSAR Services
Frequently Asked Questions on AUTOSAR Services
 
SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...
SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...
SEooC ISO 26262 | What is Safety Element Out of Context in Automotive Functio...
 
Autosar MCAL (Microcontroller Abstraction Layer)
Autosar MCAL (Microcontroller Abstraction Layer)Autosar MCAL (Microcontroller Abstraction Layer)
Autosar MCAL (Microcontroller Abstraction Layer)
 
Formal Method for Avionics Software Verification
 Formal Method for Avionics Software Verification Formal Method for Avionics Software Verification
Formal Method for Avionics Software Verification
 
Formal Verification
Formal VerificationFormal Verification
Formal Verification
 
How to Apply Functional Safety to Autosar ECU's
How to Apply Functional Safety to Autosar ECU'sHow to Apply Functional Safety to Autosar ECU's
How to Apply Functional Safety to Autosar ECU's
 
Coding standards
Coding standardsCoding standards
Coding standards
 
AUToSAR introduction
AUToSAR introductionAUToSAR introduction
AUToSAR introduction
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
AUTOSAR 403 CAN Stack
AUTOSAR 403 CAN StackAUTOSAR 403 CAN Stack
AUTOSAR 403 CAN Stack
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Embedded C - Day 2
 
MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines - MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines -
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
Code Review
Code ReviewCode Review
Code Review
 
Automotive embedded systems part5 v1
Automotive embedded systems part5 v1Automotive embedded systems part5 v1
Automotive embedded systems part5 v1
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Microcontroller part 1
Microcontroller part 1Microcontroller part 1
Microcontroller part 1
 
Basics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow DevicesBasics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow Devices
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
Autosar software component
Autosar software componentAutosar software component
Autosar software component
 

Andere mochten auch

MISRA C – Recent developments and a road map to the future
MISRA C – Recent developments and a road map to the futureMISRA C – Recent developments and a road map to the future
MISRA C – Recent developments and a road map to the futureAdaCore
 
Misra c-2004
Misra c-2004Misra c-2004
Misra c-2004sand390
 
MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016Andrew Banks
 
HIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-CHIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-CAdaCore
 
Development of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in KoreaDevelopment of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in KoreaJin Beak Park
 
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOPMisra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOPKiyoshi Ogawa
 
Multi-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical SystemsMulti-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical SystemsAdaCore
 
GNAT Pro for ARM processors
GNAT Pro for ARM processorsGNAT Pro for ARM processors
GNAT Pro for ARM processorsAdaCore
 
Achieve iso 26262 certification
Achieve iso 26262 certificationAchieve iso 26262 certification
Achieve iso 26262 certificationPRQA
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 

Andere mochten auch (12)

MISRA C – Recent developments and a road map to the future
MISRA C – Recent developments and a road map to the futureMISRA C – Recent developments and a road map to the future
MISRA C – Recent developments and a road map to the future
 
Misra c-2004
Misra c-2004Misra c-2004
Misra c-2004
 
MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016
 
HIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-CHIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-C
 
Development of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in KoreaDevelopment of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in Korea
 
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOPMisra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOP
 
Multi-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical SystemsMulti-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical Systems
 
GNAT Pro for ARM processors
GNAT Pro for ARM processorsGNAT Pro for ARM processors
GNAT Pro for ARM processors
 
Achieve iso 26262 certification
Achieve iso 26262 certificationAchieve iso 26262 certification
Achieve iso 26262 certification
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Ähnlich wie An Introduction to MISRA C:2012

Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsAndrey Karpov
 
VDA 2015 Presentation - Full
VDA 2015 Presentation - FullVDA 2015 Presentation - Full
VDA 2015 Presentation - FullAndrew Banks
 
Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?Lionel Briand
 
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...Lionel Briand
 
Misracompliant20162020
Misracompliant20162020Misracompliant20162020
Misracompliant20162020Kiyoshi Ogawa
 
Software Quality Assurance class 1
Software Quality Assurance  class 1Software Quality Assurance  class 1
Software Quality Assurance class 1Santhiya Grace
 
Lecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptxLecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptxelham706227
 
Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...ChantalWauters
 
software requirement specifcation.pptx
software requirement specifcation.pptxsoftware requirement specifcation.pptx
software requirement specifcation.pptxSACHINMAURYA57
 
Navigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding StandardsNavigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding StandardsChantalWauters
 
Model-Based Systems Requirements
Model-Based Systems RequirementsModel-Based Systems Requirements
Model-Based Systems RequirementsJean-Michel Bruel
 
Transforming the Central Office: Implementing CORD
Transforming the Central Office:  Implementing CORDTransforming the Central Office:  Implementing CORD
Transforming the Central Office: Implementing CORDRadisys Corporation
 
Quality Management and Quality Standard
Quality Management and Quality StandardQuality Management and Quality Standard
Quality Management and Quality StandardMurageppa-QA
 
Software Requirements and Specifications
Software Requirements and SpecificationsSoftware Requirements and Specifications
Software Requirements and Specificationsvustudent1
 
Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!Lionel Briand
 
Embedded Internship review
Embedded Internship reviewEmbedded Internship review
Embedded Internship reviewHadiRazak4
 
Component based development | what, why and how
Component based development | what, why and howComponent based development | what, why and how
Component based development | what, why and howRakesh Kumar Jha
 
MISRA-Compliance-2020
MISRA-Compliance-2020MISRA-Compliance-2020
MISRA-Compliance-2020Massimo Talia
 
Software product quality
Software product qualitySoftware product quality
Software product qualitytumetr1
 
MISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdfMISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdfTamilKumaran31
 

Ähnlich wie An Introduction to MISRA C:2012 (20)

Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
 
VDA 2015 Presentation - Full
VDA 2015 Presentation - FullVDA 2015 Presentation - Full
VDA 2015 Presentation - Full
 
Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?
 
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
 
Misracompliant20162020
Misracompliant20162020Misracompliant20162020
Misracompliant20162020
 
Software Quality Assurance class 1
Software Quality Assurance  class 1Software Quality Assurance  class 1
Software Quality Assurance class 1
 
Lecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptxLecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptx
 
Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...
 
software requirement specifcation.pptx
software requirement specifcation.pptxsoftware requirement specifcation.pptx
software requirement specifcation.pptx
 
Navigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding StandardsNavigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding Standards
 
Model-Based Systems Requirements
Model-Based Systems RequirementsModel-Based Systems Requirements
Model-Based Systems Requirements
 
Transforming the Central Office: Implementing CORD
Transforming the Central Office:  Implementing CORDTransforming the Central Office:  Implementing CORD
Transforming the Central Office: Implementing CORD
 
Quality Management and Quality Standard
Quality Management and Quality StandardQuality Management and Quality Standard
Quality Management and Quality Standard
 
Software Requirements and Specifications
Software Requirements and SpecificationsSoftware Requirements and Specifications
Software Requirements and Specifications
 
Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!
 
Embedded Internship review
Embedded Internship reviewEmbedded Internship review
Embedded Internship review
 
Component based development | what, why and how
Component based development | what, why and howComponent based development | what, why and how
Component based development | what, why and how
 
MISRA-Compliance-2020
MISRA-Compliance-2020MISRA-Compliance-2020
MISRA-Compliance-2020
 
Software product quality
Software product qualitySoftware product quality
Software product quality
 
MISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdfMISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdf
 

Kürzlich hochgeladen

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Kürzlich hochgeladen (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

An Introduction to MISRA C:2012

  • 1. © Programming Research www.programmingresearch.com An Introduction to MISRA C:2012 Paul Burden Webinar will start shortly
  • 2. © Programming Research 2 Welcome • A warm welcome to all our visitors • The Webinar will last for approx 50 minutes • We will take 10 minutes of questions at the end
  • 4. © Programming Research 4 Paul Burden • Technical Consultant working for PRQA • Expert in coding standards enforcement • Product Manager for PRQA’s leading static analysis tool QA·C • Prominent member of the MISRA C Working Group since its formation more than 10 years ago.
  • 5. © Programming Research 5 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 6. © Programming Research 6 MISRA C MISRA C:1998 • Derived from PRQA standards developed for Ford and Rover • Developed in UK for automotive applications MISRA C:2004 • Amended and extended • Supplemented with an Exemplar suite MISRA C:2012 • A committee of 10 representing many years of experience • 4 years of effort • Released 18th March 2013 • A further step forward …
  • 7. © Programming Research 7 Coding standard adoption VDC Research White Paper* April 2011: “Re-evaluation of Development and Testing Practices April 2011” Available at: www.programmingresearch.com/whitepapers Data obtained from 600 respondents in Embedded and Enterprise/IT software and systems development. 0.0% 10.0% 20.0% 30.0% 40.0% Coding Standard Adoption by % of Respondents
  • 8. © Programming Research 8 MISRA C • Automotive • Aerospace • Defence • Medical • Nuclear power • Railways • Consumer electronics • Process control • etc. MISRA C is now the most widely used coding standard for the C language - worldwide
  • 9. © Programming Research 9 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 10. © Programming Research 10 The Changes in MISRA C:2012 MISRA C:2012 compared to MISRA C:2004 • It's bigger – a few more rules (159 instead of 142 ) – and the content is better • Many guidelines are unchanged – they may be reworded and better specified – guideline/rule numbering has changed • Legacy code may not be compliant – there are new requirements – not many – but some restrictions have been removed
  • 11. © Programming Research 11 C language support ISO:C90 • Well supported by compilers and tools • The dangers are well understood • Limitations – e.g. absence of Boolean type ISO:C99 • More features, e.g. _Bool and inline functions • More dangers, e.g. additional undefined behaviour • Most compilers do not support all features of C99 ISO:C11 • Still relatively new • Very limited tool support MISRA C:1998 MISRA C:2004 MISRA C:2012 MISRA C:2012
  • 12. © Programming Research 12 Guideline specification An expanded explanation of the requirement Why the guideline is necessary More extensive code examples Headline text clarification Exceptions
  • 13. © Programming Research 13 Terminology MISRA terminology has changed These terms were loosely defined and have been replaced The new terms are fully defined and used to describe expressions of any arithmetic type MISRA C:2004 MISRA C:2012 underlying type essential type complex expression composite expression effectively Boolean essentially Boolean
  • 14. © Programming Research 14 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 15. © Programming Research 15 Guideline classification Category • Advisory • Required • Mandatory Decidability • Decidable • Undecidable Language • C90 • C99 • C90, C99 Guideline Type • Directive • Rule Analysis Scope • Single Translation Unit • System
  • 16. © Programming Research 16 Rules and Directives Rules – Have well defined requirements – Are statically enforceable (subject to certain limitations) Directives – May be loosely defined – allowing alternative interpretations – May address "process" or "documentation" requirements There are now 2 types of guideline:
  • 17. © Programming Research 17 Rules and Directives - examples Rules Rule 8.5 An external object or function shall be declared once in one and only one file Rule 11.3 A cast shall not be performed between a pointer to object type and a different pointer to object type Dir 3.1 All code shall be traceable to documented requirements Dir 4.3 Assembly language shall be encapsulated and isolated Directives
  • 18. © Programming Research 18 Guideline categories • Advisory guidelines – These are recommendations – Non-compliance is permitted at the user's discretion – Non-compliance should be documented – Formal deviations are not required • Required guidelines – Non-compliance must be supported by a formal "deviation" • Mandatory guidelines – Must always be obeyed – Compliance is always required Mandatory guidelines were not a feature of previous versions of MISRA C There are now 3 guideline categories:
  • 19. © Programming Research 19 Rule decidability A rule is decidable if it is always possible, in any program, for a tool to determine whether code is compliant. Otherwise the rule is undecidable Rules are either "decidable" or "undecidable" Rule 12.4 Evaluation of constant expressions should not lead to unsigned integer wrap-around Decidable … Undecidable … Rule 13.5 The right hand operand of a logical && or || operator shall not contain persistent side effects
  • 20. © Programming Research 20 Analysis scope There are 2 types of "analysis scope" Single Translation Unit Rules System Rules Rule 8.2 Function types shall be in prototype form with named parameters Rule 16.4 Every switch statement shall have a default label Rule 8.7 Functions and objects should not be defined with external linkage if they are referenced in only one translation unit Rule 13.5 The right hand operand of a logical && or || operator shall not contain persistent side efects
  • 21. © Programming Research 21 Guideline Classification Summary CLASSIFICATION SUMMARY DIRECTIVES (16) RULES (143) CATEGORY Advisory 7 32 Required 9 101 Mandatory 0 10 LANGUAGE C90 0 2 C99 0 11 C90 or C99 16 130 DECIDABILITY Decidable - 117 Undecidable - 26 ANALYSIS SCOPE Single Translation Unit - 104 System - 39 Some rules are now classified as "mandatory" Some rules are only relevant for a specific language version Some rules cannot be statically enforced with certainty Rules that can be enforced within a single translation unit are decidable
  • 22. © Programming Research 22 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 23. © Programming Research 23 MISRA C Compliance • Enforceability • Decidability • Deviations What do we mean by "MISRA Compliant Code" ?
  • 24. © Programming Research 24 Enforceability 143 16 "The vision for the third edition of MISRA C is therefore to: … Increase the number of guidelines that can be processed by static analysis tools" … MISRA C:2012 Chapter 1 – The Vision Rules - can be automatically enforced Directives – tools can sometimes assist with enforcement
  • 25. © Programming Research 25 Enforceability Independent Research performed by TERA-Labs, a new research division of the Karel de Grote university college in Antwerp, Belgium. • Test code was written for 11 key rules in MISRA C:2004 - selected by a panel of industrial partners • The test code was analysed using a number of analysis tools claiming to enforce compliancy with MISRA C • Two tool attributes were examined – Effectiveness in identifying rule violations – Incidence of false positive messages No False Positives Many False Positives All violations reported No violations reported GOOD BAD "The ability to detect the maximum number of violations possible, while minimizing the number of false positive messages, is therefore an important factor in choosing a tool." MISRA C:2012 Chapter 3.2 Analysis Tools
  • 26. © Programming Research 26 Tool Enforcement Tool XYZ The author of the TERA-Labs report observed: “On paper all the selected tools claimed to provide comprehensive MISRA C compliance checking – but the reality was different.” www.programmingresearch.com/resources/white-papers
  • 27. © Programming Research 27 MISRA C Compliance • Enforceability • Decidability • Deviations
  • 28. © Programming Research 28 Decidability "In order to use MISRA C, it is necessary to develop and document … • A compliance matrix, showing how compliance with each MISRA C guideline will be checked" MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C "Where a guideline cannot be completely checked by a tool, then a manual review will be required." MISRA C:2012 Chapter 5.3 – Compliance 117 26 16 MISRA C:2012 Guidelines Decidable Rules Undecidable Rules Directives
  • 29. © Programming Research 29 MISRA C Compliance • Enforceability • Decidability • Deviations What do we mean by "MISRA Compliant Code" ?
  • 30. © Programming Research 30 Deviations "In order to use MISRA C, it is necessary to develop and document … • A deviation process by which justifiable non-compliances can be authorized and recorded " MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C " It is important that such deviations are properly recorded and authorized." MISRA C:2012 Chapter 5.4 – Deviation procedure Deviations are often necessary … … but the process can also be abused MISRA C ADC: Approved deviation compliance for MISRA C:2004 ISBN 978-906400-09-5 (PDF), February 2013. Freely downloadable from www.misra.org.uk
  • 31. © Programming Research 31 Deviation Management • Deviation support • Documentation • Collaborative code review • Baselining
  • 33. © Programming Research 33 In conclusion … • Effective, accurate, automatic enforcement MISRA C 2012 QA C • Disciplined compliance and deviation management • Enforceable, decidable, well-specified coding rules
  • 34. © Programming Research 34 Do you have any questions?
  • 35. © Programming Research 35 MISRA C:2012 microsite www.programmingresearch.com/mc3 • Download our MISRA C:2012 whitepaper • Share our 1-page MISRA C:2012 summary • Watch our videos about coding standards • Access the MISRA webstore
  • 36. © Programming Research 36 Do you have any questions?
  • 37. © Programming Research 37 Thank you Thank you for tuning in and giving an hour of your valuable time ! We will email the video link of this presentation and a summary of the Q&A shortly. Email us to ask any questions or for any follow-up points of interest. Paul Burden paul_burden@programmingresearch.com Please don’t forget to fill in our short survey to tell us how we did !

Hinweis der Redaktion

  1. NOTES The GoToMeeting attendee interface is made up of two parts. The Viewer Window is where attendees see the presenter’s screen. The Viewer Window can be resized by clicking and dragging the lower right corner. The Control Panel is where attendees can interact with organizers. Click 1, 2 and 3: Clicking the arrows on the Grab Tab opens and closes the Control Panel. Click 4: Audio pane provides audio information. If the organizer has given attendees a choice, there are two options. Attendees joined via VoIP (Use Mic & Speakers) need speakers to hear. Click 5 and 6: Attendees can also joined via telephone. Click 6: Attendees can communicate with organizers and other attendees through the Chat box (if enabled by the organizer). Click 7: In the View menu, uncheck “Auto-Hide the Control Panel” if attendees want their Control Panel to remain open.