@@ -1457,6 +1457,15 @@ def _save_ctu_summary_usage(self, dumpfile, cfg):
14571457 cppcheckdata .reportSummary (dumpfile , 'MisraUsage' , names )
14581458
14591459
1460+ def misra_1_2 (self , cfg ):
1461+ # gcc language extensions: https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
1462+ for token in cfg .tokenlist :
1463+ if simpleMatch (token , '? :' ):
1464+ self .reportError (token , 1 , 2 )
1465+ elif simpleMatch (token , '( {' ) and simpleMatch (token .next .link .previous , '; } )' ):
1466+ self .reportError (token , 1 , 2 )
1467+
1468+
14601469 def misra_1_4 (self , cfg ):
14611470 for token in cfg .tokenlist :
14621471 if token .str in ('_Atomic' , '_Noreturn' , '_Generic' , '_Thread_local' , '_Alignas' , '_Alignof' ):
@@ -4311,6 +4320,7 @@ def fillVerifyExpected(verify_expected, tok):
43114320 if not self .settings .quiet :
43124321 self .printStatus ('Checking %s, config %s...' % (dumpfile , cfg .name ))
43134322
4323+ self .executeCheck (102 , self .misra_1_2 , cfg )
43144324 if not path_premium_addon :
43154325 self .executeCheck (104 , self .misra_1_4 , cfg )
43164326 self .executeCheck (202 , self .misra_2_2 , cfg )
0 commit comments