Menu

update of 3aug2025 is not robust against circular includes in header files

2025-08-21
2025-08-21
  • Peter Schops

    Peter Schops - 2025-08-21

    On 3aug2025 preprocessor and simplecpp got updated, and after this update cppcheck is failing to analyze real projects.

    In cppcheck/test I added color.h, and that was enough to trigger the problem.

    color.h includes fixture.h and fixture.h includes color.h again.
    This is perfectly ok in regular c-code. And the preprocessor of the c-compiler we give a helping hand to protect itself with the #ifndef/#define or #pragma once. And before the update, cppcheck also did not have issues with circular includes.

    #ifndef colorH
    #define colorH
    
    #include "fixture.h"
    #include "precompiled.h"
    
    #endif //colorH
    

    I have no idea where to start to solve this issue. So I hope there is someone smarter then me that knows how to fix the issue.

    I can say that when I take the last version, and replace simplecpp and preprocessor files with the version of 2aug2025, the issue is gone.

     
  • Peter Schops

    Peter Schops - 2025-08-21

    Issue seems to be fixed now
    Fix #14086 (simplecpp: Update to 1.5.2) (#7762)

    https://github.com/danmar/simplecpp/blob/master/simplecpp.cpp
    Fix infinite loop with circular includes (#497)

     

    Last edit: Peter Schops 2025-08-21

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.