Menu

Hide certain pathes doesn't working

Anonymous
2015-01-08
2015-01-10
  • Anonymous

    Anonymous - 2015-01-08

    Hello,

    we have enabled search for unused functions, so we have to define all include pathes to 3rd-Party projects. After this we getting a lot of hints, that includes like windows.h are not found (we are using linux). So we tried to disable some pathes, but cppcheck still check this pathes. What we are doing wrong?

    Example with CGAL

    cppcheck --enable=all --inconclusive --force --xml --xml-version=2 -I /usr/include/CGAL -I ... -U_WIN32 -UCGAL_USE_LEDA --check-config src 2> cppcheck.xml
    

    After this we still get a hint about e.g. LEDA/real.h:

    // /usr/include/CGAL/leda_real.h
    #ifdef CGAL_USE_LEDA
    
    #include <CGAL/leda_coercion_traits.h>
    
    #include <CGAL/utils.h>
    #include <CGAL/Interval_nt.h>
    
    #include <utility>
    
    #include <CGAL/LEDA_basic.h>
    #if CGAL_LEDA_VERSION < 500
    #include <LEDA/real.h>
    #include <LEDA/interval.h>
    #else
    #include <LEDA/numbers/real.h>
    #endif
    

    Btw: Maybe --force makes trouble, but we need it, because we have some more defines in our own project

     
  • Daniel Marjamäki

    Hi.

    So we tried to disable some pathes, but cppcheck still check this pathes. What we are doing wrong?

    strange. I am not sure why. I'll need to investigate why you get that.

     

    Last edit: Daniel Marjamäki 2015-01-09
  • Daniel Marjamäki

    The explanation for your problems is that the Cppcheck preprocessor is a bit special. We want to check all configurations. And we don't want to completely re-preprocess the file (read all files over and over again) for each configuration. Therefore the preprocessor first tries to read all files that are included and save it all in memory. Then #ifdefs and #defines etc are handled after that.

    We might be able to tweak it so it will skip a #ifdef block that is disabled with -U though.

    I opened a ticket in our issue tracker so we won't forget this:
    http://trac.cppcheck.net/ticket/6427

     

    Last edit: Daniel Marjamäki 2015-01-10

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.