The current linter configuration misses to find lots of formatting errors as we've seen here: https://gerrit.osmocom.org/c/osmo-trx/+/42198/comments/f8f1b5a2_3c7e1389
This is caused by the following exclude rules in .checkpatch.conf, which were added there to avoid that some of the checkpatch rules don't work correctly with C++ code:
Fix this by splitting the .checkpatch.conf into two files, .checkpatch.c.conf and .checkpatch.c++.conf. Let the C version use the default rules. Let the C++ version ignore the rules that don't work with C++ code:
* SPACING Fails on: std::vector<std::string> With: ERROR:SPACING: spaces required around that '<' (ctx:VxV) ERROR:SPACING: spaces required around that '>' (ctx:VxW)
* FUNCTION_ARGUMENTS Fails on: ScopedLock lock(mLock); With: WARNING:FUNCTION_ARGUMENTS: function definition argument 'mLock' should also have an identifier name
* INDENTED_LABEL Fails on: private: protected: With: WARNING:INDENTED_LABEL: labels should not be indented
* NEW_TYPEDEFS Fails on: typedef std::map<K,D*> Map; With: WARNING:NEW_TYPEDEFS: do not add new typedefs
With the new config, the linter only complains about the following things across the existing C++ code, which seem to be legitimate linting problems (and if not, can be ignored as well):