Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





  sample comment for Rule 21.1
Posted by: satoshi - 17-04-2014, 03:06 AM - Forum: 8.21 Standard libraries - Replies (1)

In p.166, there are the following examples.

Quote:#define defined /* Non-compliant - reserved identifier */

And, It is written as follows in the "amplification":
  • Identifiers or macro names beginning with underscore.
  • Identifiers in file scope described in Section 7

I was thinking "the identifiers which is limited by this rule is
the identifiers(ex. memcpy, errno, ...) that defined in the library section of the C90/C99."

If the rationale of the comment is the following statement, can I be considered that the normal reserved identifiers(ex. int, typedef, ...) are OK?
Of course, although not preferred, int or etc. are excluded as rule 21.1?

Quote:This rule prohibits the use of #define or #undef on th identifier defined as ...

-----
Best regards,
Satoshi Kawajiri

Print this item

  MISRA-C:2012 5.4 deviation procedure
Posted by: ogawa.kiyoshi - 16-04-2014, 02:17 AM - Forum: General Questions - Replies (1)

For clarification, at 5.4 deviation procedure in MISRA-C:2012,
There are codes, like this

#define PORT (* (volatile unsigned char * )0x002)
PORT = 0x010u;

I try to compile and go like this.
// file misrac-5-4.c
#include "misra_c.h" // #include and type definitions.
#define PORT (* (volatile unsigned char * )0x002)
int main(void){
printf(" PORT = %x \n", (unsigned int) &PORT);
PORT = 0x010u;
return printf("End of File misrac-5-4.c: Deviation procedure\n");
}
// file end
command is
cc -std=c99 -Wall misrac-5-4.c

There are no error and no warning.

The results are
PORT = 2
Segmentation fault: 11

This in intended behavior? or
Are there any good implementation?

I use Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix.

By the way, I try to compile all examples of MISRA-C:2012.

Are there any good place about sample codes without of the rules and directories.

Print this item

  Essential Type of parenthesised expression
Posted by: misra-c - 11-04-2014, 07:47 AM - Forum: 8.10 The essential type model - Replies (1)

What is the essential type of a parenthesised expression?

For example: ( 3 U ) has a standard type of "unsigned int". Is the essential type of the parenthesised expression "unsigned int" or "unsigned char"

Print this item

  MISRA C:2012 addenum typo
Posted by: Lundin - 04-04-2014, 02:10 PM - Forum: MISRA C:2004 to MISRA C:2012 migration - Replies (1)

I found a typo in the MISRA C:2012 addenum.

Page 6, rule 2004:19.4 compared with 2012:20.4

Quote:Rule 14.6 requires that a macro with more than 1
statement does not get expanded in an iteration or
selection statements.

Rule 14.6 does not exist. It should be Rule 15.6 "The body of an iteration statement..." /--/ "...should be a compound statement".

Print this item

  Questions about Rule 2.1
Posted by: tsukukazu - 01-04-2014, 09:42 AM - Forum: 8.2 Unused code - Replies (4)

In rule 2.1 sample code,

default:
{
/*
* This default will only be ......
* holds a value that is not ......
*/
}

The comments here,there are not written neither compliant nor non-compliant.
But I have understood to be compliant from the comment.
Is it correct?

Best Regards.

Print this item

  A Question for Rule8.5
Posted by: KumikoItoh - 01-04-2014, 01:12 AM - Forum: 8.8 Declarations and defnitions - Replies (1)

Hello

I have a question for the Rule8.5 etc.

The Rule8.5 in MISRAC_2004 was deleted in MISRAC_2012.

In MISRA C:2012 RuleMappings,
Rule8.5's description is
[The problems associated with --- dealt with by other rules].

I think that "other rules" means "Rule8.4, Rule8.5, and Rule8.6 in MISRAC 2012".

Is my opinion correct?

Please teach me your idea and rule numbers.

Best Regards,
Kumiko Itoh

Print this item

  I comply with which rules
Posted by: bschoi1984 - 27-03-2014, 01:09 PM - Forum: General Questions - Replies (2)

I have mixed feeling for comply with MISRA-C 2004 because I use Autocode generator such as TargetLink and I think it is reasonable that they make efforts to comply with MISRA-AC such as MISRA-AC ACG, MISRA-AC TL and MISRA-AC SLSF.

So I don’t know which stand (MISRA-C or MISRA-AC) I have to conform to.
I want to know which standard the people using hand-coding comply with and the people using MBD(Model-based development with AutoCode Generator) comply with.
If possible, please give me some opinions

Print this item

  Rule 11.3 Access to registers or memory
Posted by: barbara.seyfarth - 27-03-2014, 10:31 AM - Forum: 6.11 Pointer Type Conversions - Replies (2)

A cast should not be performed between a pointer type and an integral type, this casts from type "unsigned int" to "uint32_t volatile *" (MISRA C 2004 rule 11.3)
In two cases this error occurs on my system (ARM Cortex M3 with IAR workbench and MISRA check from IAR):
1. Access to registers.
2. Access to RAM (during a cyclic RAM test).

Is there any way conform to MISRA C2004 for the following code?

Code:
register uint32_t address; /* during the critical section no RAM access other than the test access may occur */
    register uint32_t pattern;

    ...
    *(volatile uint32_t *)address = pattern;

Print this item

  Out of date link
Posted by: keith.collyer - 20-03-2014, 03:18 PM - Forum: General Questions - Replies (1)

Who needs to be contacted about an inaccurate link on the Links page of the web site (http://www.misra.org.uk/Links/tabid/63/Default.aspx)? Telelogic was acquired by IBM in 2008, so this entry should now read "IBM Rational" and the link should be http://www-01.ibm.com/software/rational/.

Thanks

Print this item

  MISRA rule 20.1 and 20.2
Posted by: VRK - 14-03-2014, 06:53 PM - Forum: 6.20 Standard Libraries - Replies (2)

20.1 (req): %s: Reserved identifiers, macros and functions in the standard library, shall not be defined, redefined or undefined.
20.2 (req): %s: The names of standard library macros, objects and functions shall not be reused.

As per the rule 20.1, Reserved identifiers should not be defined, redefined or undefined.
I am getting the violation of MISRA 20.2 for the below example:

For the declaration,
int for;
'for' is the reserve identifier. It is re-defined as variable declaration and it is not used in any standard library.
Hence it should violates the MISRA rule 20.1 and not MISRA rule 20.2.

Please explain the difference between MISRA 20.1 and 20.2 rules with suitable examples.

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,171
» Latest member: stephanmuench
» Forum threads: 998
» Forum posts: 2,752

Full Statistics

Online Users
There are currently 304 online users.
» 0 Member(s) | 302 Guest(s)
Bing, Google

Latest Threads
Rule 6.2.1: non-inline co...
Forum: 4.6 Basic concepts
Last Post: cgpzs
22-11-2024, 10:11 AM
» Replies: 0
» Views: 26
Rule 0.1.2
Forum: 4.0 Language independent issues
Last Post: stephanmuench
21-11-2024, 01:12 PM
» Replies: 0
» Views: 36
A18-9-4
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
23-10-2024, 12:04 PM
» Replies: 2
» Views: 378
A8-4-5: are partial moves...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
22-10-2024, 02:03 PM
» Replies: 1
» Views: 328
model information blocks ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:27 PM
» Replies: 1
» Views: 4,445
MISRA AL SLSF - Rule 043I
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:11 PM
» Replies: 1
» Views: 8,863
MISRA AC EC guidelines
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:21 AM
» Replies: 4
» Views: 15,503
News on future releases
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:05 AM
» Replies: 1
» Views: 5,694
Signal naming convention ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 07:57 AM
» Replies: 1
» Views: 7,246
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 432