Reverted [890] it cause more problems with Visual C++
This commit is contained in:
parent
9239ebc6d1
commit
40637e436f
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* cppcheck - c/c++ syntax checking
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
*
|
||||
* 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
|
||||
|
@ -26,6 +26,11 @@
|
|||
#include <cstring>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#include <ctype.h>
|
||||
#include <mem.h>
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
CheckClass::CheckClass(const Tokenizer *tokenizer, const Settings &settings, ErrorLogger *errorLogger)
|
||||
|
@ -92,6 +97,7 @@ struct CheckClass::VAR *CheckClass::ClassChecking_GetVarList(const Token *tok1)
|
|||
if (varname)
|
||||
{
|
||||
struct VAR *var = new VAR;
|
||||
memset(var, 0, sizeof(struct VAR));
|
||||
var->name = varname;
|
||||
var->init = false;
|
||||
var->next = varlist;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* cppcheck - c/c++ syntax checking
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
*
|
||||
* 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
|
||||
|
@ -26,6 +26,12 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#include <mem.h> // <- memset
|
||||
#else
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* cppcheck - c/c++ syntax checking
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
*
|
||||
* 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
|
||||
|
@ -25,6 +25,10 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#include <ctype>
|
||||
#endif
|
||||
|
||||
|
||||
Preprocessor::Preprocessor()
|
||||
{
|
||||
|
@ -50,7 +54,7 @@ std::string Preprocessor::read(std::istream &istr)
|
|||
++lineno;
|
||||
|
||||
// Replace assorted special chars with spaces..
|
||||
if ((ch != '\n') && (std::isspace(ch) || std::iscntrl(ch)))
|
||||
if ((ch != '\n') && (isspace(ch) || iscntrl(ch)))
|
||||
ch = ' ';
|
||||
|
||||
// Skip spaces after ' ' and after '#'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* cppcheck - c/c++ syntax checking
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
*
|
||||
* 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
|
||||
|
@ -22,6 +22,10 @@
|
|||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#include <ctype.h> // isalpha, isdigit
|
||||
#endif
|
||||
|
||||
Token::Token() :
|
||||
_str(""),
|
||||
_cstr(0),
|
||||
|
@ -46,8 +50,8 @@ void Token::str(const char s[])
|
|||
_str = s;
|
||||
std::free(_cstr);
|
||||
_cstr = strdup(s);
|
||||
_isName = bool(_str[0] == '_' || std::isalpha(_str[0]));
|
||||
_isNumber = bool(std::isdigit(_str[0]) != 0);
|
||||
_isName = bool(_str[0] == '_' || isalpha(_str[0]));
|
||||
_isNumber = bool(isdigit(_str[0]) != 0);
|
||||
if (_str == "true" || _str == "false")
|
||||
_isBoolean = true;
|
||||
else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* cppcheck - c/c++ syntax checking
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
* Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam
|
||||
*
|
||||
* 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
|
||||
|
@ -37,6 +37,12 @@
|
|||
#include <stdlib.h> // <- strtoul
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#include <ctype.h>
|
||||
#include <mem.h>
|
||||
#endif
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Tokenizer::Tokenizer()
|
||||
|
@ -96,10 +102,10 @@ void Tokenizer::Define(const char Name[], const char Value[])
|
|||
bool dec = true, hex = true;
|
||||
for (int i = 0; Value[i]; i++)
|
||||
{
|
||||
if (! std::isdigit(Value[i]))
|
||||
if (! isdigit(Value[i]))
|
||||
dec = false;
|
||||
|
||||
if (! std::isxdigit(Value[i]) && (!(i == 1 && Value[i] == 'x')))
|
||||
if (! isxdigit(Value[i]) && (!(i == 1 && Value[i] == 'x')))
|
||||
hex = false;
|
||||
}
|
||||
|
||||
|
@ -121,6 +127,7 @@ void Tokenizer::Define(const char Name[], const char Value[])
|
|||
}
|
||||
|
||||
DefineSymbol *NewSym = new DefineSymbol;
|
||||
memset(NewSym, 0, sizeof(DefineSymbol));
|
||||
NewSym->name = strdup(Name);
|
||||
NewSym->value = strValue;
|
||||
NewSym->next = _dsymlist;
|
||||
|
@ -300,21 +307,21 @@ void Tokenizer::tokenizeCode(std::istream &code, const unsigned int FileIndex)
|
|||
{
|
||||
if (State == Space1 || State == Space2)
|
||||
{
|
||||
if (std::isspace(line[i]))
|
||||
if (isspace(line[i]))
|
||||
continue;
|
||||
State = (State == Space1) ? Id : Value;
|
||||
}
|
||||
|
||||
else if (State == Id)
|
||||
{
|
||||
if (std::isspace(line[i]))
|
||||
if (isspace(line[i]))
|
||||
{
|
||||
strId = CurrentToken;
|
||||
CurrentToken.clear();
|
||||
State = Space2;
|
||||
continue;
|
||||
}
|
||||
else if (! std::isalnum(line[i]))
|
||||
else if (! isalnum(line[i]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -473,7 +480,7 @@ void Tokenizer::tokenizeCode(std::istream &code, const unsigned int FileIndex)
|
|||
}
|
||||
|
||||
|
||||
if (std::isspace(ch) || std::iscntrl(ch))
|
||||
if (isspace(ch) || iscntrl(ch))
|
||||
{
|
||||
addtoken(CurrentToken.c_str(), lineno, FileIndex);
|
||||
CurrentToken.clear();
|
||||
|
|
Loading…
Reference in New Issue