Menu

#15 #if 1 not supported

Moritz_2_0_1
closed
None
5
2020-12-28
2020-12-23
No

Hi Eckard,

I noticed, that if my code starts (maybe just contains)an

#if 1
...
#endif 

abc2xml breaks.
I reproduced it by using this code

#if 1
void test(){}
// #if 0
void test2(){}
// #endif //0
#endif //1

BR
Wasili

Discussion

  • Eckard Klotz

    Eckard Klotz - 2020-12-24
    • status: open --> accepted
     
  • Eckard Klotz

    Eckard Klotz - 2020-12-24

    Hello Wasili.

    To solve this issue I have to provide a new configuration file. This patch should should solve your issue "#if 1 not supported ".

    • Please check the attached file with your virus scanner before you use it to replace the one with the same name in the bin folder of your Moritz distribution.
    • Replace with the attached file "ANSI_C_Expression.a2x" the one with the same name in your Moritz distribution sub folder "[MoritzRoot]\LangPack\ansi_c\a2x\".
    • It may be useful to keep the old files for the case that the new ones are not satisfying you.

    Note this patch was created for the newest Moritz patch published on 2020-12-23 and was not tested with older versions.

    • But actually it should work with the Moritz Release 2.1.0 also.
    • However, the further fixing of bug is done based on the last patch only.
    • So if you face additional issues related to this topic please update your Moritz release by using the patch as described in the readme.

    The patch, I provide here, is extending the syntax-rule used by the directive process to detect identifiers.

    • A number like your 1 is now treated by this process as an ID like MY_PREPROCESSOR_CONSTANT.
    • This may not be the ideal solution. But it is one that was done by modifying a configuration text and not a binary. Thus I hope that it supports you even your IT department rejects your request to provide you the binaries you need as patch.
    • Depending on the content of your compiler-switch you may have to define the boolean meaning of the numerical identifier.

    Please refer the following parts of the Moritz documentation to get an overview if necessary:

    • User-Configuration of abc2xml especially its section Configuring Preprocessor-Constants in the section DirectiveDefinition

    The background is explained in the MuLanPa Documentaion.

    • How it works especially its sub chapter Directive Process

    Please check this patch and respond with a comment if your issue is solved or not.

    Have a merry Christmas and a happy new year.

    Stay healthy,
    Eckard.

     
  • Eckard Klotz

    Eckard Klotz - 2020-12-24
    • status: accepted --> pending
     
  • Wasilios Goutas

    Wasilios Goutas - 2020-12-28

    Thanks Eckard, I tested it and it works

     
  • Eckard Klotz

    Eckard Klotz - 2020-12-28
    • status: pending --> closed
     

Log in to post a comment.