view vera/rules/T018.tcl @ 708:0dd4fb9dfcc8

Irccd: disable pid, gid, uid and daemon options, closes #846 @1h Those options are too platform specific and should be handled by the service manager instead.
author David Demelier <markand@malikania.fr>
date Sat, 07 Jul 2018 09:21:10 +0200
parents 6ec510722582
children
line wrap: on
line source

#!/usr/bin/tclsh
# using namespace are not allowed in header files

foreach fileName [getSourceFileNames] {
    set extension [file extension $fileName]
    if {[lsearch {.h .hh .hpp .hxx .ipp} $extension] != -1} {

        set state "start"
        foreach token [getTokens $fileName 1 0 -1 -1 {using namespace identifier}] {
            set type [lindex $token 3]

            if {$state == "using" && $type == "namespace"} {
                report $fileName $usingLine "using namespace not allowed in header file"
            }

            if {$type == "using"} {
                set usingLine [lindex $token 1]
            }

            set state $type
        }
    }
}