Skip to content

"Insert or Update C/C++ Include Guard" keeps adding include guards #583

@albatrossen

Description

@albatrossen

A file called bar.h:

#ifndef BAR_H__
#define BAR_H__
#ifdef FOO
#endif /* FOO */


#endif /* BAR_H__ */

After running the command twice you end up with this in the file:

#ifndef BAR_H__
#define BAR_H__
#ifndef BAR_H__
#define BAR_H__
#ifndef BAR_H__
#define BAR_H__
#ifdef FOO
#endif /* FOO */


#endif /* BAR_H__ */


#endif /* BAR_H__ */


#endif /* BAR_H__ */

The non default config is:

{
    "C/C++ Include Guard.Macro Type": "Filename",
    "C/C++ Include Guard.Auto Include Guard Insertion For New File": false,
    "C/C++ Include Guard.Auto Update Include Guard": false,
    "C/C++ Include Guard.Remove Extension": false,
    "C/C++ Include Guard.Suffix": "__"
}

Appears to be the comment after the foo that somehow fools it into thinking there is no include guard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions