Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocking inline functions option destroying include files with no inline functions #382

Closed
kamal-ahmed-emphysys opened this issue Mar 1, 2022 · 3 comments

Comments

@kamal-ahmed-emphysys
Copy link

I am using Cmock option for mocking inline functions. The option for mocking externs in not set (default). Not sure what is triggering the inline treatment. Plus, even if there was an inline function here, I did not expect the macros and the included file to be removed in the replacement. I am also surprised that the parser does not generate header guards.

I have included the original file and generated replacement. The included file for macro magic and the macros should be irrelevant to the parser.

Original:

/*

  • control.h
    */
    #ifndef control_h
    #define control_h 1

#include "vartypes.h"
#include "global_defines.h"

#undef VAR
#undef STRUCT

#define VAR( type, name, init, fname ) type name ;
#define STRUCT( type, ref ) struct _##type *ref ;

//!Typedef for structure that contains all variables in the control structure
typedef struct _control_t {
#include "controlvars.h"
} control_t;

#undef VAR
#undef STRUCT

extern control_t control_def;

int
control_update( void );

void
control_init( void );

void
control_halt( void );

#endif

Replacement generated by Cmock:

#include "../CM7/controlvars.h"
#include "../CM7/global_defines.h"
#include "../CM7/base/vartypes.h"

typedef struct _control_t {

} control_t;

extern control_t control_def;

int

control_update( void );

void

control_init( void );

void

control_halt( void );

@laurensmiers
Copy link
Contributor

Are you using cmock with ceedling? If so, there is a known issue with the test preprocessor (see #328).
But I don't know why the inline mocking is enabled, it is disabled by default.

@M-Bab
Copy link

M-Bab commented Jan 12, 2023

Please check if this is the problem described here: ThrowTheSwitch/Ceedling#706 (comment)

@mvandervoord
Copy link
Member

duplicate inline function issues.

@mvandervoord mvandervoord closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants