2008-11-15 14:05:58 +01:00
|
|
|
/*
|
2008-10-26 08:55:15 +01:00
|
|
|
* c++check - c/c++ syntax checking
|
|
|
|
* Copyright (C) 2007 Daniel Marjamäki
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-25 08:51:18 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#ifndef CheckOtherH
|
|
|
|
#define CheckOtherH
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-11-20 23:19:26 +01:00
|
|
|
#include "tokenize.h"
|
|
|
|
#include "errorlogger.h"
|
2008-11-15 09:53:51 +01:00
|
|
|
|
|
|
|
class CheckOther
|
|
|
|
{
|
|
|
|
public:
|
2008-11-20 23:19:26 +01:00
|
|
|
CheckOther( Tokenizer *tokenizer, ErrorLogger *errorLogger );
|
2008-11-15 09:53:51 +01:00
|
|
|
~CheckOther();
|
2008-11-12 22:34:47 +01:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Casting
|
|
|
|
void WarningOldStylePointerCast();
|
2007-05-25 08:51:18 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Use standard functions instead
|
|
|
|
void WarningIsDigit();
|
2007-05-25 08:51:18 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Use standard functions instead
|
|
|
|
void WarningIsAlpha();
|
2007-05-25 08:51:18 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Redundant code
|
|
|
|
void WarningRedundantCode();
|
2007-06-05 06:51:01 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Warning upon: if (condition);
|
|
|
|
void WarningIf();
|
2007-05-25 08:51:18 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Assignment in condition
|
|
|
|
void CheckIfAssignment();
|
2007-05-25 08:51:18 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Using dangerous functions
|
|
|
|
void WarningDangerousFunctions();
|
2007-07-24 08:23:28 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Invalid function usage..
|
|
|
|
void InvalidFunctionUsage();
|
2007-05-25 08:51:18 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Check for unsigned division that might create bad results
|
|
|
|
void CheckUnsignedDivision();
|
2007-05-25 08:51:18 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Check scope of variables
|
|
|
|
void CheckVariableScope();
|
2008-02-20 19:20:59 +01:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Check for constant function parameter
|
|
|
|
void CheckConstantFunctionParameter();
|
2008-03-16 14:17:43 +01:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Check that all struct members are used
|
|
|
|
void CheckStructMemberUsage();
|
2008-05-03 09:20:25 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Using char variable as array index / as operand in bit operation
|
|
|
|
void CheckCharVariable();
|
2008-05-09 20:29:42 +02:00
|
|
|
|
2008-11-11 07:42:09 +01:00
|
|
|
// Incomplete statement. A statement that only contains a constant or variable
|
2008-11-15 09:53:51 +01:00
|
|
|
void CheckIncompleteStatement();
|
|
|
|
private:
|
|
|
|
void CheckVariableScope_LookupVar( const TOKEN *tok1, const char varname[] );
|
|
|
|
|
2008-11-20 23:19:26 +01:00
|
|
|
Tokenizer *_tokenizer;
|
|
|
|
ErrorLogger *_errorLogger;
|
2008-11-15 09:53:51 +01:00
|
|
|
};
|
2008-08-28 08:36:30 +02:00
|
|
|
|
2007-05-25 08:51:18 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif
|
|
|
|
|