C-Vise

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

C-Vise is a super-parallel Python port of the C-Reduce. The port is fully compatible to the C-Reduce and uses the same efficient LLVM-based C/C++ reduction tool named clang_delta.

Installation

USE flags

USE flags for dev-util/cvise Super-parallel Python port of the C-Reduce

test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

Emerge

To install dev-util/cvise:

root #emerge --ask dev-util/cvise

Usage

Reducing the official example

C-vise's official example is:

FILE pr94534.c
template<typename T>
class Demo
{
  struct
  {
    Demo* p;
  } payload{this};
  friend decltype(payload);
};

int main()
{
  Demo<int> d;
}

The issue with this example is it compiles on Clang but not GCC, so to figure out why, a reduction script has to be made.

Important
C-Vise's return values might be considered the inverse of "normal" values, 0 means the file is interesting (i.e. failure to compile) and 1 means the file is not interesting (i.e. it successfully compiles).

To make a script to reduce, a simple shell file should suffice:

FILE reduce.sh
#!/bin/sh

g++ pr94534.C -c 2>&1 | grep 'instantiate_class_template_1' && clang++ -c pr94534.C

And finally the reduction may be run:

user $cvise reduce.sh pr94534.c
INFO ===< 30356 >===
INFO running 16 interestingness tests in parallel
INFO INITIAL PASSES
INFO ===< IncludesPass >===
...
template <typename> class a {
  int b;
  friend decltype(b);
};
void c() { a<int> d; }