preprocessor: Added new preprocessor. Only used in the tests yet.

This commit is contained in:
Daniel Marjamäki 2008-10-26 10:54:20 +00:00
parent 5b9aa96aba
commit cde8e89987
4 changed files with 96 additions and 2 deletions

View File

@ -1,6 +1,6 @@
SRCS=CheckBufferOverrun.cpp CheckClass.cpp CheckHeaders.cpp CheckMemoryLeak.cpp CheckOther.cpp CommonCheck.cpp tokenize.cpp
SRCS=CheckBufferOverrun.cpp CheckClass.cpp CheckHeaders.cpp CheckMemoryLeak.cpp CheckOther.cpp CommonCheck.cpp preprocessor.cpp tokenize.cpp
OBJS=$(SRCS:%.cpp=%.o)
TESTS=testbufferoverrun.o testcharvar.o testconstructors.o testdivision.o testmemleak.o testother.o testunusedvar.o
TESTS=testbufferoverrun.o testcharvar.o testconstructors.o testdivision.o testmemleak.o testother.o testpreprocessor.o testunusedvar.o
%.o: %.cpp
g++ -Wall -pedantic -g -I. -o $@ -c $^

21
preprocessor.cpp Normal file
View File

@ -0,0 +1,21 @@
/*
* 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/
*/

28
preprocessor.h Normal file
View File

@ -0,0 +1,28 @@
/*
* 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/
*/
//---------------------------------------------------------------------------
#ifndef preprocessorH
#define preprocessorH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#endif

45
testpreprocessor.cpp Normal file
View File

@ -0,0 +1,45 @@
/*
* 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/
*/
// The preprocessor that c++check uses is a bit special. Instead of generating
// the code for a known configuration, it generates the code for each configuration.
#include "testsuite.h"
#include "preprocessor.h"
class TestPreprocessor : public TestFixture
{
public:
TestPreprocessor() : TestFixture("TestPreprocessor")
{ }
private:
void run()
{
TEST_CASE( test1 );
}
void test1()
{
}
};
REGISTER_TEST( TestPreprocessor )