PKEuS
bac8ed7127
Refactorized stringification of tokens:
...
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
2012-04-16 19:51:07 +02:00
PKEuS
8cb904feaa
Refactorizations in class Token:
...
- Added support for < and > in nextArgument()
- Made isStandardType inline by writing its implementation to token.h (like other bool is*() functions)
- Made firstWordEquals return bool instead of integer (only 0 and 1 were returned)
- Use std::string::empty() instead of operator==(""); Use character literals instead of string literals for single characters printed.
2012-04-16 15:28:38 +02:00
Daniel Marjamäki
1d95416840
astyle formatting
2012-03-25 11:51:59 +02:00
Edoardo Prezioso
28431da0ae
Nitpicky style change: use 'for(;;)' construct instead of 'while(true)' in the code.
2012-03-24 21:50:09 +01:00
PKEuS
df0cb89a40
Fixed compiler error
2012-02-13 18:48:44 +01:00
PKEuS
bb319c1c96
Improved Tokens and Tokenizer:
...
- Better handling of deleteThis() as last element of token list
- Code simplified
2012-02-13 17:44:08 +01:00
Edoardo Prezioso
6cac600d37
Token::replace: Little style change.
2012-01-22 00:03:33 +01:00
Edoardo Prezioso
3a2ba173ac
Token::move|replace: update progressValues correctly.
2012-01-21 21:06:30 +01:00
Reijo Tomperi
194327048a
Add InternalError and change MathLib to throw it in case of an error.
...
- Previously MathLib errors did not provide a filename, but after this change at least source file name should be printed
and if token is provided, also line number should be printed.
- Change also Token to use InternalError
- Modify Cppcheck-class to catch InternalError instead of Token
- Run dmake to update Makefile
2012-01-08 22:19:44 +02:00
PKEuS
38ddcde7b0
- Refactorizations in preprocessor.cpp and tokenizer.cpp
...
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 12:58:34 +01:00
PKEuS
064e0ea0d0
Revert "- Refactorizations in preprocessor.cpp and tokenizer.cpp"
...
Committing with subversion seems to have issues. Sorry for that. I'll the changes again, now using git.
This reverts commit 69498de6ca
.
2012-01-02 12:10:53 +01:00
Philipp K
69498de6ca
- Refactorizations in preprocessor.cpp and tokenizer.cpp
...
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 03:15:02 -08:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Daniel Marjamäki
2bb5de4c89
Fixed #3425 (False positive: Null pointer dereference (pointer is checked in macro))
2011-12-18 13:33:23 +01:00
PKEuS
c9f5117cf5
Fixed #3407 (False positive: (inconclusive) Found duplicate branches for if and else. (inline assembler))
2011-12-13 21:42:38 +01:00
Edoardo Prezioso
4de5d87078
1)Remove newly copy of 'eraseTokens' and replace every occurrence with 'deleteNext' with right parameter.
...
2)General improvements to code.
2011-12-08 01:44:18 +01:00
Edoardo Prezioso
76972e8dd3
Extend 'Token::deleteNext' by introducing a new parameter which determines how many tokens should be deleted. It's still not used, though.
2011-12-07 23:36:11 +01:00
PKEuS
1c1c31bea0
Tokenizer: Refactorings and improvements. Better handling of []
2011-12-07 21:15:00 +01:00
Edoardo Prezioso
612b3c59ca
1)Implement another declaration of 'Token::eraseTokens' with parameters: the starting token and the number of times needed to call 'deleteNext'.
...
2)Use the overloaded 'eraseTokens' where needed instead of using consecutively 'deleteNext'.
3)Tokenizer: general optimizations about the deletion of some tokens.
4)Run astyle.
2011-12-07 02:29:03 +01:00
Daniel Marjamäki
2e08c8c5b1
DJGPP: Fixed a few compiler errors by using std::size_t instead of size_t
2011-11-22 21:14:14 +01:00
Reijo Tomperi
eebd1393ff
"Internal error. Token::Match called with varid 0." didn't work when error was in a header file. Fixed that.
2011-11-21 00:41:26 +02:00
Reijo Tomperi
91e89380c2
astyle fix
2011-11-20 23:43:55 +02:00
Reijo Tomperi
e0ea4228cd
"Internal error. Token::Match called with varid 0." will now cause check to abort and write a proper error log with filename. Previously filename was empty and format was always xml.
2011-11-20 23:38:37 +02:00
Edoardo Prezioso
ccdb18f213
Add a sanity check and an error message to linkAt when the index is outside the tokens range.
2011-11-19 13:34:36 +01:00
Thomas Jarosch
a645235d5a
Adapt Token::strAt() to return a const reference like Token::str() does
...
Saves us a complete conversion from string.c_str() back to std::string.
2011-11-14 09:19:46 +01:00
Edoardo Prezioso
2aceb623ae
1)Add 'Token' function 'linkAt', which simplifies the writing 'tokAt(i)->link()' to 'linkAt(i)'.
...
It's still unused, though.
2)Fix one grammatical mistake inside token.h
3)Style change to token.cpp: remove the whitespace between '!' and 'begin'.
2011-11-11 21:55:37 +01:00
Thomas Jarosch
1a454256dc
Cache result of tok->isStandardType()
...
Also contains test order improvements from Johan Samuelson (#3116 ).
Run time went down from 15.15s to 14.95s for the case below.
Benchmarked using these settings:
- CXXFLAGS="-O2 -g -NDEBUG"
- time -p cppcheck.git -q --std=posix --enable=all --inconclusive -Dfoo .
on the "rpm" codebase.
2011-11-09 21:56:30 +01:00
Thomas Jarosch
a83c47d9cf
Fix false positive of %or% match in alternative pattern match code
...
%or% triggered on code using "|=" or "||".
2011-11-06 22:12:31 +01:00
Thomas Jarosch
19c9c97608
Fix single %op% operator not working at all
...
When parsing the Token::Match pattern, we accesed
the wrong character in the pattern and never
executed the %op% check.
In addition the unit test function for %op%
wasn't registered in the test suite. Ups.
All fixed now and also provide a complete
check for all operators %op% supports.
2011-11-06 18:02:18 +01:00
Daniel Marjamäki
9903c8c0d9
astyle formatting
2011-11-05 20:00:18 +01:00
Daniel Marjamäki
2f32965bdf
Token: assert that multicompare patterns don't begin with some %% command
2011-11-05 19:59:48 +01:00
Daniel Marjamäki
5edf153602
Fixed #3294 (Token::Match multi compare false negative)
2011-11-05 19:24:21 +01:00
Reijo Tomperi
682aae3196
Improve internal error print out, print line number with the error message.
2011-11-03 22:43:13 +02:00
Edoardo Prezioso
979f3b051c
Improve nextArgument by returning 0 if there's an unexpected ';'.
2011-10-28 18:57:10 +02:00
Thomas Jarosch
434fb933a8
Implement Token::findsimplematch und use it for simple patterns
2011-10-27 15:59:22 +02:00
Edoardo Prezioso
df5d26901c
Add new warning option to check for dead code and change the order of some struct members to reduce structure padding.
2011-10-24 03:02:00 +02:00
Thomas Jarosch
5b97cc1440
Bugfix: Update token properties on string changes
2011-10-23 21:06:56 +02:00
PKEuS
54b3d72ee3
Added Token::nextArgument()
2011-10-23 11:23:48 +02:00
Daniel Marjamäki
6f8e42a5af
changed the astyle formatting flags
2011-10-13 20:53:06 +02:00
Johan Samuelson
889c407f58
Fixed #3118 (Tokenizer: str*cmp() in hot spot code)
2011-09-20 19:03:19 +02:00
Robert Reif
daf0c71f77
fix #2911 (Token::Match(tok, %oror%|&&) doesn't match &&)
2011-07-31 13:26:26 -04:00
Daniel Marjamäki
d78d8660ab
astyle formatting
2011-07-15 19:02:16 +02:00
John Smits
7f2d62cbde
Fixed #2882 (One-character token can be mistaken for a multiCompare)
2011-07-15 19:01:36 +02:00
Daniel Marjamäki
66d145ba1c
Fixed #2892 (false positive: (portability) Assigning an address value to the integer (int/long/etc) type is not portable)
2011-07-07 15:14:33 +02:00
Martin Exner
2b08744b97
Fixed #2676 (setVarId: variables with global scope qualification :: don't get varids)
2011-04-18 06:56:39 +02:00
Daniel Marjamäki
58dbbb0cab
Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError.
2011-04-14 18:02:01 +02:00
Daniel Marjamäki
747a2331c6
Token::Match : Allow that %oror% and %or% is used in multiCompare patterns
2011-04-10 08:39:55 +02:00
Daniel Marjamäki
6c4f5fc496
Token::multiCompare : allow that %op% is used in multiCompare pattern
2011-04-09 18:09:13 +02:00
Zachary Blair
f89f0c748f
Fixed #2665 (Slightly sped-up how Token::Match() parses patterns)
2011-03-22 00:15:12 -07:00
Robert Reif
d74ae3b0f0
copy all flag fields in a Token
2011-03-07 20:04:25 -05:00
Reijo Tomperi
226b605774
Change year 2010 -> 2011 in license texts.
2011-01-09 21:33:36 +02:00
Zachary Blair
26afb04dc5
Fixed #2105 (Incorrect operator: mutual exclusion over ||)
2010-10-24 18:14:21 -07:00
Pete Johns
50c2fa9ab0
Revert "Fixed #1132 (Detection of misused scope objects)"
...
This reverts commit c6acdccfa0
.
2010-10-01 20:52:16 +10:00
Pete Johns
c6acdccfa0
Fixed #1132 (Detection of misused scope objects)
...
Emits error in the form:
[useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately
...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.
Removed "internal error" from token.cpp, since in this case varid would be NULL.
2010-10-01 20:30:21 +10:00
Daniel Marjamäki
7e954ebb57
Optimisation: optimised Token::Match
2010-09-20 20:15:07 +02:00
Daniel Marjamäki
78e13f098e
Refactorings: Optimised the Token::multiCompare function
2010-09-19 15:14:13 +02:00
Robert Reif
807269b5e9
Refactoring handling of microsoft types. Ticket: #1956
2010-08-22 21:53:45 +02:00
Robert Reif
cb7b508f77
Tokenizer::simplifyBitfields: fixed more issues. Ticket #1956
2010-08-22 13:25:47 +02:00
Daniel Marjamäki
195b48e81f
astyle formatting
2010-08-08 18:55:15 +02:00
Daniel Marjamäki
1d79c164c4
Optimisation: Optimised firstWordEquals
2010-08-08 18:54:49 +02:00
Daniel Marjamäki
adc47f1820
Fixed #1487 (fix gcc compiler warnings)
2010-08-06 21:02:43 +02:00
Daniel Marjamäki
9edecd4a3f
Added ErrorLogger::reportProgress and removed ErrorLogger::ReportProgress. This will make it easier for GUI and other clients to display progress information.
2010-08-03 16:36:21 +02:00
Robert Reif
0bb07e6947
Create a symbol database
2010-07-26 16:46:37 +02:00
Daniel Marjamäki
dfbdd8f9c4
Refactoring Token::Match: Report errors through ErrorLogger. Ticket: #1839
2010-07-24 10:51:17 +02:00
Robert Reif
ee7ad272d6
variable usage: fix false positives when __attribute__ is used. Ticket: #1792
2010-06-16 18:04:31 +02:00
Robert Reif
98ae660260
Fixed #1792 (false positive: Variable 'test' is assigned a value that is never used)
2010-06-14 15:46:57 +02:00
Daniel Marjamäki
b9d8f52cca
CheckBufferOverrun: Fixed false positives caused by refactorings
2010-04-22 19:22:23 +02:00
Daniel Marjamäki
c718a7c595
astyle: Update to astyle 1.24
2010-04-15 20:08:51 +02:00
Reijo Tomperi
35d2a27b9c
Update copyright year in all source files
2010-04-13 22:23:17 +03:00
Reijo Tomperi
6dc3860ae9
Fix more -Wshadow compile warnings
2010-04-09 22:40:37 +03:00
Daniel Marjamäki
1d1d79a1e5
Cleanup: Removed unused %name% cmd for patterns
2010-04-02 20:25:13 +02:00
Daniel Marjamäki
0cad22314e
Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup.
2010-04-02 07:30:58 +02:00
Martin Ettl
193aa7d1d3
astyle fix
2010-04-02 02:21:53 +02:00
Robert Reif
ef57d01f7a
Fixed #1492 (false negatives: array index out of bounds)
2010-03-31 17:14:49 +02:00
Robert Reif
62d2845014
Fixed #1492 (false negatives: array index out of bounds)
2010-03-28 15:56:13 +02:00
Daniel Marjamäki
9394816fcf
Refactoring: Use std::string instead of const char *
2010-02-14 19:58:17 +01:00
Reijo Tomperi
ba00e031c0
Added %name% pattern to Token.
...
Currenly same as %var%, but in the future %var% is supposed to match only tokens that have varid != 0.
2010-02-12 23:40:05 +02:00
Daniel Marjamäki
fb09b2fd37
Fixed #1356 (Double-False positive: uninitialized variable)
2010-02-07 13:34:39 +01:00
Daniel Marjamäki
94b0cbbcff
uncomment validation of Tokenizer::_tokensBack
2010-01-06 21:18:42 +01:00
Daniel Marjamäki
57d1da3910
Ticket #1228 : Handle tokensBack in the Token class. When adding&removing tokens the Token class can make sure that this pointer is updated accordingly. It is very important that the tokensBack has the same scope as the token list, otherwise there will be a dead pointer problem.
2010-01-06 20:19:27 +01:00
Reijo Tomperi
54629ff221
Fix #1037 (tokenizing a nested do while, while loop fails)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/1037
2009-12-04 00:06:03 +02:00
Daniel Marjamäki
b0470d649a
mode change from 755 to 644
2009-11-28 12:56:34 +01:00
Daniel Marjamäki
6e175053c1
minor fixes
2009-11-28 11:47:44 +01:00
Daniel Marjamäki
3db49aee71
fixed buffer overrun and removed redundant function Token::str
2009-11-28 09:48:43 +01:00
Reijo Tomperi
0bdf63d864
Token debug function printOut() can now print out filename instead of index
2009-11-28 00:04:04 +02:00
Reijo Tomperi
2c51542cf1
Fix #1018 (strcat(strcat()) causes assertion in Tokenizer::validate)
...
Test case provided by povaddict
http://sourceforge.net/apps/trac/cppcheck/ticket/1018
2009-11-27 23:21:13 +02:00
Reijo Tomperi
3d5760b149
Fix #947 (Errors not detected when size_t is used instead of int)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/947
2009-11-12 23:31:13 +02:00
Daniel Marjamäki
09859c1019
refactoring the folder structure
2009-10-25 12:49:06 +01:00