MISRA C:2012 Example-Suite https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite
The road to completion of compilation
Execute [user] with the actual folder name with the docker command below. First, I introduced the regular version of GCC considering compiling with GCC.
macOS
$ docker run -v /Users/[user]/Downloads/misra:/tmp/misra -it gcc /bin/bash
Since I edit using the editor on the PC side, I share the folder.
# cd /tmp/misra
# git clone https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite.git
# cd Example-Suite/
You can do other work while introducing it, though you can do it later.
docker
# apt update; apt -y upgrade
# apt install -y vim wget sudo apt-utils curl clang
File name list
D_01_01.c D_01_support.c D_01_system.c D_02_01.c D_02_support.c D_02_system.c D_03_01.c D_03_support.c D_03_system.c D_04_01.c D_04_01.h D_04_02.c D_04_03.c D_04_04.c D_04_05.c D_04_06.c D_04_07.c D_04_08.h D_04_08_1.c D_04_08_2.c D_04_09.c D_04_10.c D_04_10_1.h D_04_10_2.h D_04_10_3.h D_04_11.c D_04_12.c D_04_13.c D_04_13.h D_04_14.c D_04_support.c D_04_system.c README.md R_01_01.c R_01_02.c R_01_03.c R_01_support.c R_01_system.c R_02_01.h R_02_01_1.c R_02_01_2.c R_02_02.c R_02_02.h R_02_03.c R_02_03.h R_02_04.c R_02_04.h R_02_05.c R_02_05.h R_02_06.c R_02_07.c R_02_support.c R_02_system.c R_03_01.c R_03_02.c R_03_support.c R_03_system.c R_04_01.c R_04_02.c R_04_support.c R_04_system.c R_05_01.h R_05_01_1.c R_05_01_2.c R_05_02.c R_05_03.c R_05_03.h R_05_04.c R_05_05.c R_05_06.c R_05_06.h R_05_07.c R_05_07.h R_05_08.h R_05_08_1.c R_05_08_2.c R_05_09.h R_05_09_1.c R_05_09_2.c R_05_support.c R_05_system.c R_06_01.c R_06_02.c R_06_support.c R_06_system.c R_07_01.c R_07_02.c R_07_03.c R_07_04.c R_07_04.h R_07_support.c R_07_system.c R_08_01.c R_08_02.c R_08_03.c R_08_03.h R_08_04.c R_08_04.h R_08_05.h R_08_05_1.c R_08_05_2.c R_08_06.h R_08_06_1.c R_08_06_2.c R_08_07.h R_08_07_1.c R_08_07_2.c R_08_08.c R_08_09.c R_08_09.h R_08_10.c R_08_11.h R_08_11_1.c R_08_11_2.c R_08_12.c R_08_13.h R_08_13_1.c R_08_13_2.c R_08_14.c R_08_support.c R_08_system.c R_09_01.c R_09_01.h R_09_02.c R_09_03.c R_09_04.c R_09_05.c R_09_support.c R_09_system.c R_10_01.c R_10_02.c R_10_03.c R_10_04.c R_10_04.h R_10_05.c R_10_06.c R_10_07.c R_10_08.c R_10_support.c R_10_system.c R_11_01.c R_11_02.c R_11_03.c R_11_04.c R_11_05.c R_11_06.c R_11_07.c R_11_08.c R_11_09.c R_11_support.c R_11_system.c R_12_01.c R_12_01.h R_12_02.c R_12_02.h R_12_03.c R_12_04.c R_12_05.c R_12_support.c R_12_system.c R_13_01.h R_13_01_1.c R_13_01_2.c R_13_02.c R_13_02.h R_13_03.c R_13_04.c R_13_05.h R_13_05_1.c R_13_05_2.c R_13_06.c R_13_support.c R_13_system.c R_14_01.c R_14_01.h R_14_02.c R_14_02.h R_14_03.c R_14_03.h R_14_04.c R_14_support.c R_14_system.c R_15_01.c R_15_02.c R_15_03.c R_15_04.c R_15_04.h R_15_05.c R_15_06.c R_15_06.h R_15_07.c R_15_07.h R_15_support.c R_15_system.c R_16_01.c R_16_02.c R_16_03.c R_16_04.c R_16_05.c R_16_06.c R_16_07.c R_16_support.c R_16_system.c R_17_01.c R_17_02.c R_17_02.h R_17_03.c R_17_04.c R_17_05.c R_17_05.h R_17_06.c R_17_07.c R_17_08.c R_17_08.h R_17_support.c R_17_system.c R_18_01.c R_18_01.h R_18_02.c R_18_02.h R_18_03.c R_18_03.h R_18_04.c R_18_05.c R_18_06.h R_18_06_1.c R_18_06_2.c R_18_07.c R_18_08.c R_18_support.c R_18_system.c R_19_01.c R_19_01.h R_19_02.c R_19_support.c R_19_system.c R_20_01.c R_20_01.h R_20_02.c R_20_03.c R_20_03.h R_20_04.c R_20_05.c R_20_06.c R_20_07.c R_20_08.c R_20_09.c R_20_10.c R_20_11.c R_20_12.c R_20_13.c R_20_14.c R_20_14_1.h R_20_14_2.h R_20_support.c R_20_system.c R_21_01.c R_21_02.c R_21_03.c R_21_04.c R_21_05.c R_21_06.c R_21_07.c R_21_08.c R_21_09.c R_21_10.c R_21_11.c R_21_12.c R_21_13.c R_21_14.c R_21_14.h R_21_15.c R_21_16.c R_21_17.c R_21_18.c R_21_19.c R_21_20.c R_21_support.c R_21_system.c R_22_01.c R_22_01.h R_22_02.c R_22_02.h R_22_03.c R_22_03.h R_22_04.c R_22_04.h R_22_05.c R_22_05.h R_22_06.c R_22_06.h R_22_07.c R_22_08.c R_22_09.c R_22_10.c R_22_support.c R_22_system.c mc3_header.h mc3_types.h
cat D_01_system.c /*
include "mc3_types.h" include "mc3_header.h"
int main ( void ) { D_1_main_support ( ); return 0; }
/* end of D_01_system.c */
xx_system.All you have to do is compile and run c.
# 5.shell script creation
You can use make, but for the time being, use shell.
# 6. misra_c.h edit
So far, MISRA code fragments, C, C++Edit the header file used to compile the code fragment of the language standard with vi.
MISRA C Summary#include <misra_c.h>
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9
#Progress
The corrected sources created by MISRA one by one will be explained separately.
docker(201) gcc(gnu), clang(llvm)Compile error / warning comparison(1) D_04_03.c
https://qiita.com/kaizen_nagoya/items/780be9109348340e20e0
docker(202) gcc(gnu), clang(llvm)Compile error / warning comparison(2) R_02_02.c
https://qiita.com/kaizen_nagoya/items/496869b87dd3d29cea8b
docker(203) gcc(gnu), clang(llvm)Compile error / warning comparison(3) R_05_03.c
https://qiita.com/kaizen_nagoya/items/cb0d1da183f4f1e9e59d
docker(204) gcc(gnu), clang(llvm)Compile error / warning comparison(4) R_07_04.c
https://qiita.com/kaizen_nagoya/items/73b9f16638273a74d807
docker(205) gcc(gnu), clang(llvm)Compile error / warning comparison(5) R_08_04.c
https://qiita.com/kaizen_nagoya/items/c753db14cc95a9303fa5
docker(206) gcc(gnu), clang(llvm)Compile error / warning comparison(6) R_09_0x.c
https://qiita.com/kaizen_nagoya/items/8ad38c8728440688255c
docker(207) gcc(gnu), clang(llvm)Compile error / warning comparison(7) R_10_0x.c
https://qiita.com/kaizen_nagoya/items/05dd6f6c14aeafbe3e71
docker(208) gcc(gnu), clang(llvm)Compile error / warning comparison(8) R_11_0x.c
https://qiita.com/kaizen_nagoya/items/9962647a1b510825fa6e
docker(209) gcc(gnu), clang(llvm)Compile error / warning comparison(9) R_13_0x.c
https://qiita.com/kaizen_nagoya/items/dcd2de1267e3c3449536
docker(210) gcc(gnu), clang(llvm)Compile error / warning comparison(10) R_14_0x.c
https://qiita.com/kaizen_nagoya/items/772f49486e7cca1dbeb9
#The end of the road
Work results on Docker hub
#### **`macOS`**
```shell-session
$ docker push kaizenjapan/misra_c_2012_example
#The day after the last day of the journey
To continue the next day
$ docker run -v /Users/[user]/Downloads/misra:/tmp/misra -it kaizenjapan/misra_c_2012_example /bin/bash
MISRA C Summary#include <misra_c.h> https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9
#Environment
docker gcc(g++) and llvm(clang++) https://qiita.com/kaizen_nagoya/items/059874ea39c4de64c0f7
docker(40)3 types of C compiler with docker(Part 2) https://qiita.com/kaizen_nagoya/items/8f5b7fd977597269a7e7
February 2020, MISRA Compliance:2020 https://www.misra.org.uk/forum/viewtopic.php?f=241&t=1842 ISBN 978-1-906400-26-2
was published as second version.
August 2016, MISRA Compliance:2016 https://www.misra.org.uk/forum/viewtopic.php?f=241&t=1561 was published first version.
I compare 2 documents and consider the difference. And some propose are proposed.
Preface Contents Before MISRA MISRA history Comparison of MISRA Compliance:2016 and 2020
#MISRA history
| word | word | count |
|---|---|---|
| the | That | 842 |
| of | of | 433 |
| to | To | 376 |
| a | a | 369 |
| be | Become | 265 |
| and | And | 223 |
| is | is | 222 |
| in | To | 209 |
| code | Millionaire | 163 |
| for | for | 135 |
| that | It | 133 |
| guidelines | Guidelines | 115 |
| are | Is | 114 |
| as | So | 108 |
| it | It | 99 |
| by | Along | 97 |
| misra | MISRA | 96 |
| with | When | 95 |
| compliance | Compliance | 91 |
| may | May | 88 |
| guideline | Guidelines | 87 |
| which | which one | 80 |
| or | Or | 79 |
| this | this | 75 |
| not | Absent | 74 |
| deviation | deviation | 71 |
| an | of | 63 |
| tool | tool | 59 |
| process | To process | 58 |
| project | business | 58 |
| analysis | analysis | 56 |
| required | Mandatory | 53 |
| adopted | Recruitment | 52 |
| compiler | compiler | 52 |
| will | will | 51 |
| any | Any | 48 |
| been | Is | 48 |
| on | above | 47 |
| rule | Rules | 47 |
| have | Have | 44 |
| use | use | 42 |
| can | it can | 41 |
| development | development of | 41 |
| there | There | 40 |
| within | within | 40 |
| software | software | 39 |
| violations | violation | 39 |
| when | When | 38 |
| deviations | deviation | 37 |
| should | should | 37 |
| c | c | 36 |
| has | have | 36 |
| possible | Possible | 36 |
| tools | tool | 36 |
| time | time | 35 |
| example | Example | 34 |
| if | if | 34 |
| language | language | 34 |
| used | second hand | 34 |
| re | Re | 31 |
| requirements | Requirements | 30 |
| acquirer | Acquirer | 29 |
| these | these | 29 |
| some | A few | 27 |
| static | static | 27 |
| such | like that | 27 |
| supplier | Supplier | 27 |
| compliant | Compliant | 26 |
| from | From | 26 |
| advisory | advice | 25 |
| but | But | 25 |
| quality | quality | 25 |
| violation | violation | 25 |
| mandatory | Mandatory | 23 |
| must | Must | 23 |
| standard | standard | 23 |
| at | so | 22 |
| source | source | 22 |
| system | system | 22 |
| all | all | 21 |
| document | Document | 20 |
| following | Less than | 20 |
| iso | iso | 19 |
| only | only | 19 |
| order | order | 19 |
| other | Other | 19 |
| shall | To do | 19 |
| behaviour | motion | 18 |
| categorized | Classified | 18 |
| category | Classification | 18 |
| developed | Developed | 18 |
| each | each | 18 |
| grp | grp | 18 |
| level | level | 18 |
| library | library | 18 |
| no | number | 18 |
| section | section | 18 |
| where | Where | 18 |
| being | To be | 17 |
| native | Innate | 17 |
| need | necessary | 17 |
| organization | Organization | 17 |
| record | Record | 17 |
| scope | range | 17 |
| also | Also | 16 |
| between | Between | 16 |
| defined | Defined | 16 |
| permits | Permit | 16 |
| plan | plans | 16 |
| their | their | 16 |
| they | they | 16 |
| type | Type | 16 |
| would | will do | 16 |
| applied | Applied | 15 |
| b | b | 15 |
| different | Wrong | 15 |
| does | To do | 15 |
| iec | iec | 15 |
| issues | problem | 15 |
| metrics | Measurement standard | 15 |
| permit | Permit | 15 |
| rules | Rules | 15 |
| safety | safety | 15 |
| therefore | Therefore | 15 |
| both | both | 14 |
| case | If | 14 |
| enforcement | Execution | 14 |
| ensure | Secure | 14 |
| many | many | 14 |
| more | More | 14 |
| permitted | Allowed | 14 |
| s | s | 14 |
| systems | system | 14 |
| validation | Verification | 14 |
| comply | Follow | 13 |
| disapplied | Disappointed | 13 |
| however | However | 13 |
| implementation | Implementation | 13 |
| means | means | 13 |
| one | 1 | 13 |
| same | the same | 13 |
| appendix | appendix | 12 |
| bit | Binary number | 12 |
| categorization | Classification | 12 |
| during | inside | 12 |
| header | header | 12 |
| necessary | necessary | 12 |
| object | Target | 12 |
| style | form | 12 |
| approved | approved | 11 |
| cannot | Can not | 11 |
| cases | Incident | 11 |
| coding | coding | 11 |
| configured | Preconfigured | 11 |
| described | explained | 11 |
| documentation | documentation | 11 |
| expression | Facial expression | 11 |
| files | File | 11 |
| identified | Identified | 11 |
| information | information | 11 |
| its | That | 11 |
| made | Made | 11 |
| provide | provide | 11 |
| provided | Offer | 11 |
| review | Review | 11 |
| security | relief | 11 |
| staff | Factor | 11 |
| those | Those | 11 |
| translation | translation | 11 |
| appropriate | Appropriate | 10 |
| available | Available | 10 |
| developer | Developer | 10 |
| essential | Mandatory | 10 |
| even | even | 10 |
| file | File | 10 |
| important | important | 10 |
| make | create | 10 |
| messages | message | 10 |
| multiplication | Multiply | 10 |
| non | Non | 10 |
| note | Caution | 10 |
| operands | Operator | 10 |
| processes | process | 10 |
| reason | Reason | 10 |
| records | Record | 10 |
| result | result | 10 |
| reviewed | Examination | 10 |
| then | afterwards | 10 |
| undecidable | Can't decide | 10 |
| using | using | 10 |
| version | Edition | 10 |
| wider | wide | 10 |
| without | None | 10 |
| additional | add to | 9 |
| apply | Apply | 9 |
| checking | Confirm | 9 |
| control | control | 9 |
| functional | functional | 9 |
| gcs | gcs | 9 |
| how | how | 9 |
| international | international | 9 |
| macro | large | 9 |
| management | management | 9 |
| produced | Produced | 9 |
| product | Product | 9 |
| programming | programming | 9 |
| run | Run | 9 |
| violated | Violated | 9 |
| analyser | Analyst | 8 |
| associated | Relation | 8 |
| checked | Inspected | 8 |
| checks | Inspection | 8 |
| claim | Claim | 8 |
| compilers | compiler | 8 |
| composite | composite | 8 |
| do | Do | 8 |
| e | e | 8 |
| every | every | 8 |
| form | form | 8 |
| given | given | 8 |
| introduced | Introduction | 8 |
| message | message | 8 |
| might | May | 8 |
| number | number | 8 |
| part | Department | 8 |
| practice | practice | 8 |
| produce | produce | 8 |
| provides | provide | 8 |
| set | Set | 8 |
| single | single | 8 |
| standardization | Standardization | 8 |
| standards | standard | 8 |
| step | one step | 8 |
| summary | Overview | 8 |
| supported | Supported | 8 |
| two | two | 8 |
| value | value | 8 |
| various | various | 8 |
| versions | Edition | 8 |
| activities | Activities | 7 |
| agreement | Agreement | 7 |
| binary | Binary | 7 |
| check | check | 7 |
| correct | correct | 7 |
| could | maybe......right | 7 |
| define | Define | 7 |
| dir | dir | 7 |
| documents | Documents | 7 |
| execution | Run | 7 |
| extensions | Expansion | 7 |
| function | function | 7 |
| include | Including | 7 |
| into | To | 7 |
| ltd | Co., Ltd. | 7 |
| most | most | 7 |
| nature | Nature | 7 |
| options | Choices | 7 |
| performance | Performance | 7 |
| program | program | 7 |
| providing | Offer | 7 |
| related | Relating | 7 |
| report | Report | 7 |
| require | I need | 7 |
| risk | Danger | 7 |
| see | to see | 7 |
| significant | important | 7 |
| situations | Status | 7 |
| size | size | 7 |
| so | so | 7 |
| specified | Specified | 7 |
| support | support | 7 |
| task | jobs | 7 |
| testing | test | 7 |
| training | Training | 7 |
| uint | uint | 7 |
| well | Good | 7 |
| whether | whether | 7 |
| written | Recorded | 7 |
| approach | manner | 6 |
| because | Because | 6 |
| capable | Talented | 6 |
| circumstances | Status | 6 |
| claimed | Insisted | 6 |
| classification | Classification | 6 |
| clearly | Clearly | 6 |
| consider | consider | 6 |
| design | design | 6 |
| diagnosis | Diagnosis | 6 |
| directive | Command | 6 |
| effort | effort | 6 |
| errors | Apologize | 6 |
| exactly | exactly | 6 |
| examples | Example | 6 |
| f | f | 6 |
| guide | guidance | 6 |
| horiba | Horiba | 6 |
| implement | Implement | 6 |
| included | Including | 6 |
| likely | maybe | 6 |
| limited | Limited | 6 |
| list | List | 6 |
| mira | MIRA | 6 |
| outside | outside | 6 |
| over | that's all | 6 |
| particular | In particular | 6 |
| performed | Executed | 6 |
| phase | stage | 6 |
| place | place | 6 |
| references | reference | 6 |
| simply | simply | 6 |
| since | Since then | 6 |
| sometimes | Sometimes | 6 |
| specific | definite | 6 |
| t | t | 6 |
| taken | Taken | 6 |
| than | Than | 6 |
| types | Type | 6 |
| understanding | Understanding | 6 |
| unit | unit | 6 |
| FALSE | false | 6 |
Recommended Posts