Commit Graph

226 Commits

Author SHA1 Message Date
Peter Schrammel 4e7a480ee0 Make linter accept alternative copyright header 2017-08-29 22:12:56 +01:00
Peter Schrammel 22016c0469 Do not lint C++ regression tests 2017-08-23 12:51:50 +01:00
Peter Schrammel 3a67dc4052 Merge pull request #1267 from reuk/reuk/master-into-tgs
Merge master into test-gen-support
2017-08-23 09:01:36 +01:00
Daniel Kroening 69a82fc7ff Merge pull request #1175 from karkhaz/kk-cpplint-if-zero
Don't lint text between #if 0...#endif
2017-08-23 06:47:39 +01:00
reuk f17b637121 Merge master into tgs 2017-08-22 15:06:55 +01:00
Daniel Kroening 0346dcd375 Merge pull request #1232 from reuk/reuk/add-merge-driver
Add merge driver
2017-08-11 20:44:34 +02:00
reuk 4d1c26eb92 Add merge driver 2017-08-11 16:37:10 +01:00
Daniel Kroening 517e69f1e5 silence linter on builtin headers 2017-08-10 09:47:01 +02:00
Peter Schrammel bfb397e6fc Suppress some doxygen warnings 2017-08-09 13:34:47 +01:00
Peter Schrammel 8c25dcf3cc Workaround for travis performing shallow clones with wrong branch
travis clones a repo by 'git clone --depth 50 repo' which is ok if the
PR target is the master branch.  It should actually add '--branch=
$TRAVIS_BRANCH' to the clone command.  This commit provides a
workaround.
2017-08-07 13:41:04 +01:00
Chris Smowton c4a072bd6e Merge remote-tracking branch 'upstream/master' into merge-master-2017-08-03 2017-08-03 15:25:32 +01:00
Joel Allred 71d8a14a0d Add zsh support to auto-complete
This required the replacement of calls to _filedir in the script.
2017-07-26 23:32:41 +01:00
Kareem Khazem d4be554988 Don't lint text between #if 0...#endif 2017-07-25 12:36:08 +01:00
Daniel Kroening d80b10ed2f Merge pull request #1031 from pkesseli/cpplint/allow-anonymous-namespaces
Allow anonymous namespaces
2017-07-17 17:28:09 +01:00
Daniel Kroening d36c0d06a1 Merge pull request #1080 from peterschrammel/travis-check-doxygen
Report doxygen warnings on travis
2017-07-15 15:58:45 +01:00
Pascal Kesseli 427194c626 Allow anonymous namespaces
Only give warnings for namespaces with actual names, in accordance with
ad41375353.
This enables the use of anonymous namespaces without warnings.

Fixes: #932
2017-07-12 15:36:32 +02:00
Chris Smowton 0e1b95c5dc Merge remote-tracking branch 'upstream/master' into merge_master_20170705 2017-07-07 09:30:07 +01:00
Peter Schrammel c9acbeee91 Report doxygen warnings on travis 2017-07-06 07:19:55 +01:00
Peter Schrammel ebb745ff75 Extend run_diff to doxygen 2017-07-06 07:19:55 +01:00
Peter Schrammel 64a3ab5b64 Rename run_lint to run_diff 2017-07-03 17:10:23 +01:00
Peter Schrammel 7af068eb2e Generalise run_lint to run with different tools 2017-07-03 17:09:42 +01:00
Peter Schrammel 428507bc44 Generalise filter_by_diff to output lines between warnings 2017-07-03 16:20:35 +01:00
Peter Schrammel 9714e12920 Rename linter filter script 2017-07-03 16:20:17 +01:00
Pascal Kesseli 78a23bbd69 Fix removal of first component
Removal of first component for header guard suggestion is hard-coded to
remove 4 characters ("src/").  This doesn't work with all directory
names ("unit/").
2017-06-28 11:25:07 +02:00
Daniel Kroening 17e596356f Merge pull request #1005 from reuk/script-update
Stop attempting to convert previously-converted doc headers
2017-06-18 17:11:29 +01:00
Daniel Kroening a2a143a4d3 Merge pull request #1022 from karkhaz/ls-parse-script
Add script to find linkerscript-defined info
2017-06-18 17:10:14 +01:00
Kareem Khazem 6cd9693f65 Add script to find linkerscript-defined info
Add ls_parse.py, a script to discover symbols whose values are defined
in a linker script, and valid memory extents corresponding to sections
in an object file. ls_parse can emit this information as a C file,
suitable for compiling into a goto-binary and linking with the rest of
the codebase. ls_parse can also emit the information as a JSON file,
suitable for automatic processing from within goto-cc. This supports
CPROVER in knowing the actual values of symbols that are not defined in
the C source.

CR: https://cr.amazon.com/r/7191907/
2017-06-15 19:27:54 +01:00
Chris Smowton eed0afb9a7 Merge remote-tracking branch 'origin/master' into smowton/merge/master_20170614 2017-06-14 15:56:45 +01:00
Chris Smowton a320377c27 Merge commit 'aed3c25' into smowton/merge/master_20170614 2017-06-14 15:55:11 +01:00
martin 975b5a3550 Get the linter to check for assertions and give a deprecated warning. 2017-06-13 16:12:12 +01:00
reuk bec818e179 Remove duplication from conversion script 2017-06-13 13:14:24 +01:00
reuk a6c32b0d96 Stop attempting to convert previously-converted headers 2017-06-12 19:14:27 +01:00
reuk aed3c25fa3 Modify reformatting script to retain existing headers 2017-06-06 15:13:09 +01:00
reuk 69dacac7e6 Update postprocessor comparison script 2017-06-06 15:13:09 +01:00
reuk 0f6df5c2fb Add doc conversion driver script 2017-06-06 15:13:09 +01:00
reuk e0f2b2b5ca Fix parameter list bug 2017-06-06 15:13:09 +01:00
reuk 7ed20c1839 Allow python script to reformat in place 2017-06-06 15:13:09 +01:00
reuk 3e623f6e96 Revert "Fix up linter script to accept new Copyright label"
This reverts commit 60c5091e36.
2017-06-06 15:13:09 +01:00
reuk 60c5091e36 Fix up linter script to accept new Copyright label 2017-06-06 14:42:12 +01:00
reuk fa1d8e2359 Move conversion scripts to scripts folder 2017-06-06 14:42:12 +01:00
Michael Tautschnig f0fe0200b3 Make the linter ignore generated builtin-header files 2017-05-23 11:01:31 +01:00
reuk 72da3fb3c4 Give pragma files a '.def' suffix 2017-05-18 11:39:41 +01:00
reuk 44c96ebda3 Build cleanly without globally disabling warnings
Disabling warnings globally by setting 'Wno-deprecated-register' and
'Wno-sign-compare' in CXXFLAGS will silence these errors, even in new
code. It's better to use `pragma`-based warning suppression, so that
warnings are only disabled in locations that won't or can't be fixed.
Likewise, rather than filtering 'Wpedantic' from CXXFLAGS when building
some of the solvers, it's better to disable warnings just on the
problematic headers.
2017-05-18 11:33:16 +01:00
reuk a0ef01a2e1 Update linter to find std::endl 2017-05-16 16:21:42 +01:00
reuk 24fd67b55d Give pragma files a '.def' suffix 2017-04-26 22:54:50 +01:00
reuk 1dc27ae206 Build cleanly without globally disabling warnings
Disabling warnings globally by setting 'Wno-deprecated-register' and
'Wno-sign-compare' in CXXFLAGS will silence these errors, even in new
code. It's better to use `pragma`-based warning suppression, so that
warnings are only disabled in locations that won't or can't be fixed.
Likewise, rather than filtering 'Wpedantic' from CXXFLAGS when building
some of the solvers, it's better to disable warnings just on the
problematic headers.
2017-04-26 16:29:49 +01:00
Vojtěch Forejt 29d67d39e2 Merge pull request #679 from diffblue/master
Update test-gen-support from master
2017-03-22 21:39:07 +00:00
Nathan Phillips 36dee831ad Check that filter_lint_by_diff.py exists 2017-03-21 14:09:44 +00:00
Nathan Phillips 6bba4ab110 Work across repos
Use the path of the containing repository of the current path, not the one the script is downloaded into
2017-03-21 14:09:26 +00:00
Nathan Phillips 5fef8411b1 Work with submodules
Made linter use paths relative to current submodule, not the lowest containing repository
2017-03-21 14:07:56 +00:00
Nathan Phillips 9cd9843d36 Comment in lint filter 2017-03-21 14:07:56 +00:00
Nathan Phillips 88816e9998 Ignore stdout, only pass errors to filter script 2017-03-21 14:05:48 +00:00
Peter Schrammel aa8c91ee61 Update test-gen-support from master 2017-03-20 23:17:32 +00:00
thk123 835277b01a Fixed crash on non-ascii diff
Sometimes the diff file would contain a unicode character. Since we were
opening the file, this meant that unidiff was reading the file in the
wrong format. By letting unidiff handle reading the file we slightly
simplify the code and fix this problem.
2017-03-15 16:27:25 +00:00
Vlastimil Zeman 0381aab5ef Support for Linux based on musl-libc.
Change `#ifdef __linux__` and `#if defined(__linux__)` when it really
means *linux with glibc*. To avoid failures and be more specific
it is now adding `defined(__GLIBC__)` to check if `glibc` is present.
2017-03-15 13:51:59 +00:00
Robert (Jamie) Munro 5baa807a63 Add space after comma globally within the line 2017-03-15 13:51:59 +00:00
Robert (Jamie) Munro f1a99f78f2 Replace tabs globally within the line 2017-03-15 13:51:59 +00:00
Robert (Jamie) Munro 0f69c93415 Fix missing space after , errors 2017-03-15 13:51:58 +00:00
Robert (Jamie) Munro 32f91b828f Fix ; after } errors 2017-03-15 13:51:58 +00:00
Robert (Jamie) Munro db2858718d Explore matching nested bracketed stuff 2017-03-15 13:51:58 +00:00
Matthias Güdemann 6861a5826d remove `<regex>` from unapproved headers in cpplint
The reason for `<regex>` being discouraged seems to be a preference for an
external library within Google:

https://github.com/google/styleguide/issues/194
2017-03-15 13:38:55 +00:00
Daniel Kroening 0139558ba4 Merge pull request #570 from zemanlx/feature/compile-on-musl
Support for non-glibc linux which use musl-libc
2017-03-13 15:28:19 +00:00
Daniel Kroening aeb99e86fd Merge pull request #558 from rjmunro/feature/cpplint-sed-format
cpplint sed format improvements
2017-03-13 15:26:01 +00:00
Vlastimil Zeman f6d9f3bebc Support for Linux based on musl-libc.
Change `#ifdef __linux__` and `#if defined(__linux__)` when it really
means *linux with glibc*. To avoid failures and be more specific
it is now adding `defined(__GLIBC__)` to check if `glibc` is present.
2017-03-10 11:58:17 +00:00
Matthias Güdemann 4e8760856b remove `<regex>` from unapproved headers in cpplint
The reason for `<regex>` being discouraged seems to be a preference for an
external library within Google:

https://github.com/google/styleguide/issues/194
2017-03-09 11:05:27 +01:00
Robert (Jamie) Munro 0b11c4385f Add space after comma globally within the line 2017-03-03 10:26:51 +00:00
Robert (Jamie) Munro ce6b2b4ec7 Replace tabs globally within the line 2017-03-03 10:26:51 +00:00
Robert (Jamie) Munro 89d259eb97 Fix missing space after , errors 2017-03-03 10:26:51 +00:00
Robert (Jamie) Munro 4e6c7b2144 Fix ; after } errors 2017-03-03 10:26:51 +00:00
Robert (Jamie) Munro a43b86297d Explore matching nested bracketed stuff 2017-03-03 10:26:51 +00:00
Vojtěch Forejt 2f5b86689f Autocomplete script for bash
See documentation in scripts/bash-autocomplete/Readme.md
2017-03-02 15:10:57 +00:00
Chris Smowton 54ee5820b3 Fix lint filter against deleted files. Fixes #563
git-diff when a file has been removed diffs against /dev/null instead
of the usual pattern `b/some/path/to/file.cpp`. This change avoids
asserting a "b/" prefix in that case.
2017-02-21 13:25:36 +00:00
Chris Smowton 628c66bbaf Add travis-lint script
This uses $TRAVIS_BRANCH to find the pull-request merge target,
and installs the needed Python package.
2017-02-17 13:02:49 +00:00
Chris Smowton 317ffbb0f3 Switch to lint filtering by Python script
This avoids number-of-arguments problems, and is briefer to boot.
It does need Python package unidiff however.
2017-02-17 13:02:49 +00:00
Robert (Jamie) Munro 8ccd570e09 Document output formats 2017-02-16 14:43:41 +00:00
Robert (Jamie) Munro 75cbe79e4e Write sed output to stdout for ease of piping to bash
Also fix other writes to stdout to be preceeded by #
2017-02-16 14:43:40 +00:00
Robert (Jamie) Munro 8ea1668b4a Support gsed output format for Mac OS
gnu sed is installed with this name by homebrew.
2017-02-16 14:43:39 +00:00
Robert (Jamie) Munro a55cd86c37 Add fixer to delete whitespace at end of lines 2017-02-16 14:43:01 +00:00
Robert (Jamie) Munro 6646e4b712 Add tabs -> 2 spaces fixer 2017-02-16 14:42:36 +00:00
Robert (Jamie) Munro cb9bb30660 Add fixer for missing space before { 2017-02-16 13:59:07 +00:00
Robert (Jamie) Munro 58b8d75f7c Add fix for space after `//` comments 2017-02-16 13:44:01 +00:00
Robert (Jamie) Munro b3d1c1e487 Add commented Fix that removes extra lines
Works, but breaks subsequent fixes in the same file. We will need to
reverse the order of line numbers if we want to use this, so that we
apply fixes at the end of the file first.
2017-02-16 13:44:00 +00:00
Robert (Jamie) Munro eb515e40c4 Add more types of fix to sed output format 2017-02-16 13:43:59 +00:00
Robert (Jamie) Munro e6b1201c1f Added "sed" output format that allow automatic fixes 2017-02-16 13:43:58 +00:00
Robert (Jamie) Munro dacece665f Add python encoding line 2017-02-16 13:43:57 +00:00
Michael Tautschnig da0b0d5581 Make the pre-commit hook report non-temporary path names (#477)
This also fixes the problem of failing to deduce the correct include
guards.
2017-02-02 20:39:09 +00:00
Michael Tautschnig 783e84cb3d Script to prepare out-of-tree (aka vpath) builds
Run ../scripts/vpath-setup.sh desired-build-dir from the src/ directory.
2017-01-25 22:06:46 +00:00
thk123 56aea470fd Commented out some false positive tests (#457)
These were causing a bunch of false positives that were making it hard
to find real errors. Until there is time to fix them, just disable them.

Issues associated area:
https://github.com/diffblue/cbmc-testgen/issues/76
  Multi-line template types are complaining about spaces around <

https://github.com/diffblue/cbmc-testgen/issues/75
  Open parentheses inside strings were reporting errors about
  parameters being spread across multiple lines

https://github.com/diffblue/cbmc-testgen/issues/49
  Errors related to final bracket needs to be on the same line as the final
  are being wrongly reported.
2017-01-20 21:57:16 +00:00
Michael Tautschnig 3ceecf6848 Remove explicit "python" as cpplint.py is executable
Follow-up to #433 as suggested by @peterschrammel.
2017-01-18 06:49:44 -08:00
Matthias Güdemann 21ae76103f set executable bit of cpplint.py 2017-01-13 16:48:48 +01:00
Peter Schrammel 81941be03c Merge pull request #428 from thk123/bug/deleted-file-lint
Run lint script handling deleted files
2017-01-12 16:07:58 +00:00
Peter Schrammel 094c76d73e Merge pull request #427 from NathanJPhillips/feature/allow-lint-from-any-folder
Allow lint to be called from any folder
2017-01-12 16:07:30 +00:00
Peter Schrammel adcf35bc78 Merge pull request #426 from NathanJPhillips/bugfix/linter-line-number-recognition
Prevent recognising lines by prefix
2017-01-12 12:32:17 +00:00
thk123 a4954cdaf6 Run lint script handling deleted files
Previously we would try and run git blame on a deleted file (since would
still show up in the diff) which would cause an error. Now we just skip
over such files.
2017-01-12 11:00:44 +00:00
NathanJPhillips fe47dec1ea Allow lint to be called from any folder
This allows use of the lint script without changing to the root of the CBMC folder first; e.g. to lint a non-CBMC project
2017-01-12 10:59:44 +00:00
NathanJPhillips 12561ba8f6 Prevent recognising lines by prefix
Add colon to end of pattern to prevent recognising lines that start with the number of a valid line
2017-01-12 10:44:18 +00:00
Peter Schrammel 272ff50339 Merge pull request #415 from thk123/feature/lint-check-multi-line-function-call
Lint checks nested function calls broken over multiple lines
2017-01-11 18:30:14 +00:00
Peter Schrammel 60ec17195c Merge pull request #417 from thk123/feature/lint-throw-check
Adding check for throw formatting
2017-01-11 16:02:17 +00:00
thk123 4120cddbd1 Detect missing cpplint.py file
If the linting python script is missing, this script fails with a useful
message.
2017-01-11 11:49:24 +00:00
thk123 c35ba68ac0 Don't error if no errors are found
Previously, as we had set -e enabled, the final grep (filtering relevant
errors) would fail if there were no errors to find. This failure was
causing the script to exit with an error code (causing the CI to think
the lint had failed). Now we ignore whether the grep fails or not.
2017-01-11 11:48:53 +00:00