Example #1
0
void check_include_guards(file const& f)
{
    if(!f.is_of_phylum(e_cxx_header))
        {
        return;
        }

    std::string const guard = boost::regex_replace
        (f.leaf_name()
        ,boost::regex("\\.hpp$")
        ,"_hpp"
        );
    std::string const guards =
            "\\n#ifndef "   + guard
        +   "\\n#define "   + guard + "\\n"
        +   ".*"
        +   "\\n#endif // " + guard + "\\n+$"
        ;
    require(f, guards, "lacks canonical header guards.");
}