cgmb / guardonce

Utilities for converting from C/C++ include guards to #pragma once and back again.
MIT License
142 stars 3 forks source link

Support other header file suffixes #2

Closed cgmb closed 10 years ago

cgmb commented 11 years ago

*.hpp is reasonably common and should be supported. Possibly other suffixes, too.

Workaround: Edit isHeaderFile(fileName) in crules.py.

cgmb commented 10 years ago

Added *.hpp as a recognized extension in f58211d0488eff703baa6a2854bcedb9055a40b8.

.h and .hpp should cover 99% of cases. For anything else, either edit crules.py or use a tool like find to supply the header file names to the guardonce scripts.

cgmb commented 6 years ago

I've added a few more extensions to the list over the years. .hh, .H and .hxx are now checked too. If you use a different extension, it just means that the recursive option (-r) won't find the file when searching directories.

In that case, my recommendation is just to pass the file name directly. On Linux, I do that with find. For example, in the Abseil walkthrough, I could have used:

find absl \( -name '*.h' -o -name '*.hpp' \) -exec guard2once -p "path|upper|append _" {} \+

P.S. It's much faster to call guardonce a single time with a big list of files rather than calling guardonce many times with a single file each time.