Qa·C Release Notes
Total Page:16
File Type:pdf, Size:1020Kb
RELEASE NOTES QA·C 9.4.1 February, 2018 Documentation Version 1.3 IMPORTANT NOTICE DISCLAIMER OF WARRANTY This document should only be used in conjunction with QA·C 9.4.1. Programming Research Ltd. have taken due care in preparing this document which it has endeavored to ensure is accurate at the time of printing. However, no liability can be accepted for errors or omissions; nor should the document be considered as an expressed or implied warranty of accuracy or completeness, fitness for a particular purpose, or that the products described perform as specified within. COPYRIGHT NOTICE All rights reserved. No part of this document may be reproduced, stored in a retrieval system of any nature, or transmitted in any form or by any means, including photocopying and recording, without the prior written permission of Programming Research Ltd., the copyright owner. If any unauthorized acts are carried out in relation to this copyrighted work, a civil claim for damages may be made and/or a criminal prosecution may result. Copyright ©Programming Research Ltd. 2018 TRADEMARKS PRQA, the PRQA logo, QA·C, QA·C++ and High Integrity C++ (HIC++) are trademarks of Programming Research Ltd. "MISRA", "MISRA C" and "MISRA C++" are registered trademarks of HORIBA MIRA Lim- ited, held on behalf of the MISRA Consortium. "AUTOSAR" is a registered trademark of AUTOSAR GBR, held on behalf of the AU- TOSAR Development Partnership. Yices is a registered trademark of SRI International. Windows is a registered trademark of Microsoft Corporation. RELEASE NOTES : QA·C 9.4.1 Page i Programming Research Ltd. CONTACTING PROGRAMMING RESEARCH LTD For technical support, contact your nearest Programming Research Ltd. authorized dis- tributor or, alternatively, the Programming Research Ltd. head office as follows: by telephone on +44 (0) 1932 888 080 by fax on +44 (0) 1932 888 081 or by webpage: www.prqa.com/services/contact-support/ RELEASE NOTES : QA·C 9.4.1 Page ii Programming Research Ltd. Contents 1 Introduction1 2 QA·C Changes Overview2 2.1 Functional Changes in QA·C 9.4.1.......................2 2.1.1 Support for C99 Hexadecimal Floating Point.............2 2.1.2 Enhanced Analysis of Missing Const.................2 2.2 Functional Changes in QA·C 9.4.0.......................3 2.2.1 Analysis of Commented Out Code...................3 2.2.2 Other Changes in QA·C 9.4.0.....................4 2.3 Functional Changes in QA·C 9.3.0.......................4 2.3.1 MISRA C 2012 Improvements.....................4 2.3.2 Configuration Changes.........................4 2.3.3 End of line continuation character...................4 2.4 Functional Changes in QA·C 9.2.0.......................5 2.4.1 Full Support for Designated Initializers................5 2.4.1.1 Designated array members resulting in out of bounds..5 2.4.1.2 Overwritten initializers....................6 2.4.1.3 Diagnostic Locations in Initializers.............6 2.4.2 Dataflow.................................7 2.4.2.1 Header Function Analysis..................7 2.4.3 Metric Improvements..........................7 2.4.3.1 Ticket 24385.........................7 2.4.3.2 Ticket 24386.........................9 2.4.3.3 Ticket 24387.........................9 2.4.4 Known Issues..............................9 2.4.4.1 Use of -extensions Option with Assembly.........9 2.5 Functional Changes in QA·C 9.1.1....................... 10 2.5.1 Justification for Comment Based Suppressions............ 10 2.6 Functional Changes in QA·C 9.1.0....................... 10 2.6.1 Messages Location Changes...................... 10 2.6.2 Support for GCC language extensions................ 11 2.6.2.1 Nested Functions...................... 11 2.6.2.2 Statement Expressions................... 11 2.6.3 Dataflow................................. 12 2.6.3.1 Query Timeout Message.................. 12 2.6.3.2 Buffer Overflow Checking.................. 13 2.6.3.3 Parameters Declared with Array Syntax.......... 13 3 QA·C Messages 14 3.1 Messages for QA·C 9.4.1............................ 14 3.1.1 New Messages............................. 14 3.1.2 Messages with Modified Behavior................... 14 RELEASE NOTES : QA·C 9.4.1 Page iii Programming Research Ltd. 3.2 Messages for QA·C 9.4.0............................ 41 3.2.1 New Messages............................. 41 3.2.2 Messages with Modified Behavior................... 48 3.2.3 Message Text Changes......................... 118 3.3 Messages for QA·C 9.3.1............................ 120 3.3.1 Messages with Modified Behavior................... 120 3.4 Messages for QA·C 9.3.0............................ 125 3.4.1 New Messages............................. 125 3.4.2 Removed Messages.......................... 151 3.4.3 Messages with Modified Behavior................... 153 3.4.4 Message Text Changes......................... 362 3.5 Messages for QA·C 9.2.0............................ 364 3.5.1 New Messages............................. 364 3.5.2 Messages with Modified Behavior................... 372 3.5.3 Message Text Changes......................... 450 3.6 Messages for QA·C 9.1.1............................ 451 3.6.1 New Messages............................. 451 3.6.2 Messages with Modified Behavior................... 451 3.7 Messages for QA·C 9.1.0............................ 454 3.7.1 New Messages............................. 454 3.7.2 Messages with Modified Behavior................... 468 4 QA·C Ticket Summary 486 4.1 Ticket Summary for QA·C 9.4.1......................... 486 4.2 Ticket Summary for QA·C 9.4.0......................... 487 4.3 Ticket Summary for QA·C 9.3.1......................... 502 4.4 Ticket Summary for QA·C 9.3.0......................... 504 4.5 Ticket Summary for QA·C 9.2.0......................... 523 4.6 Ticket Summary for QA·C 9.1.1......................... 541 4.7 Ticket Summary for QA·C 9.1.0......................... 542 RELEASE NOTES : QA·C 9.4.1 Page iv Programming Research Ltd. 1 Introduction Version 9.4.1 of QA·C is a patch release. This document provides information on the feature additions and fixes made in the re- lease. RELEASE NOTES : QA·C 9.4.1 Page 1 Programming Research Ltd. 2 QA·C Changes Overview 2.1 Functional Changes in QA·C 9.4.1 2.1.1 Support for C99 Hexadecimal Floating Point ISO:C99 allows that floating constants can be expressed in hexadecimal representation in addition to decimal representation. In line with this, QA·C is now able to parse the syntax of floating point constants. QA·C also generates a new C99 language extension message (1076) to report the use of hexadecimal floating point constants, for example: /*PRQA S 1076 ++*/ double val = 0x1.1p4; /* Hexadecimal floating constant */ 2.1.2 Enhanced Analysis of Missing Const The QA·C 9.4.1 type system has been reworked to allow for better analysis of missing const, specifically through the analysis of pointer to types. Specifically, QA·C is now able to identify pointers/pointer variables which exist in block scope and point to non-const- qualified types, but which could instead point to const-qualified types. QA·C also generates new messages (3678, 3679 and 3695) to indicate when a local or static pointer variable could be declared with increased const-qualification, for example: /*PRQA S 0-9999 ++*/ /*PRQA S 3678 --*/ void foo (int * x) { int * y; /* No message */ int * z; /* Message 3678 - could be 'int const *' */ int * w; /* Message 3678 - could be 'int const *' */ y = x; z = y; w = z; * y = '\0'; } void take_ip (int * p); void take_icp (int * cp); void take_ipp (int ** pp); RELEASE NOTES : QA·C 9.4.1 Page 2 Programming Research Ltd. void bar (int * x) { int * s = x; /* No message */ int * t = x; /* Message 3678 - could be 'int const *' */ int * u = x; /* No message */ take_ip (s); take_icp (t); take_ipp (&u); } void baz (int i) { int arr[] = { 1, 2, 3, 4, 5 }; /* Message 3678 - could be 'int const [5]' */ return arr[i]; } Note: There are known false positive instances of 3678, 3679 and 3695, where typedefs are used to build derived types. For example: typedef int Num; void incorrect (Num x) { Num a[5] = { x }; // false positive 3678 Num * p = a; p[1] = 6; } 2.2 Functional Changes in QA·C 9.4.0 2.2.1 Analysis of Commented Out Code QA·C 9.4.0 provides the analysis of commented out code, for both line and block com- ments, by tokenizing comments and using a triplet-based algorithm (described in the message help) to compare the comments against a table of "common code sequences" gathered from real-world, standard-compliant projects. While TU (Translation Unit) code is being parsed, this table is dynamically updated with the sequences of tokens found in the code, and the token statistics for the project currently being parsed are updated accordingly. The configuration option -po comment::dynamic_statistics allows you to control this update behavior. The option is enabled by default, being set to -po comment::dynamic_statistics+. RELEASE NOTES : QA·C 9.4.1 Page 3 Programming Research Ltd. If you wish to disable the behavior, for example because you wish to ensure that the same table of "common code sequences" is used for every single TU, then simply set the option to -po comment::dynamic_statistics-. 2.2.2 Other Changes in QA·C 9.4.0 There is improved signal to noise ratio in the analysis of resources. In addition, QA·C 9.4.0 addresses several critical failures. 2.3 Functional Changes in QA·C 9.3.0 2.3.1 MISRA C 2012 Improvements This release includes many improvements to the coverage of MISRA C 2012, specifically relating to depth of analysis. Detailed information relating to messages added, removed and changed can be found in the QA·C Messages section. 2.3.2 Configuration Changes 2.3.3 End of line continuation character QA·C formerly treated \new-line as a continuation character. However, this behavior could have resulted in configuration problems that were hard to identify.