Add some unused private copy ctors and operator=.
In Token and in Check classes, GCC -Weffc++ reports that it's better to override the copy constructors and the assignment operator to avoid problems with copied objects which could have the same pointers, hence with double frees, when we delete one of these pointers in the copied and in the original object.
This commit is contained in:
parent
f42ab9871d
commit
9ce6630b28
|
@ -132,8 +132,9 @@ protected:
|
||||||
private:
|
private:
|
||||||
const std::string _name;
|
const std::string _name;
|
||||||
|
|
||||||
/** disabled assignment operator */
|
/** disabled assignment operator and copy constructor */
|
||||||
void operator=(const Check &);
|
void operator=(const Check &);
|
||||||
|
Check(const Check &);
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
14
lib/token.h
14
lib/token.h
|
@ -45,6 +45,8 @@ private:
|
||||||
|
|
||||||
// Not implemented..
|
// Not implemented..
|
||||||
Token();
|
Token();
|
||||||
|
Token(const Token &);
|
||||||
|
Token operator=(const Token &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
|
@ -139,8 +141,13 @@ public:
|
||||||
* multi-compare patterns such as "int|void|char" can contain %or%, %oror% and %op%
|
* multi-compare patterns such as "int|void|char" can contain %or%, %oror% and %op%
|
||||||
* but it is not recommended to put such an %cmd% as the first pattern.
|
* but it is not recommended to put such an %cmd% as the first pattern.
|
||||||
*
|
*
|
||||||
* It's possible to use multi-compare patterns with just %cmds%, except for %varid%.
|
* It's possible to use multi-compare patterns with all the other %cmds%,
|
||||||
* For example: "%var%|%num%| " means yes to a variable, a number or empty string.
|
* except for %varid%, and normal names, but the %cmds% should be put as
|
||||||
|
* the first patterns in the list, then the normal names.
|
||||||
|
* For example: "%var%|%num%|)" means yes to a variable, a number or ')'.
|
||||||
|
*
|
||||||
|
* @todo Make it possible to use the %cmds% and the normal names in the
|
||||||
|
* multicompare list without an order.
|
||||||
*
|
*
|
||||||
* The patterns can be also combined to compare to multiple tokens at once
|
* The patterns can be also combined to compare to multiple tokens at once
|
||||||
* by separating tokens with a space, e.g.
|
* by separating tokens with a space, e.g.
|
||||||
|
@ -151,7 +158,8 @@ public:
|
||||||
* @param tok List of tokens to be compared to the pattern
|
* @param tok List of tokens to be compared to the pattern
|
||||||
* @param pattern The pattern against which the tokens are compared,
|
* @param pattern The pattern against which the tokens are compared,
|
||||||
* e.g. "const" or ") const|volatile| {".
|
* e.g. "const" or ") const|volatile| {".
|
||||||
* @param varid if %varid% is given in the pattern the Token::varId will be matched against this argument
|
* @param varid if %varid% is given in the pattern the Token::varId
|
||||||
|
* will be matched against this argument
|
||||||
* @return true if given token matches with given pattern
|
* @return true if given token matches with given pattern
|
||||||
* false if given token does not match with given pattern
|
* false if given token does not match with given pattern
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue