Menu

Have a header guard check might be nice

2024-05-30
2024-05-30
  • Steve Albright

    Steve Albright - 2024-05-30

    Something that would detect a missing #pragma once or #ifndef guard.

     
  • Daniel Marjamäki

    Good idea.

    See https://trac.cppcheck.net/ticket/2829

    The usual builtin checkers in cppcheck does not have access to preprocessor directives and can't check this directly. So well if we implement this we either have to use an addon or we have to make sure the builtin checkers will have the information also.

    For information , autosar guideline m16-2-3 says "Include guards shall be provided." and this rule is provided in Cppcheck Premium. However as I read it m16-2-3 does not allow #pragma once therefore that checker will write a warning even if that is used.

     

    Last edit: Daniel Marjamäki 2024-05-30

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.