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

Username
  

Password
  





  Dir 4.10: Is a different form of the include guard considered a violation of the directive?
Posted by: GerlindeKettl - 29-03-2018, 12:36 PM - Forum: 7.4 Code design - Replies (1)

The example of Directive 4.10 "Precautions shall be taken in order to prevent the contents of a header file being included more than once" says that in order to facilitate checking, the contents of the header should be protected from being included more than once using one of the following two forms:

Code:
#if !defined ( identifier )
#define identifier
/* Contents of file */
#endif



#ifndef identifier
#define identifier
/* Contents of file */
#endif
I got software from a third party which uses the first form, but the parentheses are a bit differently placed:

Code:
#if ( !defined identifier )
As I consider this include guard correct from a functional point of view, is this nevertheless a violation of Dir 4.10 because it does not use one of the two forms listed in the example?

Print this item

  Dir 4.8 If no pointer is declared but implementation is visible
Posted by: cxlin - 29-03-2018, 11:11 AM - Forum: 7.4 Code design - Replies (1)

For Dir 4.8 the document is not clear about whether the following case should be considered as non-compliant.

/* def.h */
struct SomeType
{
/* Object implementation */
}

/* no-use.c */
#include def.h
/* Do something. But no use of SomeType at all. */

The example doesn't involve any pointer but indeed goes against the rationale since the implementation details of SomeType is not needed in no-use.c and it should at least be opaque. Also, logically, "no pointer" implies "a pointer is never dereferenced", since there is no such pointer to begin with.

Please kindly help to advise. Thanks!

Print this item

  Rule 13.2 Compliance
Posted by: rcseacord - 21-03-2018, 06:51 PM - Forum: 8.13 Side effects - Replies (2)

Does the following expression comply with Rule 13.2?

(x = a) && (x = b)

What if it is preceded by the following declaration?

int a = 0;

Thanks,
rCs

Print this item

  News on future releases
Posted by: pdrudi - 15-03-2018, 02:32 PM - Forum: MISRA AC SLSF discussions - Replies (1)

Hi,
will MISRA AC SLSF guideline be updated?
If yes, is there a planned release date?

Thank you in advance,
Paolo Drudi

Print this item

  Rule 20.2
Posted by: kalpak - 08-03-2018, 03:06 PM - Forum: 8.20 Preprocessing directives - Replies (2)

Why is
#include "c:\headers\measurement_regs.h "
non compliant to rule 20.2 due to \ in the path?

Print this item

  model information blocks in virtual subsystems (rule 022)
Posted by: ben.call - 06-03-2018, 06:55 PM - Forum: MISRA AC SLSF discussions - Replies (1)

MISRA AC SLSF 022 states that a model information block is required for every subsystem. Does application of this rule include virtual subsystems, or only "true" (i.e., atomic or nonvirtual) subsystems?
Stated differently: Virtual subsystems should share the identity and origin of the parent model, atomic subsystem, or library to which they belong (the rationale for rule 022), so do they need that information reiterated in their own model information block?
I would appreciate knowing what the community consensus is on this topic.
~Ben

Print this item

  Copyright
Posted by: ankitshah413 - 05-03-2018, 09:47 AM - Forum: MISRA-C:2004 Exemplar Suite - Replies (1)

Hello,

I have one question regarding the copyright of the Exemplar Suite. I want to share this with my colleagues in my company, so am i allowed to do that?

We have an internal tool for sharing , can i upload these examples there?

It will be accessed in my company only.

Thank you.

Print this item

  Rule 5.2 : confusion
Posted by: ankitshah413 - 01-03-2018, 04:08 PM - Forum: 6.5 Identifiers - Replies (2)

Hello,

I am getting MISRA 5.2 rule violation in my project. The code for which i am getting violation is a structure that is declared as extern in one header file. The code example is as under

1.h

Code:
extern struct con tmp_ev;

2.c
Code:
struct con tmp_ev;
cioF_get(&tmp_ev);

3.c
Code:
struct con tmp_ev;
(void)eeF_read(CON, &tmp_ev);

I get the warning only in 2.c in the line struct con tmp_ev; saying that declaration of symbol tmp_ev hides symbol tmp_ev and not in 3.c . Both 2.c and 3.c include the 1.h header file.

I am confused why this issue is present. Can anyone help me resolve this issue?

Thank you

Print this item

  Rule 8.3 Function definition
Posted by: ankitshah413 - 21-02-2018, 10:12 AM - Forum: 6.8 Declarations and Definitions - Replies (1)

I want to just clarify that following is a MISRA violation before using it in my code. I am calling one function from a file as under:

Code:
(void)Dem_SetEventStatus((Dem_EventIdType)(dtcFlt_t.dtc[dtcIndex]), DEM_EVENT_STATUS_FAILED);

Here Dem_SetEventStatus is defined in one header as under:

Code:
extern FUNC(Std_ReturnType, RTE_CODE) Dem_SetEventStatus (Dem_ASR42_EventIdType EventId, Dem_ASR42_EventStatusType EventStatus);

Here Dem_EventIdType is a typedef of unit8 and Dem_ASR42_EventIdType is unsigned short.

So , there were the violation of MISRA 8.3 right??

Print this item

  9.1 Variable may not have been initialized
Posted by: ankitshah413 - 19-02-2018, 11:51 AM - Forum: 6.9 Initialisation - Replies (4)

Hello,

I have an issue with MISRA 9.1 rule. In my code i have a "if" loop and inside that a variable is initialized and then is read after that. But when i do static analysis using pclint then i have a warning for 9.1 rule. Below is my code :

struct mgm2_info_return msg_ascu_info;

Code:
if(klr_ecuConf_t->feat_multislave)
    {
        msg_ascu_info = mgmF_massage_get_ascu_info();
    }
    msg_info = mgmF_massage_get_info();

The line where it is read and where warning occurs:
Code:
if( (((vF_mcms_fl_on((tm_uint8)V_FLONCMD_ACK)) ||
          (msg_info.pmcu_state ==  LDF_MASSSQC_STATE_ACTIVE))
                    &&((klr_ecuConf_t->feat_multislave)
                    || (msg_ascu_info.ascu_state ==  LDF_MASSSQC_STATE_ACTIVE))
        ) &&
        (msg_info.pmcu_trig_source == RqSource_ActvComf))

Do i need to write a justification or i need to initialize the entire structure first?

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,207
» Latest member: MLBstubs
» Forum threads: 1,017
» Forum posts: 2,796

Full Statistics

Online Users
There are currently 151 online users.
» 0 Member(s) | 148 Guest(s)
Bing, Google, UptimeRobot

Latest Threads
Rule 7.0.5, example non-c...
Forum: 4.7 Standard conversions
Last Post: cgpzs
17-04-2025, 12:10 PM
» Replies: 0
» Views: 161
A3-3-2 Contradictory exam...
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
31-03-2025, 09:30 AM
» Replies: 2
» Views: 289
16.6.1 clarification
Forum: 4.16 Overloading
Last Post: cgpzs
31-03-2025, 09:29 AM
» Replies: 2
» Views: 274
Rule 9.3.1 - iteration st...
Forum: 4.9 Statements
Last Post: misra cpp
28-03-2025, 01:17 PM
» Replies: 1
» Views: 182
Rule 8.2.8 - why aren't a...
Forum: 4.8 Expressions
Last Post: misra cpp
28-03-2025, 01:05 PM
» Replies: 1
» Views: 202
Typo in Appendix C of MIS...
Forum: 8.10 The essential type model
Last Post: Yordan Naydenov
17-03-2025, 02:58 PM
» Replies: 0
» Views: 160
Adopted modal expressions...
Forum: General Questions
Last Post: Yordan Naydenov
17-03-2025, 09:01 AM
» Replies: 0
» Views: 249
Roadmap to c23 support
Forum: General Questions
Last Post: ACHart
28-02-2025, 03:23 PM
» Replies: 0
» Views: 207
Rule 6.2.1 weak linkage
Forum: 4.6 Basic concepts
Last Post: misra cpp
28-02-2025, 01:04 PM
» Replies: 1
» Views: 263
A8-4-5: Should have an ex...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
21-02-2025, 12:58 PM
» Replies: 3
» Views: 676