|  | 
|  | 1 | +class CbmcAT660 < Formula | 
|  | 2 | +  desc "C Bounded Model Checker" | 
|  | 3 | +  homepage "https://www.cprover.org/cbmc/" | 
|  | 4 | +  url "https://github.com/diffblue/cbmc.git", | 
|  | 5 | +      tag:      "cbmc-6.6.0", | 
|  | 6 | +      revision: "cbmc-3c915ebe35448a20555c1ef55d51540b52c5c34a" | 
|  | 7 | +  license "BSD-4-Clause" | 
|  | 8 | + | 
|  | 9 | +  bottle do | 
|  | 10 | +    root_url "https://github.com/diffblue/homebrew-cbmc/releases/download/bag-of-goodies" | 
|  | 11 | +    sha256 cellar: :any_skip_relocation, arm64_sonoma:      "e8d12d4f33dd52dcb0cccda25d091e178336bdfb4d2613a0dbb3052ace05f31e" | 
|  | 12 | +    sha256 cellar: :any_skip_relocation, arm64_ventura:     "53143c96cb703df1c8d1c283cc5a32811cf3abd984bd38afb697b53f73c82ed1" | 
|  | 13 | +    sha256 cellar: :any_skip_relocation, sonoma:            "a09fb34fff54907969e84c845dae796c9131e5f08a991f21a5e14902135b437e" | 
|  | 14 | +    sha256 cellar: :any_skip_relocation, ventura:           "c56d120a74cd50f94d7c44c4e0b4be15b82c201f60d80a9bca5a8512cb2ac5d2" | 
|  | 15 | +    sha256 cellar: :any_skip_relocation, x86_64_linux:      "7842382106bd523e4a2bf64f090b9ebe1b8d2ba6c1fe5dfecd371e82e4841626" | 
|  | 16 | +  end | 
|  | 17 | + | 
|  | 18 | +  depends_on "cmake" => :build | 
|  | 19 | +  depends_on "maven" => :build | 
|  | 20 | +  depends_on "openjdk" => :build | 
|  | 21 | +  depends_on "rust" => :build | 
|  | 22 | + | 
|  | 23 | +  uses_from_macos "bison" => :build | 
|  | 24 | +  uses_from_macos "flex" => :build | 
|  | 25 | + | 
|  | 26 | +  fails_with gcc: "5" | 
|  | 27 | + | 
|  | 28 | +  def install | 
|  | 29 | +    system "cmake", "-S", ".", "-B", "build", "-Dsat_impl=minisat2;cadical", *std_cmake_args | 
|  | 30 | +    system "cmake", "--build", "build" | 
|  | 31 | +    system "cmake", "--install", "build" | 
|  | 32 | + | 
|  | 33 | +    # lib contains only `jar` files | 
|  | 34 | +    libexec.install lib | 
|  | 35 | +  end | 
|  | 36 | + | 
|  | 37 | +  test do | 
|  | 38 | +    # Find a pointer out of bounds error | 
|  | 39 | +    (testpath/"main.c").write <<~EOS | 
|  | 40 | +      #include <stdlib.h> | 
|  | 41 | +      int main() { | 
|  | 42 | +        char *ptr = malloc(10); | 
|  | 43 | +        char c = ptr[10]; | 
|  | 44 | +      } | 
|  | 45 | +    EOS | 
|  | 46 | +    assert_match "VERIFICATION FAILED", | 
|  | 47 | +                 shell_output("#{bin}/cbmc --pointer-check main.c", 10) | 
|  | 48 | +  end | 
|  | 49 | +end | 
0 commit comments