Menu

Conditional compilation not in call graph

2010-02-16
2013-06-11
  • Alois Hahn (alois61)

    Hi,

    I use conditional compilation with #ifndef preprocessor commands in my C-Code.

    I expected that functions in the excluded code should not show up in the call-graph.

    But it does !

    In my example (LWL_LoopTest)  the function FastRand() is used in the excluded code section only.
    It should be removed by the preprocessor, so that no further calls to FastRand() exist any more.

    Unfortunately the the call graph still shows a call from LWL_LoopTest->FastRand().
    Just like the preprocessing would be ignored.

    I ran doxygen with the -d option: doxygen -d Preprocessor
    It shows the preprocessor output at STDOUT, which is correct, the #ifndef NO_FASTRAND section is blank.

    Does anyone know if this is a kind of feature I did not recognize ? or is it a bug ?

    many thanks
    Alois

    example code:
    (I have also a self contained example to reproduce it)

    /*************************************************************************/
    int LWL_LoopTest(int ModuleId, int * iseed_ptr) {
    ………
    // This is just a testcase for the Doxygen Preprocessor
    //
    //   The function FastRand is not called actually, but is shown
    //   in the call graph for some reason
    //  
    //   The preprocessor removes the #ifndef section properly.
    //   (doxygen -d Preprocessor CLIO.Doxyfile > CLIO.preprocessor.txt) 
    // 
    //   doxygen 1.6.1
    //   doxygen 1.6.2
    //
    //

    #define NO_FASTRAND
    #ifndef NO_FASTRAND
    // randomize packet size
    packetSize = (FastRand(seed_ptr) % PACKET_SIZE_MAX) + 1;
     
    // randomize source/destination data
    s_ptr = SourceData;
    d_ptr = DestData;
    for (i=0; i<PACKET_SIZE_MAX; i++) {
    idata = FastRand(seed_ptr);
       *s_ptr++ = idata;
    *d_ptr++ = ~idata;
    }

    #endif

     
  • Paul Decker

    Paul Decker - 2010-02-19

    I too am interested in a similar idea.

    My code has conditional compilation controlled by preprocessor macros.   I would like to document both behaviors.   For example, I would want to document

    #ifdef BUILD_TYPE_A
    struct
    {
         unsigned char pinA;
         unsigned char pinB;
    } pins;
    #else
    struct
    {
         unsigned char pinA;
         unsigned char pinB;
         unsigned char pinC;
    } pins;

    How can I make doxygen work to document both definitions, preferablly also giving an indication as to which build mode uses each structure?

    Thanks so much in advance,
    Paul

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.