This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

conditional compile extraction

Conditional compile/assembly is a great means of having several (somewhat) similar products generated from the same source. I guarantees that if you fix a problem it will be fixed globally, one verison will not be forgotten. I am very much a proponent of conditionals in product series code. That much said, it sometimes makes it very difficult to read/follow the flow of a version of program. Is there a means in the Keil tools of creating a "clean source" for a given version i. e. a source with all ifdefs removed and only the lines that will be compiled for this version left?. If not, does anyone know of a program that will do that?.

Parents
  • You may enable the preprocessor output and a file is generated with only the compiled code. However, all macros are "cooked" and output in the fully expanded form. This may not be what you want.

    Other than that, I don't know of a utility that will do what you want.

    Jon

Reply
  • You may enable the preprocessor output and a file is generated with only the compiled code. However, all macros are "cooked" and output in the fully expanded form. This may not be what you want.

    Other than that, I don't know of a utility that will do what you want.

    Jon

Children
  • Most (all?) compilers have the "generate preprocessor listing" option but, as it is the output of the preprocessor, it is bound to have all macros expanded.

    Many compilers (eg,MSVC, Borland) have an option to retain the comments in the preprocessor out - which makes it somewhat easier to read.
    Unfortunately, Keil does not have this option :-(

    However, there is a listing option on the Keil compiler which includes only the "active" source lines in the compiler listing.
    The problems I have found with this are:
    1. It leaves in the #if line, but omits the corresponding #endif, which makes the listing somewhat confusing;
    2. It breaks the LPP utility (see elsewhere on this forum...)