#14 instruct moc generation script to do a define while parsing input file

v1.0_(example)
closed
pogn
None
4
2013-07-25
2012-12-03
Anonymous
No

A particular header for which mocs are to be generated has only relevant content if a particular define is being done:

ifndef XXX_YYY_H

define XXX_YYY _H

if defined(INCLUDE_L3)

Inside the UT Makefile, I already added -DINCLUDE_L3 to make the UT compilation succeed for the FUT that includes this particular header.

Howhever, when I try to generate mocs out of this file, I do not know how to instruct the moc generation inside generate.sh to do also that define.
I tried export INCLUDE_L3=1 within generate.sh
I tried INCLUDE_L3=1 $OPMOCK_SH
None of this is successfull.
I am unable to edit the original header file (third party sw), so I guess I am forced to make a local copy of it...to get rid of below error
YYY_stub.c:11: warning: \u2018opmock_reset_all_mocks_in_this_header\u2019 defined but not used
YYY_stub.c:15: warning: \u2018opmock_verify_all_mocks_in_this_header\u2019 defined but not used
Adding to generate.sh below sed cmd is working:
sed '/#if defined(INCLUDE_L3)/i #define INCLUDE_L3' /yyy.h > yyy_temp.h
But then I get: yyy_temp.h:54:1: error: "INCLUDE_L3" redefined
...

Discussion

  • pogn

    pogn - 2013-07-25

    Hi,

    If you're using opmock 1, you should use the variable SWIG_FEATURES as described in section 8 of the manual.
    If you're using opmock 2, use a standard -D option to define a macro when calling opmock.

    Pascal

     
  • pogn

    pogn - 2013-07-25
    • status: open --> closed
    • assigned_to: pogn
     


Anonymous

Cancel  Add attachments