diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 3101a85521c753f082694f2bc35ba9c81e42abaf..b6ef39a67856b8c00985e4a92dc62e4be686179c 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -31,9 +31,12 @@ dc99367c8f4a95d53ec7ce6187892b91fbfd4c1f 0e05285bd47c752f57c190683608527599fa5afb a767fdcb7adda81a5ef192733ef7c62fd56b30e2 4130bab7a8b59d0c94a22d792b2a7d5a26d3484d +237d1bc71eb5efb7c5f32a097aacb90f90e0ff73 6cc1a6f2036b75c6b2451518ffbfbe025eb1a1f8 +1b7754fe7325a59ddbba62842a4bd907b0af6036 aef808e15e4dcc02dcee7004add8530083d33474 220072cecdcc0b0b8292c40d93e793b3219b506f 6ead6d862f1960e6baca64d335b811c954cf8430 7955ef2039b2010cc30b88da7a47d4f07e298042 8353ff71c9958169cf27c589b678f183cca63a9c +fe98b40c209dbe13fdc2069e26c42d4062fda3f0 diff --git a/.gitattributes b/.gitattributes index 91434116d050a224e0f676a68ea47b63279057e0..81fb7ae21dcd777a52224de02ddba38cd050a364 100644 --- a/.gitattributes +++ b/.gitattributes @@ -166,13 +166,13 @@ README* header_spec=.ignore /bin/sed_get_* header_spec=.ignore -/devel_tools/docker/*.template header_spec=.ignore +/dev/docker/*.template header_spec=.ignore # TODO: header_spec=JCF_LGPL_2_only -/devel_tools/size.mli header_spec=.ignore -/devel_tools/size.ml header_spec=.ignore -/devel_tools/size_states.ml header_spec=.ignore -/devel_tools/size_states.mli header_spec=.ignore +/dev/size.mli header_spec=.ignore +/dev/size.ml header_spec=.ignore +/dev/size_states.ml header_spec=.ignore +/dev/size_states.mli header_spec=.ignore /doc/CC-BY-SA-4.0 header_spec=.ignore /doc/CHANGES.obfuscator header_spec=.ignore @@ -220,7 +220,7 @@ README* header_spec=.ignore /nix/frama-c-public/known_hosts header_spec=.ignore /nix/sources.json header_spec=.ignore -/ptests/tests/**/* header_spec=.ignore +/tools/ptests/tests/**/* header_spec=.ignore /share/framac.vim header_spec=.ignore /share/META.frama-c header_spec=.ignore @@ -337,7 +337,7 @@ README* header_spec=.ignore /bin/frama-c* header_spec=CEA_LGPL /doc/code/*.txt header_spec=CEA_LGPL -/devel_tools/git-hooks/pre-commit header_spec=CEA_LGPL +/dev/git-hooks/pre-commit header_spec=CEA_LGPL /headers/headache_config.txt header_spec=CEA_LGPL /headers/*.sh header_spec=CEA_LGPL_OR_PROPRIETARY diff --git a/.gitignore b/.gitignore index 5b85a81865966bf791ed8dc91d533bb33db4be4a..29cae708d2d8f51474e32144a5d7b340d123060f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,6 @@ ########### TAGS -*.cm* -*.o -*.a *.annot #ocamlyacc -v *.output @@ -20,20 +17,20 @@ TAGS #artifacts from execution frama_c_journal.ml /.frama-c/ -/frama-c-*.tar.gz +/frama-c*.tar.gz /.merlin /headers/hdrck /headers/hdrck.exe #build - +/_opam/ configure autom4te.cache .log.autoconf /.depend /config.log /config.status -/frama-c-*.tar.gz +/frama-c*.tar.gz /distributed /.log.autoconf /.Makefile.user @@ -42,27 +39,31 @@ autom4te.cache .Makefile.plugin.generated .ocamldebug +# This file is generated (on need) during configure +/src/plugins/dune + +#lint +/.lint/ + #tests -/tests/ptests_config -/tests/**/result/ -/tests/**/result_*/ +/.wp-cache +/tests/**/result*/ +/tests/**/oracle*/dune + +/src/plugins/*/tests/**/result*/ +/src/plugins/*/tests/**/oracle*/dune /tests/crowbar/*constfold /tests/crowbar/integer_bb_pretty /tests/crowbar/mutable /tests/crowbar/output-* /tests/crowbar/test_ghost_cfg -/tests/spec/preprocess_dos.c /tests/*/*.opt -/devel_tools/fc-time -/devel_tools/fc-memuse +/dev/fc-time +/dev/fc-memuse /bin/ocamldep_transitive_closure -/bin/check_newlines -/bin/check_newlines.exe -/bin/isutf8 -/bin/isutf8.exe #share /share/Makefile.config @@ -200,8 +201,7 @@ Makefile.plugin.generated /src/kernel_internals/parsing/clexer.ml /src/kernel_internals/parsing/cparser.ml /src/kernel_internals/parsing/cparser.mli -/src/libraries/stdlib/transitioning.ml -/src/plugins/callgraph/cg_viewer.ml +# /src/plugins/callgraph/cg_viewer.ml /src/plugins/gui/debug_manager.ml /src/plugins/gui/dgraph_helper.ml /src/plugins/gui/GSourceView.ml @@ -215,6 +215,17 @@ Makefile.plugin.generated /doc/developer/hello.tar.gz hello-*.tar.gz +# Dune conversion +.merlin +_build +*.install +/config.sed + +# Nix + +# When a nix-build is executed it generates +/result* + ####################### # should remain empty # ####################### diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1b49643d0b39c0a5181be374f9f2d2e174f7fe8..3be36fee6c1252fd76117cd18912f6e4bb0c5f68 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,279 +1,388 @@ +################################################################################ +### STAGES + stages: - - git-update - - build - - tests - - distrib_and_compatibility - - make_public + - prepare + - build + - tests + - distrib + - compatibility + - publish + +################################################################################ +### DEFAULT JOB PARAMETERS + +default: + interruptible: true + tags: [ nix ] + +################################################################################ +### VARIABLES variables: - CURRENT: $CI_COMMIT_REF_NAME - DEFAULT: "master" - FRAMA_CI_OPT: "--override frama-c:$CI_COMMIT_REF_NAME,$CI_COMMIT_SHA" - OCAML: "4_08" + DEFAULT: "feature/bobot/jbuilder" + OCAML: "4.11" + PUBLISH: "no" + +################################################################################ +### PREPARE check-no-old-frama-c: - stage: git-update + stage: prepare script: - - (! git merge-base --is-ancestor a1e186c68a6418a53b3dc06237f49e8dcbf75f4a HEAD) - - git merge-base --is-ancestor a35d2118fe6999dddce9e1847eff626fae9cc37c HEAD - tags: - - nix + - (! git merge-base --is-ancestor a1e186c68a6418a53b3dc06237f49e8dcbf75f4a HEAD) + - git merge-base --is-ancestor a35d2118fe6999dddce9e1847eff626fae9cc37c HEAD -#avoid a nix error https://github.com/NixOS/nix/issues/2087 -git-update: - stage: git-update +.build_template: &do_not_stop_pipeline_template + stage: prepare + interruptible: false script: - - nix/frama-ci.sh instantiate --eval -A frama-c.src.outPath - tags: - - nix + - echo "This pipeline won't be interrupted" + +unstoppable-pipeline: + <<: *do_not_stop_pipeline_template + only: + variables: + - $DEFAULT == $CI_COMMIT_BRANCH + +do-not-stop-pipeline: + <<: *do_not_stop_pipeline_template + when: manual + except: + variables: + - $DEFAULT == $CI_COMMIT_BRANCH + +################################################################################ +### BUILD frama-c: stage: build script: - - nix/frama-ci.sh build -A frama-c.main + - ./nix/build-proxy.sh frama-c artifacts: when: on_failure paths: - commits.nix - results.log expire_in: 1 day - tags: - - nix -lint: +ivette: stage: build + image: node:lts-gallium + cache: + paths: + - ivette/node_modules/ script: - - nix/frama-ci.sh build -A frama-c.lint - coverage: '/lint coverage: \d+\.\d+/' + - node --version + - npm --version + - yarn --version + - make -C ivette tags: - - nix + - docker -tests: - stage: tests - script: - - nix/frama-ci.sh build -A frama-c.tests - tags: - - nix +################################################################################ +### TESTS -wp-qualif: - stage: tests - script: - - nix/frama-ci.sh build -A frama-c.wp-qualif - tags: - - nix -aorai-prove: +e-acsl-tests: stage: tests script: - - nix/frama-ci.sh build -A frama-c.aorai-prove - tags: - - nix - allow_failure: true + - ./nix/build-proxy.sh e-acsl-tests -genassigns: +.build_template: &eva_template stage: tests script: - - nix/frama-ci.sh build -A genassigns.tests - tags: - - nix + - ./nix/build-proxy.sh eva-$CONFIG-tests -frama-clang: - stage: tests - script: - - nix/frama-ci.sh build -A frama-clang.tests - tags: - - nix +eva-default-tests: + variables: + CONFIG: "default" + <<: *eva_template -acsl-importer: - stage: tests - script: - - nix/frama-ci.sh build -A acsl-importer.tests - tags: - - nix +eva-domains: + <<: *eva_template + parallel: + matrix: + - CONFIG: ["bitwise","equality","gauges","multidim","octagon","symblocs"] -volatile: +kernel-tests: stage: tests script: - - nix/frama-ci.sh build -A volatile.tests - tags: - - nix + - ./nix/build-proxy.sh kernel-tests -metacsl: +plugins-tests: stage: tests script: - - nix/frama-ci.sh build -A meta.tests - tags: - - nix + - ./nix/build-proxy.sh plugins-tests -Security: +wp-tests: stage: tests script: - - nix/frama-ci.sh build -A security.tests - tags: - - nix + - ./nix/build-proxy.sh wp-tests -CFP: +external-plugins: stage: tests script: - - nix/frama-ci.sh build -A context-from-precondition.tests - tags: - - nix - -Linea-Cabs: - stage: tests + - ./nix/external-plugin-ci.sh $PLUGIN + parallel: + matrix: + - PLUGIN: [ + "ACSL-importer", + "Caveat-importer", + "context-from-precondition", + "frama-clang", + "genassigns", + "linea-cabs", + "meta", + "mthread", + "security", + "Volatile" + ] + +################################################################################ +### DISTRIB + +# API documentation + +.build_template: &api_doc_template + stage: distrib + variables: + OUT: "api" script: - - nix/frama-ci.sh build -A linea-cabs.tests - tags: - - nix + - ./nix/build-proxy.sh api-doc -eva-tests: - stage: tests - script: - - nix/frama-ci.sh build -A frama-c.eva-tests - tags: - - nix - allow_failure: true +api-doc-default: # Check that we successfully build but no artifact + <<: *api_doc_template + +api-doc-artifact: # Note: the Nix store avoids rebuilding + <<: *api_doc_template + artifacts: + paths: + - api/frama-c-api.tar.gz + expire_in: 7 days + when: manual + +api-doc-scheduled: # Keep artifact for published branch each night + <<: *api_doc_template + artifacts: + paths: + - api/frama-c-api.tar.gz + expire_in: 7 days # Note: the LAST artifact of the ref is always kept + only: + variables: + - $PUBLISH == "yes" + +# Build distribution tarball build-distrib-tarball: - stage: build + stage: distrib + variables: + OPEN_SOURCE: "yes" + CI_LINK: "yes" + HDRCK: "frama-c-hdrck" script: - - nix/frama-ci.sh build -A frama-c.build-distrib-tarball - tags: - - nix + - ./nix/shell-checkers.sh "autoconf && ./dev/make-distrib.sh" + artifacts: + paths: + - ./*.tar.gz + expire_in: 1 week -build-from-distrib-tarball: - stage: tests +# Check files header + +header-check: + stage: distrib + variables: + FRAMAC_HDRCK: "" script: - - nix/frama-ci.sh build -A frama-c.build-from-distrib-tarball - tags: - - nix + - ./nix/shell-checkers.sh "make -f share/Makefile.headers check-headers" -doc: - stage: tests +# Lint files + +lint: + stage: distrib + variables: + LINT_MAKEFILE: "share/Makefile.linting" script: - - nix/frama-ci.sh build -A frama-c.doc - tags: - - nix - allow_failure: true + - ./nix/shell-checkers.sh "make -f share/Makefile.linting lint" + +# Manuals + +.build_template: &manuals_template + stage: distrib + variables: + OUT: "manuals" + script: + - ./nix/build-proxy.sh manuals + +manuals: + <<: *manuals_template + when: manual + artifacts: + paths: + - manuals/*.pdf + - manuals/*.tgz + expire_in: 7 days # Note: the LAST artifact of the ref is always kept + +################################################################################ +### COMPATIBILITY + +# Internalized plugins tests .build_template: &internal_template - stage: distrib_and_compatibility - tags: - - nix + stage: compatibility + script: + - ./nix/internal-tests.sh internal: <<: *internal_template - script: - - nix/frama-ci.sh build -A frama-c.internal when: manual - + except: + - schedules internal_nightly: <<: *internal_template - script: - - nix/frama-ci.sh build -A frama-c.internal + # The Opam target may affect this job + timeout: 2h only: - - schedules + - schedules +# OCaml versions -.build_template: &frama-c-ocaml - stage: distrib_and_compatibility +.build_template: &ocaml_versions_template + stage: compatibility script: - - nix/frama-ci.sh build -A frama-c.tests - tags: - - nix + - ./nix/build-proxy.sh default-config-tests + parallel: + matrix: + - OCAML: ["4.08", "4.13"] + +ocaml-versions: + <<: *ocaml_versions_template + # in schedules, each OCAML is tested in its own complete pipeline + except: + - schedules + +ocaml-versions-nightly: + <<: *ocaml_versions_template + # we still check them for the publisher pipeline job + only: + variables: + - $PUBLISH == "yes" -frama-c-ocaml-4.13: - variables: - OCAML: "4_13" - <<: *frama-c-ocaml +# Opam pin -caveat-importer: - stage: tests +.build_template: &opam_template + stage: compatibility + image: 'ocaml/opam:ubuntu-20.04-ocaml-$OCAML' script: - - nix/frama-ci.sh build -A caveat-importer.tests + - opam pin . -n + - opam depext frama-c --with-test + - opam install --jobs 2 frama-c --with-test tags: - - nix + - docker -mthread: - stage: tests - script: - - nix/frama-ci.sh build -A mthread.tests - tags: - - nix +opam-pin: + <<: *opam_template + when: manual + except: + - schedules -pathcrawler: - stage: tests - script: - - nix/frama-ci.sh build -A pathcrawler.tests - tags: - - nix +opam-pin-nightly: + <<: *opam_template + only: + - schedules + allow_failure: true -e-acsl-tests-dev: - stage: tests +# TODO: Enable this rule later: +# +# opam-pin-minimal: +# variables: +# OPAMSOLVERTIMEOUT: "500" +# OPAMCRITERIA: "+count[version-lag,solution]" +# OPAMEXTERNALSOLVER: "builtin-0install" +# stage: prepare +# image: 'ocaml/opam:ubuntu-20.04-ocaml-$OCAML' +# script: +# - sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam +# - opam --version +# - opam init --reinit -ni +# - opam pin . -n +# - opam depext frama-c --with-test +# - opam install --jobs 2 frama-c --with-test +# tags: +# - docker + +# Distrib + +.build_template: &src_distrib_tests_template + stage: compatibility + variables: + DIR: "extracted" script: - - nix/frama-ci.sh build -A frama-c.e-acsl-tests-dev - tags: - - nix + - mkdir $DIR && tar -xzf frama-c.tar.gz --strip-components 1 -C ./extracted + - ./nix/build-proxy.sh src-distrib-tests + +src-distrib-tests: + <<: *src_distrib_tests_template + except: + - schedules + +src-distrib-tests-nightly: + <<: *src_distrib_tests_template + # The Opam target may affect this job + timeout: 2h + only: + - schedules -ivette: - stage: build - image: node:lts-gallium - cache: - paths: - - ivette/node_modules/ - script: - - node --version - - npm --version - - yarn --version - - make -C ivette - tags: - - docker +################################################################################ +### PUBLISH -# make_public stage is used to push the current master branch of Frama-C and +# publish stage is used to push the current master branch of Frama-C and # associated plugins from the internal frama-c group to the public pub group. -# For that, it uses the 'frama-c to frama-c-public' deploy key. Thus, to publish +# +# For that, it uses the 'frama-c to frama-c-public' publish key. Thus, to publish # a new plugin (while keeping its main repository internal), you can add a new # target to this stage, adapting the script for MetAcsl or Frama-Clang to your # own plugin. -# You must also activate the deploy key on both frama-c/my_plugin +# +# You must also activate the publish key on both frama-c/my_plugin # and pub/my_plugin repositories (the former should be read-only, the latter -# must provide write access to the deploy key). +# must provide write access to the publish key). # Do not forget to trigger the target only on schedules, so that all public # repositories stay synchronized. -make_public: - stage: make_public +publish-frama-c: + stage: publish script: - - (! git merge-base --is-ancestor a1e186c68a6418a53b3dc06237f49e8dcbf75f4a origin/master) - - echo "$FRAMA_C_PUBLIC_SSH_PRIVATE_KEY" | nix run -f channel:nixos-19.03 coreutils --command base64 -d > nix/frama-c-public/id_ed25519 - - nix run -f channel:nixos-19.03 coreutils --command chmod 400 nix/frama-c-public/id_ed25519 - - GIT_SSH=nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git push git@git.frama-c.com:pub/frama-c.git origin/master:refs/heads/master - tags: - - nix + - (! git merge-base --is-ancestor a1e186c68a6418a53b3dc06237f49e8dcbf75f4a origin/master) + - echo "$FRAMA_C_PUBLIC_SSH_PRIVATE_KEY" | nix run -f channel:nixos-19.03 coreutils --command base64 -d > nix/frama-c-public/id_ed25519 + - nix run -f channel:nixos-19.03 coreutils --command chmod 400 nix/frama-c-public/id_ed25519 + - GIT_SSH=nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git push git@git.frama-c.com:pub/frama-c.git origin/master:refs/heads/master only: - - schedules + variables: + - $PUBLISH == "yes" + interruptible: false -make_public_meta: - stage: make_public +publish-meta: + stage: publish script: - - echo "$FRAMA_C_PUBLIC_SSH_PRIVATE_KEY" | nix run -f channel:nixos-19.03 coreutils --command base64 -d > nix/frama-c-public/id_ed25519 - - nix run -f channel:nixos-19.03 coreutils --command chmod 400 nix/frama-c-public/id_ed25519 - - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git clone git@git.frama-c.com:frama-c/meta.git nix/frama-c-public/meta - - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git -C nix/frama-c-public/meta push git@git.frama-c.com:pub/meta origin/master:refs/heads/master - tags: - - nix + - echo "$FRAMA_C_PUBLIC_SSH_PRIVATE_KEY" | nix run -f channel:nixos-19.03 coreutils --command base64 -d > nix/frama-c-public/id_ed25519 + - nix run -f channel:nixos-19.03 coreutils --command chmod 400 nix/frama-c-public/id_ed25519 + - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git clone git@git.frama-c.com:frama-c/meta.git nix/frama-c-public/meta + - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git -C nix/frama-c-public/meta push git@git.frama-c.com:pub/meta origin/master:refs/heads/master only: - - schedules + variables: + - $PUBLISH == "yes" + interruptible: false -make_public_fclang: - stage: make_public +publish-fclang: + stage: publish script: - - echo "$FRAMA_C_PUBLIC_SSH_PRIVATE_KEY" | nix run -f channel:nixos-19.03 coreutils --command base64 -d > nix/frama-c-public/id_ed25519 - - nix run -f channel:nixos-19.03 coreutils --command chmod 400 nix/frama-c-public/id_ed25519 - - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git clone git@git.frama-c.com:frama-c/frama-clang.git nix/frama-c-public/frama-clang - - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git -C nix/frama-c-public/frama-clang push git@git.frama-c.com:pub/frama-clang origin/master:refs/heads/master - tags: - - nix + - echo "$FRAMA_C_PUBLIC_SSH_PRIVATE_KEY" | nix run -f channel:nixos-19.03 coreutils --command base64 -d > nix/frama-c-public/id_ed25519 + - nix run -f channel:nixos-19.03 coreutils --command chmod 400 nix/frama-c-public/id_ed25519 + - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git clone git@git.frama-c.com:frama-c/frama-clang.git nix/frama-c-public/frama-clang + - GIT_SSH=$PWD/nix/frama-c-public/ssh.sh nix run -f channel:nixos-19.03 openssh --command git -C nix/frama-c-public/frama-clang push git@git.frama-c.com:pub/frama-clang origin/master:refs/heads/master only: - - schedules + variables: + - $PUBLISH == "yes" + interruptible: false diff --git a/Changelog b/Changelog index 8fa0ae1eca938d72e434382f575730467f3d4786..dc984a5c05ecad75c391614d7f387263f3c0d859 100644 --- a/Changelog +++ b/Changelog @@ -18,6 +18,7 @@ Open Source Release <next-release> ################################## +o! Pdg [2022-07-01] Removed from Db. Use proper Pdg API instead. -! Kernel [2022-06-06] Remove journalisation. #################################### diff --git a/Makefile b/Makefile index aae354b695ec534ea789b4548c21a249377569a8..b3735d0559e79e224576485d3d512e96448481ac 100644 --- a/Makefile +++ b/Makefile @@ -22,1362 +22,40 @@ # This file is the main makefile of Frama-C. -FRAMAC_SRC=. MAKECONFIG_DIR=share -PLUGIN_TESTS_LIST:= -include share/Makefile.common -include share/Makefile.dynamic_config.internal - -#Check share/Makefile.config available -ifndef FRAMAC_ROOT_SRCDIR -$(error \ - "You should run ./configure first (or autoconf if there is no configure)") -endif - -################### -# Frama-C Version # -################### - -VERSION:=$(shell $(CAT) VERSION) -VERSION_SAFE=$(subst ~,-,$(VERSION)) -VERSION_CODENAME:=$(shell $(CAT) VERSION_CODENAME) - -########################### -# Global plugin variables # -########################### - -# the directory where compiled plugin non-GUI files are stored -PLUGIN_TOP_LIB_DIR= $(PLUGIN_LIB_DIR)/top - -# the directory where compiled plugin GUI files are stored -PLUGIN_GUI_LIB_DIR= $(PLUGIN_LIB_DIR)/gui - -# the directory where the other Makefiles are -FRAMAC_SHARE = share - -# Shared lists between Makefile.plugin and Makefile : -# initialized them as "simply extended variables" (with :=) -# for a correct behavior of += (see section 6.6 of GNU Make manual) -PLUGIN_LIST := -PLUGIN_GENERATED_LIST:= -PLUGIN_CMO_LIST := -PLUGIN_CMX_LIST := -PLUGIN_META_LIST := -PLUGIN_DYN_CMI_LIST := -PLUGIN_DYN_CMO_LIST := -PLUGIN_DYN_CMX_LIST := -PLUGIN_INTERNAL_CMO_LIST:= -PLUGIN_INTERNAL_CMX_LIST:= -PLUGIN_GUI_CMO_LIST:= -PLUGIN_GUI_CMX_LIST:= -PLUGIN_DYN_DEP_GUI_CMO_LIST:= -PLUGIN_DYN_DEP_GUI_CMX_LIST:= -PLUGIN_DYN_GUI_CMO_LIST := -PLUGIN_DYN_GUI_CMX_LIST := -PLUGIN_TYPES_CMO_LIST := -PLUGIN_TYPES_CMX_LIST := -PLUGIN_DEP_LIST:= -PLUGIN_DOC_LIST := -PLUGIN_DOC_DIRS := -PLUGIN_DOC_DUMP_LIST := -PLUGIN_DISTRIBUTED_LIST:= -PLUGIN_DIST_TARGET_LIST:= -PLUGIN_DIST_DOC_LIST:= -PLUGIN_BIN_DOC_LIST:= -PLUGIN_DIST_EXTERNAL_LIST:= -PLUGIN_DIST_TESTS_LIST:= -PLUGIN_DISTRIBUTED_NAME_LIST:= - -PLUGIN_HEADER_SPEC_LIST := -PLUGIN_HEADER_DIRS_LIST := -PLUGIN_HEADER_EXCEPTIONS_LIST := -PLUGIN_CEA_PROPRIETARY_HEADERS_LIST := -PLUGIN_CEA_PROPRIETARY_FILES_LIST := - -# default value used for HEADER_SPEC and PLUGIN_HEADER_SPEC -DEFAULT_HEADER_SPEC := headers/header_spec.txt -# default value used for HEADER_DIRS and PLUGIN_HEADER_DIRS -DEFAULT_HEADER_DIRS := headers -# default value used for HEADER_EXCEPTIONS and PLUGIN_HEADER_EXCEPTIONS -DEFAULT_HEADER_EXCEPTIONS := configure -# default value used for CEA_PROPRIETARY_FILES and PLUGIN_CEA_PROPRIETARY_FILES -DEFAULT_CEA_PROPRIETARY_FILES := tests/non-free/% -# default value used for CEA_PROPRIETARY_HEADERS -# and PLUGIN_CEA_PROPRIETARY_HEADERS -DEFAULT_CEA_PROPRIETARY_HEADERS := CEA_PROPRIETARY - -MERLIN_PACKAGES:= - -############################### -# Additional global variables # -############################### - -# Directories containing some source code -SRC_DIRS= ptests $(PLUGIN_LIB_DIR) $(FRAMAC_SRC_DIRS) - -# Directory containing source code documentation -DOC_DIR = doc/code - -# Source files to document -MODULES_TODOC= - -# Directories to include when compiling -INCLUDES=$(addprefix -I ,$(FRAMAC_SRC_DIRS)) -I $(PLUGIN_LIB_DIR) -ifneq ($(ENABLE_GUI),no) -GUI_INCLUDES = $(addprefix -package ,$(LIBRARY_NAMES_GUI)) -else -GUI_INCLUDES = -endif - -# Files for which dependencies must be computed. -# Other files are added later in this Makefile. -FILES_FOR_OCAMLDEP+=$(PLUGIN_LIB_DIR)/*.mli - -BFLAGS = $(PACKAGES) $(FLAGS) $(DEBUG) $(INCLUDES) \ - $(FRAMAC_USER_BFLAGS) -OFLAGS = $(PACKAGES) $(FLAGS) $(DEBUG) $(INCLUDES) -compact \ - $(FRAMAC_USER_OFLAGS) - -BLINKFLAGS += -linkpkg $(BFLAGS) -linkall -custom -OLINKFLAGS += -linkpkg $(OFLAGS) -linkall - -DOC_FLAGS= -charset utf8 -colorize-code -stars -m A $(PACKAGES) $(INCLUDES) $(GUI_INCLUDES) - -ifneq ($(VERBOSEMAKE),yes) -DOC_FLAGS+= -hide-warnings -endif - -# Files that depend on external libraries -namely Zarith- whose interface -# has not been explicitely declared -opaque, hence would trigger warning 58. -# This can't be solved by Frama-C itself, we can only wait for an update of -# said library. - -NON_OPAQUE_DEPS:= - -# Libraries generated by Frama-C -GEN_BYTE_LIBS= -GEN_OPT_LIBS= - -# Libraries used in Frama-C -EXTRA_OPT_LIBS:= -PACKAGES = $(addprefix -package ,$(LIBRARY_NAMES)) -BYTE_LIBS = $(GEN_BYTE_LIBS) -OPT_LIBS = $(EXTRA_OPT_LIBS) - -OPT_LIBS+= $(GEN_OPT_LIBS) - -ICONS:= $(addprefix share/,\ - frama-c.ico frama-c.png unmark.png \ - switch-on.png switch-off.png) - -THEME_ICON_NAMES:= \ - never_tried.png \ - unknown.png \ - surely_valid.png \ - surely_invalid.png \ - considered_valid.png \ - valid_under_hyp.png \ - invalid_under_hyp.png \ - invalid_but_dead.png \ - unknown_but_dead.png \ - valid_but_dead.png \ - inconsistent.png \ - fold.png unfold.png - -THEME_ICONS_DEFAULT:= \ - $(addprefix share/theme/default/,$(THEME_ICON_NAMES)) -THEME_ICONS_COLORBLIND:= \ - $(addprefix share/theme/colorblind/,$(THEME_ICON_NAMES)) -THEME_ICONS_FLAT:= \ - $(addprefix share/theme/flat/,$(THEME_ICON_NAMES)) - -ROOT_LIBC_DIR:= share/libc -LIBC_SUBDIRS:= sys netinet net arpa -LIBC_DIR:= $(ROOT_LIBC_DIR) $(addprefix $(ROOT_LIBC_DIR)/,$(LIBC_SUBDIRS)) -LIBC_FILES:= \ - $(wildcard share/*.h share/*.c) \ - $(wildcard $(addsuffix /*.h,$(LIBC_DIR))) \ - $(wildcard $(addsuffix /*.c,$(LIBC_DIR))) - -# Checks that all .h can be included multiple times. -ALL_LIBC_HEADERS:=$(wildcard share/*.h $(addsuffix /*.h,$(LIBC_DIR))) - -check-libc: bin/toplevel.$(OCAMLBEST)$(EXE) - @echo "checking libc..."; \ - EXIT_VALUE=0; \ - for file in $(filter-out share/builtin.h,$(ALL_LIBC_HEADERS)); do \ - echo "#include \"$$file\"" > check-libc.c; \ - echo "#include \"$$file\"" >> check-libc.c; \ - FRAMAC_SHARE=share bin/toplevel.$(OCAMLBEST)$(EXE) \ - -cpp-extra-args="-Ishare/libc -nostdinc" check-libc.c \ - > $$(basename $$file .h).log 2>&1; \ - if test $$? -ne 0; then \ - if grep -q -e '#error "Frama-C:' $$file; then : ; \ - else \ - echo "$$file cannot be included twice. \ -Output is in $$(basename $$file .h).log"; \ - EXIT_VALUE=1; \ - fi; \ - else \ - rm $$(basename $$file .h).log; \ - fi; \ - done; \ - rm check-libc.c; \ - exit $$EXIT_VALUE - -clean-check-libc: - $(RM) *.log - -# Kernel files to be included in the distribution. -# Plug-ins should use PLUGIN_DISTRIB_EXTERNAL if they export something else -# than *.ml* files in their directory. -# NB: configure for the distribution is generated in the distrib directory -# itself, rather than copied: otherwise, it could include references to -# non-distributed plug-ins. -DISTRIB_FILES:=\ - $(wildcard bin/migration_scripts/*2*.sh) bin/local_export.sh \ - bin/frama-c bin/frama-c.byte bin/frama-c-gui bin/frama-c-gui.byte \ - bin/frama-c-config bin/frama-c-script \ - share/frama-c.WIN32.rc share/frama-c.Unix.rc \ - $(ICONS) $(THEME_ICONS_DEFAULT) $(THEME_ICONS_COLORBLIND) \ - $(THEME_ICONS_FLAT) \ - man/frama-c.1 doc/README \ - doc/code/docgen.ml \ - $(wildcard doc/code/*.css) doc/code/intro_plugin.txt \ - doc/code/intro_plugin_D_and_S.txt \ - doc/code/intro_plugin_default.txt \ - doc/code/intro_kernel_plugin.txt \ - doc/code/toc_head.htm \ - doc/code/toc_tail.htm \ - doc/Makefile \ - $(filter-out ptests/ptests_config.ml,$(wildcard ptests/*.ml*)) \ - configure.in Makefile Makefile.generating \ - Changelog config.h.in \ - VERSION VERSION_CODENAME $(wildcard licenses/*) \ - $(LIBC_FILES) \ - share/analysis-scripts/analysis.mk \ - share/analysis-scripts/benchmark_database.py \ - share/analysis-scripts/build.py \ - share/analysis-scripts/build_callgraph.py \ - share/analysis-scripts/cmd-dep.sh \ - share/analysis-scripts/concat-csv.sh \ - share/analysis-scripts/clone.sh \ - share/analysis-scripts/creduce.sh \ - share/analysis-scripts/detect_recursion.py \ - share/analysis-scripts/epilogue.mk \ - share/analysis-scripts/estimate_difficulty.py \ - share/analysis-scripts/fc_stubs.c \ - share/analysis-scripts/find_fun.py \ - share/analysis-scripts/flamegraph.pl \ - share/analysis-scripts/frama_c_results.py \ - share/analysis-scripts/function_finder.py \ - share/analysis-scripts/git_utils.py \ - share/analysis-scripts/heuristic_list_functions.py \ - share/analysis-scripts/list_files.py \ - share/analysis-scripts/list_functions.ml \ - share/analysis-scripts/make_wrapper.py \ - share/analysis-scripts/normalize_jcdb.py \ - share/analysis-scripts/parse-coverage.sh \ - share/analysis-scripts/print_callgraph.py \ - share/analysis-scripts/prologue.mk \ - share/analysis-scripts/pyproject.toml \ - share/analysis-scripts/README.md \ - share/analysis-scripts/results_display.py \ - share/analysis-scripts/script_for_creduce_fatal.sh \ - share/analysis-scripts/script_for_creduce_non_fatal.sh \ - share/analysis-scripts/source_filter.py \ - share/analysis-scripts/summary.py \ - share/analysis-scripts/template.mk \ - $(wildcard share/emacs/*.el) share/autocomplete_frama-c \ - share/_frama-c \ - share/compliance/c11_functions.json \ - share/compliance/c11_headers.json \ - share/compliance/compiler_builtins.json \ - share/compliance/gcc_builtins.json \ - share/compliance/glibc_functions.json \ - share/compliance/nonstandard_identifiers.json \ - share/compliance/posix_identifiers.json \ - share/configure.ac \ - share/Makefile.config.in share/Makefile.common \ - share/Makefile.generic \ - share/Makefile.plugin.template share/Makefile.dynamic \ - share/Makefile.dynamic_config.external \ - share/Makefile.dynamic_config.internal \ - share/META.frama-c \ - $(filter-out src/kernel_internals/runtime/fc_config.ml, \ - $(wildcard src/kernel_internals/runtime/*.ml*)) \ - $(wildcard src/kernel_services/abstract_interp/*.ml*) \ - $(wildcard src/plugins/gui/*.ml*) \ - $(wildcard src/libraries/stdlib/*.ml*) \ - $(wildcard src/libraries/utils/*.ml*) \ - $(wildcard src/libraries/utils/*.c) \ - $(wildcard src/libraries/project/*.ml*) \ - $(filter-out src/kernel_internals/parsing/check_logic_parser.ml, \ - $(wildcard src/kernel_internals/parsing/*.ml*)) \ - $(wildcard src/kernel_internals/typing/*.ml*) \ - $(wildcard src/kernel_services/ast_data/*.ml*) \ - $(wildcard src/kernel_services/ast_queries/*.ml*) \ - $(wildcard src/kernel_services/ast_building/*.ml*) \ - $(wildcard src/kernel_services/ast_printing/*.ml*) \ - $(wildcard src/kernel_services/cmdline_parameters/*.ml*) \ - $(wildcard src/kernel_services/analysis/*.ml*) \ - $(wildcard src/kernel_services/ast_transformations/*.ml*) \ - $(wildcard src/kernel_services/plugin_entry_points/*.ml*) \ - $(wildcard src/kernel_services/visitors/*.ml*) \ - $(wildcard src/kernel_services/parsetree/*.ml*) \ - $(wildcard src/libraries/datatype/*.ml*) \ - bin/sed_get_make_major bin/sed_get_make_minor \ - INSTALL.md README.md .make-clean \ - .make-clean-stamp .force-reconfigure \ - opam/opam \ - -# Test files to be included in the distribution (without header checking). -# Plug-ins should use PLUGIN_DISTRIB_TESTS to export their test files. -DISTRIB_TESTS=$(shell find \ - tests \ - src/plugins/aorai/tests \ - src/plugins/report/tests \ - src/plugins/wp/tests \ - -type d -name result -prune -false \ - -o -type d -name 'result_*' -prune -false \ - -o -path 'tests/crowbar/*' -type d \! -name input -prune -false \ - -o -type f \! -name "*\.log" \! -name "*\.o" \ - \! -name '*~' \! -name "*\.cm*" \! -name "*.sav" \ - -perm -u+w | sed -e 's/ /@/g') - -# files that are needed to compile API documentation of external plugins -DOC_GEN_FILES:=$(addprefix doc/code/,\ - *.css intro_plugin.txt intro_kernel_plugin.txt \ - intro_plugin_default.txt intro_plugin_D_and_S \ - kernel-doc.ocamldoc \ - docgen.ml docgen.cm* *.htm) - -################ -# Main targets # -################ - -# additional compilation targets for 'make all'. -# cannot be delayed after 'make all' -EXTRAS = ptests - -ifneq ($(ENABLE_GUI),no) -ifeq ($(HAS_LABLGTK),yes) -EXTRAS += gui -endif -endif - -all:: byte $(OCAMLBEST) $(EXTRAS) plugins_ptests_config - -.PHONY: top opt byte dist bdist rebuild rebuild-branch - -dist: clean - $(QUIET_MAKE) all - -clean-rebuild: clean - $(QUIET_MAKE) all - -rebuild: config.status - $(MAKE) smartclean - $(MAKE) depend $(FRAMAC_PARALLEL) - $(MAKE) all $(FRAMAC_PARALLEL) || \ - (touch .force-reconfigure; \ - $(MAKE) config.status && \ - $(MAKE) depend $(FRAMAC_PARALLEL) && \ - $(MAKE) all $(FRAMAC_PARALLEL)) - -sinclude .Makefile.user -# Should define FRAMAC_PARALLEL, FRAMAC_USER_FLAGS, FRAMAC_USER_MERLIN_FLAGS - -#Create link in share for local execution if -.PHONY:create_share_link -create_share_link: share/.gitignore - -# note: when using opam pin path in a cloned Frama-C git, the symbolic links -# become directories, so a different command is necessary for each situation - -share/.gitignore: share/Makefile.config - if test -f $@; then \ - for link in $$(cat $@); do \ - if test -L share$$link; then \ - rm -f share$$link \ - else \ - rm -rf share$$link; \ - fi; \ - done; \ - fi - $(RM) $@.tmp - touch $@.tmp - $(foreach dir,$(EXTERNAL_PLUGINS),\ - if test -d $(dir)/share; then \ - echo "Sharing $(dir)/link"; \ - ln -s $(realpath $(dir)/share) share/$(notdir $(dir)); \ - echo /$(notdir $(dir)) >> $@.tmp; \ - fi; ) - mv $@.tmp $@ - -ifeq ("$(DEVELOPMENT)","yes") -all:: share/.gitignore -endif - -clean_share_link: - if test -f share/.gitignore; then \ - for link in $$(cat share/.gitignore); do \ - if test -L share$$link; then \ - rm -f share$$link \ - else \ - rm -rf share$$link; \ - fi; \ - done; \ - rm share/.gitignore; \ - fi - -clean:: clean_share_link - -################## -# Frama-C Kernel # -################## - -# Libraries which could be compiled fully independently -####################################################### - -VERY_FIRST_CMO = src/kernel_internals/runtime/frama_c_init.cmo -CMO += $(VERY_FIRST_CMO) - -LIB_CMO =\ - src/libraries/stdlib/transitioning \ - src/libraries/stdlib/FCHashtbl \ - src/libraries/stdlib/extlib \ - src/libraries/datatype/unmarshal \ - src/libraries/datatype/unmarshal_z \ - src/libraries/datatype/structural_descr \ - src/libraries/datatype/type \ - src/libraries/datatype/descr \ - src/libraries/utils/filepath \ - src/libraries/utils/sanitizer \ - src/libraries/utils/pretty_utils \ - src/libraries/utils/hook \ - src/libraries/utils/bag \ - src/libraries/utils/wto \ - src/libraries/utils/vector \ - src/libraries/utils/indexer \ - src/libraries/utils/rgmap \ - src/libraries/utils/bitvector \ - src/libraries/utils/qstack \ - src/libraries/stdlib/integer \ - src/libraries/utils/json \ - src/libraries/utils/markdown \ - src/libraries/utils/rich_text \ - src/libraries/utils/dotgraph - -NON_OPAQUE_DEPS+=\ - src/libraries/datatype/unmarshal_z \ - src/libraries/stdlib/integer - -LIB_CMO:= $(addsuffix .cmo,$(LIB_CMO)) -CMO += $(LIB_CMO) - -# Very first files to be linked (most modules use them) -############################### - -FIRST_CMO= src/kernel_internals/runtime/fc_config \ - src/kernel_internals/runtime/gui_init \ - src/kernel_services/plugin_entry_points/log \ - src/kernel_services/cmdline_parameters/cmdline \ - src/libraries/project/project_skeleton \ - src/libraries/datatype/datatype - -# project_skeleton requires log -# datatype requires project_skeleton -# rangemap requires datatype - -FIRST_CMO:= $(addsuffix .cmo,$(FIRST_CMO)) -CMO += $(FIRST_CMO) - -#Project (Project_skeleton must be linked before Journal) -PROJECT_CMO= \ - state \ - state_dependency_graph \ - state_topological \ - state_selection \ - project \ - state_builder -PROJECT_CMO:= $(patsubst %,src/libraries/project/%.cmo,$(PROJECT_CMO)) -CMO += $(PROJECT_CMO) - -# kernel -######## - -KERNEL_CMO=\ - src/libraries/utils/utf8_logic.cmo \ - src/libraries/utils/binary_cache.cmo \ - src/libraries/utils/hptmap.cmo \ - src/libraries/utils/hptset.cmo \ - src/libraries/utils/escape.cmo \ - src/kernel_services/ast_queries/cil_datatype.cmo \ - src/kernel_services/cmdline_parameters/typed_parameter.cmo \ - src/kernel_services/plugin_entry_points/dynamic.cmo \ - src/kernel_services/cmdline_parameters/parameter_category.cmo \ - src/kernel_services/cmdline_parameters/parameter_customize.cmo \ - src/kernel_services/cmdline_parameters/parameter_state.cmo \ - src/kernel_services/cmdline_parameters/parameter_builder.cmo \ - src/kernel_services/plugin_entry_points/plugin.cmo \ - src/kernel_services/plugin_entry_points/kernel.cmo \ - src/libraries/utils/unicode.cmo \ - src/kernel_services/plugin_entry_points/emitter.cmo \ - src/libraries/utils/floating_point.cmo \ - src/libraries/utils/rangemap.cmo \ - src/kernel_services/ast_printing/cil_types_debug.cmo \ - src/kernel_services/ast_printing/printer_builder.cmo \ - src/libraries/utils/cilconfig.cmo \ - src/kernel_internals/typing/alpha.cmo \ - src/kernel_services/ast_queries/cil_state_builder.cmo \ - src/kernel_internals/runtime/machdeps.cmo \ - src/kernel_services/ast_queries/cil_const.cmo \ - src/kernel_services/ast_queries/logic_env.cmo \ - src/kernel_services/ast_queries/logic_const.cmo \ - src/kernel_services/visitors/visitor_behavior.cmo \ - src/kernel_services/ast_queries/cil.cmo \ - src/kernel_services/ast_queries/cil_builtins.cmo \ - src/kernel_internals/parsing/parse_env.cmo \ - src/kernel_internals/parsing/errorloc.cmo \ - src/kernel_services/ast_printing/cil_printer.cmo \ - src/kernel_services/ast_printing/cil_descriptive_printer.cmo \ - src/kernel_services/parsetree/cabshelper.cmo \ - src/kernel_services/ast_queries/logic_utils.cmo \ - src/kernel_services/ast_printing/logic_print.cmo \ - src/kernel_internals/parsing/logic_parser.cmo \ - src/kernel_internals/parsing/logic_lexer.cmo \ - src/kernel_services/ast_queries/logic_typing.cmo \ - src/kernel_services/ast_queries/acsl_extension.cmo \ - src/kernel_services/ast_queries/ast_info.cmo \ - src/kernel_services/ast_data/ast.cmo \ - src/kernel_services/ast_printing/cprint.cmo \ - src/kernel_services/visitors/cabsvisit.cmo \ - src/kernel_internals/typing/cabs2cil.cmo \ - src/kernel_services/ast_data/globals.cmo \ - src/kernel_internals/typing/cfg.cmo \ - src/kernel_services/ast_data/kernel_function.cmo \ - src/kernel_services/ast_data/property.cmo \ - src/kernel_services/ast_data/property_status.cmo \ - src/kernel_services/ast_data/annotations.cmo \ - src/kernel_services/ast_printing/printer.cmo \ - src/kernel_internals/typing/logic_builtin.cmo \ - src/kernel_services/ast_queries/ast_diff.cmo \ - src/kernel_services/ast_printing/cabs_debug.cmo \ - src/kernel_internals/parsing/lexerhack.cmo \ - src/kernel_internals/parsing/clexer.cmo \ - src/kernel_internals/parsing/cparser.cmo \ - src/kernel_internals/parsing/logic_preprocess.cmo \ - src/kernel_internals/typing/mergecil.cmo \ - src/kernel_internals/typing/rmtmps.cmo \ - src/kernel_internals/typing/oneret.cmo \ - src/kernel_internals/typing/frontc.cmo \ - src/kernel_internals/typing/substitute_const_globals.cmo \ - src/kernel_services/analysis/ordered_stmt.cmo \ - src/kernel_services/analysis/wto_statement.cmo \ - src/kernel_services/analysis/dataflows.cmo \ - src/kernel_services/analysis/dataflow2.cmo \ - src/kernel_services/analysis/stmts_graph.cmo \ - src/kernel_services/analysis/dominators.cmo \ - src/kernel_services/analysis/service_graph.cmo \ - src/kernel_services/analysis/undefined_sequence.cmo \ - src/kernel_services/analysis/interpreted_automata.cmo \ - src/kernel_services/ast_data/alarms.cmo \ - src/kernel_services/ast_printing/description.cmo \ - src/kernel_services/abstract_interp/lattice_messages.cmo \ - src/kernel_services/abstract_interp/abstract_interp.cmo \ - src/kernel_services/abstract_interp/lattice_bounds.cmo \ - src/kernel_services/abstract_interp/int_Base.cmo \ - src/kernel_services/analysis/bit_utils.cmo \ - src/kernel_services/abstract_interp/fc_float.cmo \ - src/kernel_services/abstract_interp/float_interval.cmo \ - src/kernel_services/abstract_interp/fval.cmo \ - src/kernel_services/abstract_interp/int_interval.cmo \ - src/kernel_services/abstract_interp/int_set.cmo \ - src/kernel_services/abstract_interp/int_val.cmo \ - src/kernel_services/abstract_interp/ival.cmo \ - src/kernel_services/abstract_interp/base.cmo \ - src/kernel_services/abstract_interp/origin.cmo \ - src/kernel_services/abstract_interp/map_lattice.cmo \ - src/kernel_services/abstract_interp/tr_offset.cmo \ - src/kernel_services/abstract_interp/offsetmap.cmo \ - src/kernel_services/abstract_interp/int_Intervals.cmo \ - src/kernel_services/abstract_interp/locations.cmo \ - src/kernel_services/abstract_interp/lmap.cmo \ - src/kernel_services/abstract_interp/lmap_bitwise.cmo \ - src/kernel_services/visitors/visitor.cmo \ - src/kernel_services/ast_data/statuses_by_call.cmo \ - src/kernel_services/ast_printing/printer_tag.cmo \ - $(PLUGIN_TYPES_CMO_LIST) \ - src/kernel_services/plugin_entry_points/db.cmo \ - src/libraries/utils/command.cmo \ - src/libraries/utils/task.cmo \ - src/kernel_services/ast_queries/filecheck.cmo \ - src/kernel_services/ast_queries/json_compilation_database.cmo \ - src/kernel_services/ast_queries/file.cmo \ - src/kernel_internals/typing/translate_lightweight.cmo \ - src/kernel_internals/typing/ghost_cfg.cmo \ - src/kernel_internals/typing/ghost_accesses.cmo \ - src/kernel_internals/typing/allocates.cmo \ - src/kernel_internals/typing/unroll_loops.cmo \ - src/kernel_internals/typing/asm_contracts.cmo \ - src/kernel_services/analysis/loop.cmo \ - src/kernel_services/analysis/exn_flow.cmo \ - src/kernel_services/analysis/destructors.cmo \ - src/kernel_services/analysis/logic_interp.cmo \ - src/kernel_internals/typing/infer_annotations.cmo \ - src/kernel_services/ast_transformations/clone.cmo \ - src/kernel_services/ast_transformations/filter.cmo \ - src/kernel_services/ast_transformations/inline.cmo \ - src/kernel_internals/runtime/dump_config.cmo \ - src/kernel_services/ast_transformations/contract_special_float.cmo \ - src/kernel_internals/runtime/special_hooks.cmo \ - src/kernel_internals/runtime/messages.cmo \ - src/kernel_services/ast_building/cil_builder.cmo \ - -CMO += $(KERNEL_CMO) - -MLI_ONLY+=\ - src/libraries/utils/hptmap_sig.mli \ - src/kernel_services/cmdline_parameters/parameter_sig.mli \ - src/kernel_services/ast_data/cil_types.mli \ - src/kernel_services/parsetree/cabs.mli \ - src/kernel_services/parsetree/logic_ptree.mli \ - src/kernel_services/ast_printing/printer_api.mli \ - src/kernel_services/abstract_interp/float_sig.mli \ - src/kernel_services/abstract_interp/float_interval_sig.mli \ - src/kernel_services/abstract_interp/lattice_type.mli \ - src/kernel_services/abstract_interp/eva_lattice_type.mli \ - src/kernel_services/abstract_interp/int_Intervals_sig.mli \ - src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli \ - src/kernel_services/abstract_interp/offsetmap_sig.mli \ - src/kernel_services/abstract_interp/lmap_sig.mli \ - src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli - -MODULES_NODOC+= src/kernel_internals/runtime/machdep_ppc_32.ml \ - src/kernel_internals/runtime/machdep_x86_16.ml \ - src/kernel_internals/runtime/machdep_x86_32.ml \ - src/kernel_internals/runtime/machdep_x86_64.ml \ - external/unmarshal_z.mli - - -GENERATED += $(addprefix src/kernel_internals/parsing/,\ - clexer.ml cparser.ml cparser.mli \ - logic_lexer.ml logic_parser.ml \ - logic_parser.mli logic_preprocess.ml) - - -.PHONY: check-logic-parser-wildcard -check-logic-parser-wildcard: - cd src/kernel_internals/parsing && ocaml check_logic_parser.ml - -NON_OPAQUE_DEPS+= src/kernel_services/plugin_entry_points/dynamic - -# C Bindings -############ - -GEN_C_BINDINGS=src/libraries/utils/c_bindings.o -GEN_C_BINDINGS_FLAGS= -fPIC -GEN_BYTE_LIBS+= $(GEN_C_BINDINGS) -GEN_OPT_LIBS+= $(GEN_C_BINDINGS) - -src/libraries/utils/c_bindings.o: src/libraries/utils/c_bindings.c - $(PRINT_CC) $@ - $(CC) $(GEN_C_BINDINGS_FLAGS) -c -I$(call winpath,$(OCAMLLIB)) -O3 -Wall -o $@ $< - -# Common startup module -# All link command should add it as last linked module and depend on it. -######################################################################## - -STARTUP_CMO=src/kernel_internals/runtime/boot.cmo -STARTUP_CMX=$(STARTUP_CMO:.cmo=.cmx) - -# GUI modules -# See below for GUI compilation -############################################################################## - -WTOOLKIT= \ - wutil widget wbox wfile wpane wpalette wtext wtable - -ifeq ("$(LABLGTK_VERSION)","3") - -src/plugins/gui/GSourceView.ml: src/plugins/gui/GSourceView3.ml.in - $(CP) $< $@ - $(CHMOD_RO) $@ - -src/plugins/gui/GSourceView.mli: src/plugins/gui/GSourceView3.mli.in - $(CP) $< $@ - $(CHMOD_RO) $@ - -else -src/plugins/gui/GSourceView.ml: src/plugins/gui/GSourceView2.ml.in - $(CP) $< $@ - $(CHMOD_RO) $@ - -src/plugins/gui/GSourceView.mli: src/plugins/gui/GSourceView2.mli.in - $(CP) $< $@ - $(CHMOD_RO) $@ - -endif - -SOURCEVIEWCOMPAT:=GSourceView -GENERATED+=src/plugins/gui/GSourceView.ml src/plugins/gui/GSourceView.mli \ - src/plugins/gui/dgraph_helper.ml src/plugins/gui/gtk_compat.ml - -ifeq ($(LABLGTK),lablgtk3) -src/plugins/gui/gtk_compat.ml: src/plugins/gui/gtk_compat.3.ml - $(CP) $< $@ - $(CHMOD_RO) $@ -else -src/plugins/gui/gtk_compat.ml: src/plugins/gui/gtk_compat.2.ml - $(CP) $< $@ - $(CHMOD_RO) $@ -endif -GENERATED+=src/plugins/gui/gtk_compat.ml - -SINGLE_GUI_CMO:= \ - wutil_once \ - gtk_compat \ - $(WTOOLKIT) \ - $(SOURCEVIEWCOMPAT) \ - gui_parameters \ - gtk_helper \ - dgraph_helper \ - gtk_form \ - source_viewer pretty_source source_manager book_manager \ - warning_manager \ - filetree \ - launcher \ - menu_manager \ - history \ - gui_printers \ - design \ - analyses_manager file_manager project_manager \ - help_manager \ - $(DGRAPHFILES) \ - property_navigator \ - -SINGLE_GUI_CMO:= $(patsubst %,src/plugins/gui/%.cmo,$(SINGLE_GUI_CMO)) - -############################################################################### -# # -#################### # -# Plug-in sections # # -#################### # -# # -# For 'internal' developers: # -# you can add your own plug-in here, # -# but it is better to have your own separated Makefile # -############################################################################### - -########### -# Metrics # -########### - -PLUGIN_ENABLE:=$(ENABLE_METRICS) -PLUGIN_NAME:=Metrics -PLUGIN_DISTRIBUTED:=yes -PLUGIN_DIR:=src/plugins/metrics -PLUGIN_CMO:= metrics_parameters css_html metrics_base metrics_acsl \ - metrics_cabs metrics_cilast metrics_coverage metrics_pivot \ - register -PLUGIN_GUI_CMO:= metrics_gui register_gui -PLUGIN_DEPENDENCIES:=Eva -PLUGIN_INTERNAL_TEST:=yes -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -############# -# Callgraph # -############# - -PLUGIN_ENABLE:=$(ENABLE_CALLGRAPH) -PLUGIN_NAME:=Callgraph -PLUGIN_DISTRIBUTED:=yes -PLUGIN_DIR:=src/plugins/callgraph -PLUGIN_CMO:= options subgraph cg services uses register -ifeq ($(HAS_DGRAPH),yes) -PLUGIN_GUI_CMO:=cg_viewer -PLUGIN_GENERATED:=$(PLUGIN_DIR)/cg_viewer.ml -else -PLUGIN_GUI_CMO:= -endif -PLUGIN_DISTRIB_EXTERNAL:=cg_viewer.yes.ml -PLUGIN_CMI:= callgraph_api -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_TESTS_DIRS:=callgraph -PLUGIN_TESTS_LIB:=tests/callgraph/function_pointer.ml -PLUGIN_DEPENDENCIES:=Eva - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) -################## -# Evolved Value Analysis # -################## - -PLUGIN_ENABLE:=$(ENABLE_EVA) -PLUGIN_NAME:=Eva -PLUGIN_DIR:=src/plugins/value -PLUGIN_EXTRA_DIRS:=engine values domains api domains/cvalue domains/apron \ - domains/gauges domains/equality legacy partitioning utils gui_files \ - api values/numerors domains/numerors domains/multidim -PLUGIN_TESTS_DIRS+=value/traces -PLUGIN_GENERATED:=$(PLUGIN_DIR)/Eva.mli -PLUGIN_DISTRIB_EXTERNAL+=gen-api.sh - -# Files for the binding to Apron domains. Only available if Apron is available. -ifeq ($(HAS_APRON),yes) -PLUGIN_REQUIRES+= apron.octMPQ apron.boxMPQ apron.polkaMPQ apron.apron gmp -APRON_CMO:= domains/apron/apron_domain -else -APRON_CMO:= -PLUGIN_DISTRIB_EXTERNAL+= \ - domains/apron/apron_domain.ml domains/apron/apron_domain.mli -endif +include share/Makefile.common -# Files for the numerors domain. Only available is MPFR is available. -NUMERORS_FILES:= \ - values/numerors/numerors_utils values/numerors/numerors_float \ - values/numerors/numerors_interval values/numerors/numerors_arithmetics \ - values/numerors/numerors_value domains/numerors/numerors_domain +DUNE_BUILD_OPTS?= -ifeq ($(HAS_MPFR),yes) -PLUGIN_REQUIRES+= mlmpfr -PLUGIN_TESTS_DIRS+=value/numerors -NUMERORS_CMO:= $(NUMERORS_FILES) -else -# Do not compile numerors files, but include them in the distributed files. -NUMERORS_CMO:= -PLUGIN_DISTRIB_EXTERNAL+= $(addsuffix .ml,$(NUMERORS_FILES)) -PLUGIN_DISTRIB_EXTERNAL+= $(addsuffix .mli,$(NUMERORS_FILES)) +RELEASE?=no +ifeq ($(RELEASE),yes) +DUNE_BUILD_OPTS+=--release endif -# General rules for ordering files within PLUGIN_CMO: -# - try to keep the legacy Value before Eva -PLUGIN_CMO:= partitioning/split_strategy domains/domain_mode self parameters \ - utils/eva_audit utils/eva_perf utils/eva_annotations \ - utils/eva_dynamic utils/eva_utils utils/red_statuses \ - utils/cvalue_callbacks utils/active_behaviors \ - utils/widen_hints_ext utils/widen \ - partitioning/split_return \ - partitioning/per_stmt_slevel \ - utils/library_functions \ - utils/eval_typ utils/backward_formals \ - alarmset eval utils/structure utils/abstract \ - values/value_product values/location_lift \ - values/cvalue_forward values/cvalue_backward \ - values/main_values values/main_locations \ - values/offsm_value values/sign_value \ - legacy/eval_op legacy/function_args \ - domains/domain_store domains/domain_builder \ - domains/domain_product domains/domain_lift domains/unit_domain \ - domains/printer_domain \ - domains/traces_domain \ - domains/simple_memory \ - domains/octagons \ - domains/gauges/gauges_domain \ - domains/hcexprs \ - domains/equality/equality domains/equality/equality_domain \ - domains/offsm_domain \ - domains/symbolic_locs \ - domains/sign_domain \ - domains/cvalue/warn domains/cvalue/locals_scoping \ - domains/cvalue/cvalue_offsetmap \ - utils/summary \ - domains/cvalue/builtins domains/cvalue/builtins_malloc \ - domains/cvalue/builtins_string domains/cvalue/builtins_misc \ - domains/cvalue/builtins_memory domains/cvalue/builtins_print_c \ - domains/cvalue/builtins_watchpoint \ - domains/cvalue/builtins_float domains/cvalue/builtins_split \ - domains/inout_domain \ - legacy/eval_terms \ - domains/cvalue/cvalue_transfer domains/cvalue/cvalue_init \ - domains/cvalue/cvalue_specification \ - domains/cvalue/cvalue_domain \ - domains/powerset \ - partitioning/auto_loop_unroll \ - partitioning/partition partitioning/partitioning_parameters \ - partitioning/partitioning_index partitioning/trace_partitioning \ - engine/recursion engine/function_calls legacy/eval_annots \ - engine/subdivided_evaluation engine/evaluation engine/abstractions \ - engine/transfer_logic engine/transfer_stmt engine/transfer_specification \ - engine/mem_exec engine/iterator engine/initialization \ - engine/compute_functions engine/analysis register \ - domains/multidim/multidim \ - domains/multidim/abstract_offset \ - domains/multidim/abstract_memory \ - domains/multidim/pretty_memory \ - domains/multidim/abstract_structure \ - domains/multidim/segmentation \ - domains/multidim/typed_memory \ - domains/multidim/multidim_domain \ - domains/taint_domain \ - $(APRON_CMO) $(NUMERORS_CMO) \ - utils/eva_results \ - utils/results api/general_requests api/values_request \ - utils/unit_tests -PLUGIN_CMI:= values/abstract_value values/abstract_location \ - domains/abstract_domain domains/simpler_domains -PLUGIN_DEPENDENCIES:=Server - -# These files are used by the GUI, but do not depend on Lablgtk -VALUE_GUI_AUX:=gui_files/gui_types gui_files/gui_eval \ - gui_files/gui_callstacks_filters -PLUGIN_GUI_CMO:=$(VALUE_GUI_AUX) gui_files/gui_callstacks_manager \ - gui_files/gui_red gui_files/register_gui - -PLUGIN_INTERNAL_TEST:= yes -PLUGIN_TESTS_LIB=tests/float/fval_test.ml -PLUGIN_DISTRIBUTED:=yes -VALUE_TYPES:=$(addprefix src/plugins/value_types/,\ - cilE cvalue precise_locs value_types widen_type) -PLUGIN_TYPES_CMO:=$(VALUE_TYPES) -PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(VALUE_TYPES)) - -# Eva API. -API_MLI := $(addprefix $(PLUGIN_DIR)/, \ - engine/analysis.mli utils/results.mli \ - parameters.mli utils/eva_annotations.mli \ - eval.mli domains/cvalue/builtins.mli utils/cvalue_callbacks.mli \ - legacy/eval_terms.mli utils/eva_results.mli utils/unit_tests.mli) - -$(PLUGIN_DIR)/Eva.mli: $(PLUGIN_DIR)/gen-api.sh Makefile $(API_MLI) - $(PRINT_MAKING) $@ - $(RM) $@ $@.tmp - $< $(API_MLI) > $@.tmp - $(CHMOD_RO) $@.tmp - $(MV) $@.tmp $@ - -clean:: - $(RM) $(PLUGIN_DIR)/Eva.mli - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - +# DUNE_DISPLAY: chose Dune build verbosity (see '--display' dune option) +# Default: progress (same as dune default) +# Recommend for tests: short +DUNE_DISPLAY?=progress +DUNE_BUILD_OPTS+=--display $(DUNE_DISPLAY) -######### -# Reduc # -######### -PLUGIN_ENABLE:=$(ENABLE_REDUC) -PLUGIN_NAME:=Reduc -PLUGIN_DISTRIBUTED:=yes -PLUGIN_DIR:=src/plugins/reduc -PLUGIN_CMO:=reduc_options misc value2acsl collect hyp register -PLUGIN_DEPENDENCIES:=Eva +# PTESTS SRC +FRAMAC_PTESTS_SRC:=tools/ptests -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) +# HDRCK SRC +FRAMAC_HDRCK_SRC:=tools/hdrck -################## -# Occurrence # -################## - -PLUGIN_ENABLE:=$(ENABLE_OCCURRENCE) -PLUGIN_NAME:=Occurrence -PLUGIN_DISTRIBUTED:=yes -PLUGIN_DIR:=src/plugins/occurrence -PLUGIN_CMO:= options register -PLUGIN_GUI_CMO:=register_gui -PLUGIN_INTRO:=doc/code/intro_occurrence.txt -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Eva -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -################################################ -# Runtime Error Annotation Generation analysis # -################################################ - -PLUGIN_ENABLE:=$(ENABLE_RTEGEN) -PLUGIN_NAME:=RteGen -PLUGIN_DIR:=src/plugins/rte -PLUGIN_CMO:= options generator rte flags visit register -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_TESTS_DIRS:=rte rte_manual -PLUGIN_TESTS_LIB:=\ - tests/rte/my_annotation.ml \ - tests/rte/rte_get_annot.ml \ - tests/rte/compute_annot.ml \ - tests/rte/my_annot_proxy.ml -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -################# -# From analysis # -################# - -PLUGIN_ENABLE:=$(ENABLE_FROM_ANALYSIS) -PLUGIN_NAME:=From -PLUGIN_DIR:=src/plugins/from -PLUGIN_CMO:= from_parameters from_compute \ - functionwise callwise from_register -PLUGIN_GUI_CMO:=from_register_gui -PLUGIN_TESTS_DIRS:=idct test float -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -FROM_TYPES:=src/plugins/value_types/function_Froms -PLUGIN_TYPES_CMO:=$(FROM_TYPES) -PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(FROM_TYPES)) -PLUGIN_DEPENDENCIES:=Callgraph Eva Postdominators - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -################## -# Users analysis # -################## - -PLUGIN_ENABLE:=$(ENABLE_USERS) -PLUGIN_NAME:=Users -PLUGIN_DIR:=src/plugins/users -PLUGIN_CMO:= users_register -PLUGIN_NO_TEST:=yes -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Callgraph Eva - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -######################## -# Constant propagation # -######################## - -PLUGIN_ENABLE:=$(ENABLE_CONSTANT_PROPAGATION) -PLUGIN_NAME:=Constant_Propagation -PLUGIN_DIR:=src/plugins/constant_propagation -PLUGIN_TESTS_LIB:=tests/constant_propagation/introduction_of_non_explicit_cast.ml -PLUGIN_CMO:= propagationParameters \ - api -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Eva - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -################### -# Post-dominators # ################### - -PLUGIN_ENABLE:=$(ENABLE_POSTDOMINATORS) -PLUGIN_NAME:=Postdominators -PLUGIN_DIR:=src/plugins/postdominators -PLUGIN_CMO:= postdominators_parameters print compute -PLUGIN_NO_TEST:=yes -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Eva - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -######### -# inout # -######### - -PLUGIN_ENABLE:=$(ENABLE_INOUT) -PLUGIN_NAME:=Inout -PLUGIN_DIR:=src/plugins/inout -PLUGIN_CMO:= inout_parameters cumulative_analysis \ - operational_inputs outputs inputs derefs register -PLUGIN_NO_TEST:=yes -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -INOUT_TYPES:=src/plugins/value_types/inout_type -PLUGIN_TYPES_CMO:=$(INOUT_TYPES) -PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(INOUT_TYPES)) -PLUGIN_DEPENDENCIES:=Callgraph Eva From - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -################### -# Impact analysis # +# Frama-C Version # ################### -PLUGIN_ENABLE:=$(ENABLE_IMPACT) -PLUGIN_NAME:=Impact -PLUGIN_DIR:=src/plugins/impact -PLUGIN_CMO:= options pdg_aux reason_graph compute_impact register -PLUGIN_GUI_CMO:= register_gui -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Inout Eva Pdg Slicing - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -################################## -# PDG : program dependence graph # -################################## - -PLUGIN_ENABLE:=$(ENABLE_PDG) -PLUGIN_NAME:=Pdg -PLUGIN_DIR:=src/plugins/pdg -PLUGIN_TESTS_LIB:=tests/pdg/dyn_dpds.ml \ - tests/pdg/sets.ml -PLUGIN_TESTS_DIRS:=pdg -PLUGIN_CMO:= pdg_parameters \ - ctrlDpds \ - pdg_state \ - build \ - sets \ - annot \ - marks \ - register - -PDG_TYPES:=pdgIndex pdgTypes pdgMarks -PDG_TYPES:=$(addprefix src/plugins/pdg_types/,$(PDG_TYPES)) -PLUGIN_TYPES_CMO:=$(PDG_TYPES) - -PLUGIN_INTRO:=doc/code/intro_pdg.txt -PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(PDG_TYPES)) -PLUGIN_DEPENDENCIES:=Callgraph Eva From -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -################################################ -# Scope : show different kinds of dependencies # -################################################ - -PLUGIN_ENABLE:=$(ENABLE_SCOPE) -PLUGIN_NAME:=Scope -PLUGIN_DIR:=src/plugins/scope -PLUGIN_TESTS_LIB:=tests/scope/bts971.ml \ - tests/scope/zones.ml -PLUGIN_CMO:= datascope zones defs -PLUGIN_GUI_CMO:=dpds_gui -PLUGIN_DEPENDENCIES:=Eva Inout -PLUGIN_INTRO:=doc/code/intro_scope.txt -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -##################################### -# Sparecode : unused code detection # -##################################### - -PLUGIN_ENABLE:=$(ENABLE_SPARECODE) -PLUGIN_NAME:=Sparecode -PLUGIN_DIR:=src/plugins/sparecode -PLUGIN_CMO:= sparecode_params globs spare_marks transform register -PLUGIN_INTRO:=doc/code/intro_sparecode.txt -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Pdg Eva Users - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -########### -# Slicing # -########### - -PLUGIN_ENABLE:=$(ENABLE_SLICING) -PLUGIN_NAME:=Slicing -PLUGIN_DIR:=src/plugins/slicing -PLUGIN_CMO:= slicingInternals \ - slicingTypes \ - slicingParameters \ - slicingState \ - slicingMacros \ - slicingMarks \ - slicingActions \ - fct_slice \ - printSlice \ - slicingProject \ - slicingTransform \ - slicingSelect \ - slicingCmds \ - api \ - register - -PLUGIN_GUI_CMO:=register_gui - -PLUGIN_INTRO:=doc/code/intro_slicing.txt -PLUGIN_UNDOC:=register.ml # slicing_gui.ml - -PLUGIN_TESTS_DIRS:= slicing -PLUGIN_TESTS_LIB:= tests/slicing/libSelect.ml tests/slicing/libAnim.ml \ - tests/slicing/simple_intra_slice.ml tests/slicing/combine.ml \ - tests/slicing/ex_spec_interproc.ml tests/slicing/horwitz.ml \ - tests/slicing/mark_all_slices.ml tests/slicing/merge.ml \ - tests/slicing/min_call.ml tests/slicing/select_by_annot.ml \ - tests/slicing/select_simple.ml tests/slicing/simple_intra_slice.ml \ - tests/slicing/slice_no_body.ml tests/slicing/switch.ml \ - tests/slicing/adpcm.ml -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Pdg Callgraph Eva Sparecode - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -##################### -# External plug-ins # -##################### - -define INCLUDE_PLUGIN -FRAMAC_SHARE:=$(FRAMAC_ROOT_SRCDIR)/share -FRAMAC_PLUGIN:=$(FRAMAC_ROOT_SRCDIR)/lib/plugins -FRAMAC_PLUGIN_GUI:=$(FRAMAC_ROOT_SRCDIR)/lib/plugins/gui -PLUGIN_DIR:=$(1) -include $(1)/Makefile -endef - -$(foreach p,$(EXTERNAL_PLUGINS),$(eval $(call INCLUDE_PLUGIN,$p))) - -############################################################################### -# # -########################### # -# End of plug-in sections # # -########################### # -# # -############################################################################### - -##################### -# Generic variables # -##################### - -CMX = $(CMO:.cmo=.cmx) -CMI = $(CMO:.cmo=.cmi) - -ALL_CMO = $(CMO) $(PLUGIN_CMO_LIST) $(STARTUP_CMO) -ALL_CMX = $(CMX) $(PLUGIN_CMX_LIST) $(STARTUP_CMX) - -FILES_FOR_OCAMLDEP+= $(addsuffix /*.mli,$(FRAMAC_SRC_DIRS)) \ - $(addsuffix /*.ml,$(FRAMAC_SRC_DIRS)) - -MODULES_TODOC+=$(filter-out $(MODULES_NODOC),\ - $(MLI_ONLY) \ - $(filter-out $(PLUGIN_TYPES_CMO_LIST:.cmo=.mli),$(CMO:.cmo=.mli)) \ - $(STARTUP_CMO:.cmo=.mli) \ -) - -################################ -# toplevel.{byte,opt} binaries # -################################ - -ALL_BATCH_CMO= $(filter-out src/kernel_internals/runtime/gui_init.cmo,\ - $(ALL_CMO)) -ALL_BATCH_CMX= $(filter-out src/kernel_internals/runtime/gui_init.cmx,\ - $(ALL_CMX)) - -bin/toplevel.byte$(EXE): $(ALL_BATCH_CMO) $(GEN_BYTE_LIBS) \ - $(PLUGIN_DYN_CMO_LIST) - $(PRINT_LINKING) $@ - $(OCAMLC) $(BLINKFLAGS) -o $@ $(BYTE_LIBS) $(ALL_BATCH_CMO) - -#Profiling version of toplevel.byte using ocamlprof -bin/toplevel.prof$(EXE): $(ALL_BATCH_CMO) $(GEN_BYTE_LIBS) \ - $(PLUGIN_DYN_CMO_LIST) - $(PRINT_OCAMLCP) $@ - $(OCAMLCP) $(BLINKFLAGS) -o $@ $(BYTE_LIBS) $(ALL_BATCH_CMO) - -bin/toplevel.opt$(EXE): $(ALL_BATCH_CMX) $(GEN_OPT_LIBS) \ - $(PLUGIN_DYN_CMX_LIST) - $(PRINT_LINKING) $@ - $(OCAMLOPT) $(OLINKFLAGS) -o $@ $(OPT_LIBS) $(ALL_BATCH_CMX) - -LIB_KERNEL_CMO= $(filter-out src/kernel_internals/runtime/gui_init.cmo, $(CMO)) -LIB_KERNEL_CMX= $(filter-out src/kernel_internals/runtime/gui_init.cmx, $(CMX)) - -lib/fc/frama-c.cma: $(LIB_KERNEL_CMO) $(GEN_BYTE_LIBS) lib/fc/META.frama-c - $(PRINT_LINKING) $@ - $(MKDIR) $(FRAMAC_LIB) - $(OCAMLMKLIB) -o lib/fc/frama-c $(BYTE_LIBS) $(LIB_KERNEL_CMO) - -lib/fc/frama-c.cmxa: lib/fc/frama-c.cma $(GEN_OPT_LIBS) $(LIB_KERNEL_CMX) - $(MKDIR) $(FRAMAC_LIB) - $(PRINT_LINKING) $@ - $(OCAMLMKLIB) -o lib/fc/frama-c $(OPT_LIBS) $(LIB_KERNEL_CMX) - -#################### -# (Ocaml) Toplevel # -#################### - -bin/toplevel.top$(EXE): $(filter-out src/kernel_internals/runtime/boot.ml,$(ALL_BATCH_CMO)) \ - src/kernel_internals/runtime/toplevel_config.cmo \ - $(GEN_BYTE_LIBS) $(PLUGIN_DYN_CMO_LIST) - $(PRINT_OCAMLMKTOP) $@ - $(OCAMLMKTOP) $(BFLAGS) -warn-error -31 -custom -o $@ \ - -linkpkg $(BYTE_LIBS) $(ALL_BATCH_CMO) \ - src/kernel_internals/runtime/toplevel_config.cmo - -####### -# GUI # -####### - -ifneq ($(ENABLE_GUI),no) - -SINGLE_GUI_CMI = $(SINGLE_GUI_CMO:.cmo=.cmi) -SINGLE_GUI_CMX = $(SINGLE_GUI_CMO:.cmo=.cmx) - -GUICMO += $(SINGLE_GUI_CMO) $(PLUGIN_GUI_CMO_LIST) - -MODULES_TODOC+= $(filter-out src/plugins/gui/book_manager.mli,\ - $(SINGLE_GUI_CMO:.cmo=.mli)) - -GUICMI = $(GUICMO:.cmo=.cmi) -GUICMX = $(SINGLE_GUI_CMX) $(PLUGIN_GUI_CMX_LIST) - -$(GUICMI) $(GUICMO) bin/viewer.byte$(EXE): BFLAGS+= $(GUI_INCLUDES) $(THREAD) -$(GUICMX) bin/viewer.opt$(EXE): OFLAGS+= $(GUI_INCLUDES) $(THREAD) - -$(PLUGIN_DYN_DEP_GUI_CMO_LIST): BFLAGS+= $(GUI_INCLUDES) -$(PLUGIN_DYN_DEP_GUI_CMX_LIST): OFLAGS+= $(GUI_INCLUDES) - -.PHONY:gui - -gui-byte:: bin/viewer.byte$(EXE) share/Makefile.dynamic_config \ - $(PLUGIN_META_LIST) - -gui-opt:: gui-byte bin/viewer.opt$(EXE) - -gui: gui-$(OCAMLBEST) - -ALL_GUI_CMO= $(ALL_CMO) $(GRAPH_GUICMO) $(GUICMO) -ALL_GUI_CMX= $(patsubst %.cma,%.cmxa,$(ALL_GUI_CMO:.cmo=.cmx)) - -bin/viewer.byte$(EXE): BYTE_LIBS+= $(GRAPH_GUICMO) -bin/viewer.byte$(EXE): $(filter-out $(GRAPH_GUICMO),$(ALL_GUI_CMO)) \ - $(GEN_BYTE_LIBS) \ - $(PLUGIN_DYN_CMO_LIST) $(PLUGIN_DYN_GUI_CMO_LIST) - $(PRINT_LINKING) $@ - $(OCAMLC) $(BLINKFLAGS) $(THREAD) -o $@ $(BYTE_LIBS) \ - $(CMO) \ - $(filter-out \ - $(patsubst $(PLUGIN_GUI_LIB_DIR)/%,$(PLUGIN_LIB_DIR)/%,\ - $(PLUGIN_GUI_CMO_LIST)),\ - $(PLUGIN_CMO_LIST)) \ - $(GUICMO) $(STARTUP_CMO) - -bin/viewer.opt$(EXE): OPT_LIBS+= $(GRAPH_GUICMX) -bin/viewer.opt$(EXE): $(filter-out $(GRAPH_GUICMX),$(ALL_GUI_CMX)) \ - $(GEN_OPT_LIBS) \ - $(PLUGIN_DYN_CMX_LIST) $(PLUGIN_DYN_GUI_CMX_LIST) \ - $(PLUGIN_CMX_LIST) $(PLUGIN_GUI_CMX_LIST) - $(PRINT_LINKING) $@ - $(OCAMLOPT) $(OLINKFLAGS) $(THREAD) -o $@ $(OPT_LIBS) \ - $(CMX) \ - $(filter-out \ - $(patsubst $(PLUGIN_GUI_LIB_DIR)/%,$(PLUGIN_LIB_DIR)/%,\ - $(PLUGIN_GUI_CMX_LIST)),\ - $(PLUGIN_CMX_LIST)) \ - $(GUICMX) $(STARTUP_CMX) -endif - -##################### -# Config Ocaml File # -##################### +VERSION:=$(shell $(CAT) VERSION) +VERSION_CODENAME:=$(shell $(CAT) VERSION_CODENAME) -CONFIG_DIR=src/kernel_internals/runtime -CONFIG_FILE=$(CONFIG_DIR)/fc_config.ml -CONFIG_CMO=$(CONFIG_DIR)/fc_config.cmo -GENERATED +=$(CONFIG_FILE) -#Generated in Makefile.generating +.PHONY: all -empty:= -space:=$(empty) $(empty) - -ifeq ($(ENABLE_GUI),no) -CONFIG_CMO=$(ALL_CMO) -CONFIG_PLUGIN_CMO=$(PLUGIN_CMO_LIST) -else -CONFIG_CMO=$(ALL_GUI_CMO) -CONFIG_PLUGIN_CMO=$(PLUGIN_GUI_CMO_LIST) -endif +all: config.sed + dune build $(DUNE_BUILD_OPTS) @install ifeq ($(HAS_DOT),yes) OPTDOT=Some \"$(DOT)\" @@ -1385,884 +63,32 @@ else OPTDOT=None endif -COMPILATION_UNITS=\ - $(foreach p,$(CONFIG_CMO),\"$(notdir $(patsubst %.cmo,%,$p))\"; ) - -################### -# Generating part # -################### -# It is in another file in order to have a dependency only on Makefile.generating. -# It must be before `.depend` definition because it modifies $GENERATED. - -include Makefile.generating - -######### -# Tests # -######### - -ifeq ($(OCAMLBEST),opt) -PTESTS_FILES=ptests_config.cmi ptests_config.cmx ptests_config.o -else -PTESTS_FILES=ptests_config.cmi ptests_config.cmo -endif - -.PHONY: tests oracles btests tests_dist libc_tests plugins_ptests_config external_tests \ - update_external_tests - -tests:: byte opt ptests - $(PRINT_EXEC) ptests - time -p $(PTESTS) $(PTESTS_OPTS) $(FRAMAC_PARALLEL) \ - -make "$(MAKE)" $(PLUGIN_TESTS_LIST) - -external_tests: byte opt ptests -tests:: external_tests - -update_external_tests: PTESTS_OPTS="-update" -update_external_tests: external_tests - -oracles: byte opt ptests - $(PRINT_MAKING) oracles - ./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" $(PLUGIN_TESTS_LIST) \ - > /dev/null 2>&1 - ./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" -update \ - $(PLUGIN_TESTS_LIST) - -btests: byte ./bin/ptests.byte$(EXE) - $(PRINT_EXEC) ptests -byte - time -p ./bin/ptests.byte$(EXE) -make "$(MAKE)" -byte \ - $(PLUGIN_TESTS_LIST) - -tests_dist: dist ptests - $(PRINT_EXEC) ptests - time -p ./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" \ - $(PLUGIN_TESTS_LIST) - -# test only one test suite : make suite_tests -%_tests: opt ptests - $(PRINT_EXEC) ptests - ./bin/ptests.$(OCAMLBEST)$(EXE) -make "$(MAKE)" $($*_TESTS_OPTS) $* - -# full test suite -wp_TESTS_OPTS=-j 1 -fulltests: tests wp_tests - -acsl_tests: byte - $(PRINT_EXEC) acsl_tests - find doc/speclang -name \*.c -exec ./bin/toplevel.byte$(EXE) {} \; > /dev/null - -LONELY_TESTS_DIR:=$(wildcard $(TEST_DIRS_AS_PLUGIN:%=tests/%)) -ifeq ($(strip $(LONELY_TESTS_DIR)),) - LONELY_TESTS_ML_FILES:= -else - LONELY_TESTS_ML_FILES:=\ - $(sort $(shell find $(TEST_DIRS_AS_PLUGIN:%=tests/%) -not -path '*/\.*' -name '*.ml')) -endif -$(foreach file,$(LONELY_TESTS_ML_FILES),\ - $(eval $(file:%.ml=%.cmo): BFLAGS+=-w -70 -I $(dir $(file)))) -$(foreach file,$(LONELY_TESTS_ML_FILES),\ - $(eval $(file:%.ml=%.cmx): OFLAGS+=-I $(dir $(file)))) -$(foreach file,$(LONELY_TESTS_ML_FILES),\ - $(eval $(file:%.ml=%.cmxs): OFLAGS+=-I $(dir $(file)))) -.PRECIOUS: $(LONELY_TESTS_ML_FILES:%.ml=%.cmx) \ - $(LONELY_TESTS_ML_FILES:%.ml=%.cmxs) \ - $(LONELY_TESTS_ML_FILES:%.ml=%.cmo) \ - $(LONELY_TESTS_ML_FILES:%.ml=%.cmi) - -bin/ocamldep_transitive_closure: devel_tools/ocamldep_transitive_closure.ml - $(OCAMLOPT) -package ocamlgraph -package str -linkpkg -o $@ $< - -tests/crowbar/.%.depend: tests/crowbar/%.ml - $(OCAMLDEP) $(INCLUDES) $< > $@ - -tests/crowbar/%: tests/crowbar/%.ml tests/crowbar/.%.depend .depend \ - bin/ocamldep_transitive_closure bin/toplevel.opt - $(OCAMLOPT) $(OLINKFLAGS) -w -42 -package crowbar -o $@ \ - $(GEN_C_BINDINGS) \ - $$(bin/ocamldep_transitive_closure -root tests/crowbar/$*.cmx \ - -deps tests/crowbar/.$*.depend -deps .depend) \ - $< - -tests/crowbar/full-link-%: tests/crowbar/%.ml lib/fc/frama-c.cmxa - $(OCAMLOPT) $(OLINKFLAGS) -ccopt "-Llib/fc" -w -42 -package crowbar -o $@ \ - lib/fc/frama-c.cmxa $< - -crowbar-%: tests/crowbar/% - $< - -crowbar-afl-%: tests/crowbar/% - $(MKDIR) tests/crowbar/output-$* - afl-fuzz $(AFL_OPTS) -i tests/crowbar/input -o tests/crowbar/output-$* $< @@ - -crowbar-afl-check-%: tests/crowbar/% - $(foreach file,$(wildcard tests/crowbar/output-$*/crashes/id*), \ - $< $(file) >/dev/null 2>&1 || \ - echo "$(file) leads to a real test failure";) - -############## -# Emacs tags # -############## - -.PHONY: tags -# otags gives a better tagging of ocaml files than etags -ifdef OTAGS -tags: - $(OTAGS) -r src lib -vtags: - $(OTAGS) -vi -r src lib -else -tags: - find . -name "*.ml[ily]" -o -name "*.ml" | sort -r | xargs \ - etags "--regex=/[ \t]*let[ \t]+\([^ \t]+\)/\1/" \ - "--regex=/[ \t]*let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \ - "--regex=/[ \t]*and[ \t]+\([^ \t]+\)/\1/" \ - "--regex=/[ \t]*type[ \t]+\([^ \t]+\)/\1/" \ - "--regex=/[ \t]*exception[ \t]+\([^ \t]+\)/\1/" \ - "--regex=/[ \t]*val[ \t]+\([^ \t]+\)/\1/" \ - "--regex=/[ \t]*module[ \t]+\([^ \t]+\)/\1/" -endif - -################# -# Documentation # -################# - -.PHONY: doc doc-distrib - -# private targets, useful for recompiling the doc without dependencies -# (too long!) -.PHONY: doc-kernel doc-index plugins-doc doc-update doc-tgz - -DOC_DEPEND=$(MODULES_TODOC) byte $(DOC_PLUGIN) -ifneq ($(ENABLE_GUI),no) -DOC_DEPEND+=bin/viewer.byte$(EXE) -endif - -$(DOC_DIR)/docgen.cmo: $(DOC_DIR)/docgen.ml - $(PRINT_OCAMLC) $@ - $(OCAMLC) -c -I +ocamldoc -I +compiler-libs -I $(CONFIG_DIR) $(DOC_DIR)/docgen.ml - -$(DOC_DIR)/docgen.cmxs: $(DOC_DIR)/docgen.ml - $(PRINT_PACKING) $@ - $(OCAMLOPT) -o $@ -shared -I +ocamldoc -I +compiler-libs -I $(CONFIG_DIR) \ - $(DOC_DIR)/docgen.ml - -clean-doc:: - $(PRINT_RM) "documentation generator" - $(RM) $(DOC_DIR)/docgen.cm* - -DOC_NOT_FOR_DISTRIB=yes -plugins-doc: - $(QUIET_MAKE) \ - $(if $(DOC_NOT_FOR_DISTRIB),$(PLUGIN_DOC_LIST),\ - $(filter \ - $(addsuffix _DOC,$(PLUGIN_DISTRIBUTED_NAME_LIST)),\ - $(PLUGIN_DOC_LIST))) - -.PHONY: server-doc-md server-doc-html server-doc - -server-doc-md: byte - $(PRINT) 'Generating Markdown server documentation' - @rm -fr doc/server - @mkdir -p doc/server - ./bin/frama-c.byte -server-doc doc/server - -server-doc-html: server-doc-md - $(PRINT) 'Generating HTML server documentation' - @find doc/server -name "*.md" -print -exec pandoc \ - --standalone --toc --toc-depth=2 --to html \ - --template doc/pandoc/template.html \ - --metadata-file {}.json \ - --lua-filter doc/pandoc/href.lua \ - {} -o {}.html \; - @cp -f doc/pandoc/style.css doc/server/ - $(PRINT) 'HTML server documentation generated' - $(PRINT) 'HTML file://$(PWD)/doc/server/readme.md.html' - -server-doc: server-doc-html - -# to make the documentation for one plugin only, -# the name of the plugin should begin with a capital letter : -# Example for the pdg doc : make Pdg_DOC -# While working on the documentation of a plugin, it can also be useful -# to use : make -o doc/code/kernel-doc.ocamldoc Plugin_DOC -# to avoid redoing the global documentation each time. - -STDLIB_FILES:=\ - array \ - buffer \ - bytes \ - char \ - format \ - hashtbl \ - int64 \ - list \ - map \ - marshal \ - obj \ - parsing \ - printf \ - queue \ - scanf \ - set \ - stack \ - string \ - sys \ - weak \ - ephemeron - -STDLIB_FILES:=$(patsubst %,$(OCAMLLIB)/%.mli,$(STDLIB_FILES)) - -.PHONY: doc-kernel -doc-kernel: $(DOC_DIR)/kernel-doc.ocamldoc - -$(DOC_DIR)/kernel-doc.ocamldoc: $(DOC_DEPEND) - $(PRINT_DOC) Kernel Documentation - $(MKDIR) $(DOC_DIR)/html - $(RM) $(DOC_DIR)/html/*.html - $(OCAMLDOC) $(DOC_FLAGS) \ - $(addprefix -passopt -stdlib ,$(STDLIB_FILES)) \ - -t "Frama-C Kernel" \ - -sort -css-style ../style.css \ - -g $(DOC_PLUGIN) \ - -d $(DOC_DIR)/html -dump $@ \ - $(MODULES_TODOC); \ - RES=$$?; \ - if test $$RES -ne 0; then \ - $(RM) $@; \ - exit $$RES; \ - fi - -DYN_MLI_DIR := src/plugins/print_api - -.PHONY: doc-dynamic -doc-dynamic: doc-kernel - $(RM) $(DYN_MLI_DIR)/dynamic_plugins.mli - ./bin/frama-c.byte \ - -print_api $(call winpath,$(FRAMAC_ROOT_SRCDIR)/$(DYN_MLI_DIR)) - $(PRINT_DOC) Dynamically registered plugins Documentation - $(MKDIR) $(DOC_DIR)/dynamic_plugins - $(RM) $(DOC_DIR)/dynamic_plugins/*.html - $(OCAMLDOC) $(DOC_FLAGS) -I $(FRAMAC_LIB) -I $(OCAMLLIB) \ - -passopt -docpath $(DOC_DIR)/html \ - -sort -css-style ../style.css \ - -load $(DOC_DIR)/kernel-doc.ocamldoc \ - -t " Dynamically registered plugins" \ - -g $(DOC_PLUGIN) \ - -d $(DOC_DIR)/dynamic_plugins \ - $(DYN_MLI_DIR)/dynamic_plugins.mli - $(ECHO) '<li><a href="dynamic_plugins/Dynamic_plugins.html">Dynamically registered plugins</a </li>' > $(DOC_DIR)/dynamic_plugins.toc - -doc-index: doc-kernel doc-dynamic plugins-doc - $(PRINT_MAKING) doc/code/index.html - $(CAT) $(DOC_DIR)/toc_head.htm $(DOC_DIR)/*.toc \ - $(DOC_DIR)/toc_tail.htm > $(DOC_DIR)/index.html - -doc-update: doc-kernel doc-dynamic plugins-doc doc-index - -doc:: doc-kernel doc-dynamic plugins-doc doc-index - -doc-kernel doc-dynamic plugins-doc doc-index: $(DOC_DEPEND) - -doc-tgz: - $(PRINT_MAKING) frama-c-api.tar.gz - cd $(DOC_DIR); \ - $(TAR) zcf tmp.tgz index.html *.txt \ - $(notdir $(wildcard $(DOC_DIR)/*.css $(DOC_DIR)/*.png \ - $(DOC_DIR)/dynamic_plugins*)) \ - html \ - $(foreach p,$(PLUGIN_DISTRIBUTED_NAME_LIST),\ - $(notdir $($(p)_DOC_DIR))) - $(MKDIR) frama-c-api - $(RM) -r frama-c-api/* - cd frama-c-api; $(TAR) zxf ../$(DOC_DIR)/tmp.tgz - $(TAR) zcf frama-c-api.tar.gz frama-c-api - $(RM) -r frama-c-api $(DOC_DIR)/tmp.tgz - -doc-distrib: - $(QUIET_MAKE) clean-doc - $(QUIET_MAKE) doc DOC_NOT_FOR_DISTRIB= - $(QUIET_MAKE) doc-tgz - -#find src -name "*.ml[i]" -o -name "*.ml" -maxdepth 3 | sort -r | xargs -dots: $(ALL_CMO) - $(PRINT_DOC) callgraph - $(OCAMLDOC) $(DOC_FLAGS) $(INCLUDES) -o doc/call_graph.dot \ - -dot -dot-include-all -dot-reduce $(MODULES_TODOC) - $(QUIET_MAKE) doc/call_graph.svg - $(QUIET_MAKE) doc/call_graph.ps - -# pandoc is required to regenerate the manpage -man/frama-c.1: man/frama-c.1.md Makefile - $(PRINT) 'generating $@' - $(RM) $@ - pandoc -s -t man $< > $@ - $(CHMOD_RO) $@ - -# Checking consistency with the current implementation -###################################################### - -DOC_DEV_DIR = doc/developer -CHECK_API_DIR=$(DOC_DEV_DIR)/check_api - -$(CHECK_API_DIR)/check_code.cmo: $(CHECK_API_DIR)/check_code.ml - $(PRINT_OCAMLC) $@ - $(OCAMLC) -c -I +ocamldoc str.cma $(CHECK_API_DIR)/check_code.ml - -$(CHECK_API_DIR)/check_code.cmxs: $(CHECK_API_DIR)/check_code.ml - $(PRINT_PACKING) $@ - $(OCAMLOPT) -package ocamldoc -o $@ -shared \ - $(CHECK_API_DIR)/check_code.ml - -CHECK_CODE=$(CHECK_API_DIR)/check_code.cmxs - -.PHONY: check-devguide devguide -devguide: byte $(OCAMLBEST) - $(MAKE) FRAMAC_INTERNAL=no -C $(DOC_DEV_DIR) - -check-devguide: $(CHECK_CODE) $(DOC_DEPEND) $(DOC_DIR)/kernel-doc.ocamldoc plugins-doc devguide - $(PRINT) 'Checking developer guide consistency' - $(MKDIR) $(CHECK_API_DIR)/html - $(RM) $(CHECK_API_DIR)/code_file - $(foreach doc_dump, \ - $(DOC_DIR)/kernel-doc.ocamldoc $(PLUGIN_DOC_DUMP_LIST), \ - $(OCAMLDOC) $(DOC_FLAGS) -I $(OCAMLLIB) \ - -g $(CHECK_CODE) \ - -passopt -docdevpath -passopt "`pwd`/$(CHECK_API_DIR)" \ - -load $(doc_dump) \ - -d $(CHECK_API_DIR)/html; ) - $(RM) -r $(CHECK_API_DIR)/html - $(MAKE) --silent -C $(CHECK_API_DIR) main.idx - $(MAKE) --silent -C $(CHECK_API_DIR) >$(CHECK_API_DIR)/summary.txt - $(ECHO) see all the information displayed here \ - in $(CHECK_API_DIR)/summary.txt - -################################ -# Code prettyfication and lint # -################################ - -# We're interested by any .ml[i]? file in src, except for scripts in test -# directories, and generated files (in particular lexers and parsers) -# Note: the find command below is *very* ugly, but it should be POSIX-compliant. - -ALL_ML_FILES:=$(shell find src -name '*.ml' -print -o -name '*.mli' -print -o -path '*/tests' -prune '!' -name '*') -ALL_ML_FILES+=ptests/ptests.ml - -ifeq ($(origin MANUAL_ML_FILES),undefined) -MANUAL_ML_FILES:=$(ALL_ML_FILES) -endif - -MANUAL_ML_FILES:=\ - $(filter-out $(GENERATED) $(PLUGIN_GENERATED_LIST), $(MANUAL_ML_FILES)) - -# Allow control of files to be linted/fixed by external sources -# (e.g. pre-commit hook that will concentrate on files which have changed) - -sinclude .Makefile.lint - -HAS_GIT_FILE:=$(wildcard .git/HEAD) - -ifeq ("$(HAS_GIT_FILE)","") -LINT_OTHER_SOURCES:= -else -LINT_OTHER_SOURCES:=\ - $(filter-out \ - $(shell git ls-tree --name-only HEAD src/plugins/*), \ - $(wildcard src/plugins/*)) -endif - -$(foreach dir,$(LINT_OTHER_SOURCES),$(eval sinclude $(dir)/.Makefile.lint)) - -ML_LINT_MISSING:=$(filter-out $(MANUAL_ML_FILES), $(ML_LINT_KO)) - -# By default, also checks files with unknown status: -# this requires new files to pass lint checker from the beginning - -ML_LINT_CHECK?=$(filter-out $(ML_LINT_KO), $(MANUAL_ML_FILES)) - -# this NEWLINE variable containing a literal newline character is used to avoid -# the error "argument list too long", in some instances of "foreach". -# For details, see https://stackoverflow.com/questions/7039811 -define NEWLINE - - -endef - -# pre-requisite intentionally left blank: this target should only be used -# if the file is not present to generate it once and forall, -# and be edited manually afterwards -# double colon here tells make not to attempt updating the .Makefile.lint -# if it does not exist, but just to ignore it. -.Makefile.lint:: - echo "ML_LINT_KO:=" >> $@ - $(foreach file,$(sort $(MANUAL_ML_FILES)), \ - if ! $(MAKE) ML_LINT_CHECK=$(file) lint; \ - then echo "ML_LINT_KO+=$(file)" >> $@; fi;$(NEWLINE) ) - -$(foreach dir,$(LINT_OTHER_SOURCES),\ - $(eval $(dir)/.Makefile.lint:: ; \ - $(foreach file, $(sort $(filter $(dir)/%, $(MANUAL_ML_FILES))), \ - if ! $$(MAKE) ML_LINT_CHECK=$(file) lint; \ - then echo "ML_LINT_KO+=$(file)" >> $$@; fi; ))) - -.PHONY: stats-lint -stats-lint: - echo \ - "scale = 2; bad = $(words $(ML_LINT_MISSING)); \ - all = $(words $(sort $(MANUAL_ML_FILES))); \ - fail = $(words $(ML_LINT_KO)); \ - \"lint coverage: \"; \ - ((all - fail) * 100) / all; " | bc - echo "number of files supposed to pass lint: $(words $(ML_LINT_CHECK))" - echo "number of files supposed to fail lint: $(words $(ML_LINT_KO))" -ifneq ($(strip $(ML_LINT_MISSING)),) - echo "number of files missing from src/ : $(words $(ML_LINT_MISSING))" - $(foreach file, $(ML_LINT_MISSING), echo $(file);) - exit 1 -endif - -ML_LINT_CHECK_LIST=$(wildcard $(ML_LINT_CHECK)) -INDENT_TARGET= $(patsubst %,%.indent,$(ML_LINT_CHECK_LIST)) - -LINT_TARGET= $(patsubst %,%.lint,$(ML_LINT_CHECK_LIST)) - -FIX_SYNTAX_TARGET=$(patsubst %,%.fix-syntax,$(ML_LINT_CHECK_LIST)) - -.PHONY: $(INDENT_TARGET) $(LINT_TARGET) $(FIX_SYNTAX_TARGET) \ - indent lint fix-syntax - -indent: $(INDENT_TARGET) - -lint:: $(LINT_TARGET) - -check-ocp-indent-version: - if command -v ocp-indent >/dev/null; then \ - $(eval ocp_version_major := $(shell ocp-indent --version | $(SED) -E "s/^([0-9]+)\.[0-9]+\..*/\1/")) \ - $(eval ocp_version_minor := $(shell ocp-indent --version | $(SED) -E "s/^[0-9]+\.([0-9]+)\..*/\1/")) \ - if [ "$(ocp_version_major)" -lt 1 -o "$(ocp_version_minor)" -lt 8 ]; then \ - echo "error: ocp-indent 1.8.1 required for linting (got $(ocp_version_major).$(ocp_version_minor))"; \ - exit 1; \ - fi; \ - else \ - exit 1; \ - fi; - -fix-syntax: $(FIX_SYNTAX_TARGET) - -$(INDENT_TARGET): %.indent: % check-ocp-indent-version - ocp-indent -i $< - -$(LINT_TARGET): %.lint: % check-ocp-indent-version - # See SO 1825552 on mixing grep and \t (and cry) - # For OK_NL, we have three cases: - # - for empty files, the computation boils down to 0 - 0 == 0 - # - for non-empty files with a proper \n at the end, to 1 - 1 == 0 - # - for empty files without \n, to 1 - 0 == 1 that will be catched - OK_TAB=$$(grep -c -e "$$(printf '^ *\t')" $<) ; \ - OK_SPACE=$$(grep -c -e '[[:blank:]]$$' $<) ; \ - OK_NL=$$(($$(tail -c -1 $< | wc -c) - $$(tail -n -1 $< | wc -l))) ; \ - OK_EMPTY=$$(tail -n -1 $< | grep -c -e '^[[:blank:]]*$$') ; \ - ERROR=$$(($$OK_TAB + $$OK_SPACE + $$OK_NL + $$OK_EMPTY)) ; \ - if test $$ERROR -gt 0; then \ - echo "File $< does not pass syntactic checks:"; \ - echo "$$OK_TAB lines indented with tabulation instead of spaces"; \ - echo "$$OK_SPACE lines with spaces at end of line"; \ - test $$OK_NL -eq 0 || echo "No newline at end of file"; \ - test $$OK_EMPTY -eq 0 || echo "Empty line(s) at end of file"; \ - echo "Please run make ML_LINT_CHECK=$< fix-syntax"; \ - exit 1 ; \ - fi - ocp-indent $< > $<.tmp; - if cmp -s $< $<.tmp; \ - then rm -f $<.tmp; \ - else \ - echo "File $< is not indented correctly."; \ - echo "Please run make ML_LINT_CHECK=$< indent";\ - rm $<.tmp; \ - exit 1; \ - fi - -$(FIX_SYNTAX_TARGET): %.fix-syntax: % - $(ISED) -e 's/^ *\t\+/ /' $< - $(ISED) -e 's/\(.*[^[:blank:]]\)[[:blank:]]\+$$/\1/' $< - $(ISED) -e 's/^[ \t]\+$$//' $< - if test \( $$(tail -n -1 $< | wc -l) -eq 0 \) -a \( $$(wc -c $< | cut -d " " -f 1) -gt 0 \) ; then \ - echo "" >> $<; \ - else \ - while tail -n -1 $< | grep -l -e '^[ \t]*$$'; do \ - head -n -1 $< > $<.tmp; \ - mv $<.tmp $<; \ - done; \ - fi - -# Avoid a UTF-8 locale at all cost: in such setting, sed does not work -# reliably if you happen to have latin-1 encoding somewhere, -# which is still unfortunately the case in some dark corners of the platform -%.fix-syntax: LC_ALL = C - -################ -# Installation # -################ - -# line below does not work if INCLUDES contains twice the same directory -# Do not attempt to copy gui interfaces if gui is disabled -#Byte -ALL_BATCH_CMO_FIXED=$(filter-out src/kernel_internals/runtime/gui_init.cmo,$(CMO) $(STARTUP_CMO)) -LIB_BYTE_TO_INSTALL=\ - $(MLI_ONLY:.mli=.cmi) \ - $(ALL_BATCH_CMO_FIXED:.cmo=.cmi) \ - $(ALL_BATCH_CMO_FIXED) \ - $(filter-out %.o,$(GEN_BYTE_LIBS:.cmo=.cmi)) \ - $(GEN_BYTE_LIBS) - -#Byte GUI -ifneq ("$(ENABLE_GUI)","no") -LIB_BYTE_TO_INSTALL+=$(SINGLE_GUI_CMI) $(SINGLE_GUI_CMO) -endif - -#Opt -ifeq ("$(OCAMLBEST)","opt") -ALL_BATCH_CMX_FIXED= $(filter-out src/kernel_internals/runtime/gui_init.cmx,\ - $(CMX) $(STARTUP_CMX)) -LIB_OPT_TO_INSTALL +=\ - $(ALL_BATCH_CMX) \ - $(filter %.a,$(ALL_BATCH_CMX_FIXED:.cmxa=.a)) \ - $(filter %.o,$(ALL_BATCH_CMX_FIXED:.cmx=.o)) \ - $(filter-out %.o,$(GEN_OPT_LIBS)) \ - $(filter-out $(GEN_BYTE_LIBS),$(filter %.o,$(GEN_OPT_LIBS:.cmx=.o))) - -#Opt GUI -ifneq ("$(ENABLE_GUI)","no") -LIB_OPT_TO_INSTALL += $(SINGLE_GUI_CMX) $(SINGLE_GUI_CMX:.cmx=.o) -endif - -endif - -clean-install: - $(PRINT_RM) "Installation directory" - $(RM) -r $(FRAMAC_LIBDIR) - -install-lib-byte: clean-install - $(PRINT_INSTALL) kernel API - $(MKDIR) $(FRAMAC_LIBDIR) - $(CP) $(LIB_BYTE_TO_INSTALL) $(FRAMAC_LIBDIR) - $(CP) $(addprefix lib/fc/,dllframa-c$(DLLEXT) libframa-c.a frama-c.cma META.frama-c) $(FRAMAC_LIBDIR) - -install-lib-opt: install-lib-byte - $(CP) $(LIB_OPT_TO_INSTALL) $(FRAMAC_LIBDIR) - $(CP) $(addprefix lib/fc/,frama-c.a frama-c.cmxa) $(FRAMAC_LIBDIR) - -install-doc-code: - $(PRINT_INSTALL) API documentation - $(MKDIR) $(FRAMAC_DATADIR)/doc/code - (cd doc ; tar cf - --exclude='.svn' --exclude='*.toc' \ - --exclude='*.htm' --exclude='*.txt' \ - --exclude='*.ml' \ - code \ - | (cd $(FRAMAC_DATADIR)/doc ; tar xf -)) - -.PHONY: install -install:: install-lib-$(OCAMLBEST) - $(PRINT_MAKING) destination directories - $(MKDIR) $(BINDIR) - $(MKDIR) $(MANDIR)/man1 - $(MKDIR) $(FRAMAC_PLUGINDIR)/top - $(MKDIR) $(FRAMAC_PLUGINDIR)/gui - $(MKDIR) $(FRAMAC_DATADIR)/theme/default - $(MKDIR) $(FRAMAC_DATADIR)/theme/colorblind - $(MKDIR) $(FRAMAC_DATADIR)/theme/flat - $(MKDIR) $(FRAMAC_DATADIR)/libc/sys - $(MKDIR) $(FRAMAC_DATADIR)/libc/netinet - $(MKDIR) $(FRAMAC_DATADIR)/libc/net - $(MKDIR) $(FRAMAC_DATADIR)/libc/arpa - $(PRINT_INSTALL) shared files - $(CP) \ - $(wildcard share/*.c share/*.h) \ - share/Makefile.dynamic share/Makefile.plugin.template \ - share/Makefile.config share/Makefile.common share/Makefile.generic \ - share/configure.ac share/autocomplete_frama-c share/_frama-c \ - $(FRAMAC_DATADIR) - $(MKDIR) $(FRAMAC_DATADIR)/analysis-scripts - $(CP) \ - share/analysis-scripts/analysis.mk \ - share/analysis-scripts/benchmark_database.py \ - share/analysis-scripts/build.py \ - share/analysis-scripts/build_callgraph.py \ - share/analysis-scripts/cmd-dep.sh \ - share/analysis-scripts/concat-csv.sh \ - share/analysis-scripts/clone.sh \ - share/analysis-scripts/creduce.sh \ - share/analysis-scripts/epilogue.mk \ - share/analysis-scripts/fc_stubs.c \ - share/analysis-scripts/find_fun.py \ - share/analysis-scripts/flamegraph.pl \ - share/analysis-scripts/frama_c_results.py \ - share/analysis-scripts/function_finder.py \ - share/analysis-scripts/git_utils.py \ - share/analysis-scripts/list_files.py \ - share/analysis-scripts/list_functions.ml \ - share/analysis-scripts/make_wrapper.py \ - share/analysis-scripts/normalize_jcdb.py \ - share/analysis-scripts/parse-coverage.sh \ - share/analysis-scripts/prologue.mk \ - share/analysis-scripts/pyproject.toml \ - share/analysis-scripts/README.md \ - share/analysis-scripts/results_display.py \ - share/analysis-scripts/script_for_creduce_fatal.sh \ - share/analysis-scripts/script_for_creduce_non_fatal.sh \ - share/analysis-scripts/source_filter.py \ - share/analysis-scripts/summary.py \ - share/analysis-scripts/template.mk \ - $(FRAMAC_DATADIR)/analysis-scripts - $(MKDIR) $(FRAMAC_DATADIR)/compliance - $(CP) share/compliance/c11_functions.json \ - share/compliance/c11_headers.json \ - share/compliance/compiler_builtins.json \ - share/compliance/gcc_builtins.json \ - share/compliance/glibc_functions.json \ - share/compliance/nonstandard_identifiers.json \ - share/compliance/posix_identifiers.json \ - $(FRAMAC_DATADIR)/compliance - $(MKDIR) $(FRAMAC_DATADIR)/emacs - $(CP) $(wildcard share/emacs/*.el) $(FRAMAC_DATADIR)/emacs - $(CP) share/frama-c.rc $(ICONS) $(FRAMAC_DATADIR) - $(CP) $(THEME_ICONS_DEFAULT) $(FRAMAC_DATADIR)/theme/default - $(CP) $(THEME_ICONS_COLORBLIND) $(FRAMAC_DATADIR)/theme/colorblind - $(CP) $(THEME_ICONS_FLAT) $(FRAMAC_DATADIR)/theme/flat - if [ -d $(EMACS_DATADIR) ]; then \ - $(CP) $(wildcard share/emacs/*.el) $(EMACS_DATADIR); \ - fi - $(CP) share/Makefile.dynamic_config.external \ - $(FRAMAC_DATADIR)/Makefile.dynamic_config - $(PRINT_INSTALL) C standard library - $(CP) $(wildcard share/libc/*.c share/libc/*.i share/libc/*.h) \ - $(FRAMAC_DATADIR)/libc - $(CP) share/libc/sys/*.[ch] $(FRAMAC_DATADIR)/libc/sys - $(CP) share/libc/arpa/*.[ch] $(FRAMAC_DATADIR)/libc/arpa - $(CP) share/libc/net/*.[ch] $(FRAMAC_DATADIR)/libc/net - $(CP) share/libc/netinet/*.[ch] $(FRAMAC_DATADIR)/libc/netinet - $(PRINT_INSTALL) binaries - $(CP) bin/toplevel.$(OCAMLBEST) $(BINDIR)/frama-c$(EXE) - $(CP) bin/toplevel.byte$(EXE) $(BINDIR)/frama-c.byte$(EXE) - if [ -x bin/toplevel.top ] ; then \ - $(CP) bin/toplevel.top $(BINDIR)/frama-c.toplevel$(EXE); \ - fi - if [ -x bin/viewer.$(OCAMLBEST) ] ; then \ - $(CP) bin/viewer.$(OCAMLBEST) $(BINDIR)/frama-c-gui$(EXE);\ - fi - if [ -x bin/viewer.byte$(EXE) ] ; then \ - $(CP) bin/viewer.byte$(EXE) $(BINDIR)/frama-c-gui.byte$(EXE); \ - fi - $(CP) bin/ptests.$(OCAMLBEST)$(EXE) \ - $(BINDIR)/ptests.$(OCAMLBEST)$(EXE) - $(CP) bin/frama-c-config $(BINDIR)/frama-c-config; \ - if [ -x bin/frama-c-script ] ; then \ - $(CP) bin/frama-c-script $(BINDIR)/frama-c-script; \ - fi - $(PRINT_INSTALL) config files - $(CP) $(addprefix ptests/,$(PTESTS_FILES)) $(FRAMAC_LIBDIR) - $(PRINT_INSTALL) API documentation - $(MKDIR) $(FRAMAC_DATADIR)/doc/code - $(CP) $(wildcard $(DOC_GEN_FILES)) $(FRAMAC_DATADIR)/doc/code - $(PRINT_INSTALL) plug-ins - if [ -d "$(FRAMAC_PLUGIN)" ]; then \ - $(CP) $(PLUGIN_DYN_CMI_LIST) $(PLUGIN_META_LIST) \ - $(FRAMAC_PLUGINDIR); \ - $(CP) $(PLUGIN_DYN_CMO_LIST) $(FRAMAC_PLUGINDIR)/top; \ - if [ "$(OCAMLBEST)" = "opt" ]; then \ - $(CP) $(PLUGIN_DYN_CMX_LIST) $(FRAMAC_PLUGINDIR)/top; \ - fi; \ - fi - $(PRINT_INSTALL) gui plug-ins - if [ -d "$(FRAMAC_PLUGIN_GUI)" -a "$(PLUGIN_DYN_GUI_EXISTS)" = "yes" ]; \ - then \ - $(CP) $(patsubst %.cma,%.cmi,$(PLUGIN_DYN_GUI_CMO_LIST:.cmo=.cmi)) \ - $(PLUGIN_DYN_GUI_CMO_LIST) $(FRAMAC_PLUGINDIR)/gui; \ - if [ "$(OCAMLBEST)" = "opt" ]; then \ - $(CP) $(PLUGIN_DYN_GUI_CMX_LIST) $(FRAMAC_PLUGINDIR)/gui; \ - fi; \ - fi - $(PRINT_INSTALL) man pages - $(CP) man/frama-c.1 $(MANDIR)/man1/frama-c.1 - $(CP) man/frama-c.1 $(MANDIR)/man1/frama-c-gui.1 - -.PHONY: uninstall -uninstall:: - $(PRINT_RM) installed binaries - $(RM) $(BINDIR)/frama-c* $(BINDIR)/ptests.$(OCAMLBEST)$(EXE) - $(PRINT_RM) installed shared files - $(RM) -R $(FRAMAC_DATADIR) - $(PRINT_RM) installed libraries - $(RM) -R $(FRAMAC_LIBDIR) $(FRAMAC_PLUGINDIR) - $(PRINT_RM) installed man files - $(RM) $(MANDIR)/man1/frama-c.1 $(MANDIR)/man1/frama-c-gui.1 - -################################ -# File headers: license policy # -################################ - - -# Generating headers -#################### - -# Default header specification files -HEADER_SPEC := $(DEFAULT_HEADER_SPEC) -# The list can be extended by external plugins using PLUGIN_HEADER_SPEC variable -HEADER_SPEC += $(PLUGIN_HEADER_SPEC_LIST) -# Default list of header specification files can be overloaded. -HEADER_SPEC_FILE?=$(HEADER_SPEC) - -# Default directory (containing subdirectories open-source and close-source) -HEADER_DIRS := $(DEFAULT_HEADER_DIRS) -# The list can be extended by external plugins using PLUGIN_HEADER_DIRS variable -HEADER_DIRS += $(PLUGIN_HEADER_DIRS_LIST) -# Takes into account the kind of distribution (open-souce/close-source) -DISTRIB_HEADER_DIRS?=$(addsuffix /$(DISTRIB_HEADERS),$(HEADER_DIRS)) - -# List of distributed files allowed to have no entry into the HEADER_SPEC_FILE -HEADER_EXCEPTIONS := $(DEFAULT_HEADER_EXCEPTIONS) -HEADER_EXCEPTIONS += opam/files $(wildcard $(PLUGIN_HEADER_EXCEPTIONS_LIST)) - -# List of headers that cannot be part of an open-source distribution -CEA_PROPRIETARY_HEADERS := $(DEFAULT_CEA_PROPRIETARY_HEADERS) -CEA_PROPRIETARY_HEADERS += $(PLUGIN_CEA_PROPRIETARY_HEADERS_LIST) - -# List of files that cannot be part of an open-source distribution -CEA_PROPRIETARY_FILES := $(DEFAULT_CEA_PROPRIETARY_FILES) -CEA_PROPRIETARY_FILES += $(PLUGIN_CEA_PROPRIETARY_FILES_LIST) - -HDRCK=./headers/hdrck$(EXE) - -HDRCK_EXTRA?=$(STRICT_HEADERS) -# Can be set to "-exit-on-warning" -ifeq ($(HDRCK_EXTRA),no) -HDRCK_EXTRA:="" -else -ifeq ($(HDRCK_EXTRA),yes) -HDRCK_EXTRA:="-exit-on-warning" -endif -endif - -.PHONY: headers - -# OPEN_SOURCE: set it to 'no' if you want to apply close source headers. -# STRICT_HEADERS: set it to 'yes' if you want to consider warnings as errors -headers:: $(HDRCK) - $(PRINT) "|$(OPEN_SOURCE)|$(SPECIFIED_OPEN_SOURCE)|" - $(PRINT) "Applying $(HDRCK_DISTRIB_HEADERS) headers (OPEN_SOURCE=$(HDRCK_OPEN_SOURCE))..." - $(PRINT) "- HEADER_SPEC_FILE=$(HEADER_SPEC_FILE)" - $(PRINT) "- DISTRIB_HEADER_DIRS=$(HDRCK_DISTRIB_HEADER_DIRS)" - $(HDRCK) \ - $(HDRCK_EXTRA) \ - -update -C . \ - $(addprefix -header-dirs ,$(HDRCK_DISTRIB_HEADER_DIRS)) \ - -headache-config-file ./headers/headache_config.txt \ - $(HEADER_SPEC_FILE) - -hdrck: $(HDRCK) - -$(HDRCK): headers/hdrck.ml - $(PRINT_MAKING) $@ -ifeq ($(OCAMLBEST),opt) - $(OCAMLOPT) str.cmxa unix.cmxa $< -o $@ -else - $(OCAMLC) str.cma unix.cma $< -o $@ -endif - -hdrck-clean: - $(RM) $(HDRCK) headers/hdrck.o - $(RM) headers/hdrck.cmx headers/hdrck.cmi headers/hdrck.cmp - -clean:: hdrck-clean - -CURRENT_HEADERS?=open-source -CURRENT_HEADER_DIRS?=$(addsuffix /$(CURRENT_HEADERS),$(HEADER_DIRS)) - -CHECK_NEWLINES:=./bin/check_newlines$(EXE) - -$(CHECK_NEWLINES): bin/check_newlines.ml - $(PRINT_MAKING) $@ -ifeq ($(OCAMLBEST),opt) - $(OCAMLOPT) unix.cmxa $< -o $@ -else - $(OCAMLC) unix.cma $< -o $@ -endif - -check-newlines-clean: - $(RM) $(CHECK_NEWLINES) bin/check_newlines.cm* bin/check_newlines.o - -clean:: check-newlines-clean - -ISUTF8:=./bin/isutf8$(EXE) - -$(ISUTF8): bin/isutf8.ml - $(PRINT_MAKING) $@ -ifeq ($(OCAMLBEST),opt) - $(OCAMLOPT) $< -o $@ -else - $(OCAMLC) $< -o $@ -endif - -isutf8-clean: - $(RM) $(ISUTF8) bin/isutf8.cm* bin/isutf8.o - -clean:: isutf8-clean - -BINARY_DISTRIB_FILES := \ - $(sort $(wildcard ivette/ivette.icns ivette/src/dome/doc/template/static/fonts/*)) \ - $(sort $(wildcard share/*.ico share/*.png share/theme/*/*.png)) \ - -FILES_WITHOUT_NEWLINE := \ - $(BINARY_DISTRIB_FILES) \ - VERSION \ - VERSION_CODENAME \ - -BINARY_DISTRIB_TESTS := \ - tests/misc/oracle/interpreted_automata_dataflow_backward.dot \ - tests/misc/oracle/interpreted_automata_dataflow_forward.dot \ - -TESTS_WITHOUT_NEWLINE := \ - $(BINARY_DISTRIB_TESTS) \ - tests/spec/unfinished-oneline-acsl-comment.i \ - -# OPEN_SOURCE: set it to 'yes' if you want to check open source headers -# STRICT_HEADERS: set it to 'yes' if you want to consider warnings as errors -# The target check-headers does the following checks: -# 1. Checks entries of HEADER_SPEC_FILE -# 2. Checks that every DISTRIB_FILES (except HEADER_EXCEPTIONS) have an entry -# inside HEADER_SPEC_FILE -# 3. Checks that all these files are not under DISTRIB_PROPRIETARY_HEADERS -# licences -# Also check that distributed files are not encoded in ISO-8859. Do this first, -# because identical headers but with different encodings are not exactly -# easy to distinguish -.PHONY: check-headers -check-headers: $(HDRCK) $(CHECK_NEWLINES) $(ISUTF8) - $(PRINT) "Checking $(DISTRIB_HEADERS) headers (OPEN_SOURCE=$(OPEN_SOURCE), CURRENT_HEADERS=$(CURRENT_HEADERS))..." - $(PRINT) "- HEADER_SPEC_FILE=$(HEADER_SPEC_FILE)" - $(PRINT) "- CURRENT_HEADER_DIRS=$(CURRENT_HEADER_DIRS)" - $(PRINT) "- FORBIDDEN_HEADERS=$(DISTRIB_PROPRIETARY_HEADERS)" - # Workaround to avoid "argument list too long" in Cygwin - $(file >distrib_files.tmp) $(foreach O,$(DISTRIB_FILES),$(file >>distrib_files.tmp,$O)) - $(file >distrib_tests.tmp) $(foreach O,$(DISTRIB_TESTS),$(file >>distrib_tests.tmp,$(subst @, ,$(O)))) - $(file >header_exceptions.tmp) $(foreach O,$(HEADER_EXCEPTIONS),$(file >>header_exceptions.tmp,$O)) - echo "Checking that distributed files terminate with a newline..." - $(CHECK_NEWLINES) distrib_files.tmp $(FILES_WITHOUT_NEWLINE) - $(CHECK_NEWLINES) distrib_tests.tmp $(TESTS_WITHOUT_NEWLINE) - echo "Checking that distributed files do not use iso-8859..." - $(ISUTF8) distrib_files.tmp $(BINARY_DISTRIB_FILES) - $(ISUTF8) distrib_tests.tmp $(BINARY_DISTRIB_TESTS) - echo "Checking headers..." - $(HDRCK) \ - $(HDRCK_EXTRA) \ - $(addprefix -header-dirs ,$(CURRENT_HEADER_DIRS)) \ - $(addprefix -forbidden-headers ,$(DISTRIB_PROPRIETARY_HEADERS)) \ - -headache-config-file ./headers/headache_config.txt \ - -distrib-file distrib_files.tmp \ - -header-except-file header_exceptions.tmp \ - $(HEADER_SPEC_FILE) - $(RM) distrib_files.tmp distrib_tests.tmp header_exceptions.tmp +MAJOR_VERSION=$(shell $(SED) -E 's/^([0-9]+)\..*/\1/' VERSION) +MINOR_VERSION=$(shell $(SED) -E 's/^[0-9]+\.([0-9]+).*/\1/' VERSION) +VERSION_CODENAME=$(shell $(CAT) VERSION_CODENAME) + +# File used by dune to build src/kernel_internals/runtime/fc_config.ml +config.sed: VERSION share/Makefile.config share/Makefile.common Makefile configure.in + @echo "# generated file" > $@ + @echo "s|@VERSION@|$(VERSION)|" >> $@ + @echo "s|@VERSION_CODENAME@|$(VERSION_CODENAME)|" >> $@ + @echo "s|@MAJOR_VERSION@|$(MAJOR_VERSION)|g" >> $@ + @echo "s|@MINOR_VERSION@|$(MINOR_VERSION)|g" >> $@ + @echo "s|@FRAMAC_DEFAULT_CPP@|$(FRAMAC_DEFAULT_CPP)|" >> $@ + @echo "s|@FRAMAC_DEFAULT_CPP_ARGS@|$(FRAMAC_DEFAULT_CPP_ARGS)|" >> $@ + @echo "s|@FRAMAC_GNU_CPP@|$(FRAMAC_GNU_CPP)|" >> $@ + @echo "s|@DEFAULT_CPP_KEEP_COMMENTS@|$(DEFAULT_CPP_KEEP_COMMENTS)|" >> $@ + @echo "s|@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@|$(DEFAULT_CPP_SUPPORTED_ARCH_OPTS)|" >> $@ + @echo "s|@OPTDOT@|$(OPTDOT)|" >> $@ + +clean:: purge-tests # to be done before a "dune" command + dune clean + dune clean --root $(FRAMAC_PTESTS_SRC) + dune clean --root $(FRAMAC_HDRCK_SRC) + rm -rf _build .merlin config.sed autom4te.cache ######################################################################## -# Makefile is rebuilt whenever Makefile.in or configure.in is modified # +# Makefile.config is rebuilt whenever configure.in is modified # ######################################################################## share/Makefile.config: share/Makefile.config.in config.status @@ -2283,352 +109,69 @@ configure: configure.in .force-reconfigure $(PRINT_MAKING) $@ autoconf -f -# If 'make clean' has to be performed after 'svn update': -# change '.make-clean-stamp' before 'svn commit' +# If 'make clean' has to be performed after 'git pull': +# change '.make-clean-stamp' before 'git commit' .make-clean: .make-clean-stamp $(TOUCH) $@ $(QUIET_MAKE) clean include .make-clean -# force "make clean" to be executed for all users of SVN +# force "make clean" to be executed for all users of GIT force-clean: expr `$(CAT) .make-clean-stamp` + 1 > .make-clean-stamp -# force a reconfiguration for all svn users +# force a reconfiguration for all git users force-reconfigure: expr `$(CAT) .force-reconfigure` + 1 > .force-reconfigure -.PHONY: force-clean force-reconfigure - -############ -# cleaning # -############ - -clean-journal: - $(PRINT_RM) journal - $(RM) frama_c_journal* - -clean-tests: - $(PRINT_RM) tests - $(RM) tests/*/*.byte$(EXE) tests/*/*.opt$(EXE) tests/*/*.cm* \ - tests/dynamic/.cm* tests/*/*~ tests/*/#* - $(RM) tests/*/result/*.* - -clean-doc:: $(PLUGIN_LIST:=_CLEAN_DOC) - $(PRINT_RM) documentation - $(RM) -r $(DOC_DIR)/html - $(RM) $(DOC_DIR)/docgen.cm* $(DOC_DIR)/*~ - $(RM) doc/db/*~ doc/db/ocamldoc.sty doc/db/db.tex - $(RM) doc/training/*/*.cm* - if [ -f doc/developer/Makefile ]; then \ - $(MAKE) --silent -C doc/developer clean; \ - fi - -clean-gui:: - $(PRINT_RM) gui - $(RM) src/*/*/*_gui.cm* src/*/*/*_gui.o \ - src/plugins/gui/*.cm* src/plugins/gui/*.o - -clean:: $(PLUGIN_LIST:=_CLEAN) \ - clean-tests clean-journal clean-check-libc - $(PRINT_RM) lib/plugins - $(RM) $(addprefix $(PLUGIN_LIB_DIR)/,*.mli *.cm* *.o META.*) - $(RM) $(addprefix $(PLUGIN_TOP_LIB_DIR)/,*.mli *.cm* *.o *.a) - $(RM) $(addprefix $(PLUGIN_GUI_LIB_DIR)/,*.mli *.cm* *.o *.a) - $(PRINT_RM) local installation - $(RM) lib/*.cm* lib/*.o lib/fc/*.cm* lib/fc/*.o lib/gui/*.cm* lib/*.cm* - $(PRINT_RM) other sources - for d in . $(SRC_DIRS) src/plugins/gui share; do \ - $(RM) $$d/*.cm* $$d/*.o $$d/*.a $$d/*.annot $$d/*~ $$d/*.output \ - $$d/*.annot $$d/\#*; \ - done - $(PRINT_RM) generated files - $(RM) $(GENERATED) - $(PRINT_RM) binaries - $(RM) bin/toplevel.byte$(EXE) bin/viewer.byte$(EXE) \ - bin/ptests.byte$(EXE) bin/*.opt$(EXE) bin/toplevel.top$(EXE) - -smartclean: - $(MAKE) -f share/Makefile.clean smartclean - -# Do NOT use :: for this rule: it is mandatory to remove share/Makefile.config -# as the very last step performed by make (who'll otherwise try to regenerate -# it in the middle of cleaning) -dist-clean distclean: clean clean-doc \ - $(PLUGIN_LIST:=_DIST_CLEAN) - $(PRINT_RM) config - $(RM) share/Makefile.config - $(RM) config.cache config.log config.h - $(RM) -r autom4te.cache - $(PRINT_RM) documentation - $(RM) $(DOC_DIR)/kernel-doc.ocamldoc - $(PRINT_RM) dummy plug-ins - $(RM) src/dummy/*/*.cm* src/dummy/*/*.o src/dummy/*/*.a \ - src/dummy/*/*.annot src/dummy/*/*~ src/dummy/*/*.output \ - src/dummy/*/*.annot src/dummy/*/\#* - $(RM) $(CHECK_NEWLINES) $(ISUTF8) - -ifeq ($(OCAMLWIN32),yes) -# Use Win32 typical resources -share/frama-c.rc: share/frama-c.WIN32.rc - $(PRINT_MAKING) $@ - $(CP) $^ $@ -else -# Use Unix typical resources -share/frama-c.rc: share/frama-c.Unix.rc - $(PRINT_MAKING) $@ - $(CP) $^ $@ -endif - -GENERATED+=share/frama-c.rc - -########## -# Depend # -########## - -PLUGIN_DEP_LIST:=$(PLUGIN_LIST) - -.PHONY: depend - -# tell make not to remove generated files even if they are only a byproduct -# of making .depend. -.PRECIOUS: $(GENERATED) share/Makefile.dynamic_config - -# in case .depend is absent, we will make it. Otherwise, it will be left -# untouched. Only make depend will force a recomputation of dependencies -.depend: $(GENERATED) share/Makefile.dynamic_config - $(MAKE) depend - -depend:: $(GENERATED) share/Makefile.dynamic_config - $(PRINT_MAKING) .depend - $(RM) .depend - $(OCAMLDEP) $(INCLUDES) $(FILES_FOR_OCAMLDEP) > .depend - $(OCAMLDEP) $(INCLUDES) $(TEST_DIRS_AS_PLUGIN:%=-I tests/%) \ - $(LONELY_TESTS_ML_FILES) >> .depend - $(CHMOD_RO) .depend - -#Used by internal plugins to wait until the *.mli of all the plugins are in -# $(PLUGIN_LIB_DIR) before computing their .depend. Otherwise ocamldep doesn't -# mark inter-plugin dependencies -$(PLUGIN_LIB_DIR)/.placeholders_ready: - touch $@ - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),distclean) -ifneq ($(MAKECMDGOALS),smartclean) -ifneq ($(MAKECMDGOALS),depend) -sinclude .depend -endif -endif -endif -endif - -##################### -# ptest development # -##################### - -.PHONY: ptests - -PTESTS_SRC=ptests/ptests_config.ml ptests/ptests.ml - -# Do not generate tests/ptests_config if we are compiling a distribution -# that does not contain a 'tests' dir -PTESTS_CONFIG:= $(shell if test -d tests; then echo tests/ptests_config; fi) - -ifneq ("$(PTESTS_CONFIG)","") -GENERATED_TESTS:=tests/spec/preprocess_dos.c -else -GENERATED_TESTS:= -endif - -tests/spec/preprocess_dos.c: tests/spec/preprocess_dos.c.in \ - Makefile share/Makefile.config - $(RM) $@ - $(SED) -e "s|@UNIX2DOS@|$(PP_DOS_UNIX2DOS)|g" \ - -e "s|@DONTRUN@|$(PP_DOS_DONTRUN)|g" \ - $< > $@ - $(CHMOD_RO) $@ - -ifneq ("$(HAS_UNIX2DOS)","no") -tests/spec/preprocess_dos.c: PP_DOS_UNIX2DOS=$(UNIX2DOS) -tests/spec/preprocess_dos.c: PP_DOS_DONTRUN= -else -tests/spec/preprocess_dos.c: PP_DOS_UNIX2DOS=unix2dos -tests/spec/preprocess_dos.c: PP_DOS_DONTRUN=DONTRUN: no unix2dos found -endif - -ptests: bin/ptests.$(OCAMLBEST)$(EXE) $(PTESTS_CONFIG) $(GENERATED_TESTS) - -bin/ptests.byte$(EXE): $(PTESTS_SRC) - $(PRINT_LINKING) $@ - $(OCAMLC) -I ptests -dtypes -thread -g -o $@ \ - unix.cma threads.cma str.cma dynlink.cma $^ -bin/ptests.opt$(EXE): $(PTESTS_SRC) - $(PRINT_LINKING) $@ - $(OCAMLOPT) -I ptests -dtypes -thread -o $@ \ - unix.cmxa threads.cmxa str.cmxa dynlink.cmxa $^ - -GENERATED+=ptests/ptests_config.ml tests/ptests_config $(GENERATED_TESTS) - -####################### -# Source distribution # -####################### - -.PHONY: src-distrib - -STANDALONE_PLUGINS_FILES = \ - $(addprefix src/dummy/hello_world/,hello_world.ml Makefile) \ - $(addprefix src/dummy/untyped_metrics/,count_for.ml Makefile) - -DISTRIB_FILES += $(wildcard $(PLUGIN_DISTRIBUTED_LIST) \ - $(PLUGIN_DIST_EXTERNAL_LIST) \ - $(PLUGIN_DIST_DOC_LIST) $(STANDALONE_PLUGINS_FILES)) -DISTRIB_FILES:=$(filter-out $(GENERATED) $(PLUGIN_GENERATED_LIST),\ - $(DISTRIB_FILES)) - -DISTRIB_TESTS += $(wildcard $(PLUGIN_DIST_TESTS_LIST)) - -sinclude ivette/Makefile.distrib -sinclude ivette/Makefile.plugins - -SPECIFIED_OPEN_SOURCE:=$(OPEN_SOURCE) -OPEN_SOURCE ?= no - -ifneq ($(OPEN_SOURCE),yes) -# close source version -DISTRIB_HEADERS:=close-source -DISTRIB_PROPRIETARY_HEADERS:= -else -# open source version -DISTRIB_HEADERS:=open-source -# for checking that distributed files aren't under proprietary licence. -DISTRIB_PROPRIETARY_HEADERS:=$(CEA_PROPRIETARY_HEADERS) -# DISTRIB_TESTS contains files that can be distributed without header checking -DISTRIB_TESTS:=$(filter-out $(CEA_PROPRIETARY_FILES) ,\ - $(DISTRIB_TESTS)) -endif - -# Set some variables for `headers`target. -ifeq ($(OPEN_SOURCE),$(SPECIFIED_OPEN_SOURCE)) -# The OPEN_SOURCE variable is specified. So, use it for `make headers` -HDRCK_OPEN_SOURCE=$(SPECIFIED_OPEN_SOURCE) -HDRCK_DISTRIB_HEADERS=$(DISTRIB_HEADERS) -HDRCK_DISTRIB_HEADER_DIRS=$(DISTRIB_HEADER_DIRS) -else -# The OPEN_SOURCE variable is unspecified. So, use open-source default for `make headers` -HDRCK_OPEN_SOURCE=unspecified -HDRCK_DISTRIB_HEADERS=open-source -HDRCK_DISTRIB_HEADER_DIRS?=$(addsuffix /$(HDRCK_DISTRIB_HEADERS),$(HEADER_DIRS)) -endif - -# Variables governing the name of the generated .tar.gz. -# Optionally define them as empty to silence warnings about undefined variables -CLIENT ?= - -DISTRIB_DIR=tmp -ifeq ("$(CLIENT)","") -VERSION_NAME:=$(VERSION_SAFE) -else -VERSION_NAME:=$(VERSION_SAFE)-$(CLIENT) -endif - -DISTRIB?=frama-c-$(VERSION_NAME)-$(VERSION_CODENAME) -CLIENT_DIR=$(DISTRIB_DIR)/$(DISTRIB) +############################################################################## +# INSTALL/UNINSTALL +################################ +FRAMAC_INSTALLDIR?= -# useful parameters: -# CLIENT: name of the client (in the version number, the archive name, etc) -# DISTRIB: name of the generated tarball and of the root tarball directory -# OPEN_SOURCE: set it to 'yes' if you want to exclude close source files -# note: make headers has to be applied... -src-distrib: $(HDRCK) check-headers -ifeq ("$(CLIENT)","") - $(PRINT_BUILD) "$(DISTRIB_HEADERS) tarball $(DISTRIB) (OPEN_SOURCE=$(OPEN_SOURCE))" -else - $(PRINT_BUILD) "$(DISTRIB_HEADERS) tarball $(DISTRIB) for $(CLIENT) (OPEN_SOURCE=$(OPEN_SOURCE))" -endif - $(RM) -r $(CLIENT_DIR) - $(MKDIR) -p $(CLIENT_DIR) - #Workaround to avoid "argument list too long" in Cygwin - $(file >file_list_to_archive.tmp) - $(foreach f,$(DISTRIB_FILES) $(DISTRIB_TESTS), \ - $(file >>file_list_to_archive.tmp,$(subst @, ,$(f)))) - $(TAR) -cf - --files-from file_list_to_archive.tmp | $(TAR) -C $(CLIENT_DIR) -xf - - $(RM) file_list_to_archive.tmp - $(PRINT_MAKING) files - (cd $(CLIENT_DIR) ; \ - echo "$(VERSION_NAME)" > VERSION && \ - DISTRIB_CONF=yes autoconf > ../../.log.autoconf 2>&1) - $(MKDIR) $(CLIENT_DIR)/bin - $(MKDIR) $(CLIENT_DIR)/lib/plugins - $(MKDIR) $(CLIENT_DIR)/lib/gui - $(RM) ../$(DISTRIB).tar.gz - $(PRINT) "Updating files to archive with $(DISTRIB_HEADERS) headers" - $(HDRCK) \ - $(HDRCK_EXTRA) \ - -update -C $(CLIENT_DIR) \ - $(addprefix -header-dirs ,$(DISTRIB_HEADER_DIRS)) \ - -headache-config-file ./headers/headache_config.txt \ - $(HEADER_SPEC_FILE) - $(PRINT_TAR) $(DISTRIB).tar.gz - (cd $(DISTRIB_DIR); $(TAR) cf - \ - --numeric-owner --owner=0 --group=0 --sort=name \ - --mtime="$$(date +"%F") Z" --mode='a+rw' \ - --exclude "*autom4te.cache*" \ - $(DISTRIB) | gzip -9 -n > ../$(DISTRIB).tar.gz \ - ) - $(PRINT_RM) $(DISTRIB_DIR) - $(RM) -r $(DISTRIB_DIR) +INSTALLDIR:=$(FRAMAC_INSTALLDIR) -doc-companions: - $(MAKE) -C doc/developer archives VERSION=$(VERSION_SAFE)-$(VERSION_CODENAME) - $(MV) doc/developer/hello-$(VERSION_SAFE)-$(VERSION_CODENAME).tar.gz hello-$(VERSION_SAFE)-$(VERSION_CODENAME).tar.gz - $(ECHO) "The documentation companion hello-$(VERSION_SAFE)-$(VERSION_CODENAME).tar.gz has been generated." +include share/Makefile.installation -clean-distrib: dist-clean - $(PRINT_RM) distrib - $(RM) -r $(DISTRIB_DIR) $(DISTRIB).tar.gz +############################################################################### +# HEADER MANAGEMENT +################################ -create_lib_to_install_list = $(addprefix $(FRAMAC_LIB)/,$(call map,notdir,$(1))) +# HDRCK is internal +FRAMAC_HDRCK:=headers/hdrck.exe -byte:: bin/toplevel.byte$(EXE) lib/fc/frama-c.cma share/Makefile.dynamic_config \ - $(call create_lib_to_install_list,$(LIB_BYTE_TO_INSTALL)) \ - $(PLUGIN_META_LIST) lib/fc/META.frama-c +# Part that can be shared for external plugins +include share/Makefile.headers -opt:: bin/toplevel.opt$(EXE) lib/fc/frama-c.cmxa share/Makefile.dynamic_config \ - $(call create_lib_to_install_list,$(LIB_OPT_TO_INSTALL)) \ - $(filter %.o %.cmi,\ - $(call create_lib_to_install_list,$(LIB_BYTE_TO_INSTALL))) \ - $(PLUGIN_META_LIST) lib/fc/META.frama-c +############################################################################### +# Testing +################################ -top: bin/toplevel.top$(EXE) \ - $(call create_lib_to_install_list,$(LIB_BYTE_TO_INSTALL)) \ - $(PLUGIN_META_LIST) +# PTESTS is internal +FRAMAC_PTESTS:=$(FRAMAC_PTESTS_SRC)/ptests.exe -################## -# Copy in lib/fc # -################## +# WTESTS is internal +FRAMAC_WTESTS:=$(FRAMAC_PTESTS_SRC)/wtests.exe -define copy_in_lib -$(FRAMAC_LIB)/$(notdir $(1)): $(1) - $(MKDIR) $(FRAMAC_LIB) - $(CP) $$< $$@ +# Frama-C also have ptest directories in plugins, so we do not use default +PTEST_ALL_DIRS:=tests $(wildcard src/plugins/*/tests) -endef -$(eval $(foreach file,$(LIB_BYTE_TO_INSTALL),$(call copy_in_lib,$(file)))) -$(eval $(foreach file,$(LIB_OPT_TO_INSTALL),$(call copy_in_lib,$(file)))) +# Ptests needs config.sed so that dune can build Frama-C (if it is not built) +PTEST_DEPS:=config.sed -################ -# Generic part # -################ +# WP tests need WP cache +PTEST_USE_WP_CACHE:=yes -$(NON_OPAQUE_DEPS:%=%.cmx): OFLAGS := $(OFLAGS) -w -58 +# Part that can be shared for external plugins +include share/Makefile.testing -$(CROWBAR_AFL_TARGET:%=%.cmx): OFLAGS:=$(OFLAGS) -afl-instrument +############################################################################### -include share/Makefile.generic +# Code prettyfication and lint +include share/Makefile.linting ############################################################################### # Local Variables: diff --git a/Makefile.generating b/Makefile.generating deleted file mode 100644 index 993a0603c970f690112f6384ec975db08bdec200..0000000000000000000000000000000000000000 --- a/Makefile.generating +++ /dev/null @@ -1,199 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -ptests/ptests_config.ml: Makefile.generating share/Makefile.config - $(PRINT_MAKING) $@ - $(RM) $@ - $(TOUCH) $@ - $(CHMOD_RO) $@ - -tests/ptests_config: Makefile.generating share/Makefile.config - $(PRINT_MAKING) $@ - $(RM) $@ - $(TOUCH) $@ - $(ECHO) "DEFAULT_SUITES=$(PLUGIN_TESTS_LIST)" >> $@ - $(ECHO) "TOPLEVEL_PATH=$(FRAMAC_ROOT_SRCDIR)/bin/toplevel.$(OCAMLBEST)$(EXE)" >> $@ - $(ECHO) "OCAMLRUNPARAM=" >> $@ - $(ECHO) "FRAMAC_SESSION=$(FRAMAC_ROOT_SRCDIR)" >> $@ - $(ECHO) "FRAMAC_SHARE=$(FRAMAC_ROOT_SRCDIR)/share" >> $@ - $(ECHO) "FRAMAC_PLUGIN=$(FRAMAC_ROOT_SRCDIR)/lib/plugins" >> $@ - $(ECHO) "FRAMAC_PLUGIN_GUI=$(FRAMAC_ROOT_SRCDIR)/lib/plugins/gui" >> $@ - $(ECHO) "FRAMAC_LIB=$(FRAMAC_ROOT_SRCDIR)/lib/fc" >> $@ - $(CHMOD_RO) $@ - -ALL_LIBRARY_NAMES=$(shell ocamlfind query -r -p-format $(LIBRARY_NAMES) $(LIBRARY_NAMES_GUI)) -MAJOR_VERSION=$(shell $(SED) -E 's/^([0-9]+)\..*/\1/' VERSION) -MINOR_VERSION=$(shell $(SED) -E 's/^[0-9]+\.([0-9]+).*/\1/' VERSION) - -$(CONFIG_FILE): $(CONFIG_FILE).in VERSION VERSION_CODENAME share/Makefile.config Makefile.generating configure.in - $(SED) \ - -e "s|@VERSION@|$(VERSION)|" \ - -e "s|@VERSION_CODENAME@|$(VERSION_CODENAME)|" \ - -e "s|@CURR_DATE@|$$(LC_ALL=C date)|" \ - -e "s|@LABLGTK@|$(LABLGTK)|" \ - -e "s|@OCAMLC@|$(OCAMLC)|" \ - -e "s|@OCAMLOPT@|$(OCAMLOPT)|" \ - -e "s|@WARNINGS@|$(WARNINGS)|" \ - -e "s|@FRAMAC_DATADIR@|$(FRAMAC_DATADIR)|" \ - -e "s|@FRAMAC_LIBDIR@|$(FRAMAC_LIBDIR)|" \ - -e "s|@FRAMAC_ROOT_SRCDIR@|$(FRAMAC_ROOT_SRCDIR)|" \ - -e "s|@FRAMAC_PLUGINDIR@|$(FRAMAC_PLUGINDIR)|" \ - -e "s|@FRAMAC_DEFAULT_CPP@|$(FRAMAC_DEFAULT_CPP)|" \ - -e "s|@FRAMAC_DEFAULT_CPP_ARGS@|$(FRAMAC_DEFAULT_CPP_ARGS)|" \ - -e "s|@FRAMAC_GNU_CPP@|$(FRAMAC_GNU_CPP)|" \ - -e "s|@DEFAULT_CPP_KEEP_COMMENTS@|$(DEFAULT_CPP_KEEP_COMMENTS)|" \ - -e "s|@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@|$(DEFAULT_CPP_SUPPORTED_ARCH_OPTS)|" \ - -e "s|@COMPILATION_UNITS@|$(COMPILATION_UNITS)|" \ - -e "s|@LIBRARY_NAMES@|$(foreach p,$(ALL_LIBRARY_NAMES),\"$p\";)|" \ - -e "s|@OPTDOT@|$(OPTDOT)|" \ - -e "s|@EXE@|$(EXE)|" \ - -e "s|@MAJOR_VERSION@|$(MAJOR_VERSION)|" \ - -e "s|@MINOR_VERSION@|$(MINOR_VERSION)|" \ - $< > $@.tmp - @touch -r $@.tmp $< - $(CP_IF_DIFF) $@.tmp $@ - $(RM) $@.tmp - $(CHMOD_RO) $@ - -ifeq ("$(LOCAL_MACHDEP)","yes") - -MACHDEP_PATH=share - -# Create the machine dependency module -# If the cl command cannot be run then the MSVC part will be identical to GCC -.PHONY : machdep $(MACHDEP_PATH)/local_machdep.ml -machdep: $(MACHDEP_PATH)/local_machdep.ml -bin/machdep.exe: machdep - -config.h: - $(PRINT_MAKING) $@ - $(ECHO) "missing config.h file generated at configure stage using --enable-localmachdep option." - exit 1; - -$(MACHDEP_PATH)/local_machdep.ml: \ - $(MACHDEP_PATH)/machdep.c config.h Makefile.generating - $(PRINT_MAKING) $@ - $(RM) $@ - $(ECHO) "(* This module was generated automatically by code in Makefile and machdep.c *)" >$@ -# Now generate the type definition - $(ECHO) "open Cil_types" >> $@ - if $(CC) -D_GNUCC $< -o bin/machdep.exe ;then \ - $(ECHO) "machdep.exe created successfully."; \ - else \ - $(RM) $@; exit 1; \ - fi - $(ECHO) "let gcc = {" >>$@ - ./bin/machdep.exe >>$@ - $(ECHO) " underscore_name = $(UNDERSCORE_NAME) ;" >> $@ - $(ECHO) "}" >>$@ - if cl /D_MSVC $< /Febin/machdep.exe /Fobin/machdep.obj ;then \ - $(ECHO) "let hasMSVC = true" >>$@; \ - else \ - $(ECHO) "let hasMSVC = false" >>$@; \ - fi - $(ECHO) "let msvc = {" >>$@ - ./bin/machdep.exe >>$@ - $(ECHO) " underscore_name = true ;" >> $@ - $(ECHO) "}" >>$@ - $(ECHO) \ - "let gccHas__builtin_va_list = $(HAVE_BUILTIN_VA_LIST)" >>$@ - $(ECHO) \ - "$@ generated. You may have this file merged into Frama-C by developers." - $(CHMOD_RO) $@ - -endif - -# transitioning.ml - -GENERATED+= src/libraries/utils/json.ml src/libraries/stdlib/transitioning.ml - -src/libraries/stdlib/transitioning.ml: \ - src/libraries/stdlib/transitioning.ml.in \ - Makefile.generating share/Makefile.config - $(PRINT_MAKING) $@ - rm -f $@ - cat $< > $@ - $(CHMOD_RO) $@ - -ifeq ($(HAS_DGRAPH),yes) - DGRAPHFILES:=debug_manager - GENERATED+=src/plugins/gui/debug_manager.ml - ifeq ($(HAS_OCAMLGRAPH_2), yes) - DGRAPH_MODULE=Graph_gtk - DGRAPH_ERROR=Graph_gtk.DGraphMake.DotError - else - DGRAPH_MODULE=Dgraph - DGRAPH_ERROR=Dgraph.DGraphModel.DotError - endif - src/plugins/gui/debug_manager.ml \ - src/plugins/gui/dgraph_helper.ml \ - src/plugins/callgraph/cg_viewer.ml: %.ml: %.yes.ml Makefile.generating share/Makefile.config - $(RM) $@ - $(SED) -e 's/DGRAPH_MODULE/$(DGRAPH_MODULE)/g' \ - -e 's/DGRAPH_ERROR/$(DGRAPH_ERROR)/g' $< > $@ - $(CHMOD_RO) $@ -else - DGRAPHFILES:= - src/plugins/gui/dgraph_helper.ml: src/plugins/gui/dgraph_helper.no.ml Makefile.generating share/Makefile.config - $(CP) $< $@ - $(CHMOD_RO) $@ -endif - -# Merlin # - -.PHONY:merlin - -# hack to account for the fact that merlin and ocamlfind treat -# differently dependencies between ppx rewriting. -PPX_DEPENDENCIES=ppx_deriving.eq ppx_import - -#create Merlin file -.merlin merlin: share/Makefile.config Makefile.generating - $(PRINT_MAKING) $@ - echo "FLG -c $(FLAGS) $(FRAMAC_USER_MERLIN_FLAGS)" > .merlin - for PKG in $(filter-out $(PPX_DEPENDENCIES),$(LIBRARY_NAMES)); \ - do echo PKG $$PKG >> .merlin; done - for PKG in $(filter-out $(PPX_DEPENDENCIES),$(LIBRARY_NAMES_GUI)); \ - do echo PKG $$PKG >> .merlin; done - for PKG in \ - $(filter $(LIBRARY_NAMES) $(LIBRARY_NAMES_GUI),$(PPX_DEPENDENCIES)); \ - do echo PKG $$PKG >> .merlin; done - for PKG in $(MERLIN_PACKAGES); do echo PKG $$PKG >> .merlin; done - echo "B lib/plugins" >> .merlin - echo "B lib/plugins/gui" >> .merlin - find src \( -name '.*' -o -name tests -o -name doc -o -name '*.cache' \) -prune \ - -o \( -type d -exec printf "B %s\n" {} \; -exec printf "S %s\n" {} \; \) >> .merlin - -ifeq ("$(DEVELOPMENT)","yes") -all:: .merlin -endif - -lib/fc/META.frama-c: share/META.frama-c share/Makefile.config Makefile.generating - $(MKDIR) lib/fc/ - $(SED) "s/@REQUIRES/$(LIBRARY_NAMES)/" $< > $@ - -GENERATED += lib/fc/META.frama-c - - -# Local Variables: -# mode: makefile -# End: diff --git a/bin/check_newlines.ml b/bin/check_newlines.ml deleted file mode 100644 index 29e3c5a2dadb2f66097b57bb68010435ce1bf968..0000000000000000000000000000000000000000 --- a/bin/check_newlines.ml +++ /dev/null @@ -1,77 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -module StringSet = Set.Make(String) - -(* returns true for empty files *) -let is_last_byte_newline filename = - try - let ic = open_in filename in - try - let fd = Unix.descr_of_in_channel ic in - ignore (Unix.lseek fd (-1) Unix.SEEK_END); - let buf = Bytes.create 1 in - let n_bytes_read = Unix.read fd buf 0 1 in - close_in ic; - n_bytes_read <= 0 || Bytes.get buf 0 = '\n' - with - | Unix.Unix_error _ -> - (* probably an empty file; ignoring *) - close_in ic; - true - with - | Sys_error msg -> - (* possibly a non-existing file (e.g. with spaces); ignoring *) - Format.printf "check_newlines: cannot open, ignoring file: %s (%s)@." - filename msg; - true - -(* usage: first argument is a file name containing a list of files - (one per line) to be checked; the remaining arguments are a list of - files to be ignored during checking - (i.e. they do not terminate with newlines). *) -let () = - if Array.length Sys.argv < 2 then begin - Format.printf "usage: %s file_list.txt [ignore1 ignore2 ...]@." Sys.argv.(0); - exit 0 - end; - let errors = ref 0 in - let file_list_ic = open_in Sys.argv.(1) in - let to_ignore = StringSet.of_list (List.tl (Array.to_list Sys.argv)) in - begin - try - while true; do - let filename = input_line file_list_ic in - if not (StringSet.mem filename to_ignore) && - not (is_last_byte_newline filename) then begin - incr errors; - Format.printf "error: no newline at end of file: %s@." filename - end - done - with End_of_file -> - close_in file_list_ic - end; - if !errors > 0 then begin - Format.printf "Found %d file(s) with errors.@." !errors; - exit 1 - end else - exit 0 diff --git a/bin/dune b/bin/dune new file mode 100644 index 0000000000000000000000000000000000000000..8ede308343c592b5769b58338effeff9fa0b3c78 --- /dev/null +++ b/bin/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(install + (package frama-c) + (section bin) + (files + (frama-c-script as frama-c-script) + (frama-c-config as frama-c-config) + (local_export.sh as local_export.sh) + ) +) diff --git a/bin/frama-c b/bin/frama-c index 98143d9d30a63ad46a2b261d527ba92ce746a4fd..1b2c8e8291c56ec9cab09a6139daf9f63ae86e4a 100755 --- a/bin/frama-c +++ b/bin/frama-c @@ -22,6 +22,4 @@ ########################################################################## -. $(dirname $0)/local_export.sh - -exec $BINDIR/toplevel.opt "$@" +dune exec --root=$(dirname $0)/.. --no-build frama-c -- "$@" diff --git a/bin/frama-c-gui b/bin/frama-c-gui index f4ab55c0a6ae809992806282e8b9abac9df7b900..00e631d11d070bc225471b5342d0d0de2f58e20e 100755 --- a/bin/frama-c-gui +++ b/bin/frama-c-gui @@ -22,6 +22,4 @@ ########################################################################## -. $(dirname $0)/local_export.sh - -exec $BINDIR/viewer.opt "$@" +dune exec --root=$(dirname $0)/.. --no-build frama-c-gui -- "$@" diff --git a/bin/frama-c-script b/bin/frama-c-script index 6036009bc359e077531467acd652f5ad8bbd587e..06e66c5715598ada693958393c75302936577c67 100755 --- a/bin/frama-c-script +++ b/bin/frama-c-script @@ -232,7 +232,7 @@ case "$command" in # to avoid a slow startup, we only load plugins which perform syntactic # transformations. This may trigger annotation errors due to missing # plugins, so we disable those - "${DIR}"/frama-c "$@" -no-autoload-plugins -load-module variadic,instantiate,"${FRAMAC_SHARE}"/analysis-scripts/list_functions.ml -kernel-warn-key annot-error=inactive -kernel-verbose 0; + "${DIR}"/frama-c "$@" -no-autoload-plugins -load-module variadic,instantiate,frama-c.analysis-scripts -kernel-warn-key annot-error=inactive -kernel-verbose 0; ;; "find-fun") shift; diff --git a/bin/init-plugin.sh b/bin/init-plugin.sh new file mode 100755 index 0000000000000000000000000000000000000000..584e8c8f0bb468e7d6b8ff93f9293972fe5d5119 --- /dev/null +++ b/bin/init-plugin.sh @@ -0,0 +1,57 @@ +#! /usr/bin/env bash +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +if [[ $# != 1 && $# != 2 ]]; then + echo "Usage: $0 <plugin-name> [<directory>]" + exit 2 +fi +if [[ $# == 1 ]]; then + directory="." +else + directory=$2 +fi + +if [[ ! -d $directory ]]; then + echo "'$directory': not such file or directory" + exit 17 +fi + +echo "Target directory is '$directory'" + +dune_file=$directory/dune + +if [[ -f $dune_file ]]; then + echo "'$dune_file' file already exists." + exit 17 +fi + +cat > $dune_file <<EOF +( library + (name $1) + (public_name frama-c-$1.core) + (flags -open Frama_c_kernel :standard) + (libraries frama-c.kernel) +) + +(plugin (optional) (name $1) (libraries frama-c-$1.core) (site (frama-c plugins))) +EOF diff --git a/bin/isutf8.ml b/bin/isutf8.ml deleted file mode 100644 index 0e775f13502710afea395fa9aadb2686ca72b40d..0000000000000000000000000000000000000000 --- a/bin/isutf8.ml +++ /dev/null @@ -1,97 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -module StringSet = Set.Make(String) - -exception False - -let is_valid_utf8 filename = - let buf = Bytes.create 1024 in - try - let ic = open_in_bin filename in - let extra = ref 0 in - try - while true do - let n_bytes_read = input ic buf 0 1024 in - if n_bytes_read = 0 then raise End_of_file; - for i = 0 to n_bytes_read - 1 do - let c = Bytes.get_uint8 buf i in - (*Format.printf "extra: %d, read byte: %d (0x%x, char %c)@." - !extra c c (Char.chr c);*) - if !extra > 0 then begin - decr extra; - if c lsr 6 <> 2 then raise False - end - else - if c > 127 then begin - if c lsr 5 = 6 then extra := 1 - else if c lsr 4 = 14 then extra := 2 - else if c lsr 3 = 30 then extra := 3 - else raise False - end; - done; - done; - close_in ic; - !extra = 0 - with - | End_of_file -> - close_in ic; - !extra = 0 - | False -> - close_in ic; - false - with - | Sys_error msg -> - (* possibly a non-existing file (e.g. with spaces); ignoring *) - Format.printf "isutf8: cannot open, ignoring file: %s (%s)@." - filename msg; - true - -(* usage: first argument is a file name containing a list of files - (one per line) to be checked; the remaining arguments are filenames - to be ignored during checking. *) -let () = - if Array.length Sys.argv < 2 then begin - Format.printf "usage: %s file_list.txt [ignore1 ignore2 ...]@." Sys.argv.(0); - exit 0 - end; - let errors = ref 0 in - let file_list_ic = open_in Sys.argv.(1) in - let to_ignore = StringSet.of_list (List.tl (Array.to_list Sys.argv)) in - begin - try - while true; do - let filename = input_line file_list_ic in - if not (StringSet.mem filename to_ignore) - && not (is_valid_utf8 filename) then begin - incr errors; - Format.printf "error: invalid UTF-8 in file: %s@." filename - end - done - with End_of_file -> - close_in file_list_ic - end; - if !errors > 0 then begin - Format.printf "Found %d file(s) with errors.@." !errors; - exit 1 - end else - exit 0 diff --git a/bin/test.sh b/bin/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..a08a3d356c3c02e3929a6f76737e70d60628ee07 --- /dev/null +++ b/bin/test.sh @@ -0,0 +1,348 @@ +#!/bin/bash +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +THIS_SCRIPT="$0" +CONFIG="<all>" +VERBOSE= +UPDATE= +LOGS= +TESTS= +SAVE= + +DUNE_OPT= +DUNE_LOG=./.test-errors.log +CACHEDIR=./.wp-cache +FRAMAC_WP_CACHE_GIT=git@git.frama-c.com:frama-c/wp-cache.git + +# -------------------------------------------------------------------------- +# --- Help Message +# -------------------------------------------------------------------------- + +function Usage +{ + echo "USAGE" + echo "" + echo "${THIS_SCRIPT} [OPTIONS|TESTS]..." + echo "" + echo "TESTS SPECIFICATION" + echo "" + echo " Tip: use shell completion" + echo "" + echo " <DIR> all tests in <DIR>" + echo " <FILE> single test file <FILE>" + echo "" + echo " -a|--all run all tests" + echo " -d|--default run tests from default config only" + echo " -c|--config <name> run tests from specified config only" + echo "" + echo "" + echo "OPTIONS" + echo "" + echo " -r|--clean clean (remove all) test results (includes -p)" + echo " -p|--ptests prepare (all) dune files and pull cache" + echo " -l|--logs print output of tests (single file, no diff)" + echo " -u|--update run tests and update wp-cache" + echo " -s|--save save dune logs into $DUNE_LOG" + echo " -v|--verbose print executed commands" + echo " -h|--help print this help" + echo "" + echo "VARIABLES" + echo "" + echo " FRAMAC_WP_CACHE" + echo " Management mode of wp-cache ($FRAMAC_WP_CACHE)" + echo "" + echo " FRAMAC_WP_QUALIF" + echo " FRAMAC_WP_CACHEDIR" + echo " Location of wp-cache ($FRAMAC_WP_CACHEDIR)" + if [ ! -d $FRAMAC_WP_CACHEDIR ]; then + echo " About to clone from $FRAMAC_WP_CACHE_GIT" + fi + echo " Please, always push to master branch" + echo "" +} + +# -------------------------------------------------------------------------- +# --- Utilities +# -------------------------------------------------------------------------- + +function Head() +{ + echo "# $@" +} + +function Error () +{ + echo "Error: $@" + exit 1 +} + +function ErrorUsage () +{ + echo "Error: $@" + echo "USAGE: ${THIS_SCRIPT} -h" + exit 1 +} + +function Echo() +{ + [ "$VERBOSE" != "yes" ] || echo $@ +} + +function Run +{ + Echo "> $@" + $@ +} + +function Cmd +{ + Run $@ + [ "$?" = "0" ] || Error "(command exits $?): $@" +} + +# -------------------------------------------------------------------------- +# --- WP Cache Environment +# -------------------------------------------------------------------------- + +function SetEnv +{ + if [ "$FRAMAC_WP_CACHE" = "" ]; then + FRAMAC_WP_CACHE=offline + Echo "Set FRAMAC_WP_CACHE=$FRAMAC_WP_CACHE" + fi + + if [ "$FRAMAC_WP_QUALIF" != "" ]; then + FRAMAC_WP_CACHEDIR="$FRAMAC_WP_QUALIF" + Echo "Set FRAMAC_WP_CACHEDIR=$FRAMAC_WP_CACHEDIR" + elif [ "$FRAMAC_WP_CACHEDIR" = "" ]; then + FRAMAC_WP_CACHEDIR="$CACHEDIR" + Echo "Set FRAMAC_WP_CACHEDIR=$FRAMAC_WP_CACHEDIR" + fi + + [ ! -f "$FRAMAC_WP_CACHEDIR" ] || [ -d "$FRAMAC_WP_CACHEDIR" ] \ + || Error "$FRAMAC_WP_CACHEDIR is not a directory" + +} + +function CloneCache +{ + if [ ! -d "$FRAMAC_WP_CACHEDIR" ]; then + Head "Cloning WP cache (from $FRAMAC_WP_CACHE_GIT to $FRAMAC_WP_CACHEDIR)..." + Cmd git clone $FRAMAC_WP_CACHE_GIT $FRAMAC_WP_CACHEDIR + fi +} + +function PullCache +{ + CloneCache + Head "Pull WP cache (to $FRAMAC_WP_CACHEDIR)..." + Run git -C $FRAMAC_WP_CACHEDIR pull --rebase +} + +# -------------------------------------------------------------------------- +# --- Test Dir Alias +# -------------------------------------------------------------------------- + +[ "$DUNE_LOG" = "" ] || rm -rf $DUNE_LOG +function TestAlias +{ + + if [ "$DUNE_LOG" = "" ]; then + Run dune build $DUNE_OPT $@ + elif [ "$SAVE" != "yes" ] && [ "$VERBOSE" != "yes" ]; then + Run dune build $DUNE_OPT $@ + else + # note: the Run function cannot performs redirection + echo "> dune build $DUNE_OPT $@ 2> >(tee -a $DUNE_LOG >&2)" + dune build $DUNE_OPT $@ 2> >(tee -a $DUNE_LOG >&2) + fi +} + +# -------------------------------------------------------------------------- +# --- Test Dir Processing +# -------------------------------------------------------------------------- + +function TestDir +{ + CloneCache + case "$CONFIG" in + "<all>") + ALIAS=$1/ptests + CFG="(all configs)" + ;; + "<default>") + ALIAS=$1/ptests_config + CFG="(default config)" + ;; + *) + ALIAS=$1/ptests_config_$CONFIG + CFG="(config $CONFIG)" + ;; + esac + Head "Running test on directory $1 $CFG" + TestAlias @$ALIAS +} + +# -------------------------------------------------------------------------- +# --- Test File Processing +# -------------------------------------------------------------------------- + +function TestFile +{ + CloneCache + DIR=$(dirname $1) + FILE=$(basename $1) + + case "$CONFIG" in + "<all>"|"<default>") + RESULT=result + CFG="(default config)" + ;; + *) + RESULT=result_$CONFIG + CFG="(config $CONFIG)" + ;; + esac + if [ "$LOGS" = "yes" ]; then + ALIAS=$DIR/$RESULT/$FILE + else + ALIAS=$DIR/$RESULT/${FILE%.*}.wtests + fi + Head "Running test on file $1 $CFG" + TestAlias @$ALIAS +} + +# -------------------------------------------------------------------------- +# --- Tests Processing +# -------------------------------------------------------------------------- + +function RunTests +{ + while [ "$1" != "" ] + do + if [ -d $1 ]; then + TestDir $1 + elif [ -f $1 ]; then + TestFile $1 + else + case $1 in + @*) Head "Running test on alias $1"; TestAlias $1;; + *) ErrorUsage "ERROR: don't known what to do with '$1'";; + esac + fi + shift + done +} + + +# -------------------------------------------------------------------------- +# --- Tests Numbering +# -------------------------------------------------------------------------- + +function Status +{ + #-- Count number of executed tests + if [ "$1" != "" ] && [ -f "$1" ]; then + if [ "$VERBOSE" = "yes" ] ; then + #-- Total + NB=$(grep -c "^frama-c-wtests " "$1") + Head "Number of executed frama-c-wtests= $NB" + #-- Details + Head "Details by directory:" + if [ "$NB" != "0" ]; then + for dir in tests/* src/plugins/*/tests/* ; do + if [ -d "$dir" ]; then + NB=$(grep -c "^frama-c-wtests $dir" "$1") + [ "$NB" = "0" ] || echo "- $dir= $NB" + fi + done + fi + fi + if [ "$SAVE" != "yes" ]; then + Cmd rm -f $1 + fi + fi + + #-- Check wp-cache status + if [ "$UPDATE" = "yes" ]; then + Head "Check $FRAMAC_WP_CACHEDIR status" + git -C $FRAMAC_WP_CACHEDIR status -s + fi +} + +# -------------------------------------------------------------------------- +# --- Command Line Processing +# -------------------------------------------------------------------------- + +SetEnv +while [ "$1" != "" ] +do + case "$1" in + "-h"|"-help"|"--help") + Usage + exit 0 + ;; + "-r"|"--clean") + PullCache + Head "Cleaning all tests..." + Cmd make clean-tests + Head "Generating dune files..." + Cmd make run-ptests + ;; + "-p"|"--ptests") + PullCache + Head "Generating dune files..." + Cmd make run-ptests + ;; + "-u"|"--update") + FRAMAC_WP_CACHE=update + UPDATE=yes + ;; + "-v"|"--verbose") + DUNE_OPT+="--display=short" + VERBOSE=yes + ;; + "-l"|"--logs") + LOGS=yes + ;; + "-s"|"--save" ) + SAVE=yes + ;; + "-d"|"--default") + CONFIG="<default>" + ;; + "-c"|"--config") + CONFIG=$2 + shift + ;; + "-a"|"--all") + TESTS="tests src/plugins/*/tests" + ;; + *) + TESTS+=" $1" + ;; + esac + shift +done +RunTests $TESTS +Status $DUNE_LOG diff --git a/configure.in b/configure.in index f6ddfe547f6e4281cfd848735814f6a6b472cb4e..2962072db6a0a4946ec3ad666de1a7aebc170925 100644 --- a/configure.in +++ b/configure.in @@ -39,10 +39,11 @@ # OCAMLLIB the path to the ocaml standard library # OCAMLVERSION the ocaml version number # OCAMLWIN32 "yes"/"no" depending on Sys.os_type = "Win32" -# EXE ".exe" if OCAMLWIN32=yes, "" otherwise -# DLLEXT ".dll" if OCAMLWIN32=yes, ".so" otherwise +# PLATFORM "Win32", "Cygwin", "MacOS" or "Unix" +# EXE ".exe" if PLATFORM=Win32 (or Cygwin), "" otherwise +# DLLEXT ".dll" if PLATFORM=Win32 (or Cygwin), ".so" otherwise -AC_INIT(src/kernel_internals/runtime/boot.ml) +AC_INIT(src/init/boot/boot.ml) define([FRAMAC_MAIN_AUTOCONF]) m4_include(share/configure.ac) @@ -63,9 +64,10 @@ MAKE_DISTRIB=`sh -c "$MAKE -v | sed -n -e 's/\(.*\) Make.*$/\1/p'"` MAKE_MAJOR=`sh -c "$MAKE -v | sed -n -f bin/sed_get_make_major"` MAKE_MINOR=`sh -c "$MAKE -v | sed -n -f bin/sed_get_make_minor"` AC_MSG_RESULT($MAKE_MAJOR.$MAKE_MINOR) -if test "$MAKE_DISTRIB" != GNU -o "$MAKE_MAJOR" -lt 4 +if test "$MAKE_DISTRIB" != GNU -o "$MAKE_MAJOR" -lt 3 \ + -o "$MAKE_MAJOR" = 3 -a "$MAKE_MINOR" -lt 81 then - AC_MSG_ERROR([unsupported version; GNU Make version 4.0 + AC_MSG_ERROR([unsupported version; GNU Make version 3.81 or higher is required.]); fi @@ -81,21 +83,14 @@ if test "$VERBOSEMAKE" = yes ; then AC_MSG_RESULT(Make will be verbose.) fi -############################################################## -# Check for invalid command-line options and build directory # -############################################################## +########################################## +# Check for invalid command-line options # +########################################## case $prefix in *\ * ) AC_MSG_ERROR(spaces not allowed in --prefix argument "$prefix");; * ) ;; esac -case $(pwd) in - *\ * ) AC_MSG_ERROR(spaces not allowed in build directory "$(pwd)");; - *\'* ) AC_MSG_ERROR(single quotes not allowed in build directory "$(pwd)");; - *\"* ) AC_MSG_ERROR(double quotes not allowed in build directory "$(pwd)");; - * ) ;; -esac - ############################# # Check for Ocaml compilers # ############################# @@ -201,12 +196,11 @@ fi # checking for ocamlfind -AC_CHECK_PROG(OCAMLFIND,ocamlfind,ocamlfind,no) -if test "$OCAMLFIND" != no ; then - OCAMLC="$OCAMLFIND ocamlc" - OCAMLOPT="$OCAMLFIND ocamlopt" +AC_CHECK_PROG(DUNE,dune,dune,no) +if test "$DUNE" != no ; then + true else - AC_MSG_ERROR(Cannot find ocamlfind.) + AC_MSG_ERROR(Cannot find dune.) fi ################################################### @@ -236,202 +230,31 @@ else AC_MSG_NOTICE(Distribution mode: all warnings are deactivated) fi -############################################## -# Check for other mandatory tools/libraries # -############################################## - -new_section "configure mandatory tools and libraries" - -# ocamldep -AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no) -if test "$OCAMLDEP" = no ; then - AC_MSG_ERROR(Cannot find ocamldep.) -else - OCAMLDEP="$OCAMLFIND ocamldep" -fi - -# ocamllex -AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no) -if test "$OCAMLLEX" = no ; then - AC_MSG_ERROR(Cannot find ocamllex.) -else - AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no) - if test "$OCAMLLEXDOTOPT" != no ; then - OCAMLLEX=$OCAMLLEXDOTOPT - fi -fi - -# ocamlyacc -AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no) -if test "$OCAMLYACC" = no ; then - AC_MSG_ERROR(Cannot find ocamlyacc.) -fi - -# ocamlcp -AC_CHECK_PROG(OCAMLCP,ocamlcp,ocamlcp,no) -if test "$OCAMLCP" = no ; then - AC_MSG_ERROR(Cannot find ocamlcp.) -else - OCAMLCP="$OCAMLFIND ocamlcp" -fi - -# ocamlgraph -############ - -AC_MSG_CHECKING(for ocamlgraph) - -OCAMLGRAPH=$($OCAMLFIND query ocamlgraph -format %v) -if test -z "$OCAMLGRAPH" ; then - AC_MSG_ERROR(Cannot find ocamlgraph via ocamlfind \ -(requires ocamlgraph 1.8.5 or higher).) -fi - -AC_SUBST(HAS_OCAMLGRAPH_2) -HAS_OCAMLGRAPH_2=no - -case $OCAMLGRAPH in - 0.* | 1.[[01234567]].* \ - | 1.8.0 | 1.8.0+dev \ - | 1.8.1 | 1.8.1+dev \ - | 1.8.2 | 1.8.2+dev \ - | 1.8.3 | 1.8.3+dev \ - | 1.8.4 | 1.8.4+dev) - AC_MSG_ERROR(found $OCAMLGRAPH: requires 1.8.5 or higher.);; - 1.8.5 | 1.8.6 | 1.8.7|1.8.8) - AC_MSG_RESULT(found);; - 2.0.*) - HAS_OCAMLGRAPH_2=yes - AC_MSG_RESULT(found);; - *) - HAS_OCAMLGRAPH_2=yes - AC_MSG_RESULT(found $OCAMLGRAPH: should work, but is not tested);; -esac - -# zarith -######## - -AC_MSG_CHECKING(for zarith) - -ZARITH=$($OCAMLFIND query zarith -format %v) -if test -z "$ZARITH" ; then - AC_MSG_ERROR(Cannot find zarith via ocamlfind (requires zarith 1.5 or higher).) -fi -case ZARITH in - 1.[[01234]].*) - AC_MSG_ERROR(found $ZARITH: requires 1.5 or higher.);; - *) - AC_MSG_RESULT(found $ZARITH);; -esac - -# yojson -######## - -AC_MSG_CHECKING(for Yojson) - -YOJSON=$($OCAMLFIND query yojson -format %v) -if test -z "$YOJSON" ; then - AC_MSG_ERROR(Cannot find yojson via ocamlfind \ -(requires yojson 1.4.1 or higher).) -else - AC_MSG_RESULT(found $YOJSON) -fi - -# ppx_import -############ - -AC_MSG_CHECKING(for ppx_import) -PPX_IMPORT=$($OCAMLFIND query ppx_import -format %v) -if test -z "$PPX_IMPORT"; then - AC_MSG_ERROR(Cannot find ppx_import via ocamlfind) -else - AC_MSG_RESULT(found $PPX_IMPORT) -fi - -# ppx_deriving.eq -############ - -AC_MSG_CHECKING(for ppx_deriving.eq) -PPX_DERIVING_EQ=$($OCAMLFIND query ppx_deriving.eq -format %v) -if test -z "$PPX_DERIVING_EQ"; then - AC_MSG_ERROR(Cannot find ppx_deriving.eq via ocamlfind) -else - AC_MSG_RESULT(found $PPX_DERIVING_EQ) -fi - -################################################# -# Check for other (optional) tools/libraries # -################################################# - -new_section "configure optional tools and libraries" - -AC_CHECK_PROG(OCAMLDOC,ocamldoc,ocamldoc,no) -if test "$OCAMLDOC" = no ; then - AC_MSG_RESULT(ocamldoc discarded not present) -else - OCAMLDOC="$OCAMLFIND ocamldoc" -fi - -AC_CHECK_PROG(OCAMLMKTOP,ocamlmktop,ocamlmktop,no) -if test "$OCAMLMKTOP" = no ; then - AC_MSG_RESULT(Cannot find ocamlmktop: toplevels cannot be built.) -else - OCAMLMKTOP="$OCAMLFIND ocamlmktop" -fi - -AC_CHECK_PROG(OTAGS,otags,otags,) - -# apron -######## - -AC_MSG_CHECKING(for Apron) - -APRON_PATH=$($OCAMLFIND query apron 2>/dev/null | tr -d '\r\n') -if test -f "$APRON_PATH/apron.$DYN_SUFFIX"; then - HAS_APRON="yes"; - AC_MSG_RESULT(found) -else - HAS_APRON="no"; - AC_MSG_RESULT(not found. The corresponding domains won't be available in Eva) -fi; - -# mpfr -####### - -AC_MSG_CHECKING(for MPFR) - -MPFR_PATH=$($OCAMLFIND query mlmpfr 2>/dev/null | tr -d '\r\n') -if test -f "$MPFR_PATH/mlmpfr.$DYN_SUFFIX"; then - HAS_MPFR="yes"; - AC_MSG_RESULT(found) -else - HAS_MPFR="no"; - AC_MSG_RESULT(not found. The numerors domain won't be available in Eva) -fi; # landmarks (profiling tool, for developers) ######## -AC_ARG_ENABLE( - landmarks, - [ --enable-landmarks enable landmarks profiling (default: yes if package installed)], - ENABLE_LANDMARKS=$enableval, - ENABLE_LANDMARKS=yes) - -if test "$ENABLE_LANDMARKS" = yes ; then - AC_MSG_CHECKING(for Landmarks and Landmarks-ppx) - LANDMARKS_PATH=$($OCAMLFIND query landmarks 2>/dev/null | tr -d '\r\n') - LANDMARKS_PPX_PATH=$($OCAMLFIND query landmarks-ppx 2>/dev/null | tr -d '\r\n') - if test -f "$LANDMARKS_PATH/landmark.$DYN_SUFFIX" -a -f "$LANDMARKS_PPX_PATH/ppx_landmarks.$DYN_SUFFIX"; then - HAS_LANDMARKS="yes"; - AC_MSG_RESULT(found) - else - HAS_LANDMARKS="no"; - AC_MSG_RESULT(not found.) - fi; -else - AC_MSG_RESULT(Landmarks profiling disabled); - HAS_LANDMARKS="no" -fi +dnl AC_ARG_ENABLE( +dnl landmarks, +dnl [ --enable-landmarks enable landmarks profiling (default: yes if package installed)], +dnl ENABLE_LANDMARKS=$enableval, +dnl ENABLE_LANDMARKS=yes) + +dnl if test "$ENABLE_LANDMARKS" = yes ; then +dnl AC_MSG_CHECKING(for Landmarks) +dnl LANDMARKS_PATH=$($OCAMLFIND query landmarks 2>/dev/null | tr -d '\r\n') +dnl LANDMARKS_PPX_PATH=$($OCAMLFIND query landmarks.ppx 2>/dev/null | tr -d '\r\n') +dnl if test -f "$LANDMARKS_PATH/landmark.$DYN_SUFFIX" -a -f "$LANDMARKS_PPX_PATH/ppx_landmarks.$DYN_SUFFIX"; then +dnl HAS_LANDMARKS="yes"; +dnl AC_MSG_RESULT(found) +dnl else +dnl HAS_LANDMARKS="no"; +dnl AC_MSG_RESULT(not found.) +dnl fi; +dnl else +dnl AC_MSG_RESULT(Landmarks profiling disabled); +dnl HAS_LANDMARKS="no" +dnl fi # Python >=3.7 (for analysis-scripts and several tests: compliance, jcdb, ...) ######## @@ -458,8 +281,6 @@ else esac fi -plugin_use_external(tests,python3) - ############ # Platform # ############ @@ -673,7 +494,7 @@ CPPFLAGS="$OLD_CPPFLAGS -m32" AC_PREPROC_IFELSE( [AC_LANG_SOURCE([/* Check if preprocessor supports option -m32 */])], [if test -e conftest.i; then - DEFAULT_CPP_SUPPORTED_ARCH_OPTS="$DEFAULT_CPP_SUPPORTED_ARCH_OPTS "'\"-m32\";'; + DEFAULT_CPP_SUPPORTED_ARCH_OPTS+='\"-m32\"; '; fi], []) rm -f conftest.i @@ -681,7 +502,7 @@ CPPFLAGS="$OLD_CPPFLAGS -m64" AC_PREPROC_IFELSE( [AC_LANG_SOURCE([/* Check if preprocessor supports option -m64 */])], [if test -e conftest.i; then - DEFAULT_CPP_SUPPORTED_ARCH_OPTS="$DEFAULT_CPP_SUPPORTED_ARCH_OPTS "'\"-m64\";'; + DEFAULT_CPP_SUPPORTED_ARCH_OPTS+='\"-m64\"; '; fi], []) rm -f conftest.i @@ -689,351 +510,13 @@ CPPFLAGS="$OLD_CPPFLAGS -m16" AC_PREPROC_IFELSE( [AC_LANG_SOURCE([/* Check if preprocessor supports option -m16 */])], [if test -e conftest.i; then - DEFAULT_CPP_SUPPORTED_ARCH_OPTS="$DEFAULT_CPP_SUPPORTED_ARCH_OPTS "'\"-m16\";'; + DEFAULT_CPP_SUPPORTED_ARCH_OPTS+='\"-m16\"; '; fi], []) # revert CPPFLAGS to original value CPPFLAGS=$OLD_CPPFLAGS -AC_MSG_RESULT(Default preprocessor supported architecture-related options:$DEFAULT_CPP_SUPPORTED_ARCH_OPTS) - - -################# -# Plugin wished # -################# - -new_section "wished frama-c plug-ins" - -# Option -with-no-plugin -####################### - -define([NO_PLUGIN_HELP], - AC_HELP_STRING([--with-no-plugin], - [disable all plug-ins (default: no)])) - -AC_ARG_WITH(no-plugin,NO_PLUGIN_HELP,[ONLY_KERNEL=$withval],[ONLY_KERNEL=no]) - -# library declarations -###################### - -# REQUIRE_LIBRARY: library *must* be present in order to build plugins -# USE_LIBRARY: better for plugins if library is present, but not required -# HAS_LIBRARY: is the library available? - -REQUIRE_LABLGTK= -USE_LABLGTK= -HAS_LABLGTK= - -### Now plugin declarations - -PLUGINS_FORCE_LIST= - -############################################################################### -# # -#################### # -# Plug-in sections # # -#################### # -# # -# For 'internal' developers: # -# Add your own plug-in here # -# # -############################################################################### - -# callgraph -########### - -check_plugin(callgraph, src/plugins/callgraph, - [support for callgraph plugin], yes) - -plugin_use_external(callgraph,dot) -plugin_use(callgraph,gui) -plugin_require(callgraph,eva) - -# constant propagation -###################### - -check_plugin(semantic_constant_folding, src/plugins/constant_propagation, - [support for constant propagation plugin],yes) - -plugin_require(semantic_constant_folding,eva) - -# from -###### - -check_plugin(from_analysis,src/plugins/from,[support for from analysis],yes) - -plugin_require(from_analysis,eva) -plugin_require(from_analysis,callgraph) -plugin_require(from_analysis,postdominators) - -# gui -##### - -check_plugin(gui,src/plugins/gui,[support for gui],yes) - -plugin_require_external(gui,lablgtk) -# in ocamlgraph 2, the gtk part is separated. Hence if we found it, -# there's no need to check specifically for gnomecanvas -if test "$HAS_OCAMLGRAPH_2" = "yes"; then - plugin_use_external(gui,ocaml_ocamlgraph_gtk) -else - plugin_use_external(gui,gnomecanvas) -fi -plugin_require_external(gui,gtksourceview) -plugin_use_external(gui,dot) - -# impact -######## - -check_plugin(impact,src/plugins/impact,[support for impact plugin],yes) - -plugin_use(impact,gui) -plugin_require(impact,slicing) -plugin_require(impact,pdg) -plugin_require(impact,eva) -plugin_require(impact,inout) - -# inout -####### - -check_plugin(inout,src/plugins/inout,[support for inout analysis],yes) -plugin_require(inout,from_analysis) -plugin_require(inout,eva) -plugin_require(inout,callgraph) - -# metrics -######### - -check_plugin(metrics,src/plugins/metrics,[support for metrics analysis],yes) -plugin_require(metrics,server) -plugin_require(metrics,eva) -plugin_use(metrics,gui) - -# occurrence -############ - -check_plugin(occurrence,src/plugins/occurrence, - [support for occurrence analysis],yes) -plugin_use(occurrence,gui) -plugin_require(occurrence,eva) - -# pdg -##### - -check_plugin(pdg,src/plugins/pdg,[support for pdg plugin],yes,pdg_types) -plugin_require(pdg,from_analysis) -plugin_require(pdg,eva) -plugin_require(pdg,callgraph) - -# postdominators -################ - -check_plugin(postdominators,src/plugins/postdominators, - [support for postdominators plugin],yes) -plugin_require(postdominators,eva) - -# reduc -############ - -check_plugin(reduc,src/plugins/reduc,[support for reduc plugin],yes) -plugin_require(reduc,eva) -plugin_require(reduc,inout) - -# rte -##### - -check_plugin(rtegen,src/plugins/rte, - [support for runtime error annotation],yes) - -# scope -############ - -check_plugin(scope,src/plugins/scope,[support for scope plugin],yes) -plugin_require(scope,postdominators) -plugin_require(scope,eva) -plugin_require(scope,from_analysis) -plugin_require(scope,pdg) -plugin_use(scope,gui) - -# slicing -######### - -check_plugin(slicing,src/plugins/slicing,[support for slicing plugin],yes) -plugin_require(slicing,from_analysis) -plugin_require(slicing,pdg) -plugin_require(slicing,eva) -plugin_require(slicing,callgraph) -plugin_require(slicing,sparecode) -plugin_use(slicing,gui) - -# spare code -############ - -check_plugin(sparecode,src/plugins/sparecode, - [support for sparecode plugin],yes) -plugin_require(sparecode,pdg) -plugin_require(sparecode,eva) -plugin_require(sparecode,users) - -# users -####### - -check_plugin(users,src/plugins/users,[support for users analysis],yes) -plugin_require(users,eva) -plugin_require(users,callgraph) - -# value -####### - -check_plugin(eva,src/plugins/value, - [support for value analysis],yes) -plugin_use(eva,gui) -plugin_use(eva,scope) -plugin_use(eva,inout) -plugin_use(eva,callgraph) -plugin_require(eva,server) - -#################### -# External plugins # -#################### - -EXTRA_EXTERNAL_PLUGINS= - -AC_ARG_ENABLE(external, -[[ --enable-external=plugin - allows to compile directly from Frama-C kernel - some external plug-ins.]], -[ - for dir in $enableval; do - if test -d $dir; then - AC_MSG_NOTICE([external plug-in $dir found.]) - EXTRA_EXTERNAL_PLUGINS="$EXTRA_EXTERNAL_PLUGINS $dir" - olddir=$(pwd) - cd $dir; - if test -x ./configure; then - new_section "configure plug-in $dir" - ./configure --prefix=$prefix --datarootdir=$datarootdir \ - --exec_prefix=$exec_prefix --bindir=$bindir --libdir=$datadir/frama-c \ - --host=$host --build=$build --mandir=$mandir \ - || \ - AC_MSG_ERROR([cannot configure requested external plugin in $dir]) - fi; - cd $olddir - else - AC_MSG_ERROR([--enable-external expects an existing directory as argument.]) - fi; - done -]) - -AC_FOREACH([__plugin],m4_esyscmd([ls src/plugins]), - [ m4_if(m4_bregexp(KNOWN_SRC_DIRS,`\<__plugin\>'),[-1], - [ - m4_define([plugin_dir],[src/plugins/__plugin]) - m4_syscmd(test -r plugin_dir/configure.in) - m4_define([is_configure_in],m4_sysval) - m4_syscmd(test -r plugin_dir/configure.ac) - m4_define([is_configure_ac],m4_sysval) - m4_define([config_file], - [m4_if(is_configure_in,0,plugin_dir/configure.in, - m4_if(is_configure_ac,0,plugin_dir/configure.ac,no))]) - m4_if(config_file,[no], - [ m4_syscmd(test -r plugin_dir/Makefile) - m4_if(m4_sysval,[0], - [ m4_syscmd(test "$DISTRIB_CONF" = "yes" && \ - grep -q -e "PLUGIN_DISTRIBUTED *:= *no" \ - plugin_dir/Makefile - ) - m4_if(m4_sysval,[0],, - [ check_plugin(__plugin,plugin_dir, - [support for __plugin plug-in],yes) - if test "$[ENABLE_]tovarname(__plugin)" != "no"; then - EXTERNAL_PLUGINS="$EXTERNAL_PLUGINS plugin_dir"; - fi])])], - [ m4_syscmd(test "$DISTRIB_CONF" = "yes" && \ - grep -q -e "PLUGIN_DISTRIBUTED:=no" \ - plugin_dir/Makefile.in) - m4_if(m4_sysval,[0],, - [ m4_define([plugin_prefix],plugin_dir) - m4_include(config_file) - m4_syscmd(cd plugin_dir && \ - [FRAMAC_SHARE]=../../../share autoconf)]) - ]) - m4_undefine([plugin_dir]) - ]) - ]) - -##################################################### -# Check for tools/libraries requirements of plugins # -##################################################### - -new_section "configure tools and libraries used by some plug-ins" - -# lablgtk2 -########## - -define([ENABLE_LABLGTK3_HELP], - AC_HELP_STRING([--disable-lablgtk3], - [in case lablgtk2 and lablgtk3 are available, the default is to compile - against lablgtk3. Use this option to force compiling against lablgtk2])) - -AC_ARG_ENABLE( - lablgtk3,[ENABLE_LABLGTK3_HELP], - [ENABLE_LABLGTK3=$enableval],[ENABLE_LABLGTK3=yes]) - -REQUIRE_LABLGTK="$REQUIRE_LABLGTK$REQUIRE_GNOMECANVAS" -USE_LABLGTK="$USE_LABLGTK$USE_GNOMECANVAS" - -LABLGTK_PATH="" -SOURCEVIEW_PATH="" - -if test "$PLATFORM" != "MacOS"; then -if test "$ENABLE_LABLGTK3" = "yes"; then - LABLGTK_PATH=`ocamlfind query lablgtk3 | tr -d '\\r\\n'`; -fi -if test "$LABLGTK_PATH" != ""; then - SOURCEVIEW_PATH=`ocamlfind query lablgtk3-sourceview3 | tr -d '\\r\\n'`; -fi -fi - -if test "$SOURCEVIEW_PATH" = ""; then - LABLGTK_VERSION=2 - LABLGTK_PATH=`ocamlfind query lablgtk2 | tr -d '\\r\\n'` - if test "$LABLGTK_PATH" = "" -o \ - "$LABLGTK_PATH" -ef "$OCAMLLIB/lablgtk2" ; then - echo "Ocamlfind -> using +lablgtk2.($LABLGTK_PATH,$OCAMLLIB/lablgtk2)" - LABLGTK_PATH=+lablgtk2 - LABLGTKPATH_FOR_CONFIGURE=$OCAMLLIB/lablgtk2 - else - echo "Ocamlfind -> using $LABLGTK_PATH" - LABLGTKPATH_FOR_CONFIGURE=$LABLGTK_PATH - fi; - SOURCEVIEW_PATH=$LABLGTKPATH_FOR_CONFIGURE; -else - LABLGTK_VERSION=3 - echo "ocamlfind -> using $LABLGTK_PATH" - LABLGTKPATH_FOR_CONFIGURE=$LABLGTK_PATH; -fi - -configure_library([GTKSOURCEVIEW], - [$SOURCEVIEW_PATH/lablgtksourceview2.$LIB_SUFFIX, - $SOURCEVIEW_PATH/lablgtk3_sourceview3.$LIB_SUFFIX], - [lablgtksourceview not found], - no) - -configure_library([GNOMECANVAS], - [$LABLGTKPATH_FOR_CONFIGURE/lablgnomecanvas.$LIB_SUFFIX], - [lablgnomecanvas.$LIB_SUFFIX not found], - no) - -configure_library([LABLGTK], - [$LABLGTKPATH_FOR_CONFIGURE/lablgtk.$LIB_SUFFIX, - $LABLGTKPATH_FOR_CONFIGURE/lablgtk3.$LIB_SUFFIX], - [$LABLGTKPATH_FOR_CONFIGURE/lablgtk.$LIB_SUFFIX not found.], - no) - -if test "$HAS_OCAMLGRAPH_2" = yes; then - configure_pkg([ocamlgraph_gtk],[package ocamlgraph_gtk not found]) -fi +AC_MSG_RESULT(Default preprocessor supported architecture-related options: $DEFAULT_CPP_SUPPORTED_ARCH_OPTS) # dot and xdot tools #################### @@ -1041,32 +524,14 @@ fi configure_tool([DOT],[dot],[dot not found: you should install GraphViz],no) configure_tool([UNIX2DOS],[unix2dos], - [unix2dos not found: you should install dos2unix],no) + [unix2dos not found: you should install tofrodos],no) plugin_use_external(tests,unix2dos) -######################## -# Plug-in dependencies # -######################## - -new_section "checking for plug-in dependencies" - -check_frama_c_dependencies - -AC_SUBST(HAS_DGRAPH) -if test "$HAS_OCAMLGRAPH_2" = "yes"; then - HAS_DGRAPH=$HAS_OCAML_OCAMLGRAPH_GTK; -else - HAS_DGRAPH=$HAS_GNOMECANVAS -fi - ############################ # Substitutions to perform # ############################ -EXTERNAL_PLUGINS="${EXTERNAL_PLUGINS} ${EXTRA_EXTERNAL_PLUGINS}" - -AC_SUBST(PLATFORM) AC_SUBST(VERBOSEMAKE) AC_SUBST(DEVELOPMENT) AC_SUBST(HAS_APRON) @@ -1097,15 +562,10 @@ AC_SUBST(FRAMAC_GNU_CPP) AC_SUBST(DEFAULT_CPP_KEEP_COMMENTS) AC_SUBST(CC) -AC_SUBST(EXTERNAL_PLUGINS) - AC_SUBST(LABLGTK_PATH) -# m4_foreach_w is not supported in some old autoconf versions. -# Sadly AC_FOREACH is deprecated now... -AC_FOREACH([p],PLUGINS_LIST, - [AC_SUBST([ENABLE_]p) - ]) +# used by some share/Makefile.xxx +AC_SUBST(PLATFORM) ################################################ # Finally create the Makefile from Makefile.in # @@ -1118,25 +578,48 @@ AC_CONFIG_FILES([share/Makefile.config], [chmod a-w share/Makefile.config]) AC_OUTPUT() ########### -# Summary # +# Plugins # ########### -new_section "summary: plug-ins available" +rm -f src/plugins/.disabled +rm -f src/plugins/dune + +m4_foreach_w([__plugin],m4_esyscmd([ls src/plugins]), + [ + m4_define([plugin_dir],[src/plugins/__plugin]) + m4_syscmd(test -d plugin_dir) + m4_define([is_plugin],m4_sysval) + m4_if(is_plugin,0,[ + AC_ARG_ENABLE( + __plugin, + AC_HELP_STRING([--disable-__plugin], [Disable __plugin]), + [ENABLE___plugin=$enableval], + [ENABLE___plugin=yes] + ) + if test "$ENABLE___plugin" = no ; then + echo "__plugin" >> src/plugins/.disabled + fi + ],) + ]) -for plugin in m4_flatten(PLUGINS_LIST); do - n=NAME_$plugin - e=ENABLE_$plugin - i=INFO_$plugin - eval nv=\$$n - eval ev=\$$e - eval iv=\$$i - AC_MSG_NOTICE([$nv: $ev$iv]) -done - -if test "$EXTRA_EXTERNAL_PLUGINS" != ""; then - new_section "summary: requested external plugins" +if test -f src/plugins/.disabled ; then + echo ";; File generated by ./configure --disable-<PLUGIN>" > src/plugins/dune + echo "(include_subdirs no)" >> src/plugins/dune + echo ";; Disabled plugin list:" >> src/plugins/dune + echo "(data_only_dirs $(cat src/plugins/.disabled))" >> src/plugins/dune + cat src/plugins/.disabled | sed -n -e 's|^\(.*\)$|(rule (alias "frama-c-configure") (deps (universe)) (action (echo "Disabled plug-in: src/plugins/\1\n")))|p' >> src/plugins/dune + echo ";; Test" >> src/plugins/dune + echo "(alias (name ptests) (deps (alias ptests_config)))" >> src/plugins/dune +# "sed -n" is the posix version of "sed --quiet" + cat src/plugins/.disabled | sed -n -e 's|^\(.*\)$|(rule (alias "ptests_config") (deps (universe)) (action (echo "Testing with disabled plug-in: src/plugins/\1\n")))|p' >> src/plugins/dune + chmod a-w src/plugins/dune + rm src/plugins/.disabled fi -for plugin in $EXTRA_EXTERNAL_PLUGINS; do - AC_MSG_NOTICE([$plugin]) -done +########### +# Summary # +########### + +new_section "summary: plug-ins available" + +$DUNE build -j1 --display quiet @frama-c-configure diff --git a/default.nix b/default.nix deleted file mode 100644 index e64150378a86d1a128776f31ba1f5912ea77af15..0000000000000000000000000000000000000000 --- a/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -# standalone derivation, for nix-build, nix-shell, etc -{ pkgs ? import <nixpkgs> {} }: -let - src = builtins.fetchGit { - "url" = ./.git; - "name" = "frama-c"; - "rev" = "ffa925f404779a3a0c4aacff5bd78b1c502def11"; - "ref" = "test-nix-fetchGit"; - }; - in - -pkgs.callPackage ./nix/default.nix { - opam2nix = pkgs.callPackage ../Frama-CI/opam2nix-packages.nix {}; - src = src; -} diff --git a/devel_tools/docker/.gitignore b/dev/docker/.gitignore similarity index 100% rename from devel_tools/docker/.gitignore rename to dev/docker/.gitignore diff --git a/devel_tools/docker/Dockerfile.template b/dev/docker/Dockerfile.template similarity index 100% rename from devel_tools/docker/Dockerfile.template rename to dev/docker/Dockerfile.template diff --git a/devel_tools/docker/Makefile b/dev/docker/Makefile similarity index 100% rename from devel_tools/docker/Makefile rename to dev/docker/Makefile diff --git a/devel_tools/docker/README.md b/dev/docker/README.md similarity index 100% rename from devel_tools/docker/README.md rename to dev/docker/README.md diff --git a/devel_tools/docker/cvc4.template b/dev/docker/cvc4.template similarity index 100% rename from devel_tools/docker/cvc4.template rename to dev/docker/cvc4.template diff --git a/devel_tools/docker/env.template b/dev/docker/env.template similarity index 100% rename from devel_tools/docker/env.template rename to dev/docker/env.template diff --git a/devel_tools/docker/z3.template b/dev/docker/z3.template similarity index 100% rename from devel_tools/docker/z3.template rename to dev/docker/z3.template diff --git a/devel_tools/duplicates.pl b/dev/duplicates.pl similarity index 100% rename from devel_tools/duplicates.pl rename to dev/duplicates.pl diff --git a/devel_tools/frama-c-callgrind.sh b/dev/frama-c-callgrind.sh similarity index 100% rename from devel_tools/frama-c-callgrind.sh rename to dev/frama-c-callgrind.sh diff --git a/devel_tools/git-hooks/pre-commit b/dev/git-hooks/pre-commit similarity index 100% rename from devel_tools/git-hooks/pre-commit rename to dev/git-hooks/pre-commit diff --git a/dev/make-distrib.sh b/dev/make-distrib.sh new file mode 100755 index 0000000000000000000000000000000000000000..42fd20c928281ba7783b3402931c194cd21c3a07 --- /dev/null +++ b/dev/make-distrib.sh @@ -0,0 +1,134 @@ +#!/usr/bin/env bash +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +set -euxo pipefail + +if [ ! -f configure ] ; then + echo "No 'configure' file, you should first run 'autoconf'" + exit 2 +fi + +################################################################################ +# Configuration + +if [ -z ${OPEN_SOURCE+x} ]; then + echo "OPEN_SOURCE variable not set, defaults to 'no'" + OPEN_SOURCE="no" +fi + +if [ -z ${HDRCK+x} ]; then + HDRCK="dune exec -- frama-c-hdrck" +fi + +if [ -z ${VERSION+x} ]; then + VERSION=$(cat VERSION | sed "s,~,-,") +fi + +if [ -z ${VERSION_CODENAME+x} ]; then + VERSION_CODENAME=$(cat VERSION_CODENAME) +fi + +if [ -z ${CI_LINK+x} ]; then + CI_LINK="no" +fi + +FRAMAC="frama-c-$VERSION-$VERSION_CODENAME" +FRAMAC_TAR="$FRAMAC.tar" + +################################################################################ +# Prepare archive + + +git archive HEAD -o $FRAMAC_TAR --prefix "$FRAMAC/" + +TAR_ACC=$FRAMAC_TAR + +EXTERNAL_PLUGINS=$(find src/plugins -type d -name ".git" | sed "s/\/.git//") + +for plugin in $EXTERNAL_PLUGINS ; do + TAR="$(basename $plugin).tar" + git -C $plugin archive HEAD -o $TAR --prefix "$FRAMAC/$plugin/" + TAR_ACC="$TAR_ACC $plugin/$TAR" +done + +tar --concatenate --file=$TAR_ACC +tar rf $FRAMAC_TAR configure --transform "s,^,$FRAMAC/," + +################################################################################ +# Prepare header options + +if [[ "$OPEN_SOURCE" == "yes" ]]; then + HEADER_KIND="open-source" + HEADER_OPT= +else + HEADER_KIND="close-source" + HEADER_OPT="-update" +fi + +################################################################################ +# Prepare header spec + +HEADER_SPEC="header-spec.txt" +git ls-files -z | git check-attr --stdin -z header_spec > $HEADER_SPEC + +HEADER_DIRS="-header-dirs headers/$HEADER_KIND" + +for plugin in $EXTERNAL_PLUGINS ; do + git -C $plugin ls-files -z |\ + git -C $plugin check-attr --stdin -z header_spec |\ + xargs --null -n3 printf "$plugin/%s\n%s\n%s\n" |\ + tr '\n' '\0' >> $HEADER_SPEC +done + +PLUGINS=$(find src/plugins -type d -mindepth 1 -maxdepth 1) + +for plugin in $PLUGINS ; do + HEADER_DIRS="$HEADER_DIRS -header-dirs $plugin/headers/$HEADER_KIND" +done + +################################################################################ +# Headers + +TMP_DIR=$(mktemp -d) +echo $TMP_DIR +tar xf $FRAMAC_TAR -C $TMP_DIR + +$HDRCK $HEADER_OPT $HEADER_DIRS -spec-format="3-zeros" -C "$TMP_DIR/$FRAMAC" $HEADER_SPEC +echo $VERSION > $TMP_DIR/$FRAMAC/VERSION +echo $VERSION_CODENAME > $TMP_DIR/$FRAMAC/VERSION_CODENAME + +################################################################################ +# Finalize archive + +tar czf $FRAMAC_TAR.gz -C $TMP_DIR $FRAMAC + +if [[ "$CI_LINK" == "yes" ]]; then + ln $FRAMAC_TAR.gz "frama-c.tar.gz" +fi + +################################################################################ +# Cleaning + +rm -rf $HEADER_SPEC +rm -rf $TAR_ACC +rm -rf $TMP_DIR diff --git a/devel_tools/ocamldep_transitive_closure.ml b/dev/ocamldep_transitive_closure.ml similarity index 100% rename from devel_tools/ocamldep_transitive_closure.ml rename to dev/ocamldep_transitive_closure.ml diff --git a/devel_tools/size.ml b/dev/size.ml similarity index 100% rename from devel_tools/size.ml rename to dev/size.ml diff --git a/devel_tools/size.mli b/dev/size.mli similarity index 100% rename from devel_tools/size.mli rename to dev/size.mli diff --git a/devel_tools/size_states.ml b/dev/size_states.ml similarity index 100% rename from devel_tools/size_states.ml rename to dev/size_states.ml diff --git a/doc/Makefile b/doc/Makefile index 4b044f7e004e72299549576b10b26ce1aab5935a..929dc0b7326ee3dbce28aea9f87a5e570ac21d15 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -81,7 +81,9 @@ endif # Generation # ################### -FC_SUFFIX=$(VERSION_SAFE)-$(VERSION_CODENAME) +ifneq ($(NO_SUFFIX),yes) +FC_SUFFIX=-$(VERSION_SAFE)-$(VERSION_CODENAME) +endif clean:: $(RM) manuals/*.pdf @@ -95,35 +97,35 @@ clean:: $(MAKE) -C ../src/plugins/wp/doc/manual clean all: \ - manuals/user-manual-$(FC_SUFFIX).pdf \ - manuals/plugin-development-guide-$(FC_SUFFIX).pdf \ - manuals/rte-manual-$(FC_SUFFIX).pdf \ - manuals/aorai-manual-$(FC_SUFFIX).pdf \ - manuals/aorai-example-$(FC_SUFFIX).tgz \ - manuals/eva-manual-$(FC_SUFFIX).pdf \ - manuals/metrics-manual-$(FC_SUFFIX).pdf \ - manuals/wp-manual-$(FC_SUFFIX).pdf \ + manuals/user-manual$(FC_SUFFIX).pdf \ + manuals/plugin-development-guide$(FC_SUFFIX).pdf \ + manuals/rte-manual$(FC_SUFFIX).pdf \ + manuals/aorai-manual$(FC_SUFFIX).pdf \ + manuals/aorai-example$(FC_SUFFIX).tgz \ + manuals/eva-manual$(FC_SUFFIX).pdf \ + manuals/metrics-manual$(FC_SUFFIX).pdf \ + manuals/wp-manual$(FC_SUFFIX).pdf \ manuals/%: mkdir --parent manuals $(CP) $< $@ -%.pdf: +%.pdf: $(PRINT) Generating $@ $(MAKE) -C $(@D) $(@F) -%.tgz: +%.tgz: $(PRINT) Generating $@ $(MAKE) -C $(@D) $(@F) -manuals/user-manual-$(FC_SUFFIX).pdf: userman/userman.pdf -manuals/plugin-development-guide-$(FC_SUFFIX).pdf: developer/developer.pdf -manuals/rte-manual-$(FC_SUFFIX).pdf: rte/main.pdf -manuals/aorai-manual-$(FC_SUFFIX).pdf: aorai/main.pdf -manuals/aorai-example-$(FC_SUFFIX).tgz: aorai/aorai-example.tgz -manuals/eva-manual-$(FC_SUFFIX).pdf: value/main.pdf -manuals/metrics-manual-$(FC_SUFFIX).pdf: metrics/metrics.pdf -manuals/wp-manual-$(FC_SUFFIX).pdf: ../src/plugins/wp/doc/manual/wp.pdf +manuals/user-manual$(FC_SUFFIX).pdf: userman/userman.pdf +manuals/plugin-development-guide$(FC_SUFFIX).pdf: developer/developer.pdf +manuals/rte-manual$(FC_SUFFIX).pdf: rte/main.pdf +manuals/aorai-manual$(FC_SUFFIX).pdf: aorai/main.pdf +manuals/aorai-example$(FC_SUFFIX).tgz: aorai/aorai-example.tgz +manuals/eva-manual$(FC_SUFFIX).pdf: value/main.pdf +manuals/metrics-manual$(FC_SUFFIX).pdf: metrics/metrics.pdf +manuals/wp-manual$(FC_SUFFIX).pdf: ../src/plugins/wp/doc/manual/wp.pdf ################### @@ -137,17 +139,20 @@ $(info 'acsl' not in doc; try: git clone https://github.com/acsl-language/acsl.g else -ACSL_SUFFIX=$(shell grep acslversion acsl/version.tex | sed 's/.*{\([^{}\\]*\).*/\1/') +ACSL_VERSION=$(shell grep acslversion acsl/version.tex | sed 's/.*{\([^{}\\]*\).*/\1/') +ifneq ($(NO_SUFFIX),yes) +ACSL_SUFFIX=-$(ACSL_VERSION) +endif clean:: $(MAKE) -C acsl super-clean all: \ - manuals/acsl-implementation-$(FC_SUFFIX).pdf \ - manuals/acsl-$(ACSL_SUFFIX).pdf \ + manuals/acsl-implementation$(FC_SUFFIX).pdf \ + manuals/acsl$(ACSL_SUFFIX).pdf \ -manuals/acsl-implementation-$(FC_SUFFIX).pdf: acsl/acsl-implementation.pdf -manuals/acsl-$(ACSL_SUFFIX).pdf: acsl/acsl.pdf +manuals/acsl-implementation$(FC_SUFFIX).pdf: acsl/acsl-implementation.pdf +manuals/acsl$(ACSL_SUFFIX).pdf: acsl/acsl.pdf ################### @@ -155,17 +160,21 @@ manuals/acsl-$(ACSL_SUFFIX).pdf: acsl/acsl.pdf ################### EACSL_DOC=../src/plugins/e-acsl/doc -EACSL_SUFFIX=$(shell grep 'newcommand{\\eacsllangversion' $(EACSL_DOC)/refman/main.tex | sed 's/.*{\([^{}\\]*\).*/\1/') +EACSL_VERSION=$(shell grep 'newcommand{\\eacsllangversion' $(EACSL_DOC)/refman/main.tex | sed 's/.*{\([^{}\\]*\).*/\1/') -ifeq ($(EACSL_SUFFIX),) +ifeq ($(EACSL_VERSION),) $(info "could not retrieve E-ACSL version from ../src/plugins/e-acsl/doc/refman/main.tex") else +ifneq ($(NO_SUFFIX),yes) +EACSL_SUFFIX:=-$(EACSL_VERSION) +endif + # Sanity check: version differences between Frama-C, and E-ACSL -ifneq ($(ACSL_SUFFIX),$(EACSL_SUFFIX)) - $(info WARNING: different versions for ACSL and E-ACSL manuals: $(ACSL_SUFFIX) versus $(EACSL_SUFFIX)) +ifneq ($(ACSL_VERSION),$(EACSL_VERSION)) + $(info WARNING: different versions for ACSL and E-ACSL manuals: $(ACSL_VERSION) versus $(EACSL_VERSION)) endif clean:: @@ -173,13 +182,13 @@ clean:: $(MAKE) -C $(EACSL_DOC)/userman/ super-clean all: \ - manuals/e-acsl-implementation-$(FC_SUFFIX).pdf \ - manuals/e-acsl-manual-$(FC_SUFFIX).pdf \ - manuals/e-acsl-$(EACSL_SUFFIX).pdf \ + manuals/e-acsl-implementation$(FC_SUFFIX).pdf \ + manuals/e-acsl-manual$(FC_SUFFIX).pdf \ + manuals/e-acsl$(EACSL_SUFFIX).pdf \ -manuals/e-acsl-implementation-$(FC_SUFFIX).pdf: $(EACSL_DOC)/refman/e-acsl-implementation.pdf -manuals/e-acsl-manual-$(FC_SUFFIX).pdf: $(EACSL_DOC)/userman/main.pdf -manuals/e-acsl-$(EACSL_SUFFIX).pdf: $(EACSL_DOC)/refman/e-acsl.pdf +manuals/e-acsl-implementation$(FC_SUFFIX).pdf: $(EACSL_DOC)/refman/e-acsl-implementation.pdf +manuals/e-acsl-manual$(FC_SUFFIX).pdf: $(EACSL_DOC)/userman/main.pdf +manuals/e-acsl$(EACSL_SUFFIX).pdf: $(EACSL_DOC)/refman/e-acsl.pdf endif diff --git a/doc/aorai/.gitignore b/doc/aorai/.gitignore index 0682bf3d785b90f19aeba9598ca8f66b38edfa39..9d46210208788af111b4d814e94995b7f34a0559 100644 --- a/doc/aorai/.gitignore +++ b/doc/aorai/.gitignore @@ -1 +1 @@ -/transf +/transf.cm* diff --git a/doc/developer/Makefile b/doc/developer/Makefile index a3280d9bb37a8f96b9900f40cb0394b05d9d0209..038b9f387e886d4aa739a0beb7c83ec5413ac68e 100644 --- a/doc/developer/Makefile +++ b/doc/developer/Makefile @@ -41,7 +41,7 @@ DEPENDENCIES= $(FRAMAC_MODERN) $(GENERATED) frama-c-book.cls .PHONY: all check -all: developer.pdf check +all: developer.pdf # check << restore check later FC_BINDIR:=$(FRAMAC_ROOT_SRCDIR)/bin @@ -84,7 +84,7 @@ check: $(GENERATED) PATH=$(FC_BINDIR):$$PATH; $(MAKE) DEVELOPMENT=no PTESTS_OPTS=-error-code -C tutorial/viewcfg/generated/split opt $(MAKE) clean-tuto -check-all: developer.pdf +check-all: developer.pdf $(MAKE) -C ../.. check-devguide include ../MakeLaTeXModern @@ -117,10 +117,6 @@ archives: tutorial/hello/generated ########### -include $(MAKECONFIG_DIR)/Makefile.generic - -########### - clean: rm -f *.aux *~ *.log *.blg *.bbl *.toc *.lof *.idx *.ilg *.ind rm -rf _whizzy* *.raux *.wdvi *.out diff --git a/doc/developer/advance.tex b/doc/developer/advance.tex index c0d0a4da0a26a1d07df3584e85b7f16a930d3b9a..06ce6817dd38bcb5fd4dd82734776275bc1d86a0 100644 --- a/doc/developer/advance.tex +++ b/doc/developer/advance.tex @@ -3199,8 +3199,7 @@ their execution order. \begin{enumerate}[(a)] \item the command line options registered for the \texttt{Cmdline.Extending}\sscodeidxdef{Cmdline}{stage}{Extending} stage - are treated, such as \texttt{-load-script} and - \texttt{-add-path}; + are treated, such as \texttt{-load-script} \item the hooks registered through \texttt{Cmdline.run\_during\_extending\_stage} diff --git a/dune b/dune new file mode 100644 index 0000000000000000000000000000000000000000..8a20f109b8dfb2519252444963f97cc385f095f8 --- /dev/null +++ b/dune @@ -0,0 +1,23 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(dirs src tools tests headers share bin) diff --git a/dune-project b/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..acebea6b4983d92807c188bcd83d32ef624b4e98 --- /dev/null +++ b/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(using dune_site 0.1) +(package (name frama-c) (sites (share share) (lib plugins) (lib plugins_gui))) diff --git a/headers/dune b/headers/dune new file mode 100644 index 0000000000000000000000000000000000000000..6f261cf6c77f34f52070c1a375cd5d568ec3ce41 --- /dev/null +++ b/headers/dune @@ -0,0 +1,26 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(install + (package frama-c) + (section (site (frama-c share))) + (files (headache_config.txt as headache_config.txt))) diff --git a/headers/headache_config.txt b/headers/headache_config.txt index b49598cd666657116586a3a7d7ba105063c9798a..3c6299eab995ebeece9333b5329894ca69435b4c 100644 --- a/headers/headache_config.txt +++ b/headers/headache_config.txt @@ -53,6 +53,13 @@ | ".*config\.h\.in" -> frame open:"/*" line:"*" close:"*/" | ".*configure\..*" -> frame open:"#" line:"#" close:"#" +######## +# Dune # +######## +| "dune-project" -> frame open:";;" line:";" close:";;" +| ".*dune-project" -> skip match:"(lang.*" +| "dune" -> frame open:";;" line:";" close:";;" + ############ # Makefile # ############ @@ -152,6 +159,7 @@ ######### | ".*\.tex" -> frame open: "%" line: "%" close: "%" | ".*\.sty" -> frame open: "%" line: "%" close: "%" +| ".*\.bib" -> frame open: "%" line: "%" close: "%" ######## # HTML # diff --git a/headers/header_spec.txt b/headers/header_spec.txt deleted file mode 100644 index 931de3888232116966c0b42fc6324b86c419fa68..0000000000000000000000000000000000000000 --- a/headers/header_spec.txt +++ /dev/null @@ -1,1957 +0,0 @@ -.force-reconfigure: .ignore -.gitattributes: .ignore -.gitignore: .ignore -.gitlab-ci.yml: .ignore -.mailmap: .ignore -.make-clean: .ignore -.make-clean-stamp: .ignore -ALL_VERSIONS: .ignore -Changelog: .ignore -Changelog_detailed.md: .ignore -INSTALL.md: .ignore -Makefile: CEA_LGPL -Makefile.generating: CEA_LGPL -README.md: .ignore -VERSION: .ignore -VERSION_CODENAME: .ignore -bin/.gitignore: .ignore -bin/build-src-distrib.sh: CEA_LGPL -bin/frama-c: CEA_LGPL -bin/frama-c-config: CEA_LGPL -bin/frama-c-script: CEA_LGPL -bin/frama-c-gui: CEA_LGPL -bin/frama-c-gui.byte: CEA_LGPL -bin/frama-c.byte: CEA_LGPL -bin/frama-c.debug: CEA_LGPL -bin/frama-c.top: CEA_LGPL -bin/local_export.sh: CEA_LGPL -bin/migration_scripts/aluminium2silicon.sh: CEA_LGPL -bin/migration_scripts/boron2carbon.sh: CEA_LGPL -bin/migration_scripts/calcium2scandium.sh: CEA_LGPL -bin/migration_scripts/carbon2nitrogen.sh: CEA_LGPL -bin/migration_scripts/chlorine2argon.sh: CEA_LGPL -bin/migration_scripts/chromium2manganese.sh: CEA_LGPL -bin/migration_scripts/fluorine2neon.sh: CEA_LGPL -bin/migration_scripts/lithium2beryllium.sh: CEA_LGPL -bin/migration_scripts/magnesium2aluminium.sh: CEA_LGPL -bin/migration_scripts/neon2sodium.sh: CEA_LGPL -bin/migration_scripts/nitrogen2oxygen.sh: CEA_LGPL -bin/migration_scripts/oxygen2fluorine.sh: CEA_LGPL -bin/migration_scripts/phosphorus2sulfur.sh: CEA_LGPL -bin/migration_scripts/potassium2calcium.sh: CEA_LGPL -bin/migration_scripts/silicon2phosphorus.sh: CEA_LGPL -bin/migration_scripts/sodium2magnesium.sh: CEA_LGPL -bin/migration_scripts/sulfur2chlorine.sh: CEA_LGPL -bin/migration_scripts/titanium2vanadium.sh: CEA_LGPL -bin/migration_scripts/vanadium2chromium.sh: CEA_LGPL -bin/sed_get_binutils_version: .ignore -bin/sed_get_make_major: .ignore -bin/sed_get_make_minor: .ignore -config.h.in: CEA_LGPL -configure.in: CEA_INRIA_LGPL -devel_tools/size.ml: .ignore -devel_tools/size.mli: .ignore -doc/Makefile: CEA_LGPL -doc/README: .ignore -doc/code/docgen.ml: CEA_LGPL -doc/code/intro_kernel_plugin.txt: CEA_LGPL -doc/code/intro_occurrence.txt: CEA_LGPL -doc/code/intro_pdg.txt: CEA_LGPL -doc/code/intro_plugin.txt: CEA_LGPL -doc/code/intro_plugin_D_and_S.txt: CEA_LGPL -doc/code/intro_plugin_default.txt: CEA_LGPL -doc/code/intro_scope.txt: CEA_LGPL -doc/code/intro_slicing.txt: CEA_LGPL -doc/code/intro_sparecode.txt: CEA_LGPL -doc/code/style.css: CEA_LGPL -doc/code/toc_head.htm: CEA_LGPL -doc/code/toc_tail.htm: CEA_LGPL -headers/close-source/AORAI_LGPL: .ignore -headers/close-source/CEA_INRIA_LGPL: .ignore -headers/close-source/CEA_LGPL: .ignore -headers/close-source/CEA_LGPL_OR_PROPRIETARY: .ignore -headers/close-source/CEA_PROPRIETARY: .ignore -headers/close-source/CEA_PR_LGPL: .ignore -headers/close-source/CEA_WP: .ignore -headers/close-source/CIL: .ignore -headers/close-source/INRIA_BSD: .ignore -headers/close-source/INRIA_LGPL: .ignore -headers/close-source/INSA_INRIA_LGPL: .ignore -headers/close-source/MODIFIED_MENHIR: .ignore -headers/close-source/MODIFIED_OCAMLGRAPH: .ignore -headers/close-source/MODIFIED_WHY3: .ignore -headers/close-source/OCAML_STDLIB: .ignore -headers/close-source/UNMODIFIED_WHY3: .ignore -headers/headache_config.txt: CEA_LGPL -headers/header_spec.txt: .ignore -headers/open-source/AORAI_LGPL: .ignore -headers/open-source/CEA_INRIA_LGPL: .ignore -headers/open-source/CEA_LGPL: .ignore -headers/open-source/CEA_LGPL_OR_PROPRIETARY: .ignore -headers/open-source/CEA_PROPRIETARY: .ignore -headers/open-source/CEA_PR_LGPL: .ignore -headers/open-source/CEA_WP: .ignore -headers/open-source/CIL: .ignore -headers/open-source/INRIA_BSD: .ignore -headers/open-source/INRIA_LGPL: .ignore -headers/open-source/INSA_INRIA_LGPL: .ignore -headers/open-source/MODIFIED_MENHIR: .ignore -headers/open-source/MODIFIED_OCAMLGRAPH: .ignore -headers/open-source/MODIFIED_WHY3: .ignore -headers/open-source/OCAML_STDLIB: .ignore -headers/open-source/UNMODIFIED_WHY3: .ignore -lib/plugins/PLUGINS.README: .ignore -licenses/CDDL-1.0: .ignore -licenses/LGPLv2: .ignore -licenses/LGPLv2.1: .ignore -licenses/Q_MODIFIED_LICENSE: .ignore -man/frama-c.1: .ignore -opam/opam: .ignore -ptests/.gitignore: .ignore -ptests/.merlin: .ignore -ptests/ptests.ml: CEA_LGPL -share/_frama-c: CEA_LGPL -share/analysis-scripts/analysis.mk: CEA_LGPL -share/analysis-scripts/benchmark_database.py: CEA_LGPL -share/analysis-scripts/build.py: CEA_LGPL -share/analysis-scripts/build_callgraph.py: CEA_LGPL -share/analysis-scripts/clone.sh: CEA_LGPL -share/analysis-scripts/creduce.sh: CEA_LGPL -share/analysis-scripts/detect_recursion.py: CEA_LGPL -share/analysis-scripts/epilogue.mk: CEA_LGPL -share/analysis-scripts/estimate_difficulty.py: CEA_LGPL -share/analysis-scripts/fc_stubs.c: CEA_LGPL -share/analysis-scripts/frama_c_results.py: CEA_LGPL -share/analysis-scripts/cmd-dep.sh: CEA_LGPL -share/analysis-scripts/concat-csv.sh: CEA_LGPL -share/analysis-scripts/find_fun.py: CEA_LGPL -share/analysis-scripts/flamegraph.pl: CDDL -share/analysis-scripts/function_finder.py: CEA_LGPL -share/analysis-scripts/git_utils.py: CEA_LGPL -share/analysis-scripts/heuristic_list_functions.py: CEA_LGPL -share/analysis-scripts/list_files.py: CEA_LGPL -share/analysis-scripts/list_functions.ml: CEA_LGPL -share/analysis-scripts/make_wrapper.py: CEA_LGPL -share/analysis-scripts/normalize_jcdb.py: CEA_LGPL -share/analysis-scripts/parse-coverage.sh: CEA_LGPL -share/analysis-scripts/print_callgraph.py: CEA_LGPL -share/analysis-scripts/prologue.mk: CEA_LGPL -share/analysis-scripts/pyproject.toml: .ignore -share/analysis-scripts/README.md: .ignore -share/analysis-scripts/results_display.py: CEA_LGPL -share/analysis-scripts/script_for_creduce_fatal.sh: CEA_LGPL -share/analysis-scripts/script_for_creduce_non_fatal.sh: CEA_LGPL -share/analysis-scripts/source_filter.py: CEA_LGPL -share/analysis-scripts/summary.py: CEA_LGPL -share/analysis-scripts/template.mk: CEA_LGPL -share/compliance/c11_functions.json: .ignore -share/compliance/c11_headers.json: .ignore -share/compliance/compiler_builtins.json: .ignore -share/compliance/gcc_builtins.json: .ignore -share/compliance/glibc_functions.json: .ignore -share/compliance/nonstandard_identifiers.json: .ignore -share/compliance/posix_identifiers.json: .ignore -share/autocomplete_frama-c: CEA_LGPL -share/Makefile.clean: CEA_LGPL -share/Makefile.common: CEA_LGPL -share/Makefile.config.in: CEA_LGPL -share/Makefile.dynamic: CEA_LGPL -share/Makefile.dynamic_config.external: CEA_LGPL -share/Makefile.dynamic_config.internal: CEA_LGPL -share/Makefile.generic: CEA_LGPL -share/Makefile.plugin.template: CEA_LGPL -share/META.frama-c: .ignore -share/configure.ac: CEA_LGPL -share/emacs/acsl.el: CEA_PR_LGPL -share/emacs/frama-c-dev.el: CEA_LGPL -share/emacs/frama-c-init.el: CEA_LGPL -share/emacs/frama-c-recommended.el: CEA_LGPL -share/frama-c-icon.svg: .ignore -share/frama-c.Unix.rc: CEA_LGPL -share/frama-c.WIN32.rc: CEA_LGPL -share/frama-c.ico: .ignore -share/frama-c.png: .ignore -share/framac.vim: .ignore -share/libc.c: CEA_LGPL -share/libc/__fc_alloc_axiomatic.h: CEA_LGPL -share/libc/__fc_builtin.c: CEA_LGPL -share/libc/__fc_builtin.h: CEA_LGPL -share/libc/__fc_define_blkcnt_t.h: CEA_LGPL -share/libc/__fc_define_blksize_t.h: CEA_LGPL -share/libc/__fc_define_clockid_t.h: CEA_LGPL -share/libc/__fc_define_dev_t.h: CEA_LGPL -share/libc/__fc_define_eof.h: CEA_LGPL -share/libc/__fc_define_fd_set_t.h: CEA_LGPL -share/libc/__fc_define_fds.h: CEA_LGPL -share/libc/__fc_define_file.h: CEA_LGPL -share/libc/__fc_define_fpos_t.h: CEA_LGPL -share/libc/__fc_define_fs_cnt.h: CEA_LGPL -share/libc/__fc_define_id_t.h: CEA_LGPL -share/libc/__fc_define_ino_t.h: CEA_LGPL -share/libc/__fc_define_intptr_t.h: CEA_LGPL -share/libc/__fc_define_iovec.h: CEA_LGPL -share/libc/__fc_define_key_t.h: CEA_LGPL -share/libc/__fc_define_locale_t.h: CEA_LGPL -share/libc/__fc_define_max_open_files.h: CEA_LGPL -share/libc/__fc_define_mode_t.h: CEA_LGPL -share/libc/__fc_define_nlink_t.h: CEA_LGPL -share/libc/__fc_define_null.h: CEA_LGPL -share/libc/__fc_define_off_t.h: CEA_LGPL -share/libc/__fc_define_pid_t.h: CEA_LGPL -share/libc/__fc_define_pthread_types.h: CEA_LGPL -share/libc/__fc_define_sa_family_t.h: CEA_LGPL -share/libc/__fc_define_seek_macros.h: CEA_LGPL -share/libc/__fc_define_sigset_t.h: CEA_LGPL -share/libc/__fc_define_size_t.h: CEA_LGPL -share/libc/__fc_define_sockaddr.h: CEA_LGPL -share/libc/__fc_define_ssize_t.h: CEA_LGPL -share/libc/__fc_define_stat.h: CEA_LGPL -share/libc/__fc_define_suseconds_t.h: CEA_LGPL -share/libc/__fc_define_time_t.h: CEA_LGPL -share/libc/__fc_define_timer_t.h: CEA_LGPL -share/libc/__fc_define_timespec.h: CEA_LGPL -share/libc/__fc_define_timeval.h: CEA_LGPL -share/libc/__fc_define_uid_and_gid.h: CEA_LGPL -share/libc/__fc_define_useconds_t.h: CEA_LGPL -share/libc/__fc_define_wchar_t.h: CEA_LGPL -share/libc/__fc_define_wint_t.h: CEA_LGPL -share/libc/__fc_gcc_builtins.h: CEA_LGPL -share/libc/__fc_inet.h: CEA_LGPL -share/libc/__fc_integer.h: CEA_LGPL -share/libc/__fc_libc.h: CEA_LGPL -share/libc/__fc_machdep.h: CEA_LGPL -share/libc/__fc_machdep_linux_shared.h: CEA_LGPL -share/libc/__fc_runtime.c: CEA_LGPL -share/libc/__fc_select.h: CEA_LGPL -share/libc/__fc_string_axiomatic.h: CEA_LGPL -share/libc/aio.h: CEA_LGPL -share/libc/alloca.h: CEA_LGPL -share/libc/argz.c: CEA_FSF_LGPL -share/libc/argz.h: CEA_FSF_LGPL -share/libc/arpa/inet.h: CEA_LGPL -share/libc/assert.c: CEA_LGPL -share/libc/assert.h: CEA_LGPL -share/libc/byteswap.h: CEA_LGPL -share/libc/complex.h: CEA_LGPL -share/libc/cpio.h: CEA_LGPL -share/libc/ctype.c: CEA_LGPL -share/libc/ctype.h: CEA_LGPL -share/libc/dirent.h: CEA_LGPL -share/libc/dlfcn.h: CEA_LGPL -share/libc/endian.h: CEA_LGPL -share/libc/err.h: CEA_LGPL -share/libc/errno.c: CEA_LGPL -share/libc/errno.h: CEA_LGPL -share/libc/fcntl.h: CEA_LGPL -share/libc/features.h: CEA_LGPL -share/libc/fenv.h: CEA_LGPL -share/libc/fenv.c: CEA_LGPL -share/libc/float.h: CEA_LGPL -share/libc/fmtmsg.h: CEA_LGPL -share/libc/fnmatch.h: CEA_LGPL -share/libc/ftw.h: CEA_LGPL -share/libc/getopt.c: CEA_LGPL -share/libc/getopt.h: CEA_LGPL -share/libc/glob.c: CEA_LGPL -share/libc/glob.h: CEA_LGPL -share/libc/grp.h: CEA_LGPL -share/libc/iconv.h: CEA_LGPL -share/libc/ifaddrs.h: CEA_LGPL -share/libc/inttypes.c: CEA_LGPL -share/libc/inttypes.h: CEA_LGPL -share/libc/iso646.h: CEA_LGPL -share/libc/langinfo.h: CEA_LGPL -share/libc/libgen.h: CEA_LGPL -share/libc/limits.h: CEA_LGPL -share/libc/locale.c: CEA_LGPL -share/libc/locale.h: CEA_LGPL -share/libc/malloc.h: CEA_LGPL -share/libc/math.c: CEA_LGPL -share/libc/math.h: CEA_LGPL -share/libc/memory.h: CEA_LGPL -share/libc/monetary.h: CEA_LGPL -share/libc/mqueue.h: CEA_LGPL -share/libc/n1336.pdf: .ignore -share/libc/n1362.pdf: .ignore -share/libc/ndbm.h: CEA_LGPL -share/libc/net/if.h: CEA_LGPL -share/libc/netdb.c: CEA_LGPL -share/libc/netdb.h: CEA_LGPL -share/libc/netinet/in.c: CEA_LGPL -share/libc/netinet/in.h: CEA_LGPL -share/libc/netinet/ip.h: CEA_LGPL -share/libc/netinet/tcp.h: CEA_LGPL -share/libc/nl_types.h: CEA_LGPL -share/libc/poll.h: CEA_LGPL -share/libc/pthread.h: CEA_LGPL -share/libc/pwd.c: CEA_LGPL -share/libc/pwd.h: CEA_LGPL -share/libc/regex.h: CEA_LGPL -share/libc/resolv.h: CEA_LGPL -share/libc/sched.h: CEA_LGPL -share/libc/search.h: CEA_LGPL -share/libc/semaphore.h: CEA_LGPL -share/libc/setjmp.h: CEA_LGPL -share/libc/signal.c: CEA_LGPL -share/libc/signal.h: CEA_LGPL -share/libc/spawn.h: CEA_LGPL -share/libc/stdalign.h: CEA_LGPL -share/libc/stdarg.h: CEA_LGPL -share/libc/stdatomic.c: CEA_LGPL -share/libc/stdatomic.h: CEA_LGPL -share/libc/stdbool.h: CEA_LGPL -share/libc/stddef.h: CEA_LGPL -share/libc/stdint.h: CEA_LGPL -share/libc/stdio.c: CEA_LGPL -share/libc/stdio.h: CEA_LGPL -share/libc/stdlib.c: CEA_LGPL -share/libc/stdlib.h: CEA_LGPL -share/libc/stdnoreturn.h: CEA_LGPL -share/libc/string.c: CEA_LGPL -share/libc/string.h: CEA_LGPL -share/libc/strings.h: CEA_LGPL -share/libc/stropts.h: CEA_LGPL -share/libc/sys/file.h: CEA_LGPL -share/libc/sys/ioctl.h: CEA_LGPL -share/libc/sys/ipc.h: CEA_LGPL -share/libc/sys/mman.h: CEA_LGPL -share/libc/sys/msg.h: CEA_LGPL -share/libc/sys/param.h: CEA_LGPL -share/libc/sys/random.h: CEA_LGPL -share/libc/sys/resource.h: CEA_LGPL -share/libc/sys/select.h: CEA_LGPL -share/libc/sys/sendfile.h: CEA_LGPL -share/libc/sys/sem.h: CEA_LGPL -share/libc/sys/shm.h: CEA_LGPL -share/libc/sys/signal.h: CEA_LGPL -share/libc/sys/socket.h: CEA_LGPL -share/libc/sys/stat.h: CEA_LGPL -share/libc/sys/statvfs.h: CEA_LGPL -share/libc/sys/time.h: CEA_LGPL -share/libc/sys/times.h: CEA_LGPL -share/libc/sys/timex.h: CEA_LGPL -share/libc/sys/types.h: CEA_LGPL -share/libc/sys/uio.h: CEA_LGPL -share/libc/sys/un.h: CEA_LGPL -share/libc/sys/utsname.h: CEA_LGPL -share/libc/sys/vfs.h: CEA_LGPL -share/libc/sys/wait.h: CEA_LGPL -share/libc/syslog.h: CEA_LGPL -share/libc/tar.h: CEA_LGPL -share/libc/termios.h: CEA_LGPL -share/libc/tgmath.h: CEA_LGPL -share/libc/time.c: CEA_LGPL -share/libc/time.h: CEA_LGPL -share/libc/trace.h: CEA_LGPL -share/libc/ulimit.h: CEA_LGPL -share/libc/unistd.c: CEA_LGPL -share/libc/unistd.h: CEA_LGPL -share/libc/utime.h: CEA_LGPL -share/libc/utmp.h: CEA_LGPL -share/libc/utmpx.h: CEA_LGPL -share/libc/wait.h: CEA_LGPL -share/libc/wchar.c: CEA_LGPL -share/libc/wchar.h: CEA_LGPL -share/libc/wctype.h: CEA_LGPL -share/libc/wordexp.h: CEA_LGPL -share/machdep.c: CIL -share/switch-off.png: .ignore -share/switch-on.png: .ignore -share/theme/colorblind/considered_valid.png: .ignore -share/theme/colorblind/inconsistent.png: .ignore -share/theme/colorblind/invalid_but_dead.png: .ignore -share/theme/colorblind/invalid_under_hyp.png: .ignore -share/theme/colorblind/never_tried.png: .ignore -share/theme/colorblind/surely_invalid.png: .ignore -share/theme/colorblind/surely_valid.png: .ignore -share/theme/colorblind/unknown.png: .ignore -share/theme/colorblind/unknown_but_dead.png: .ignore -share/theme/colorblind/valid_but_dead.png: .ignore -share/theme/colorblind/valid_under_hyp.png: .ignore -share/theme/colorblind/fold.png: .ignore -share/theme/colorblind/unfold.png: .ignore -share/theme/default/considered_valid.png: .ignore -share/theme/default/inconsistent.png: .ignore -share/theme/default/invalid_but_dead.png: .ignore -share/theme/default/invalid_under_hyp.png: .ignore -share/theme/default/never_tried.png: .ignore -share/theme/default/surely_invalid.png: .ignore -share/theme/default/surely_valid.png: .ignore -share/theme/default/unknown.png: .ignore -share/theme/default/unknown_but_dead.png: .ignore -share/theme/default/valid_but_dead.png: .ignore -share/theme/default/valid_under_hyp.png: .ignore -share/theme/default/fold.png: .ignore -share/theme/default/unfold.png: .ignore -share/theme/flat/considered_valid.png: .ignore -share/theme/flat/inconsistent.png: .ignore -share/theme/flat/invalid_but_dead.png: .ignore -share/theme/flat/invalid_under_hyp.png: .ignore -share/theme/flat/never_tried.png: .ignore -share/theme/flat/surely_invalid.png: .ignore -share/theme/flat/surely_valid.png: .ignore -share/theme/flat/unknown.png: .ignore -share/theme/flat/unknown_but_dead.png: .ignore -share/theme/flat/valid_but_dead.png: .ignore -share/theme/flat/valid_under_hyp.png: .ignore -share/theme/flat/fold.png: .ignore -share/theme/flat/unfold.png: .ignore -share/unmark.png: .ignore -share/win32_installer.iss: .ignore -share/win32_manual_installation_step.txt: .ignore -src/kernel_internals/README.md: .ignore -src/kernel_internals/parsing/README.md: .ignore -src/kernel_internals/parsing/check_logic_parser.ml: CEA_LGPL -src/kernel_internals/parsing/clexer.mli: CIL -src/kernel_internals/parsing/clexer.mll: CIL -src/kernel_internals/parsing/cparser.mly: CIL -src/kernel_internals/parsing/errorloc.ml: CIL -src/kernel_internals/parsing/errorloc.mli: CIL -src/kernel_internals/parsing/lexerhack.ml: CIL -src/kernel_internals/parsing/lexerhack.mli: CIL -src/kernel_internals/parsing/logic_lexer.mli: CEA_INRIA_LGPL -src/kernel_internals/parsing/logic_lexer.mll: CEA_INRIA_LGPL -src/kernel_internals/parsing/logic_parser.mly: CEA_INRIA_LGPL -src/kernel_internals/parsing/logic_preprocess.mli: CEA_INRIA_LGPL -src/kernel_internals/parsing/logic_preprocess.mll: CEA_INRIA_LGPL -src/kernel_internals/parsing/parse_env.ml: CEA_LGPL -src/kernel_internals/parsing/parse_env.mli: CEA_LGPL -src/kernel_internals/runtime/README.md: .ignore -src/kernel_internals/runtime/boot.ml: CEA_LGPL -src/kernel_internals/runtime/boot.mli: CEA_LGPL -src/kernel_internals/runtime/dump_config.ml: CEA_LGPL -src/kernel_internals/runtime/dump_config.mli: CEA_LGPL -src/kernel_internals/runtime/fc_config.ml.in: CEA_LGPL -src/kernel_internals/runtime/fc_config.mli: CEA_LGPL -src/kernel_internals/runtime/frama_c_init.ml: CEA_LGPL -src/kernel_internals/runtime/frama_c_init.mli: CEA_LGPL -src/kernel_internals/runtime/gui_init.ml: CEA_LGPL -src/kernel_internals/runtime/gui_init.mli: CEA_LGPL -src/kernel_internals/runtime/machdeps.ml: CIL -src/kernel_internals/runtime/machdeps.mli: CIL -src/kernel_internals/runtime/messages.ml: CEA_LGPL -src/kernel_internals/runtime/messages.mli: CEA_LGPL -src/kernel_internals/runtime/special_hooks.ml: CEA_LGPL -src/kernel_internals/runtime/special_hooks.mli: CEA_LGPL -src/kernel_internals/runtime/toplevel_config.ml: CEA_LGPL -src/kernel_internals/typing/README.md: .ignore -src/kernel_internals/typing/allocates.ml: CEA_LGPL -src/kernel_internals/typing/allocates.mli: CEA_LGPL -src/kernel_internals/typing/alpha.ml: CIL -src/kernel_internals/typing/alpha.mli: CIL -src/kernel_internals/typing/asm_contracts.ml: CEA_LGPL -src/kernel_internals/typing/asm_contracts.mli: CEA_LGPL -src/kernel_internals/typing/cabs2cil.ml: CIL -src/kernel_internals/typing/cabs2cil.mli: CIL -src/kernel_internals/typing/cfg.ml: CIL -src/kernel_internals/typing/cfg.mli: CIL -src/kernel_internals/typing/frontc.ml: CIL -src/kernel_internals/typing/frontc.mli: CIL -src/kernel_internals/typing/ghost_accesses.ml: CEA_LGPL -src/kernel_internals/typing/ghost_accesses.mli: CEA_LGPL -src/kernel_internals/typing/ghost_cfg.ml: CEA_LGPL -src/kernel_internals/typing/ghost_cfg.mli: CEA_LGPL -src/kernel_internals/typing/infer_annotations.ml: CEA_LGPL -src/kernel_internals/typing/infer_annotations.mli: CEA_LGPL -src/kernel_internals/typing/logic_builtin.ml: CEA_INRIA_LGPL -src/kernel_internals/typing/logic_builtin.mli: CEA_INRIA_LGPL -src/kernel_internals/typing/mergecil.ml: CIL -src/kernel_internals/typing/mergecil.mli: CIL -src/kernel_internals/typing/oneret.ml: CIL -src/kernel_internals/typing/oneret.mli: CIL -src/kernel_internals/typing/rmtmps.ml: CIL -src/kernel_internals/typing/rmtmps.mli: CIL -src/kernel_internals/typing/translate_lightweight.ml: CEA_INRIA_LGPL -src/kernel_internals/typing/translate_lightweight.mli: CEA_INRIA_LGPL -src/kernel_internals/typing/unroll_loops.ml: CEA_LGPL -src/kernel_internals/typing/unroll_loops.mli: CEA_LGPL -src/kernel_internals/typing/substitute_const_globals.ml: CEA_LGPL -src/kernel_internals/typing/substitute_const_globals.mli: CEA_LGPL -src/kernel_services/README.md: .ignore -src/kernel_services/abstract_interp/README.md: .ignore -src/kernel_services/abstract_interp/abstract_interp.ml: CEA_LGPL -src/kernel_services/abstract_interp/abstract_interp.mli: CEA_LGPL -src/kernel_services/abstract_interp/base.ml: CEA_LGPL -src/kernel_services/abstract_interp/base.mli: CEA_LGPL -src/kernel_services/abstract_interp/eva_lattice_type.mli: CEA_LGPL -src/kernel_services/abstract_interp/fc_float.ml: CEA_LGPL -src/kernel_services/abstract_interp/fc_float.mli: CEA_LGPL -src/kernel_services/abstract_interp/float_sig.mli: CEA_LGPL -src/kernel_services/abstract_interp/float_interval.ml: CEA_LGPL -src/kernel_services/abstract_interp/float_interval.mli: CEA_LGPL -src/kernel_services/abstract_interp/float_interval_sig.mli: CEA_LGPL -src/kernel_services/abstract_interp/fval.ml: CEA_LGPL -src/kernel_services/abstract_interp/fval.mli: CEA_LGPL -src/kernel_services/abstract_interp/int_Base.ml: CEA_LGPL -src/kernel_services/abstract_interp/int_Base.mli: CEA_LGPL -src/kernel_services/abstract_interp/int_Intervals.ml: CEA_LGPL -src/kernel_services/abstract_interp/int_Intervals.mli: CEA_LGPL -src/kernel_services/abstract_interp/int_Intervals_sig.mli: CEA_LGPL -src/kernel_services/abstract_interp/int_interval.ml: CEA_LGPL -src/kernel_services/abstract_interp/int_interval.mli: CEA_LGPL -src/kernel_services/abstract_interp/int_set.ml: CEA_LGPL -src/kernel_services/abstract_interp/int_set.mli: CEA_LGPL -src/kernel_services/abstract_interp/int_val.ml: CEA_LGPL -src/kernel_services/abstract_interp/int_val.mli: CEA_LGPL -src/kernel_services/abstract_interp/ival.ml: CEA_LGPL -src/kernel_services/abstract_interp/ival.mli: CEA_LGPL -src/kernel_services/abstract_interp/lattice_bounds.ml: CEA_LGPL -src/kernel_services/abstract_interp/lattice_bounds.mli: CEA_LGPL -src/kernel_services/abstract_interp/lattice_messages.ml: CEA_LGPL -src/kernel_services/abstract_interp/lattice_messages.mli: CEA_LGPL -src/kernel_services/abstract_interp/lattice_type.mli: CEA_LGPL -src/kernel_services/abstract_interp/lmap.ml: CEA_LGPL -src/kernel_services/abstract_interp/lmap.mli: CEA_LGPL -src/kernel_services/abstract_interp/lmap_bitwise.ml: CEA_LGPL -src/kernel_services/abstract_interp/lmap_bitwise.mli: CEA_LGPL -src/kernel_services/abstract_interp/lmap_sig.mli: CEA_LGPL -src/kernel_services/abstract_interp/locations.ml: CEA_LGPL -src/kernel_services/abstract_interp/locations.mli: CEA_LGPL -src/kernel_services/abstract_interp/map_lattice.ml: CEA_LGPL -src/kernel_services/abstract_interp/map_lattice.mli: CEA_LGPL -src/kernel_services/abstract_interp/offsetmap.ml: CEA_LGPL -src/kernel_services/abstract_interp/offsetmap.mli: CEA_LGPL -src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli: CEA_LGPL -src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli: CEA_LGPL -src/kernel_services/abstract_interp/offsetmap_sig.mli: CEA_LGPL -src/kernel_services/abstract_interp/origin.ml: CEA_LGPL -src/kernel_services/abstract_interp/origin.mli: CEA_LGPL -src/kernel_services/abstract_interp/tr_offset.ml: CEA_LGPL -src/kernel_services/abstract_interp/tr_offset.mli: CEA_LGPL -src/kernel_services/analysis/README.md: .ignore -src/kernel_services/analysis/bit_utils.ml: CEA_LGPL -src/kernel_services/analysis/bit_utils.mli: CEA_LGPL -src/kernel_services/analysis/dataflow2.ml: CEA_LGPL -src/kernel_services/analysis/dataflow2.mli: CEA_LGPL -src/kernel_services/analysis/dataflows.ml: CIL -src/kernel_services/analysis/dataflows.mli: CIL -src/kernel_services/analysis/destructors.ml: CEA_LGPL -src/kernel_services/analysis/destructors.mli: CEA_LGPL -src/kernel_services/analysis/dominators.ml: CEA_LGPL -src/kernel_services/analysis/dominators.mli: CEA_LGPL -src/kernel_services/analysis/exn_flow.ml: CEA_LGPL -src/kernel_services/analysis/exn_flow.mli: CEA_LGPL -src/kernel_services/analysis/interpreted_automata.ml: CEA_LGPL -src/kernel_services/analysis/interpreted_automata.mli: CEA_LGPL -src/kernel_services/analysis/logic_interp.ml: CEA_LGPL -src/kernel_services/analysis/logic_interp.mli: CEA_LGPL -src/kernel_services/analysis/loop.ml: CEA_LGPL -src/kernel_services/analysis/loop.mli: CEA_LGPL -src/kernel_services/analysis/ordered_stmt.ml: CEA_LGPL -src/kernel_services/analysis/ordered_stmt.mli: CEA_LGPL -src/kernel_services/analysis/service_graph.ml: CEA_LGPL -src/kernel_services/analysis/service_graph.mli: CEA_LGPL -src/kernel_services/analysis/stmts_graph.ml: CEA_LGPL -src/kernel_services/analysis/stmts_graph.mli: CEA_LGPL -src/kernel_services/analysis/undefined_sequence.ml: CEA_LGPL -src/kernel_services/analysis/undefined_sequence.mli: CEA_LGPL -src/kernel_services/analysis/wto_statement.ml: CEA_LGPL -src/kernel_services/analysis/wto_statement.mli: CEA_LGPL -src/kernel_services/ast_building/cil_builder.ml: CEA_LGPL -src/kernel_services/ast_building/cil_builder.mli: CEA_LGPL -src/kernel_services/ast_data/README.md: .ignore -src/kernel_services/ast_data/alarms.ml: CEA_LGPL -src/kernel_services/ast_data/alarms.mli: CEA_LGPL -src/kernel_services/ast_data/annotations.ml: CEA_LGPL -src/kernel_services/ast_data/annotations.mli: CEA_LGPL -src/kernel_services/ast_data/ast.ml: CEA_LGPL -src/kernel_services/ast_data/ast.mli: CEA_LGPL -src/kernel_services/ast_data/cil_types.mli: CIL -src/kernel_services/ast_printing/cil_types_debug.ml: CEA_LGPL -src/kernel_services/ast_printing/cil_types_debug.mli: CEA_LGPL -src/kernel_services/ast_data/globals.ml: CEA_LGPL -src/kernel_services/ast_data/globals.mli: CEA_LGPL -src/kernel_services/ast_data/kernel_function.ml: CEA_LGPL -src/kernel_services/ast_data/kernel_function.mli: CEA_LGPL -src/kernel_services/ast_data/property.ml: CEA_LGPL -src/kernel_services/ast_data/property.mli: CEA_LGPL -src/kernel_services/ast_data/property_status.ml: CEA_LGPL -src/kernel_services/ast_data/property_status.mli: CEA_LGPL -src/kernel_services/ast_data/statuses_by_call.ml: CEA_LGPL -src/kernel_services/ast_data/statuses_by_call.mli: CEA_LGPL -src/kernel_services/ast_printing/cabs_debug.ml: CEA_LGPL -src/kernel_services/ast_printing/cabs_debug.mli: CEA_LGPL -src/kernel_services/ast_printing/cil_descriptive_printer.ml: CEA_LGPL -src/kernel_services/ast_printing/cil_descriptive_printer.mli: CEA_LGPL -src/kernel_services/ast_printing/cil_printer.ml: CEA_LGPL -src/kernel_services/ast_printing/cil_printer.mli: CEA_LGPL -src/kernel_services/ast_printing/cprint.ml: CIL -src/kernel_services/ast_printing/cprint.mli: CIL -src/kernel_services/ast_printing/description.ml: CEA_LGPL -src/kernel_services/ast_printing/description.mli: CEA_LGPL -src/kernel_services/ast_printing/logic_print.ml: CEA_INRIA_LGPL -src/kernel_services/ast_printing/logic_print.mli: CEA_INRIA_LGPL -src/kernel_services/ast_printing/printer.ml: CEA_LGPL -src/kernel_services/ast_printing/printer.mli: CEA_LGPL -src/kernel_services/ast_printing/printer_api.mli: CEA_LGPL -src/kernel_services/ast_printing/printer_builder.ml: CEA_LGPL -src/kernel_services/ast_printing/printer_builder.mli: CEA_LGPL -src/kernel_services/ast_printing/printer_tag.ml: CEA_LGPL -src/kernel_services/ast_printing/printer_tag.mli: CEA_LGPL -src/kernel_services/ast_queries/README.md: .ignore -src/kernel_services/ast_queries/acsl_extension.ml: CEA_LGPL -src/kernel_services/ast_queries/acsl_extension.mli: CEA_LGPL -src/kernel_services/ast_queries/ast_diff.ml: CEA_LGPL -src/kernel_services/ast_queries/ast_diff.mli: CEA_LGPL -src/kernel_services/ast_queries/ast_info.ml: CEA_LGPL -src/kernel_services/ast_queries/ast_info.mli: CEA_LGPL -src/kernel_services/ast_queries/cil.ml: CIL -src/kernel_services/ast_queries/cil.mli: CIL -src/kernel_services/ast_queries/cil_builtins.ml: CIL -src/kernel_services/ast_queries/cil_builtins.mli: CIL -src/kernel_services/ast_queries/cil_const.ml: CIL -src/kernel_services/ast_queries/cil_const.mli: CIL -src/kernel_services/ast_queries/cil_datatype.ml: CEA_LGPL -src/kernel_services/ast_queries/cil_datatype.mli: CEA_LGPL -src/kernel_services/ast_queries/cil_state_builder.ml: CEA_LGPL -src/kernel_services/ast_queries/cil_state_builder.mli: CEA_LGPL -src/kernel_services/ast_queries/file.ml: CEA_LGPL -src/kernel_services/ast_queries/file.mli: CEA_LGPL -src/kernel_services/ast_queries/filecheck.ml: CEA_LGPL -src/kernel_services/ast_queries/filecheck.mli: CEA_LGPL -src/kernel_services/ast_queries/json_compilation_database.ml: CEA_LGPL -src/kernel_services/ast_queries/json_compilation_database.mli: CEA_LGPL -src/kernel_services/ast_queries/logic_const.ml: CEA_INRIA_LGPL -src/kernel_services/ast_queries/logic_const.mli: CEA_INRIA_LGPL -src/kernel_services/ast_queries/logic_env.ml: CEA_INRIA_LGPL -src/kernel_services/ast_queries/logic_env.mli: CEA_INRIA_LGPL -src/kernel_services/ast_queries/logic_typing.ml: CEA_INRIA_LGPL -src/kernel_services/ast_queries/logic_typing.mli: CEA_INRIA_LGPL -src/kernel_services/ast_queries/logic_utils.ml: CEA_INRIA_LGPL -src/kernel_services/ast_queries/logic_utils.mli: CEA_INRIA_LGPL -src/kernel_services/ast_transformations/README.md: .ignore -src/kernel_services/ast_transformations/contract_special_float.ml: CEA_LGPL -src/kernel_services/ast_transformations/contract_special_float.mli: CEA_LGPL -src/kernel_services/ast_transformations/clone.ml: CEA_LGPL -src/kernel_services/ast_transformations/clone.mli: CEA_LGPL -src/kernel_services/ast_transformations/filter.ml: CEA_LGPL -src/kernel_services/ast_transformations/filter.mli: CEA_LGPL -src/kernel_services/ast_transformations/inline.ml: CEA_LGPL -src/kernel_services/ast_transformations/inline.mli: CEA_LGPL -src/kernel_services/cmdline_parameters/README.md: .ignore -src/kernel_services/cmdline_parameters/cmdline.ml: CEA_LGPL -src/kernel_services/cmdline_parameters/cmdline.mli: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_builder.ml: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_builder.mli: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_category.ml: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_category.mli: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_customize.ml: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_customize.mli: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_sig.mli: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_state.ml: CEA_LGPL -src/kernel_services/cmdline_parameters/parameter_state.mli: CEA_LGPL -src/kernel_services/cmdline_parameters/typed_parameter.ml: CEA_LGPL -src/kernel_services/cmdline_parameters/typed_parameter.mli: CEA_LGPL -src/kernel_services/parsetree/README.md: .ignore -src/kernel_services/parsetree/cabs.mli: CIL -src/kernel_services/parsetree/cabshelper.ml: CIL -src/kernel_services/parsetree/cabshelper.mli: CIL -src/kernel_services/parsetree/logic_ptree.mli: CEA_INRIA_LGPL -src/kernel_services/plugin_entry_points/README.md: .ignore -src/kernel_services/plugin_entry_points/db.ml: CEA_LGPL -src/kernel_services/plugin_entry_points/db.mli: CEA_LGPL -src/kernel_services/plugin_entry_points/dynamic.ml: CEA_LGPL -src/kernel_services/plugin_entry_points/dynamic.mli: CEA_LGPL -src/kernel_services/plugin_entry_points/emitter.ml: CEA_LGPL -src/kernel_services/plugin_entry_points/emitter.mli: CEA_LGPL -src/kernel_services/plugin_entry_points/kernel.ml: CEA_LGPL -src/kernel_services/plugin_entry_points/kernel.mli: CEA_LGPL -src/kernel_services/plugin_entry_points/log.ml: CEA_LGPL -src/kernel_services/plugin_entry_points/log.mli: CEA_LGPL -src/kernel_services/plugin_entry_points/plugin.ml: CEA_LGPL -src/kernel_services/plugin_entry_points/plugin.mli: CEA_LGPL -src/kernel_services/visitors/README.md: .ignore -src/kernel_services/visitors/cabsvisit.ml: CIL -src/kernel_services/visitors/cabsvisit.mli: CIL -src/kernel_services/visitors/visitor.ml: CEA_LGPL -src/kernel_services/visitors/visitor.mli: CEA_LGPL -src/kernel_services/visitors/visitor_behavior.ml: CEA_INRIA_LGPL -src/kernel_services/visitors/visitor_behavior.mli: CEA_INRIA_LGPL -src/libraries/README.md: .ignore -src/libraries/datatype/README.md: .ignore -src/libraries/datatype/datatype.ml: CEA_LGPL -src/libraries/datatype/datatype.mli: CEA_LGPL -src/libraries/datatype/descr.ml: CEA_LGPL -src/libraries/datatype/descr.mli: CEA_LGPL -src/libraries/datatype/structural_descr.ml: CEA_LGPL -src/libraries/datatype/structural_descr.mli: CEA_LGPL -src/libraries/datatype/type.ml: CEA_LGPL -src/libraries/datatype/type.mli: CEA_LGPL -src/libraries/datatype/unmarshal.ml: INRIA_BSD -src/libraries/datatype/unmarshal.mli: INRIA_BSD -src/libraries/datatype/unmarshal_hashtbl_test.ml: INRIA_BSD -src/libraries/datatype/unmarshal_test.ml: INRIA_BSD -src/libraries/datatype/unmarshal_z.ml: CEA_LGPL -src/libraries/datatype/unmarshal_z.mli: CEA_LGPL -src/libraries/project/README.md: .ignore -src/libraries/project/project.ml: CEA_LGPL -src/libraries/project/project.mli: CEA_LGPL -src/libraries/project/project_skeleton.ml: CEA_LGPL -src/libraries/project/project_skeleton.mli: CEA_LGPL -src/libraries/project/state.ml: CEA_LGPL -src/libraries/project/state.mli: CEA_LGPL -src/libraries/project/state_builder.ml: CEA_LGPL -src/libraries/project/state_builder.mli: CEA_LGPL -src/libraries/project/state_dependency_graph.ml: CEA_LGPL -src/libraries/project/state_dependency_graph.mli: CEA_LGPL -src/libraries/project/state_selection.ml: CEA_LGPL -src/libraries/project/state_selection.mli: CEA_LGPL -src/libraries/project/state_topological.ml: MODIFIED_OCAMLGRAPH -src/libraries/project/state_topological.mli: MODIFIED_OCAMLGRAPH -src/libraries/stdlib/FCHashtbl.ml: CEA_LGPL -src/libraries/stdlib/FCHashtbl.mli: CEA_LGPL -src/libraries/stdlib/README.md: .ignore -src/libraries/stdlib/extlib.ml: CEA_LGPL -src/libraries/stdlib/extlib.mli: CEA_LGPL -src/libraries/stdlib/integer.ml: CEA_LGPL -src/libraries/stdlib/integer.mli: CEA_LGPL -src/libraries/stdlib/transitioning.ml.in: CEA_LGPL -src/libraries/stdlib/transitioning.mli: CEA_LGPL -src/libraries/utils/README.md: .ignore -src/libraries/utils/bag.ml: CEA_LGPL -src/libraries/utils/bag.mli: CEA_LGPL -src/libraries/utils/json.mll: CEA_LGPL -src/libraries/utils/json.mli: CEA_LGPL -src/libraries/utils/binary_cache.ml: CEA_LGPL -src/libraries/utils/binary_cache.mli: CEA_LGPL -src/libraries/utils/bitvector.ml: CEA_LGPL -src/libraries/utils/bitvector.mli: CEA_LGPL -src/libraries/utils/c_bindings.c: CEA_LGPL -src/libraries/utils/cilconfig.ml: CIL -src/libraries/utils/cilconfig.mli: CIL -src/libraries/utils/command.ml: CEA_LGPL -src/libraries/utils/command.mli: CEA_LGPL -src/libraries/utils/dotgraph.ml: CEA_LGPL -src/libraries/utils/dotgraph.mli: CEA_LGPL -src/libraries/utils/escape.ml: CIL -src/libraries/utils/escape.mli: CIL -src/libraries/utils/filepath.ml: CEA_LGPL -src/libraries/utils/filepath.mli: CEA_LGPL -src/libraries/utils/floating_point.ml: CEA_LGPL -src/libraries/utils/floating_point.mli: CEA_LGPL -src/libraries/utils/hook.ml: CEA_LGPL -src/libraries/utils/hook.mli: CEA_LGPL -src/libraries/utils/hptmap.ml: MODIFIED_MENHIR -src/libraries/utils/hptmap.mli: MODIFIED_MENHIR -src/libraries/utils/hptmap_sig.mli: MODIFIED_MENHIR -src/libraries/utils/hptset.ml: CEA_LGPL -src/libraries/utils/hptset.mli: CEA_LGPL -src/libraries/utils/indexer.ml: CEA_LGPL -src/libraries/utils/indexer.mli: CEA_LGPL -src/libraries/utils/markdown.ml: CEA_LGPL -src/libraries/utils/markdown.mli: CEA_LGPL -src/libraries/utils/pretty_utils.ml: CEA_LGPL -src/libraries/utils/pretty_utils.mli: CEA_LGPL -src/libraries/utils/qstack.ml: CEA_LGPL -src/libraries/utils/qstack.mli: CEA_LGPL -src/libraries/utils/rangemap.ml: OCAML_STDLIB -src/libraries/utils/rangemap.mli: OCAML_STDLIB -src/libraries/utils/rgmap.ml: CEA_LGPL -src/libraries/utils/rgmap.mli: CEA_LGPL -src/libraries/utils/rich_text.ml: CEA_LGPL -src/libraries/utils/rich_text.mli: CEA_LGPL -src/libraries/utils/sanitizer.ml: CEA_LGPL -src/libraries/utils/sanitizer.mli: CEA_LGPL -src/libraries/utils/task.ml: CEA_LGPL -src/libraries/utils/task.mli: CEA_LGPL -src/libraries/utils/unicode.ml: CEA_LGPL -src/libraries/utils/unicode.mli: CEA_LGPL -src/libraries/utils/utf8_logic.ml: CEA_INRIA_LGPL -src/libraries/utils/utf8_logic.mli: CEA_INRIA_LGPL -src/libraries/utils/vector.ml: CEA_LGPL -src/libraries/utils/vector.mli: CEA_LGPL -src/libraries/utils/wto.ml: CEA_LGPL -src/libraries/utils/wto.mli: CEA_LGPL -src/plugins/README.md: .ignore -src/plugins/aorai/.gitignore: .ignore -src/plugins/aorai/Aorai.mli: AORAI_LGPL -src/plugins/aorai/INSTALL: .ignore -src/plugins/aorai/Makefile.in: AORAI_LGPL -src/plugins/aorai/VERSIONS.txt: .ignore -src/plugins/aorai/YA.README: .ignore -src/plugins/aorai/aorai_dataflow.ml: AORAI_LGPL -src/plugins/aorai/aorai_dataflow.mli: AORAI_LGPL -src/plugins/aorai/aorai_eva_analysis.disabled.ml: AORAI_LGPL -src/plugins/aorai/aorai_eva_analysis.enabled.ml: AORAI_LGPL -src/plugins/aorai/aorai_eva_analysis.mli: AORAI_LGPL -src/plugins/aorai/aorai_graph.ml: AORAI_LGPL -src/plugins/aorai/aorai_graph.mli: AORAI_LGPL -src/plugins/aorai/aorai_metavariables.ml: AORAI_LGPL -src/plugins/aorai/aorai_metavariables.mli: AORAI_LGPL -src/plugins/aorai/aorai_option.ml: AORAI_LGPL -src/plugins/aorai/aorai_option.mli: AORAI_LGPL -src/plugins/aorai/aorai_register.ml: AORAI_LGPL -src/plugins/aorai/aorai_register.mli: AORAI_LGPL -src/plugins/aorai/aorai_utils.ml: AORAI_LGPL -src/plugins/aorai/aorai_utils.mli: AORAI_LGPL -src/plugins/aorai/aorai_visitors.ml: AORAI_LGPL -src/plugins/aorai/aorai_visitors.mli: AORAI_LGPL -src/plugins/aorai/bool3.ml: AORAI_LGPL -src/plugins/aorai/bool3.mli: AORAI_LGPL -src/plugins/aorai/configure.ac: AORAI_LGPL -src/plugins/aorai/data_for_aorai.ml: AORAI_LGPL -src/plugins/aorai/data_for_aorai.mli: AORAI_LGPL -src/plugins/aorai/logic_simplification.ml: AORAI_LGPL -src/plugins/aorai/logic_simplification.mli: AORAI_LGPL -src/plugins/aorai/ltl_output.ml: AORAI_LGPL -src/plugins/aorai/ltl_output.mli: AORAI_LGPL -src/plugins/aorai/ltlast.mli: AORAI_LGPL -src/plugins/aorai/ltllexer.mli: AORAI_LGPL -src/plugins/aorai/ltllexer.mll: AORAI_LGPL -src/plugins/aorai/ltlparser.mly: AORAI_LGPL -src/plugins/aorai/path_analysis.ml: AORAI_LGPL -src/plugins/aorai/path_analysis.mli: AORAI_LGPL -src/plugins/aorai/promelaast.mli: AORAI_LGPL -src/plugins/aorai/promelalexer.mli: AORAI_LGPL -src/plugins/aorai/promelalexer.mll: AORAI_LGPL -src/plugins/aorai/promelalexer_withexps.mli: AORAI_LGPL -src/plugins/aorai/promelalexer_withexps.mll: AORAI_LGPL -src/plugins/aorai/promelaoutput.ml: AORAI_LGPL -src/plugins/aorai/promelaoutput.mli: AORAI_LGPL -src/plugins/aorai/promelaparser.mly: AORAI_LGPL -src/plugins/aorai/promelaparser_withexps.mly: AORAI_LGPL -src/plugins/aorai/utils_parser.ml: AORAI_LGPL -src/plugins/aorai/utils_parser.mli: AORAI_LGPL -src/plugins/aorai/yalexer.mli: AORAI_LGPL -src/plugins/aorai/yalexer.mll: AORAI_LGPL -src/plugins/aorai/yaparser.mly: AORAI_LGPL -src/plugins/callgraph/Callgraph.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/callgraph_api.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/cg.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/cg.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/cg_viewer.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/cg_viewer.yes.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/services.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/services.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/subgraph.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/subgraph.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/uses.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/callgraph/uses.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/constant_propagation/Constant_Propagation.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/constant_propagation/propagationParameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/constant_propagation/propagationParameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/constant_propagation/api.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/constant_propagation/api.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/build.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/build.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/callstack.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/callstack.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/context.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/context.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/dive_graph.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/dive_graph.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/dive_types.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/Dive.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/main.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/main.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/node_kind.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/node_kind.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/node_range.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/node_range.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/self.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/self.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/server_interface.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/dive/server_interface.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/From.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/callwise.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/callwise.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_compute.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_compute.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_register_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/from_register_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/functionwise.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/from/functionwise.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/GSourceView2.ml.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/GSourceView2.mli.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/GSourceView3.ml.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/GSourceView3.mli.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/analyses_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/analyses_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/book_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/book_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/debug_manager.yes.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/debug_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/design.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/design.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/dgraph_helper.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/dgraph_helper.no.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/dgraph_helper.yes.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/file_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/file_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/filetree.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/filetree.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gtk_compat.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gtk_compat.2.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gtk_compat.3.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gtk_form.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gtk_form.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gtk_helper.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gtk_helper.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gui_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gui_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gui_printers.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/gui_printers.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/help_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/help_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/history.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/history.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/launcher.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/launcher.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/menu_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/menu_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/pretty_source.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/pretty_source.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/project_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/project_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/property_navigator.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/property_navigator.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/source_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/source_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/source_viewer.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/source_viewer.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/warning_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/warning_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wbox.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wbox.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wfile.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wfile.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/widget.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/widget.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wpane.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wpane.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wpalette.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wpalette.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wtable.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wtable.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wtext.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wtext.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wutil.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wutil.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wutil_once.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/gui/wutil_once.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/Impact.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/compute_impact.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/compute_impact.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/pdg_aux.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/pdg_aux.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/reason_graph.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/reason_graph.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/register_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/impact/register_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/Inout.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/context.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/cumulative_analysis.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/cumulative_analysis.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/derefs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/derefs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/inout_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/inout_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/inputs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/inputs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/operational_inputs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/operational_inputs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/outputs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/outputs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/inout/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/.gitignore: .ignore -src/plugins/loop_analysis/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/LoopAnalysis.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/README.org: .ignore -src/plugins/loop_analysis/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/loop_analysis.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/loop_analysis.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/region_analysis.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/region_analysis.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/region_analysis_sig.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/region_analysis_stmt.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/region_analysis_stmt.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/loop_analysis/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/eva_info.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/eva_info.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/META.in: .ignore -src/plugins/markdown-report/md_gen.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/md_gen.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/mdr_params.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/mdr_params.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/mdr_register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/mdr_register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/parse_remarks.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/parse_remarks.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/sarif_gen.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/sarif_gen.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/sarif.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/sarif.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/markdown-report/share/acsl.xml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/Metrics.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/css_html.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/css_html.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_acsl.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_acsl.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_base.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_base.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_cabs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_cabs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_cilast.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_cilast.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_coverage.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_coverage.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_pivot.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/metrics_pivot.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/register_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/metrics/register_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/nonterm/.gitignore: .ignore -src/plugins/nonterm/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/nonterm/Nonterm.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/nonterm/README.md: .ignore -src/plugins/nonterm/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/nonterm/nonterm_run.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/nonterm/nonterm_run.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/.gitignore: .ignore -src/plugins/obfuscator/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/Obfuscator.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/dictionary.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/dictionary.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/obfuscate.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/obfuscate.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/obfuscator_kind.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/obfuscator_kind.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/obfuscator_register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/obfuscator_register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/obfuscator/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/occurrence/Occurrence.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/occurrence/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/occurrence/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/occurrence/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/occurrence/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/occurrence/register_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/occurrence/register_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/basic_blocks.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/basic_blocks.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/global_context.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/global_context.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/Instantiate.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/instantiator_builder.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/instantiator_builder.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/basic_alloc.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/basic_alloc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/calloc.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/calloc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/free.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/free.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/malloc.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/stdlib/malloc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/mem_utils.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/mem_utils.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memcmp.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memcmp.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memcpy.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memcpy.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memmove.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memmove.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memset.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/string/memset.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/transform.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/instantiate/transform.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/Pdg.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/annot.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/annot.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/build.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/build.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/ctrlDpds.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/ctrlDpds.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/marks.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/marks.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/pdg_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/pdg_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/pdg_state.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/pdg_state.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/sets.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg/sets.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg_types/pdgIndex.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg_types/pdgIndex.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg_types/pdgMarks.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg_types/pdgMarks.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg_types/pdgTypes.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/pdg_types/pdgTypes.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/postdominators/Postdominators.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/postdominators/compute.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/postdominators/compute.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/postdominators/postdominators_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/postdominators/postdominators_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/postdominators/print.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/postdominators/print.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/print_api/.gitignore: .ignore -src/plugins/print_api/Makefile: CEA_LGPL_OR_PROPRIETARY -src/plugins/print_api/Print_api.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/print_api/grammar.mly: CEA_LGPL_OR_PROPRIETARY -src/plugins/print_api/lexer.mll: CEA_LGPL_OR_PROPRIETARY -src/plugins/print_api/lexer.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/print_api/print_interface.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/print_api/print_interface.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/qed/.gitignore: .ignore -src/plugins/qed/Makefile: CEA_WP -src/plugins/qed/bvars.ml: CEA_WP -src/plugins/qed/bvars.mli: CEA_WP -src/plugins/qed/cache.ml: CEA_WP -src/plugins/qed/cache.mli: CEA_WP -src/plugins/qed/collection.ml: CEA_WP -src/plugins/qed/collection.mli: CEA_WP -src/plugins/qed/engine.mli: CEA_WP -src/plugins/qed/export.ml: CEA_WP -src/plugins/qed/export.mli: CEA_WP -src/plugins/qed/export_why3.ml: CEA_WP -src/plugins/qed/export_why3.mli: CEA_WP -src/plugins/qed/export_whycore.ml: CEA_WP -src/plugins/qed/export_whycore.mli: CEA_WP -src/plugins/qed/hcons.ml: CEA_WP -src/plugins/qed/hcons.mli: CEA_WP -src/plugins/qed/idxmap.ml: CEA_WP -src/plugins/qed/idxmap.mli: CEA_WP -src/plugins/qed/idxset.ml: CEA_WP -src/plugins/qed/idxset.mli: CEA_WP -src/plugins/qed/intmap.ml: CEA_WP -src/plugins/qed/intmap.mli: CEA_WP -src/plugins/qed/intset.ml: CEA_WP -src/plugins/qed/intset.mli: CEA_WP -src/plugins/qed/kind.ml: CEA_WP -src/plugins/qed/kind.mli: CEA_WP -src/plugins/qed/listmap.ml: CEA_WP -src/plugins/qed/listmap.mli: CEA_WP -src/plugins/qed/listset.ml: CEA_WP -src/plugins/qed/listset.mli: CEA_WP -src/plugins/qed/logic.mli: CEA_WP -src/plugins/qed/mergemap.ml: CEA_WP -src/plugins/qed/mergemap.mli: CEA_WP -src/plugins/qed/mergeset.ml: CEA_WP -src/plugins/qed/mergeset.mli: CEA_WP -src/plugins/qed/partition.ml: CEA_WP -src/plugins/qed/partition.mli: CEA_WP -src/plugins/qed/plib.ml: CEA_WP -src/plugins/qed/plib.mli: CEA_WP -src/plugins/qed/pool.ml: CEA_WP -src/plugins/qed/pool.mli: CEA_WP -src/plugins/qed/pretty.ml: CEA_WP -src/plugins/qed/pretty.mli: CEA_WP -src/plugins/qed/term.ml: CEA_WP -src/plugins/qed/term.mli: CEA_WP -src/plugins/reduc/Reduc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/collect.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/collect.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/hyp.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/hyp.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/misc.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/misc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/reduc_options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/reduc_options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/value2acsl.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/reduc/value2acsl.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/.gitignore: .ignore -src/plugins/report/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/Report.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/classify.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/classify.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/csv.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/csv.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/dump.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/dump.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/report_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/report_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/scan.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/report/scan.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/RteGen.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/flags.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/flags.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/generator.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/generator.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/rte.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/rte.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/visit.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/rte/visit.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/.gitignore: .ignore -src/plugins/server/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/Server.mli: .ignore -src/plugins/server/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/data.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/data.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/jbuffer.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/jbuffer.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_ast.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_ast.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_main.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_main.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_project.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_project.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_properties.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/kernel_properties.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/main.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/main.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/package.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/package.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/request.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/request.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_doc.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_doc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_batch.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_batch.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_socket.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_socket.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_zmq.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/server_zmq.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/states.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/server/states.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/Scope.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/datascope.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/datascope.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/defs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/defs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/dpds_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/dpds_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/zones.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/scope/zones.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/.gitignore: .ignore -src/plugins/security_slicing/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/Security_slicing.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/components.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/components.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/register_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/register_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/security_slicing_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/security_slicing/security_slicing_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/Slicing.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/api.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/api.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/fct_slice.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/fct_slice.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/printSlice.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/printSlice.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/register_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/register_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingActions.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingActions.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingCmds.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingCmds.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingInternals.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingInternals.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingMacros.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingMacros.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingMarks.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingMarks.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingParameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingParameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingProject.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingProject.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingSelect.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingSelect.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingState.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingState.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingTransform.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingTransform.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingTypes.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/slicingTypes.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/Sparecode.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/globs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/globs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/spare_marks.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/spare_marks.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/sparecode_params.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/sparecode_params.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/transform.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/sparecode/transform.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/reads.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/reads.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/studia_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/studia_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/studia_request.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/studia_request.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/Studia.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/writes.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/studia/writes.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/users/Users.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/users/users_register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/users/users_register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/.merlin: .ignore -src/plugins/value/Changelog_non_free: .ignore -src/plugins/value/Eva.mli: .ignore -src/plugins/value/alarmset.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/alarmset.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/eval.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/eval.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gen-api.sh: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/self.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/self.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/test.assert.sh: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/test.sh: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/api/general_requests.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/api/general_requests.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/api/values_request.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/api/values_request.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/abstract_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/printer_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/printer_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/simpler_domains.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/apron/apron_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/apron/apron_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_float.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_float.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_malloc.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_malloc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_misc.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_misc.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_memory.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_memory.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_print_c.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_print_c.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_watchpoint.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_watchpoint.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_split.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_split.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_string.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/builtins_string.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_init.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_init.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_offsetmap.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_offsetmap.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_specification.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_specification.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_transfer.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/cvalue_transfer.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/locals_scoping.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/locals_scoping.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/warn.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/cvalue/warn.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_mode.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_mode.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_builder.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_builder.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_lift.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_lift.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_product.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_product.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_store.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/domain_store.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/equality/equality.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/equality/equality.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/equality/equality_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/equality/equality_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/gauges/gauges_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/gauges/gauges_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/traces_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/traces_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/hcexprs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/hcexprs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/inout_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/inout_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/abstract_memory.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/abstract_memory.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/abstract_offset.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/abstract_offset.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/abstract_structure.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/abstract_structure.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/multidim.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/multidim.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/multidim_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/multidim_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/pretty_memory.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/pretty_memory.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/segmentation.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/segmentation.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/typed_memory.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/multidim/typed_memory.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/octagons.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/octagons.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/offsm_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/offsm_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/powerset.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/powerset.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/sign_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/sign_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/numerors/numerors_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/numerors/numerors_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/simple_memory.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/simple_memory.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/symbolic_locs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/symbolic_locs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/taint_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/taint_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/unit_domain.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/domains/unit_domain.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/abstractions.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/abstractions.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/analysis.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/analysis.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/compute_functions.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/compute_functions.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/evaluation.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/evaluation.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/function_calls.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/function_calls.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/initialization.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/initialization.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/iterator.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/iterator.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/mem_exec.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/mem_exec.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/recursion.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/recursion.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/subdivided_evaluation.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/subdivided_evaluation.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/transfer_logic.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/transfer_logic.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/transfer_specification.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/transfer_specification.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/transfer_stmt.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/transfer_stmt.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_callstacks_filters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_callstacks_filters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_callstacks_manager.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_callstacks_manager.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_eval.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_eval.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_types.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_types.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_red.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/gui_red.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/register_gui.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/gui_files/register_gui.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_annots.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_annots.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_op.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_op.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_terms.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_terms.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/function_args.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/function_args.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/auto_loop_unroll.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/auto_loop_unroll.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/partition.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/partition.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/partitioning_index.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/partitioning_index.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/partitioning_parameters.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/partitioning_parameters.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/per_stmt_slevel.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/per_stmt_slevel.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/split_return.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/split_return.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/split_strategy.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/split_strategy.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/trace_partitioning.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/partitioning/trace_partitioning.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/abstract.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/abstract.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/active_behaviors.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/active_behaviors.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/backward_formals.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/backward_formals.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/cvalue_callbacks.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/cvalue_callbacks.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_annotations.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_annotations.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_audit.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_audit.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_dynamic.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_dynamic.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_perf.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_perf.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_results.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_results.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_utils.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eva_utils.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eval_typ.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/eval_typ.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/red_statuses.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/red_statuses.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/library_functions.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/library_functions.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/results.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/results.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/structure.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/structure.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/summary.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/summary.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/unit_tests.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/unit_tests.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/widen.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/widen.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/widen_hints_ext.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/utils/widen_hints_ext.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/abstract_location.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/abstract_value.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/cvalue_backward.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/cvalue_backward.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/cvalue_forward.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/cvalue_forward.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/location_lift.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/location_lift.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/main_locations.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/main_locations.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/main_values.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/main_values.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/offsm_value.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/offsm_value.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/sign_value.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/sign_value.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_utils.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_utils.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_float.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_float.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_interval.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_interval.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_arithmetics.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_arithmetics.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_value.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/numerors/numerors_value.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/value_product.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/values/value_product.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/README.md: .ignore -src/plugins/value_types/cilE.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/cilE.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/cvalue.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/cvalue.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/function_Froms.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/function_Froms.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/inout_type.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/inout_type.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/precise_locs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/precise_locs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/value_types.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/value_types.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/widen_type.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value_types/widen_type.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/Makefile.in: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/configure.ac: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/Variadic.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/classify.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/classify.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/environment.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/environment.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/extends.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/extends.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_parser.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_parser.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_pprint.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_pprint.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_string.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_string.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_typer.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_typer.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/format_types.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/generic.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/generic.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/options.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/options.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/register.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/replacements.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/replacements.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/standard.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/standard.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/translate.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/translate.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/variadic/va_types.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/wp/.gitignore: .ignore -src/plugins/wp/AssignsCompleteness.ml: CEA_WP -src/plugins/wp/AssignsCompleteness.mli: CEA_WP -src/plugins/wp/Auto.ml: CEA_WP -src/plugins/wp/Auto.mli: CEA_WP -src/plugins/wp/Cache.ml: CEA_WP -src/plugins/wp/Cache.mli: CEA_WP -src/plugins/wp/Cfloat.ml: CEA_WP -src/plugins/wp/Cfloat.mli: CEA_WP -src/plugins/wp/Changelog: .ignore -src/plugins/wp/Cint.ml: CEA_WP -src/plugins/wp/Cint.mli: CEA_WP -src/plugins/wp/Cleaning.ml: CEA_WP -src/plugins/wp/Cleaning.mli: CEA_WP -src/plugins/wp/Cmath.ml: CEA_WP -src/plugins/wp/Cmath.mli: CEA_WP -src/plugins/wp/CodeSemantics.ml: CEA_WP -src/plugins/wp/CodeSemantics.mli: CEA_WP -src/plugins/wp/Conditions.ml: CEA_WP -src/plugins/wp/Conditions.mli: CEA_WP -src/plugins/wp/Context.ml: CEA_WP -src/plugins/wp/Context.mli: CEA_WP -src/plugins/wp/Cstring.ml: CEA_WP -src/plugins/wp/Cstring.mli: CEA_WP -src/plugins/wp/Cvalues.ml: CEA_WP -src/plugins/wp/Cvalues.mli: CEA_WP -src/plugins/wp/Definitions.ml: CEA_WP -src/plugins/wp/Definitions.mli: CEA_WP -src/plugins/wp/Factory.ml: CEA_WP -src/plugins/wp/Factory.mli: CEA_WP -src/plugins/wp/Filtering.ml: CEA_WP -src/plugins/wp/Filtering.mli: CEA_WP -src/plugins/wp/Footprint.ml: CEA_WP -src/plugins/wp/Footprint.mli: CEA_WP -src/plugins/wp/Generator.ml: CEA_WP -src/plugins/wp/Generator.mli: CEA_WP -src/plugins/wp/GuiConfig.ml: CEA_WP -src/plugins/wp/GuiConfig.mli: CEA_WP -src/plugins/wp/GuiComposer.ml: CEA_WP -src/plugins/wp/GuiComposer.mli: CEA_WP -src/plugins/wp/GuiGoal.ml: CEA_WP -src/plugins/wp/GuiGoal.mli: CEA_WP -src/plugins/wp/GuiList.ml: CEA_WP -src/plugins/wp/GuiList.mli: CEA_WP -src/plugins/wp/GuiNavigator.ml: CEA_WP -src/plugins/wp/GuiNavigator.mli: CEA_WP -src/plugins/wp/GuiPanel.ml: CEA_WP -src/plugins/wp/GuiPanel.mli: CEA_WP -src/plugins/wp/GuiProver.ml: CEA_WP -src/plugins/wp/GuiProver.mli: CEA_WP -src/plugins/wp/GuiProof.ml: CEA_WP -src/plugins/wp/GuiProof.mli: CEA_WP -src/plugins/wp/GuiSequent.ml: CEA_WP -src/plugins/wp/GuiSequent.mli: CEA_WP -src/plugins/wp/GuiSource.ml: CEA_WP -src/plugins/wp/GuiSource.mli: CEA_WP -src/plugins/wp/GuiTactic.ml: CEA_WP -src/plugins/wp/GuiTactic.mli: CEA_WP -src/plugins/wp/Layout.ml: CEA_WP -src/plugins/wp/Layout.mli: CEA_WP -src/plugins/wp/Lang.ml: CEA_WP -src/plugins/wp/Lang.mli: CEA_WP -src/plugins/wp/Letify.ml: CEA_WP -src/plugins/wp/Letify.mli: CEA_WP -src/plugins/wp/LogicAssigns.ml: CEA_WP -src/plugins/wp/LogicAssigns.mli: CEA_WP -src/plugins/wp/LogicBuiltins.ml: CEA_WP -src/plugins/wp/LogicBuiltins.mli: CEA_WP -src/plugins/wp/LogicCompiler.ml: CEA_WP -src/plugins/wp/LogicCompiler.mli: CEA_WP -src/plugins/wp/LogicSemantics.ml: CEA_WP -src/plugins/wp/LogicSemantics.mli: CEA_WP -src/plugins/wp/LogicUsage.ml: CEA_WP -src/plugins/wp/LogicUsage.mli: CEA_WP -src/plugins/wp/Makefile.in: CEA_WP -src/plugins/wp/Matrix.ml: CEA_WP -src/plugins/wp/Matrix.mli: CEA_WP -src/plugins/wp/MemoryContext.ml: CEA_WP -src/plugins/wp/MemoryContext.mli: CEA_WP -src/plugins/wp/MemDebug.ml: CEA_WP -src/plugins/wp/MemDebug.mli: CEA_WP -src/plugins/wp/MemEmpty.ml: CEA_WP -src/plugins/wp/MemEmpty.mli: CEA_WP -src/plugins/wp/MemLoader.ml: CEA_WP -src/plugins/wp/MemLoader.mli: CEA_WP -src/plugins/wp/MemMemory.ml: CEA_WP -src/plugins/wp/MemMemory.mli: CEA_WP -src/plugins/wp/MemRegion.ml: CEA_WP -src/plugins/wp/MemRegion.mli: CEA_WP -src/plugins/wp/MemTyped.ml: CEA_WP -src/plugins/wp/MemTyped.mli: CEA_WP -src/plugins/wp/MemVal.ml: CEA_WP -src/plugins/wp/MemVal.mli: CEA_WP -src/plugins/wp/MemVar.ml: CEA_WP -src/plugins/wp/MemVar.mli: CEA_WP -src/plugins/wp/MemZeroAlias.ml: CEA_WP -src/plugins/wp/MemZeroAlias.mli: CEA_WP -src/plugins/wp/Sigs.mli: CEA_WP -src/plugins/wp/Mstate.ml: CEA_WP -src/plugins/wp/Mstate.mli: CEA_WP -src/plugins/wp/Passive.ml: CEA_WP -src/plugins/wp/Passive.mli: CEA_WP -src/plugins/wp/Pcfg.ml: CEA_WP -src/plugins/wp/Pcfg.mli: CEA_WP -src/plugins/wp/Pcond.ml: CEA_WP -src/plugins/wp/Pcond.mli: CEA_WP -src/plugins/wp/Plang.ml: CEA_WP -src/plugins/wp/Plang.mli: CEA_WP -src/plugins/wp/ProofEngine.ml: CEA_WP -src/plugins/wp/ProofEngine.mli: CEA_WP -src/plugins/wp/ProofSession.ml: CEA_WP -src/plugins/wp/ProofSession.mli: CEA_WP -src/plugins/wp/ProofScript.ml: CEA_WP -src/plugins/wp/ProofScript.mli: CEA_WP -src/plugins/wp/ProverScript.ml: CEA_WP -src/plugins/wp/ProverScript.mli: CEA_WP -src/plugins/wp/ProverSearch.ml: CEA_WP -src/plugins/wp/ProverSearch.mli: CEA_WP -src/plugins/wp/ProverTask.ml: CEA_WP -src/plugins/wp/ProverTask.mli: CEA_WP -src/plugins/wp/ProverWhy3.mli: CEA_WP -src/plugins/wp/ProverWhy3.ml: CEA_WP -src/plugins/wp/RefUsage.ml: CEA_WP -src/plugins/wp/RefUsage.mli: CEA_WP -src/plugins/wp/Region.ml: CEA_WP -src/plugins/wp/Region.mli: CEA_WP -src/plugins/wp/RegionAccess.ml: CEA_WP -src/plugins/wp/RegionAccess.mli: CEA_WP -src/plugins/wp/RegionAnalysis.ml: CEA_WP -src/plugins/wp/RegionAnalysis.mli: CEA_WP -src/plugins/wp/RegionAnnot.ml: CEA_WP -src/plugins/wp/RegionAnnot.mli: CEA_WP -src/plugins/wp/RegionDump.ml: CEA_WP -src/plugins/wp/RegionDump.mli: CEA_WP -src/plugins/wp/Repr.ml: CEA_WP -src/plugins/wp/Repr.mli: CEA_WP -src/plugins/wp/Sigma.ml: CEA_WP -src/plugins/wp/Sigma.mli: CEA_WP -src/plugins/wp/Splitter.ml: CEA_WP -src/plugins/wp/Splitter.mli: CEA_WP -src/plugins/wp/CfgCompiler.ml: CEA_WP -src/plugins/wp/CfgCompiler.mli: CEA_WP -src/plugins/wp/StmtSemantics.ml: CEA_WP -src/plugins/wp/StmtSemantics.mli: CEA_WP -src/plugins/wp/Strategy.ml: CEA_WP -src/plugins/wp/Strategy.mli: CEA_WP -src/plugins/wp/Tactical.ml: CEA_WP -src/plugins/wp/Tactical.mli: CEA_WP -src/plugins/wp/TacArray.ml: CEA_WP -src/plugins/wp/TacArray.mli: CEA_WP -src/plugins/wp/TacBitwised.ml: CEA_WP -src/plugins/wp/TacBitwised.mli: CEA_WP -src/plugins/wp/TacBitrange.ml: CEA_WP -src/plugins/wp/TacBitrange.mli: CEA_WP -src/plugins/wp/TacBittest.ml: CEA_WP -src/plugins/wp/TacBittest.mli: CEA_WP -src/plugins/wp/TacChoice.ml: CEA_WP -src/plugins/wp/TacChoice.mli: CEA_WP -src/plugins/wp/TacClear.ml: CEA_WP -src/plugins/wp/TacClear.mli: CEA_WP -src/plugins/wp/TacCongruence.ml: CEA_WP -src/plugins/wp/TacCongruence.mli: CEA_WP -src/plugins/wp/TacCompound.ml: CEA_WP -src/plugins/wp/TacCompound.mli: CEA_WP -src/plugins/wp/TacCut.ml: CEA_WP -src/plugins/wp/TacCut.mli: CEA_WP -src/plugins/wp/TacFilter.ml: CEA_WP -src/plugins/wp/TacFilter.mli: CEA_WP -src/plugins/wp/TacHavoc.ml: CEA_WP -src/plugins/wp/TacHavoc.mli: CEA_WP -src/plugins/wp/TacInduction.ml: CEA_WP -src/plugins/wp/TacInduction.mli: CEA_WP -src/plugins/wp/TacInstance.ml: CEA_WP -src/plugins/wp/TacInstance.mli: CEA_WP -src/plugins/wp/TacLemma.ml: CEA_WP -src/plugins/wp/TacLemma.mli: CEA_WP -src/plugins/wp/TacModMask.ml: CEA_WP -src/plugins/wp/TacModMask.mli: CEA_WP -src/plugins/wp/TacNormalForm.ml: CEA_WP -src/plugins/wp/TacNormalForm.mli: CEA_WP -src/plugins/wp/TacOverflow.ml: CEA_WP -src/plugins/wp/TacOverflow.mli: CEA_WP -src/plugins/wp/TacRange.ml: CEA_WP -src/plugins/wp/TacRange.mli: CEA_WP -src/plugins/wp/TacRewrite.ml: CEA_WP -src/plugins/wp/TacRewrite.mli: CEA_WP -src/plugins/wp/TacSequence.ml: CEA_WP -src/plugins/wp/TacSequence.mli: CEA_WP -src/plugins/wp/TacShift.ml: CEA_WP -src/plugins/wp/TacShift.mli: CEA_WP -src/plugins/wp/TacSplit.ml: CEA_WP -src/plugins/wp/TacSplit.mli: CEA_WP -src/plugins/wp/TacUnfold.ml: CEA_WP -src/plugins/wp/TacUnfold.mli: CEA_WP -src/plugins/wp/VC.ml: CEA_WP -src/plugins/wp/VC.mli: CEA_WP -src/plugins/wp/VCS.ml: CEA_WP -src/plugins/wp/VCS.mli: CEA_WP -src/plugins/wp/Vlist.ml: CEA_WP -src/plugins/wp/Vlist.mli: CEA_WP -src/plugins/wp/Vset.ml: CEA_WP -src/plugins/wp/Vset.mli: CEA_WP -src/plugins/wp/Warning.ml: CEA_WP -src/plugins/wp/Warning.mli: CEA_WP -src/plugins/wp/Why3Provers.ml: CEA_WP -src/plugins/wp/Why3Provers.mli: CEA_WP -src/plugins/wp/Wp.mli: .ignore -src/plugins/wp/WpTac.ml: CEA_WP -src/plugins/wp/WpTac.mli: CEA_WP -src/plugins/wp/cfgAnnot.ml: CEA_WP -src/plugins/wp/cfgAnnot.mli: CEA_WP -src/plugins/wp/cfgInfos.ml: CEA_WP -src/plugins/wp/cfgInfos.mli: CEA_WP -src/plugins/wp/cfgCalculus.ml: CEA_WP -src/plugins/wp/cfgCalculus.mli: CEA_WP -src/plugins/wp/cfgDump.ml: CEA_WP -src/plugins/wp/cfgDump.mli: CEA_WP -src/plugins/wp/cfgGenerator.ml: CEA_WP -src/plugins/wp/cfgGenerator.mli: CEA_WP -src/plugins/wp/cfgInit.ml: CEA_WP -src/plugins/wp/cfgInit.mli: CEA_WP -src/plugins/wp/cfgWP.ml: CEA_WP -src/plugins/wp/cfgWP.mli: CEA_WP -src/plugins/wp/clabels.ml: CEA_WP -src/plugins/wp/clabels.mli: CEA_WP -src/plugins/wp/configure.ac: CEA_WP -src/plugins/wp/ctypes.ml: CEA_WP -src/plugins/wp/ctypes.mli: CEA_WP -src/plugins/wp/filter_axioms.ml: CEA_WP -src/plugins/wp/filter_axioms.mli: CEA_WP -src/plugins/wp/doc/MakeDoc: CEA_WP -src/plugins/wp/doc/coqdoc/Makefile: CEA_WP -src/plugins/wp/doc/coqdoc/coqdoc.sty: .ignore -src/plugins/wp/doc/coqdoc/qed_generated.tex: .ignore -src/plugins/wp/doc/coqdoc/typed_generated.tex: .ignore -src/plugins/wp/doc/coqdoc/wpcoq.tex: .ignore -src/plugins/wp/doc/manual/.gitignore: .ignore -src/plugins/wp/doc/manual/Makefile: CEA_WP -src/plugins/wp/doc/manual/mem.pdf: .ignore -src/plugins/wp/doc/manual/size_base.pdf: .ignore -src/plugins/wp/doc/manual/size_compl.pdf: .ignore -src/plugins/wp/doc/manual/wp-complete.png: .ignore -src/plugins/wp/doc/manual/wp-gui-main.png: .ignore -src/plugins/wp/doc/manual/wp-gui-run.png: .ignore -src/plugins/wp/doc/manual/wp-invalid.png: .ignore -src/plugins/wp/doc/manual/wp-unknown.png: .ignore -src/plugins/wp/doc/manual/wp-valid.png: .ignore -src/plugins/wp/doc/manual/wp.bib: .ignore -src/plugins/wp/doc/manual/wp.tex: .ignore -src/plugins/wp/doc/manual/wp_calculus.tex: .ignore -src/plugins/wp/doc/manual/wp_caveat.tex: .ignore -src/plugins/wp/doc/manual/wp_implementation.tex: .ignore -src/plugins/wp/doc/manual/wp_intro.tex: .ignore -src/plugins/wp/doc/manual/wp_logic.tex: .ignore -src/plugins/wp/doc/manual/wp_models.tex: .ignore -src/plugins/wp/doc/manual/wp_plugin.tex: .ignore -src/plugins/wp/doc/manual/wp_simplifier.tex: .ignore -src/plugins/wp/doc/manual/wp_typed.tex: .ignore -src/plugins/wp/driver.mli: CEA_WP -src/plugins/wp/driver.mll: CEA_WP -src/plugins/wp/dyncall.ml: CEA_WP -src/plugins/wp/dyncall.mli: CEA_WP -src/plugins/wp/intro_wp.txt: CEA_WP -src/plugins/wp/mcfg.mli: CEA_WP -src/plugins/wp/normAtLabels.ml: CEA_WP -src/plugins/wp/normAtLabels.mli: CEA_WP -src/plugins/wp/prover.ml: CEA_WP -src/plugins/wp/prover.mli: CEA_WP -src/plugins/wp/register.ml: CEA_WP -src/plugins/wp/register.mli: CEA_WP -src/plugins/wp/rformat.mli: CEA_WP -src/plugins/wp/rformat.mll: CEA_WP -src/plugins/wp/script.mli: CEA_WP -src/plugins/wp/script.mll: CEA_WP -src/plugins/wp/share/.gitignore: .ignore -src/plugins/wp/share/Makefile.resources: CEA_WP -src/plugins/wp/share/coqwp/ArcTrigo.v: CEA_WP -src/plugins/wp/share/coqwp/Bits.v: CEA_WP -src/plugins/wp/share/coqwp/BuiltIn.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/Cbits.v: CEA_WP -src/plugins/wp/share/coqwp/Cfloat.v: CEA_WP -src/plugins/wp/share/coqwp/Cint.v: CEA_WP -src/plugins/wp/share/coqwp/Cmath.v: CEA_WP -src/plugins/wp/share/coqwp/ExpLog.v: CEA_WP -src/plugins/wp/share/coqwp/HighOrd.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/Memory.v: CEA_WP -src/plugins/wp/share/coqwp/Qed.v: CEA_WP -src/plugins/wp/share/coqwp/Qedlib.v: CEA_WP -src/plugins/wp/share/coqwp/Square.v: CEA_WP -src/plugins/wp/share/coqwp/Vlist.v: CEA_WP -src/plugins/wp/share/coqwp/Vset.v: CEA_WP -src/plugins/wp/share/coqwp/Zbits.v: CEA_WP -src/plugins/wp/share/coqwp/bool/Bool.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/Abs.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/ComputerDivision.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/EuclideanDivision.v: MODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/Exponentiation.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/Int.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/MinMax.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/Power.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/int/ComputerOfEuclideanDivision.v: MODIFIED_WHY3 -src/plugins/wp/share/coqwp/map/Map.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/map/Const.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/Abs.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/FromInt.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/ExpLog.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/MinMax.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/PowerReal.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/Real.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/RealInfix.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/Square.v: UNMODIFIED_WHY3 -src/plugins/wp/share/coqwp/real/Trigonometry.v: UNMODIFIED_WHY3 -src/plugins/wp/share/install.ml: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/cbits.mlw: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/cfloat.mlw: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/cint.mlw: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/cmath.mlw: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/memory.mlw: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/qed.mlw: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/vlist.mlw: CEA_WP -src/plugins/wp/share/why3/frama_c_wp/vset.mlw: CEA_WP -src/plugins/wp/share/wp.driver: CEA_WP -src/plugins/wp/wpContext.ml: CEA_WP -src/plugins/wp/wpContext.mli: CEA_WP -src/plugins/wp/wpPropId.ml: CEA_WP -src/plugins/wp/wpPropId.mli: CEA_WP -src/plugins/wp/wpReached.ml: CEA_WP -src/plugins/wp/wpReached.mli: CEA_WP -src/plugins/wp/wpReport.ml: CEA_WP -src/plugins/wp/wpReport.mli: CEA_WP -src/plugins/wp/wpRTE.ml: CEA_WP -src/plugins/wp/wpRTE.mli: CEA_WP -src/plugins/wp/wpTarget.ml: CEA_WP -src/plugins/wp/wpTarget.mli: CEA_WP -src/plugins/wp/wp_error.ml: CEA_WP -src/plugins/wp/wp_error.mli: CEA_WP -src/plugins/wp/wp_parameters.ml: CEA_WP -src/plugins/wp/wp_parameters.mli: CEA_WP -src/plugins/wp/wpo.ml: CEA_WP -src/plugins/wp/wpo.mli: CEA_WP -src/plugins/wp/wprop.ml: CEA_WP -src/plugins/wp/wprop.mli: CEA_WP diff --git a/ivette/Makefile b/ivette/Makefile index 61a31e5f29c3d8212ae4b664bacabd92e72444d9..37236b4ab635d5a2a84d56adddc6d0267ebbdd43 100644 --- a/ivette/Makefile +++ b/ivette/Makefile @@ -106,15 +106,11 @@ update-distrib-files: api: @echo "[Ivette] Generating TypeScript API" - @find src/frama-c -path "*/api/*" -name "*.ts" -exec rm -f {} \; - ../bin/frama-c.byte \ - -load-module src/frama-c/api_generator.ml \ - -server-tsc - @find src/frama-c -path "*/api/*" -name "*.ts" \ - -exec headache \ - -h ../headers/open-source/CEA_LGPL \ - -c ../headers/headache_config.txt {} \;\ - -exec chmod a-w {} \; + ./api.sh build src + +check-api: + @echo "[Ivette] Checking TypeScript API" + ./api.sh check src # -------------------------------------------------------------------------- # --- Ivette Documentation diff --git a/share/Makefile.dynamic_config.internal b/ivette/api.sh old mode 100644 new mode 100755 similarity index 62% rename from share/Makefile.dynamic_config.internal rename to ivette/api.sh index d0dc72810bcc5418e0107c004d98121de5f69a1b..ad8c7690a9ffee9809ff52f0b12c48a5a685a9c2 --- a/share/Makefile.dynamic_config.internal +++ b/ivette/api.sh @@ -1,3 +1,4 @@ +#!/bin/bash ########################################################################## # # # This file is part of Frama-C. # @@ -20,26 +21,59 @@ # # ########################################################################## -export FRAMAC_INTERNAL?=yes +if [[ $# != 2 ]]; +then + cat <<EOF +usage: $0 [check|build] path +EOF + exit 2 +fi -export FRAMAC_OPT=$(FRAMAC_ROOT_SRCDIR)/bin/toplevel.opt$(EXE) -export FRAMAC_BYTE=$(FRAMAC_ROOT_SRCDIR)/bin/toplevel.byte$(EXE) +case "$1" in + "build") ;; + "check") ;; + *) + echo "Bad first parameter: $1" + echo "Exiting without doing anything."; + exit 31 +esac +action="$1" -export FRAMAC_INCLUDES=$(addprefix -I $(call winpath,$(FRAMAC_ROOT_SRCDIR))/,$(FRAMAC_SRC_DIRS) lib) +if [[ ! -d $2 ]]; then + echo "$2 directory doesn't exist" +fi +path=$2 -export PTESTS=$(FRAMAC_ROOT_SRCDIR)/bin/ptests.$(OCAMLBEST)$(EXE) +build () { + build_path=$1 -export FRAMAC_LIB=$(FRAMAC_ROOT_SRCDIR)/lib/fc -export DOC_DIR=$(FRAMAC_ROOT_SRCDIR)/doc/code + find $build_path/frama-c -path "*/api/*" -name "*.ts" -exec rm -f {} \; + ../bin/frama-c -server-tsc -server-tsc-out $build_path + find $build_path/frama-c -path "*/api/*" -name "*.ts" \ + -exec headache \ + -h ../headers/open-source/CEA_LGPL \ + -c ../headers/headache_config.txt {} \;\ + -exec chmod a-w {} \; +} -export PLUGIN_LIB_DIR=$(FRAMAC_ROOT_SRCDIR)/lib/plugins +tmp= +cleanup () { + if [[ -n $tmp ]]; then + rm -rf $tmp + fi +} -export FRAMAC_COMPILED_PLUGINDIR=$(FRAMAC_ROOT_SRCDIR)/lib/plugins +check () { + check_path=$1 + tmp="$(mktemp -d)" + trap cleanup EXIT -export OCAMLPATH:=$(FRAMAC_LIB):$(PLUGIN_LIB_DIR)$(if $(OCAMLPATH),:,)$(OCAMLPATH) -export OCAMLFIND_IGNORE_DUPS_IN:=$(FRAMAC_LIB):$(PLUGIN_LIB_DIR)$(if $(OCAMLFIND_IGNORE_DUPS_IN),:,)$(OCAMLFIND_IGNORE_DUPS_IN) + cp -r $check_path/frama-c $tmp/frama-c + build $tmp + diff -r $check_path/frama-c $tmp/frama-c +} -########################################################################## -# Local Variables: -# mode: makefile -# End: +case "$action" in + "build") build $path ;; + "check") check $path ;; +esac diff --git a/ivette/headers/header_spec.txt b/ivette/headers/header_spec.txt deleted file mode 100644 index 649ed47c9564883ad2bfdc95277c9831e3a661f3..0000000000000000000000000000000000000000 --- a/ivette/headers/header_spec.txt +++ /dev/null @@ -1,214 +0,0 @@ -.babelrc: .ignore -.dome-pkg-app.lock: .ignore -.dome-pkg-dev.lock: .ignore -.eslintignore: .ignore -.eslintrc.js: .ignore -.gitignore: .ignore -CONTRIBUTING.md: .ignore -INSTALL.md: .ignore -Makefile: CEA_LGPL -README.md: .ignore -configure.js: .ignore -distrib.sh: CEA_LGPL -doc/pandoc/href.lua: .ignore -doc/pandoc/index.json: .ignore -doc/pandoc/template.html: .ignore -electron-builder.json: .ignore -electron-webpack.json: .ignore -ivette-macos.sh: CEA_LGPL -package.json: .ignore -sandboxer.js: .ignore -src/dome/.gitignore: .ignore -src/dome/CONTRIBUTING.md: .ignore -src/dome/CONTRIBUTORS.md: .ignore -src/dome/LICENSE.md: .ignore -src/dome/README.md: .ignore -src/dome/doc/README.md: .ignore -src/dome/doc/config.json: .ignore -src/dome/doc/gallery.css: .ignore -src/dome/doc/guides/application.md: .ignore -src/dome/doc/guides/development.md: .ignore -src/dome/doc/guides/dome.md: .ignore -src/dome/doc/guides/glossary.md: .ignore -src/dome/doc/guides/hooks.md: .ignore -src/dome/doc/guides/hotreload.md: .ignore -src/dome/doc/guides/quickstart.md: .ignore -src/dome/doc/guides/styling.md: .ignore -src/dome/doc/icons.js: .ignore -src/dome/doc/iconsmd.js: .ignore -src/dome/doc/template/gallery-head.html: .ignore -src/dome/doc/template/gallery-tail.html: .ignore -src/dome/doc/template/publish.js: .ignore -src/dome/doc/template/static/fonts/OpenSans-Bold-webfont.eot: .ignore -src/dome/doc/template/static/fonts/OpenSans-Bold-webfont.svg: .ignore -src/dome/doc/template/static/fonts/OpenSans-Bold-webfont.woff: .ignore -src/dome/doc/template/static/fonts/OpenSans-BoldItalic-webfont.eot: .ignore -src/dome/doc/template/static/fonts/OpenSans-BoldItalic-webfont.svg: .ignore -src/dome/doc/template/static/fonts/OpenSans-BoldItalic-webfont.woff: .ignore -src/dome/doc/template/static/fonts/OpenSans-Italic-webfont.eot: .ignore -src/dome/doc/template/static/fonts/OpenSans-Italic-webfont.svg: .ignore -src/dome/doc/template/static/fonts/OpenSans-Italic-webfont.woff: .ignore -src/dome/doc/template/static/fonts/OpenSans-Light-webfont.eot: .ignore -src/dome/doc/template/static/fonts/OpenSans-Light-webfont.svg: .ignore -src/dome/doc/template/static/fonts/OpenSans-Light-webfont.woff: .ignore -src/dome/doc/template/static/fonts/OpenSans-LightItalic-webfont.eot: .ignore -src/dome/doc/template/static/fonts/OpenSans-LightItalic-webfont.svg: .ignore -src/dome/doc/template/static/fonts/OpenSans-LightItalic-webfont.woff: .ignore -src/dome/doc/template/static/fonts/OpenSans-Regular-webfont.eot: .ignore -src/dome/doc/template/static/fonts/OpenSans-Regular-webfont.svg: .ignore -src/dome/doc/template/static/fonts/OpenSans-Regular-webfont.woff: .ignore -src/dome/doc/template/static/scripts/linenumber.js: .ignore -src/dome/doc/template/static/scripts/prettify/Apache-License-2.0.txt: .ignore -src/dome/doc/template/static/scripts/prettify/lang-css.js: .ignore -src/dome/doc/template/static/scripts/prettify/prettify.js: .ignore -src/dome/doc/template/static/styles/jsdoc-default.css: .ignore -src/dome/doc/template/static/styles/prettify-jsdoc.css: .ignore -src/dome/doc/template/static/styles/prettify-tomorrow.css: .ignore -src/dome/doc/template/tmpl/augments.tmpl: .ignore -src/dome/doc/template/tmpl/container.tmpl: .ignore -src/dome/doc/template/tmpl/details.tmpl: .ignore -src/dome/doc/template/tmpl/example.tmpl: .ignore -src/dome/doc/template/tmpl/examples.tmpl: .ignore -src/dome/doc/template/tmpl/exceptions.tmpl: .ignore -src/dome/doc/template/tmpl/layout.tmpl: .ignore -src/dome/doc/template/tmpl/mainpage.tmpl: .ignore -src/dome/doc/template/tmpl/members.tmpl: .ignore -src/dome/doc/template/tmpl/method.tmpl: .ignore -src/dome/doc/template/tmpl/params.tmpl: .ignore -src/dome/doc/template/tmpl/properties.tmpl: .ignore -src/dome/doc/template/tmpl/returns.tmpl: .ignore -src/dome/doc/template/tmpl/source.tmpl: .ignore -src/dome/doc/template/tmpl/tutorial.tmpl: .ignore -src/dome/doc/template/tmpl/type.tmpl: .ignore -src/dome/examples/Makefile: CEA_LGPL -src/dome/examples/README.md: .ignore -src/dome/main/dome.ts: CEA_LGPL -src/dome/main/menubar.ts: CEA_LGPL -src/dome/misc/devtools.js: CEA_LGPL -src/dome/misc/register.js: CEA_LGPL -src/dome/misc/system.ts: CEA_LGPL -src/dome/misc/utils.ts: CEA_LGPL -src/dome/renderer/controls/buttons.tsx: CEA_LGPL -src/dome/renderer/controls/displays.tsx: CEA_LGPL -src/dome/renderer/controls/gallery.json: .ignore -src/dome/renderer/controls/icons.tsx: CEA_LGPL -src/dome/renderer/controls/labels.tsx: CEA_LGPL -src/dome/renderer/controls/style.css: .ignore -src/dome/renderer/dark.css: .ignore -src/dome/renderer/data/compare.ts: CEA_LGPL -src/dome/renderer/data/json.ts: CEA_LGPL -src/dome/renderer/data/library.js: CEA_LGPL -src/dome/renderer/data/settings.ts: CEA_LGPL -src/dome/renderer/data/states.ts: CEA_LGPL -src/dome/renderer/dialogs.tsx: CEA_LGPL -src/dome/renderer/dnd.js: CEA_LGPL -src/dome/renderer/dome.tsx: CEA_LGPL -src/dome/renderer/errors.tsx: CEA_LGPL -src/dome/renderer/frame/sidebars.tsx: CEA_LGPL -src/dome/renderer/frame/style.css: .ignore -src/dome/renderer/frame/tabs.tsx: CEA_LGPL -src/dome/renderer/frame/toolbars.tsx: CEA_LGPL -src/dome/renderer/layout/boxes.tsx: CEA_LGPL -src/dome/renderer/layout/dispatch.tsx: CEA_LGPL -src/dome/renderer/layout/forms.tsx: CEA_LGPL -src/dome/renderer/layout/grids.js: CEA_LGPL -src/dome/renderer/layout/qsplit.tsx: CEA_LGPL -src/dome/renderer/layout/splitters.tsx: CEA_LGPL -src/dome/renderer/layout/style.css: .ignore -src/dome/renderer/light.css: .ignore -src/dome/renderer/style.css: .ignore -src/dome/renderer/table/arrays.ts: CEA_LGPL -src/dome/renderer/table/models.ts: CEA_LGPL -src/dome/renderer/table/style.css: .ignore -src/dome/renderer/table/views.tsx: CEA_LGPL -src/dome/renderer/text/buffers.ts: CEA_LGPL -src/dome/renderer/text/dark-code.css: .ignore -src/dome/renderer/text/editors.tsx: CEA_LGPL -src/dome/renderer/text/pages.tsx: CEA_LGPL -src/dome/renderer/text/style.css: .ignore -src/dome/renderer/themes.tsx: CEA_LGPL -src/dome/template/Application.js: CEA_LGPL -src/dome/template/Preferences.js: CEA_LGPL -src/dome/template/babelrc.json: .ignore -src/dome/template/dome-pull.sh: CEA_LGPL -src/dome/template/dome-push.sh: CEA_LGPL -src/dome/template/electron-webpack.json: .ignore -src/dome/template/export.sh: CEA_LGPL -src/dome/template/git-ignore: .ignore -src/dome/template/main.js: CEA_LGPL -src/dome/template/makefile: CEA_LGPL -src/dome/template/makefile.app.packages: CEA_LGPL -src/dome/template/makefile.packages: CEA_LGPL -src/dome/template/package.sh: CEA_LGPL -src/dome/template/renderer.js: CEA_LGPL -src/dome/template/typescript.el: .ignore -src/dome/template/update.sh: CEA_LGPL -src/dome/template/webpack.main.js: CEA_LGPL -src/dome/template/webpack.renderer.js: CEA_LGPL -src/frama-c/api_generator.ml: CEA_LGPL -src/frama-c/client.ts: CEA_LGPL -src/frama-c/client_socket.ts: CEA_LGPL -src/frama-c/client_zmq.ts: CEA_LGPL -src/frama-c/index.tsx: CEA_LGPL -src/frama-c/kernel/ASTinfo.tsx: CEA_LGPL -src/frama-c/kernel/ASTview.tsx: CEA_LGPL -src/frama-c/kernel/Globals.tsx: CEA_LGPL -src/frama-c/kernel/History.tsx: CEA_LGPL -src/frama-c/kernel/Locations.tsx: CEA_LGPL -src/frama-c/kernel/Messages.tsx: CEA_LGPL -src/frama-c/kernel/PivotTable-style.css: .ignore -src/frama-c/kernel/PivotTable.tsx: CEA_LGPL -src/frama-c/kernel/Properties.tsx: CEA_LGPL -src/frama-c/kernel/SourceCode.tsx: CEA_LGPL -src/frama-c/kernel/Status.tsx: CEA_LGPL -src/frama-c/kernel/api/ast/index.ts: CEA_LGPL -src/frama-c/kernel/api/data/index.ts: CEA_LGPL -src/frama-c/kernel/api/project/index.ts: CEA_LGPL -src/frama-c/kernel/api/properties/index.ts: CEA_LGPL -src/frama-c/kernel/api/services/index.ts: CEA_LGPL -src/frama-c/kernel/style.css: .ignore -src/frama-c/menu.ts: CEA_LGPL -src/frama-c/pkg.json: .ignore -src/frama-c/plugins/dive/api/index.ts: CEA_LGPL -src/frama-c/plugins/dive/cytoscape_libs.js: CEA_LGPL -src/frama-c/plugins/dive/index.tsx: CEA_LGPL -src/frama-c/plugins/dive/layouts.json: .ignore -src/frama-c/plugins/dive/pkg.json: .ignore -src/frama-c/plugins/dive/react-cytoscapejs.d.ts: CEA_LGPL -src/frama-c/plugins/dive/style.json: .ignore -src/frama-c/plugins/dive/tippy.css: .ignore -src/frama-c/plugins/eva/Coverage.tsx: CEA_LGPL -src/frama-c/plugins/eva/CoverageMeter.tsx: CEA_LGPL -src/frama-c/plugins/eva/Summary.tsx: CEA_LGPL -src/frama-c/plugins/eva/api/general/index.ts: CEA_LGPL -src/frama-c/plugins/eva/api/values/index.ts: CEA_LGPL -src/frama-c/plugins/eva/index.tsx: CEA_LGPL -src/frama-c/plugins/eva/pkg.json: .ignore -src/frama-c/plugins/eva/style.css: .ignore -src/frama-c/plugins/eva/style_summary.css: .ignore -src/frama-c/plugins/eva/valuetable.tsx: CEA_LGPL -src/frama-c/plugins/pivot/api/general/index.ts: CEA_LGPL -src/frama-c/plugins/studia/api/studia/index.ts: CEA_LGPL -src/frama-c/react-pivottable.d.ts: CEA_LGPL -src/frama-c/richtext.tsx: CEA_LGPL -src/frama-c/server.ts: CEA_LGPL -src/frama-c/states.ts: CEA_LGPL -src/ivette/index.tsx: CEA_LGPL -src/ivette/prefs.tsx: CEA_LGPL -src/main/index.js: CEA_LGPL -src/renderer/Application.tsx: CEA_LGPL -src/renderer/Controller.tsx: CEA_LGPL -src/renderer/Extensions.tsx: CEA_LGPL -src/renderer/Laboratory.tsx: CEA_LGPL -src/renderer/Preferences.tsx: CEA_LGPL -src/renderer/index.js: CEA_LGPL -src/renderer/style.css: .ignore -src/sandbox/README.md: .ignore -src/sandbox/qsplit.tsx: CEA_LGPL -tests/eva-1.i: .ignore -tests/eva-2.i: .ignore -tsconfig.json: .ignore -tsfmt.json: .ignore -webpack.main.js: CEA_LGPL -webpack.renderer.js: CEA_LGPL -yarn.lock: .ignore diff --git a/ivette/src/frama-c/kernel/api/services/index.ts b/ivette/src/frama-c/kernel/api/services/index.ts index 5cd79c35c7b1775bb80693317ee2e978c1fd1576..56868eadf193ee1f571fa2c1ca9d164db8c0d8f5 100644 --- a/ivette/src/frama-c/kernel/api/services/index.ts +++ b/ivette/src/frama-c/kernel/api/services/index.ts @@ -64,15 +64,14 @@ import { tag } from 'frama-c/kernel/api/data'; const getConfig_internal: Server.GetRequest< null, - { pluginpath: string[], libdir: string, datadir: string, version: string } + { pluginpath: string[], datadir: string[], version: string } > = { kind: Server.RqKind.GET, name: 'kernel.services.getConfig', input: Json.jNull, output: Json.jObject({ pluginpath: Json.jList(Json.jString), - libdir: Json.jFail(Json.jString,'String expected'), - datadir: Json.jFail(Json.jString,'String expected'), + datadir: Json.jList(Json.jString), version: Json.jFail(Json.jString,'String expected'), }), signals: [], @@ -80,7 +79,7 @@ const getConfig_internal: Server.GetRequest< /** Frama-C Kernel configuration */ export const getConfig: Server.GetRequest< null, - { pluginpath: string[], libdir: string, datadir: string, version: string } + { pluginpath: string[], datadir: string[], version: string } >= getConfig_internal; const load_internal: Server.SetRequest<string,string | undefined> = { diff --git a/man/frama-c.1.md b/man/frama-c.1.md index 2a0418c66d594290405f52b794ece6680939d094..30fa54a0ea410812b67aff5471f605b6c2ee2ee9 100644 --- a/man/frama-c.1.md +++ b/man/frama-c.1.md @@ -103,10 +103,6 @@ This option has the same per-plugin (and kernel) specializations as Bounds are parsed as OCaml integer constants. By default, all numerical addresses are considered invalid. --add-path *p1[,p2[...,pn]]* -: adds directories *p1* through *pn* to the list of directories in which -plugins are searched. - -add-symbolic-path *p1:n1[,p2:n2[...,pn:nn]]* : replaces each path *pi* with the name *ni* when displaying file locations in messages. @@ -546,10 +542,6 @@ the following variables. FRAMAC_LIB : The directory where kernel's compiled interfaces are installed. -FRAMAC_PLUGIN -: The directory where Frama-C can find standard plugins. -If you wish to have plugins in several places, use **-add-path** instead. - FRAMAC_SHARE : The directory where Frama-C data (e.g. its version of the standard library) is installed. diff --git a/nix/alt-ergo.nix b/nix/alt-ergo.nix new file mode 100644 index 0000000000000000000000000000000000000000..159534d5d6aa17a3e61d07fd862648c0d537607f --- /dev/null +++ b/nix/alt-ergo.nix @@ -0,0 +1,55 @@ +{ callPackage +, fetchzip +, lib +, stdenv +, ocaml +, findlib +, ocplib-simplex +, psmt2-frontend +, lablgtk +, zarith +, menhir +, camlzip +, num +, which +, autoreconfHook +}: + +stdenv.mkDerivation rec { + pname = "alt-ergo"; + version = "2.2.0-free"; + + src = fetchzip { + url = https://alt-ergo.ocamlpro.com/http/alt-ergo-free-2.2.0/alt-ergo-free-2.2.0.tar.gz; + sha256 = "11ffm87vsrii8nyhxhbc9gzjmqkspqv7hpjq7ll9xflll7gpnpkj"; + stripRoot=false; + }; + + nativeBuildInputs = [ + autoreconfHook + which + ]; + + buildInputs = [ + ocaml + findlib + zarith + ocplib-simplex + psmt2-frontend + lablgtk + menhir + ]; + + propagatedBuildInputs = [ camlzip num ]; + + enableParallelBuilding = true; + + configureFlags = [ "--enable-verbose-make" ]; + + meta = { + description = "High-performance theorem prover and SMT solver"; + homepage = "https://alt-ergo.ocamlpro.com/"; + license = lib.licenses.ocamlpro_nc; + maintainers = [ lib.maintainers.thoughtpolice ]; + }; +} diff --git a/nix/api-doc.nix b/nix/api-doc.nix new file mode 100644 index 0000000000000000000000000000000000000000..d83dd85c02edf0cbc41bfa5d34d1e9b674c2d8aa --- /dev/null +++ b/nix/api-doc.nix @@ -0,0 +1,36 @@ +{ lib +, stdenv +, frama-c +, odoc +} : + +stdenv.mkDerivation rec { + pname = "api-doc"; + version = frama-c.version; + slang = frama-c.slang; + + src = frama-c.src; + + nativeBuildInputs = frama-c.nativeBuildInputs; + + buildInputs = frama-c.buildInputs ++ [ + odoc + ]; + + preConfigure = frama-c.preConfigure; + + buildPhase = '' + make config.sed + dune build -j1 @doc + + cp -r _build/default/_doc/_html frama-c-api + + echo ".dummy" > excluded + tar czf frama-c-api.tar.gz -X excluded frama-c-api + ''; + + installPhase = '' + mkdir -p $out + cp frama-c-api.tar.gz $out + ''; +} diff --git a/nix/frama-ci.sh b/nix/build-proxy.sh similarity index 74% rename from nix/frama-ci.sh rename to nix/build-proxy.sh index 5db2f7357c230c6040e64d3d37d1e315c50e9f8a..a71c04d4a67037f3710d491dbd1b3f60012404be 100755 --- a/nix/frama-ci.sh +++ b/nix/build-proxy.sh @@ -1,4 +1,4 @@ -#!/bin/sh -eu +#!/usr/bin/env bash ########################################################################## # # # This file is part of Frama-C. # @@ -21,13 +21,32 @@ # # ########################################################################## -DIR=$(dirname $0) +# OCAML must be set to the right version of OCAML (format: N_MM or N.MM) -export FRAMA_CI_NIX=$DIR/frama-ci.nix -export FRAMA_CI=$(nix-instantiate --eval -E "((import <nixos-20.03> {}).callPackage $FRAMA_CI_NIX { password = \"$TOKEN_FOR_API\";}).src.outPath") +if [[ $# != 1 ]]; +then + cat <<EOF +usage: OCAML=N_MM $0 <nix-target> + $0 <nix-target> run the nix-build command for this target +EOF + exit 2 +fi -FRAMA_CI=${FRAMA_CI#\"} -FRAMA_CI=${FRAMA_CI%\"} +if [ -z ${OCAML+x} ]; then + echo "OCAML variable must be set to a version of OCaml" + exit 2 +fi -export NIX_PATH="nixpkgs=$(eval echo $(nix-instantiate --eval -E "with import $FRAMA_CI/pkgs-ref.nix; url"))" -$FRAMA_CI/compile.sh $@ +# Normalize version for Nix +OCAML=${OCAML/./_} + +OUTOPT="" +if [ ! -z ${OUT+x} ]; then + OUTOPT="-o $OUT" +fi + +if [ -z ${DIR+x} ]; then + DIR="." +fi + +nix-build $OUTOPT $DIR/nix/pkgs.nix -A ocaml-ng.ocamlPackages_$OCAML.$1 diff --git a/nix/camlzip.nix b/nix/camlzip.nix new file mode 100644 index 0000000000000000000000000000000000000000..2750726714bfb9c8817ecd11ad7c9a874a3f5a19 --- /dev/null +++ b/nix/camlzip.nix @@ -0,0 +1,77 @@ +{lib, stdenv, fetchurl, zlib, ocaml, findlib}: + +let + param = + if lib.versionAtLeast ocaml.version "4.07" + then { + version = "1.11"; + url = "https://github.com/xavierleroy/camlzip/archive/rel111.tar.gz"; + sha256 = "0dzdspqp9nzx8wyhclbm68dykvfj6b97c8r7b47dq4qw7vgcbfzz"; + patches = []; + postPatchInit = '' + true + ''; + } else if lib.versionAtLeast ocaml.version "4.02" + then { + version = "1.10"; + url = "https://github.com/xavierleroy/camlzip/archive/rel110.tar.gz"; + sha256 = "X0YcczaQ3lFeJEiTIgjSSZ1zi32KFMtmZsP0FFpyfbI="; + patches = []; + postPatchInit = '' + cp META-zip META-camlzip + echo 'directory="../zip"' >> META-camlzip + ''; + } else { + version = "1.05"; + download_id = "1037"; + url = "http://forge.ocamlcore.org/frs/download.php/${param.download_id}/camlzip-${param.version}.tar.gz"; + sha256 = "930b70c736ab5a7ed1b05220102310a0a2241564786657abe418e834a538d06b"; + patches = [./makefile_1_05.patch]; + postPatchInit = '' + substitute ${./META} META --subst-var-by VERSION "${param.version}" + ''; + }; +in + +stdenv.mkDerivation { + pname = "camlzip"; + version = param.version; + + src = fetchurl { + inherit (param) url; + inherit (param) sha256; + }; + + buildInputs = [ ocaml findlib ]; + + propagatedBuildInputs = [zlib]; + + inherit (param) patches; + + createFindlibDestdir = true; + + postPatch = param.postPatchInit + '' + substituteInPlace Makefile \ + --subst-var-by ZLIB_LIBDIR "${zlib.out}/lib" \ + --subst-var-by ZLIB_INCLUDE "${zlib.dev}/include" + ''; + + buildFlags = [ "all" "allopt" ]; + + postInstall = '' + ln -s $out/lib/ocaml/${ocaml.version}/site-lib/{,caml}zip + ''; + + meta = with lib; { + homepage = "http://cristal.inria.fr/~xleroy/software.html#camlzip"; + description = "A library for handling ZIP and GZIP files in OCaml"; + longDescription = '' + This Objective Caml library provides easy access to compressed files in + ZIP and GZIP format, as well as to Java JAR files. It provides functions + for reading from and writing to compressed files in these formats. + ''; + license = "LGPL+linking exceptions"; + platforms = ocaml.meta.platforms or []; + maintainers = with maintainers; [ maggesi ]; + }; +} diff --git a/nix/default-config-tests.nix b/nix/default-config-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..5ba96c479ab83caf4cfae47b0318d0e517544c78 --- /dev/null +++ b/nix/default-config-tests.nix @@ -0,0 +1,9 @@ +{ mk_tests } : + +mk_tests { + tests-name = "default-config-tests"; + tests-command = '' + dune exec -- frama-c-ptests tests src/plugins/*/tests + dune build -j1 --display short @ptests_config + ''; +} diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index 7d5b49d4dfa1f65a0c7064a79a2220fda842ee90..0000000000000000000000000000000000000000 --- a/nix/default.nix +++ /dev/null @@ -1,396 +0,0 @@ -# paramaterised derivation with dependencies injected (callPackage style) -{ pkgs, stdenv, src ? ../., opam2nix, ocaml ? pkgs.ocaml-ng.ocamlPackages_4_08.ocaml, plugins ? { } }: - -let mydir = builtins.getEnv("PWD"); - mk-opam-selection = { name, opamSrc?{}, ... }: { - inherit ocaml; - src = opamSrc; - selection = "${mydir}/${name}-${ocaml.version}-opam-selection.nix"; - }; - opamPackages = - [ "ocamlfind=1.9.3" "zarith" "ocamlgraph" "yojson=1.7.0" "zmq" - "ppx_import" "ppx_deriving" "ppx_deriving_yojson" - "coq=8.13.0" "alt-ergo=2.2.0" - "why3=1.5.0" "why3-coq=1.5.0" - "menhir=20211012" - "easy-format=1.3.2" - "biniou=1.2.1" - ]; - # only pure nix packages. See mk_deriv below for adding opam2nix packages - mk_buildInputs = { nixPackages ? [] } : - [ pkgs.gnugrep pkgs.gnused pkgs.autoconf pkgs.gnumake pkgs.gcc pkgs.ncurses pkgs.time pkgs.python3 pkgs.perl pkgs.file pkgs.which pkgs.dos2unix] ++ nixPackages; - # Extends the call to stdenv.mkDerivation with parameters common for all - # frama-c derivations - mk_deriv = args: - let my_opam_packages = - if args?opamPackages then - opamPackages ++ args.opamPackages - else opamPackages - ; - opam-selection = mk-opam-selection args; - buildInputs = args.buildInputs ++ opam2nix.buildInputs opam-selection; - in - stdenv.mkDerivation ( - args // - { - # Disable Nix's GCC hardening - hardeningDisable = [ "all" ]; - inherit buildInputs; - }) - // - { gen-opam-selection = - opam2nix.resolve opam-selection my_opam_packages; } - ; -in - -pkgs.lib.makeExtensible -(self: { - inherit src mk_buildInputs opamPackages mk_deriv; - buildInputs = mk_buildInputs {}; - installed = self.main.out; - main = mk_deriv { - name = "frama-c"; - src = self.src; - buildInputs =self.buildInputs; - outputs = [ "out" "build_dir" ]; - postPatch = '' - patchShebangs . - ''; - configurePhase = '' - unset CC - autoconf - ./configure --prefix=$out - ''; - buildPhase = '' - make -j 4 - ''; - installPhase = '' - make install - mkdir -p $build_dir - tar -cf $build_dir/dir.tar . - pwd > $build_dir/old_pwd - ''; - setupHook = pkgs.writeText "setupHook.sh" '' - addFramaCPath () { - if test -d "$1/lib/frama-c/plugins"; then - export FRAMAC_PLUGIN="''${FRAMAC_PLUGIN:-}''${FRAMAC_PLUGIN:+:}$1/lib/frama-c/plugins" - export OCAMLPATH="''${OCAMLPATH:-}''${OCAMLPATH:+:}$1/lib/frama-c/plugins" - fi - - if test -d "$1/lib/frama-c"; then - export OCAMLPATH="''${OCAMLPATH:-}''${OCAMLPATH:+:}$1/lib/frama-c" - fi - - if test -d "$1/share/frama-c/"; then - export FRAMAC_EXTRA_SHARE="''${FRAMAC_EXTRA_SHARE:-}''${FRAMAC_EXTRA_SHARE:+:}$1/share/frama-c" - fi - - } - - addEnvHooks "$targetOffset" addFramaCPath - ''; - }; - - lint = mk_deriv { - name = "frama-c-lint"; - src = self.src; - opamPackages = [ "ocp-indent=1.8.1" "headache=1.05"]; - buildInputs = - self.mk_buildInputs { nixPackages = [ pkgs.bc pkgs.clang_10 ]; }; - outputs = [ "out" ]; - postPatch = '' - patchShebangs . - ''; - configurePhase = '' - unset CC - autoconf - ./configure --prefix=$out - ''; - buildPhase = '' - make lint - make stats-lint - STRICT_HEADERS=yes make check-headers - ''; - installPhase = '' - true - ''; - }; - - doc = mk_deriv { - name = "frama-c-doc"; - buildInputs = self.buildInputs; - build_dir = self.main.build_dir; - src = self.main.build_dir + "/dir.tar"; - sourceRoot = "."; - postPatch = '' - find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; - ''; - configurePhase = '' - true - ''; - buildPhase = '' - make doc - ''; - installPhase = '' - true - ''; - } // { other-opam-selection = "main";}; - - tests = mk_deriv { - name = "frama-c-test"; - buildInputs = self.buildInputs; - build_dir = self.main.build_dir; - src = self.main.build_dir + "/dir.tar"; - sourceRoot = "."; - postUnpack = '' - find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; - ''; - configurePhase = '' - true - ''; - buildPhase = '' - make clean_share_link - make create_share_link - make tests -j4 PTESTS_OPTS="-error-code -j 4" - ''; - installPhase = '' - true - ''; - } // { other-opam-selection = "main"; }; - - build-distrib-tarball = mk_deriv { - name = "frama-c-build-distrib-tarball"; - src = self.src; - buildInputs = self.buildInputs; - opamPackages = [ "headache=1.05" ]; - outputs = [ "out" ]; - configurePhase = '' - unset CC - autoconf - ./configure --prefix=$out - ''; - buildPhase = '' - make DISTRIB="frama-c-archive" src-distrib - tar -zcf frama-c-tests-archive.tar.gz tests src/plugins/*/tests - ''; - installPhase = '' - tar -C $out --strip-components=1 -xzf frama-c-archive.tar.gz - tar -C $out -xzf frama-c-tests-archive.tar.gz - ''; - }; - - build-from-distrib-tarball = mk_deriv { - name = "frama-c-build-from-distrib-tarball"; - doCheck = true; - buildInputs = self.buildInputs; - opamPackages = self.build-distrib-tarball.opamPackages; - src = self.build-distrib-tarball.out ; - outputs = [ "out" ]; - postPatch = '' - patchShebangs . - ''; - configurePhase = '' - unset CC - autoconf - ./configure --prefix=$out - ''; - buildPhase = '' - make -j 4 - ''; - checkPhase = '' - make clean_share_link - make create_share_link - make tests -j4 PTESTS_OPTS="-error-code -j 4" - ''; - installPhase = '' - true - ''; - } // { other-opam-selection = "build-distrib-tarball"; }; - - wp-qualif = mk_deriv { - name = "frama-c-wp-qualif"; - buildInputs = self.mk_buildInputs { }; - build_dir = self.main.build_dir; - src = self.main.build_dir + "/dir.tar"; - sourceRoot = "."; - postUnpack = '' - find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; - ''; - configurePhase = '' - true - ''; - buildPhase = '' - make clean_share_link - make create_share_link - mkdir home - HOME=$(pwd)/home - why3 config detect - make src/plugins/wp/tests/test_config_qualif - export FRAMAC_WP_CACHE=replay - export FRAMAC_WP_CACHEDIR=${plugins.wp-cache.src} - bin/ptests.opt -error-code -config qualif src/plugins/wp/tests - ''; - installPhase = '' - true - ''; - } // { other-opam-selection = "main"; }; - - aorai-prove = mk_deriv { - name = "frama-c-aorai-prove"; - buildInputs = self.mk_buildInputs { }; - build_dir = self.main.build_dir; - src = self.main.build_dir + "/dir.tar"; - sourceRoot = "."; - postUnpack = '' - find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "test_config*" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; - ''; - configurePhase = '' - true - ''; - - buildPhase = '' - make clean_share_link - make create_share_link - mkdir home - HOME=$(pwd)/home - why3 config detect - make src/plugins/aorai/tests/ptests_config - export AORAI_WP_CACHE=replay - export AORAI_WP_CACHEDIR=${plugins.wp-cache.src} - make PTESTS_OPTS="-error-code" aorai-test-prove - ''; - - installPhase = '' - true - ''; - } // { other-opam-selection = "main"; }; - - eva-tests = mk_deriv { - name = "frama-c-eva-tests"; - buildInputs = self.mk_buildInputs { }; - build_dir = self.main.build_dir; - src = self.main.build_dir + "/dir.tar"; - sourceRoot = "."; - postUnpack = '' - find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; - ''; - configurePhase = '' - true - ''; - buildPhase = '' - make clean_share_link - make create_share_link - export CONFIGS="equality bitwise symblocs gauges octagon" - src/plugins/value/vtests.sh -j 4 -error-code - ''; - installPhase = '' - true - ''; - } // { other-opam-selection = "main"; }; - - e-acsl-tests-dev = mk_deriv { - name = "frama-c-e-acsl-tests-dev"; - buildInputs = self.mk_buildInputs { nixPackages = [ pkgs.gmp pkgs.getopt ]; }; - build_dir = self.main.build_dir; - src = self.main.build_dir + "/dir.tar"; - sourceRoot = "."; - postUnpack = '' - find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \; - ''; - configurePhase = '' - true - ''; - buildPhase = '' - make clean_share_link - make create_share_link - make E_ACSL_TESTS PTESTS_OPTS="-error-code" DEV=yes - ''; - installPhase = '' - true - ''; - } // { other-opam-selection = "main"; }; - - internal = mk_deriv { - name = "frama-c-internal"; - src = self.src; - opamPackages = [ "xml-light" ]; - buildInputs = - self.mk_buildInputs - { nixPackages = - [ pkgs.getopt pkgs.libxslt pkgs.libxml2 pkgs.autoPatchelfHook - pkgs.swiProlog stdenv.cc.cc.lib ]; - }; - genassigns_src = plugins.genassigns.src; - frama_clang_src = plugins.frama-clang.src; - pathcrawler_src = plugins.pathcrawler.src; - mthread_src = plugins.mthread.src; - caveat_importer_src = plugins.caveat-importer.src; - acsl_importer_src = plugins.acsl-importer.src; - volatile_src = plugins.volatile.src; - security_src = plugins.security.src; - context_from_precondition_src = plugins.context-from-precondition.src; - metacsl_src = plugins.meta.src; - linea_cabs_src = plugins.linea-cabs.src; - postPatch = '' - patchShebangs . - ''; - postUnpack = '' - cp -r --preserve=mode "$genassigns_src" "$sourceRoot/src/plugins/genassigns" - chmod -R u+w -- "$sourceRoot/src/plugins/genassigns" - # cp -r --preserve=mode "$frama_clang_src" "$sourceRoot/src/plugins/frama-clang" - # chmod -R u+w -- "$sourceRoot/src/plugins/frama-clang" - cp -r --preserve=mode "$pathcrawler_src" "$sourceRoot/src/plugins/pathcrawler" - chmod -R u+w -- "$sourceRoot/src/plugins/pathcrawler" - cp -r --preserve=mode "$mthread_src" "$sourceRoot/src/plugins/mthread" - chmod -R u+w -- "$sourceRoot/src/plugins/mthread" - cp -r --preserve=mode "$caveat_importer_src" "$sourceRoot/src/plugins/caveat-importer" - chmod -R u+w -- "$sourceRoot/src/plugins/caveat-importer" - cp -r --preserve=mode "$volatile_src" "$sourceRoot/src/plugins/volatile" - chmod -R u+w -- "$sourceRoot/src/plugins/volatile" - cp -r --preserve=mode "$acsl_importer_src" "$sourceRoot/src/plugins/acsl-importer" - chmod -R u+w -- "$sourceRoot/src/plugins/acsl-importer" - echo IN_FRAMA_CI=yes > "$sourceRoot/in_frama_ci" - cp -r --preserve=mode "$context_from_precondition_src" "$sourceRoot/src/plugins/context-from-precondition" - chmod -R u+w -- "$sourceRoot/src/plugins/context-from-precondition" - cp -r --preserve=mode "$linea_cabs_src" "$sourceRoot/src/plugins/linea-cabs" - chmod -R u+w -- "$sourceRoot/src/plugins/linea-cabs" - cp -r --preserve=mode "$security_src" "$sourceRoot/src/plugins/security" - chmod -R u+w -- "$sourceRoot/src/plugins/security" - ''; - - configurePhase = '' - unset CC - autoconf - ./configure --prefix=$out - ''; - buildPhase = '' - make unpack-eclipse - sed -i src/plugins/pathcrawler/extern/eclipseCLP/RUNME -e "s/chmod 2755/chmod 755/g" - rm src/plugins/pathcrawler/extern/eclipseCLP/lib/x86_64_linux/dbi_mysql.so - rm src/plugins/pathcrawler/extern/eclipseCLP/lib/x86_64_linux/ic.so - rm src/plugins/pathcrawler/extern/eclipseCLP/lib/x86_64_linux/bitmap.so - rm -fr src/plugins/pathcrawler/extern/eclipseCLP/lib/i386_linux - rm src/plugins/pathcrawler/src/generator/COLIBRI/float_util_sparc_sunos5.so - rm src/plugins/pathcrawler/src/generator/COLIBRI/float_util_i386_linux.so.* - rm src/plugins/pathcrawler/share/bin/float_util_sparc_sunos5.so - find src/plugins/pathcrawler -name '*_i386_*.so' -delete - autoPatchelf src/plugins/pathcrawler/ - make -j 4 - ln -sr src/plugins/pathcrawler/share share/pc - # Setup Why3 - mkdir home - HOME=$(pwd)/home - why3 config detect - # Setup WP related - export CAVEAT_IMPORTER_NIX_MODE=yes - export GENASSIGNS_NIX_MODE=yes - export FRAMAC_WP_CACHE=replay - export FRAMAC_WP_CACHEDIR=${plugins.wp-cache.src} - make tests -j4 PTESTS_OPTS="-error-code -j 4" - ''; - installPhase = '' - make install - ''; - }; - -}) diff --git a/nix/e-acsl-tests.nix b/nix/e-acsl-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..7128d8d4a33a0b740c9fc78be436b4db41c10ae5 --- /dev/null +++ b/nix/e-acsl-tests.nix @@ -0,0 +1,9 @@ +{ mk_tests } : + +mk_tests { + tests-name = "e-acsl-tests"; + tests-command = '' + dune exec -- frama-c-ptests tests src/plugins/e-acsl/tests + dune build -j1 --display short @src/plugins/e-acsl/tests/ptests + ''; +} diff --git a/nix/eva-tests.nix b/nix/eva-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..41a12edd7b5734107ed0b9e29af3ea6f060fe618 --- /dev/null +++ b/nix/eva-tests.nix @@ -0,0 +1,15 @@ +{ mk_tests, config } : + +let eva-tests = "eva-tests" + (if config == "" then "" else "-" + config); in +let ptests = "ptests_config" + (if config == "" then "" else "_" + config) ; in +let tbuiltins = " @tests/builtins/" + ptests ; in +let tfloat = " @tests/float/" + ptests ; in +let tidct = " @tests/idct/" + ptests ; in +let tvalue = " @tests/value/" + ptests ; in + +mk_tests { + tests-name = eva-tests ; + tests-command = '' + dune exec -- frama-c-ptests tests + dune build -j1 --display short'' + tbuiltins + tfloat + tidct + tvalue + "\n" ; +} diff --git a/nix/external-plugin-ci.sh b/nix/external-plugin-ci.sh new file mode 100755 index 0000000000000000000000000000000000000000..fe3219be89b8bb107f6e82f7df4158ed590425ca --- /dev/null +++ b/nix/external-plugin-ci.sh @@ -0,0 +1,131 @@ +#!/usr/bin/env bash +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +# DEFAULT variable can be configured to indicate reference branch when the +# current branch does not exist in a dependency or in Frama-C. +# +# OCAML must be set to the right version of OCAML (format: N_MM or N.MM) + +set -euxo pipefail + +if [[ $# != 1 ]]; +then + cat <<EOF +usage: OCAML=N_MM $0 <plugin> + $0 <plugin_name> run CI on this plugin +EOF + exit 2 +fi + +if [ -z ${OCAML+x} ]; then + echo "OCAML variable must be set to a version of OCaml" + exit 2 +fi + +# Normalize version for Nix +OCAML=${OCAML/./_} + +DEFAULT=${DEFAULT:-master} + +# prints +# - "$2" if it is a branch name in remote $1, +# - else "$DEFAULT" if it is set and $DEFAULT is a branch name in remote $1, +# - else master +get_matching_branch () { + if git ls-remote --quiet --exit-code "$1" "$2" >/dev/null 2>/dev/null; + then echo "$2" + elif git ls-remote --quiet --exit-code "$1" "$DEFAULT" >/dev/null 2>/dev/null; + then echo "$DEFAULT" + else echo master + fi +} + +# fc-dir nix-dir +fc_dir="$(dirname "$(dirname "$(readlink -f "$0")")")" + +git_current_branch="$(git branch --show-current)" +: "${git_current_branch:=${CI_COMMIT_BRANCH:-}}" +echo "currently on branch $git_current_branch" +[[ -n $git_current_branch ]] +plugin_repo= + +cleanup () { + if [[ -n $plugin_repo ]]; + then rm -rf "$plugin_repo" + fi +} + +trap cleanup EXIT + +OPTS="--arg frama-c-repo $fc_dir" + +plugin=$1 + +cd "$(mktemp -d)" + +# the hash of the derivation depends on the directory name +mkdir "$plugin" +cd "$plugin" +plugin_repo="$(readlink -f .)" +plugin_url="git@git.frama-c.com:frama-c/$plugin.git" + +plugin_branch="$(get_matching_branch "$plugin_url" "$git_current_branch")" +echo "using branch $plugin_branch of $plugin_url" +git clone --depth=1 --branch="$plugin_branch" "$plugin_url" . + +declare -A deps=( ) +declare -A dirs=( ) + +if [[ -f "./nix/dependencies" ]]; then + while read -r var value; do + deps[$var]=$value + done < "./nix/dependencies" + + for repo in ${!deps[@]}; do + # the hash of the derivation depends on the directory name + mkdir "../$repo" + directory="$(readlink -f ../$repo)" + dirs[$repo]=$directory + + url=${deps[$repo]} + branch="$(get_matching_branch "$url" "$git_current_branch")" + echo "using branch $branch of $repo at $directory" + # clone + git clone --depth=1 --branch="$branch" "$url" "$directory" + + OPTS="$OPTS --arg $repo $directory" + done +fi + +# run the build +nix-build --no-out-link "./nix/pkgs.nix" $OPTS -A ocaml-ng.ocamlPackages_$OCAML."$plugin" + +cd "$fc_dir" + +for repo in ${!dirs[@]}; do + if [[ -n ${dirs[$repo]} ]]; + then rm -rf "${dirs[$repo]}" + fi +done + +rm -rf "$plugin_repo" diff --git a/nix/external-plugins.txt b/nix/external-plugins.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb844b7d95041148e639ebc1fc3577afeca5c7e1 --- /dev/null +++ b/nix/external-plugins.txt @@ -0,0 +1,9 @@ +acsl-importer git@git.frama-c.com:frama-c/acsl-importer.git +caveat-importer git@git.frama-c.com:frama-c/caveat-importer.git +context-from-precondition git@git.frama-c.com:frama-c/context-from-precondition.git +genassigns git@git.frama-c.com:frama-c/genassigns.git +linea-cabs git@git.frama-c.com:frama-c/linea-cabs.git +meta git@git.frama-c.com:frama-c/meta.git +mthread git@git.frama-c.com:frama-c/mthread.git +security git@git.frama-c.com:frama-c/security.git +volatile git@git.frama-c.com:frama-c/volatile.git diff --git a/nix/frama-c-checkers-shell.nix b/nix/frama-c-checkers-shell.nix new file mode 100644 index 0000000000000000000000000000000000000000..a9716f262e3ca2358d850ac87a35e836ed6fc34b --- /dev/null +++ b/nix/frama-c-checkers-shell.nix @@ -0,0 +1,22 @@ +{ lib +, stdenv +, autoconf +, clang_10 +, frama-c-hdrck +, git +, gnumake +, headache +, ocp-indent +} : +stdenv.mkDerivation rec { + name = "frama-c-checkers-shell"; + buildInputs = [ + autoconf + clang_10 + frama-c-hdrck + git + gnumake + headache + ocp-indent + ]; +} diff --git a/nix/frama-c-hdrck.nix b/nix/frama-c-hdrck.nix new file mode 100644 index 0000000000000000000000000000000000000000..e634a7742dc2b1127a1cac186cc3b8db11d4cee8 --- /dev/null +++ b/nix/frama-c-hdrck.nix @@ -0,0 +1,34 @@ +{ lib +, stdenv +, dune_3 +, gitignoreSource +, ocaml +} : + +stdenv.mkDerivation rec { + pname = "frama-c-hdrck"; + version = + lib.strings.replaceStrings ["~"] ["-"] + (lib.strings.removeSuffix "\n" + (builtins.readFile ../VERSION)); + slang = lib.strings.removeSuffix "\n" (builtins.readFile ../VERSION_CODENAME); + + src = gitignoreSource ./../tools/hdrck ; + + buildInputs = [ + dune_3 + ocaml + ]; + + configurePhase = '' + true + ''; + + buildPhase = '' + dune build --root . + ''; + + installPhase = '' + dune install --prefix $out --root . + ''; +} diff --git a/nix/frama-c.nix b/nix/frama-c.nix new file mode 100644 index 0000000000000000000000000000000000000000..5616e9944a00658218741c726858d31c2a0befac --- /dev/null +++ b/nix/frama-c.nix @@ -0,0 +1,164 @@ +# Nix +{ lib +, stdenvNoCC # for E-ACSL +, fetchurl +, gitignoreSource +, makeWrapper +, nix-gitignore +, wrapGAppsHook +, writeText +# Generic +, autoconf +, findlib +# Frama-C build +, apron +, camlzip +, dune_3 +, dune-site +, gcc9 +, graphviz +, lablgtk3 +, lablgtk3-sourceview3 +, ltl2ba +, menhirLib +, mlmpfr +, ocaml +, ocamlgraph +, ocamlgraph_gtk +, ppx_deriving +, ppx_deriving_yojson +, ppx_import +, yojson +, which +, why3 +, zarith +, zmq +# Frama-C extra (other targets do not reconfigure) +, dos2unix +, doxygen +, python3 +, release_mode ? false +}: + +# We do not use buildDunePackage because Frama-C still uses a Makefile to build +# some files and prepare some information before starting dune. +stdenvNoCC.mkDerivation rec { + pname = "frama-c"; + version = + lib.strings.replaceStrings ["~"] ["-"] + (lib.strings.removeSuffix "\n" + (builtins.readFile ../VERSION)); + slang = lib.strings.removeSuffix "\n" (builtins.readFile ../VERSION_CODENAME); + + src = + if release_mode + then ./.. + else gitignoreSource ./.. ; + + nativeBuildInputs = [ + autoconf + which + wrapGAppsHook + ]; + + buildInputs = [ + apron + camlzip + dune_3 + dune-site + findlib + gcc9 + graphviz + lablgtk3 + lablgtk3-sourceview3 + ltl2ba + menhirLib + mlmpfr + ocaml + ocamlgraph + ocamlgraph_gtk + ppx_deriving + ppx_deriving_yojson + ppx_import + yojson + which + why3 + zarith + zmq + # For other CI targets + dos2unix + doxygen + python3 + ]; + + outputs = [ "out" "build_dir" ]; + + preConfigure = (if release_mode then "" else "autoconf \n") + '' + patchShebangs src/plugins/value/gen-api.sh + chmod +x src/plugins/value/gen-api.sh + ''; + + # Do not use default parallel building, but allow 2 cores for Frama-C build + enableParallelBuilding = false; + dune_opt = if release_mode then "--release" else "" ; + + buildPhase = '' + make config.sed + dune build -j2 --display short $release_mode @install + make tools/ptests/ptests.exe + make tools/ptests/wtests.exe + ''; + + installFlags = [ + "FRAMAC_INSTALLDIR=$(out)" + ]; + + # Simpler for our test target + # We export the build directory to avoid rebuilding Frama-C without having to + # manage complex dependencies. + postInstall = '' + mkdir -p $build_dir + tar -cf $build_dir/dir.tar . + ''; + + # Required so that tests of external plugins can be excuted + postFixup = '' + cp -r $out/share/doc $out/doc + ''; + + # Allow loading of external Frama-C plugins + setupHook = writeText "setupHook.sh" '' + has_dirs() { + for f do + [ -d "$f" ] && return + done + false + } + + addFramaCPath () { + if test -d "''$1/lib/frama-c/plugins"; then + export FRAMAC_PLUGIN="''${FRAMAC_PLUGIN-}''${FRAMAC_PLUGIN:+:}''$1/lib/frama-c/plugins" + export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/frama-c/plugins" + fi + + if has_dirs ''$1/lib/frama-c-*; then + export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib" + export DUNE_DIR_LOCATIONS="''${DUNE_DIR_LOCATIONS-}''${DUNE_DIR_LOCATIONS:+:}frama-c:lib:''$1/lib/frama-c" + fi + + if test -d "''$1/share/frama-c/"; then + export FRAMAC_EXTRA_SHARE="''${FRAMAC_EXTRA_SHARE-}''${FRAMAC_EXTRA_SHARE:+:}''$1/share/frama-c" + fi + + } + + addEnvHooks "$targetOffset" addFramaCPath + ''; + + meta = { + description = "An extensible and collaborative platform dedicated to source-code analysis of C software"; + homepage = "http://frama-c.com/"; + license = lib.licenses.lgpl21; + platforms = lib.platforms.unix; + }; +} diff --git a/nix/frama-ci.nix b/nix/frama-ci.nix deleted file mode 100644 index eccc033949bb7b58902bedfcbf60a6d6555b59eb..0000000000000000000000000000000000000000 --- a/nix/frama-ci.nix +++ /dev/null @@ -1,16 +0,0 @@ -#To copy in other repository -{ password}: - -let - src = builtins.fetchGit { - "url" = "https://bobot:${password}@git.frama-c.com/frama-c/Frama-CI.git"; - "name" = "Frama-CI"; - "rev" = "ceea8c97fc127db159bfd92919eae404e2e67f18"; - "ref" = "master"; - }; - pkgs = import "${src}/pkgs.nix" {}; - in - { - src = src; - compiled = pkgs.callPackage "${src}/compile.nix" { inherit pkgs; }; - } diff --git a/nix/full-tests.nix b/nix/full-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..511d04ce19ef5fc2bff7198e2e1e4f8b7d19397a --- /dev/null +++ b/nix/full-tests.nix @@ -0,0 +1,12 @@ +# Not meant to be used in CI: uses maximum parallelism + +{ mk_tests } : + +mk_tests { + tests-name = "full-tests"; + tests-command = '' + dune exec -- frama-c-ptests tests src/plugins/*/tests + dune build @ptests + ''; + has-wp-proofs = true ; +} diff --git a/nix/headache.nix b/nix/headache.nix new file mode 100644 index 0000000000000000000000000000000000000000..258016810ddcf07992f3c430e46afd05c8b05135 --- /dev/null +++ b/nix/headache.nix @@ -0,0 +1,32 @@ +{ lib +, camomile +, fetchFromGitHub +, buildDunePackage +, cmdliner +}: + +buildDunePackage rec { + version = "v1.05"; + pname = "headache"; + + src = fetchFromGitHub { + owner = "Frama-C"; + repo = pname; + rev = version; + sha256 = "036lrcxh23j2rrj91wlgq9piyyv1vh82wjy63z1l1ggkkhfs7d8r"; + }; + + useDune2 = true; + + buildInputs = [ + cmdliner + camomile + ]; + + meta = with lib; { + homepage = https://github.com/Frama-C/headache/; + description = "Automatic generation of files headers"; + license = licenses.gpl2; + maintainers = [ ]; + }; +} diff --git a/nix/internal-tests.nix b/nix/internal-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..2df01e54b1631c95093e47581045eb01816bb029 --- /dev/null +++ b/nix/internal-tests.nix @@ -0,0 +1,146 @@ +# Note: plugins are loaded from 'internal-tests.sh' + +# Nix +{ lib +, stdenvNoCC # for E-ACSL +, fetchurl +, gitignoreSource +, makeWrapper +, nix-gitignore +, wrapGAppsHook +, writeText +# Generic +, autoconf +, findlib +# Frama-C build +, apron +, camlzip +, dune_3 +, dune-site +, gcc9 +, graphviz +, lablgtk3 +, lablgtk3-sourceview3 +, ltl2ba +, menhirLib +, mlmpfr +, ocaml +, ocamlgraph +, ppx_deriving +, ppx_deriving_yojson +, ppx_import +, yojson +, which +, why3 +, zarith +, zmq +# Frama-C tests +, alt-ergo +, dos2unix +, doxygen +, perl +, pkgs +, python3 +, swiProlog +, time +}: + +# We do not use buildDunePackage because Frama-C still uses a Makefile to build +# some files and prepare some information before starting dune. +stdenvNoCC.mkDerivation rec { + pname = "frama-c-internal-tests"; + version = + lib.strings.replaceStrings ["~"] ["-"] + (lib.strings.removeSuffix "\n" + (builtins.readFile ../VERSION)); + slang = lib.strings.removeSuffix "\n" (builtins.readFile ../VERSION_CODENAME); + + src = gitignoreSource ./..; + + nativeBuildInputs = [ + autoconf + which + wrapGAppsHook + ]; + + buildInputs = [ + apron + alt-ergo + camlzip + dune_3 + dune-site + findlib + gcc9 + graphviz + lablgtk3 + lablgtk3-sourceview3 + ltl2ba + menhirLib + mlmpfr + ocaml + ocamlgraph + ppx_deriving + ppx_deriving_yojson + ppx_import + yojson + which + why3 + zarith + zmq + # Tests + alt-ergo + dos2unix + doxygen + perl + pkgs.getopt + python3 + swiProlog + time + ]; + + outputs = [ "out" ]; + + preConfigure = '' + autoconf + patchShebangs src/plugins/value/gen-api.sh + chmod +x src/plugins/value/gen-api.sh + ''; + + # Do not use default parallel building, but allow 2 cores for Frama-C build + enableParallelBuilding = false; + buildPhase = '' + make config.sed + dune build -j2 --display short @install + make tools/ptests/ptests.exe + make tools/ptests/wtests.exe + ''; + + wp_cache = fetchGit "git@git.frama-c.com:frama-c/wp-cache.git"; + + doCheck = true; + preCheck = '' + patchShebangs . + mkdir home + HOME=$(pwd)/home + why3 config detect + export FRAMAC_WP_CACHE=offline + export FRAMAC_WP_CACHEDIR=$wp_cache + ''; + + checkPhase = '' + runHook preCheck + dune exec -- frama-c-ptests tests src/plugins/*/tests + dune build -j1 --display short @ptests_config + ''; + + installFlags = [ + "FRAMAC_INSTALLDIR=$(out)" + ]; + + meta = { + description = "An extensible and collaborative platform dedicated to source-code analysis of C software"; + homepage = "http://frama-c.com/"; + license = lib.licenses.lgpl21; + platforms = lib.platforms.unix; + }; +} diff --git a/nix/internal-tests.sh b/nix/internal-tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..aca2f3e814cb73d6244d780cbbb52a8cc7d6b293 --- /dev/null +++ b/nix/internal-tests.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +# DEFAULT variable can be configured to indicate reference branch when the +# current branch does not exist in a plugin. +# +# OCAML must be set to the right version of OCAML (format: N_MM or N.MM) + +set -euxo pipefail + +if [ -z ${OCAML+x} ]; then + echo "OCAML variable must be set to a version of OCaml" + exit 2 +fi + +# Normalize version for Nix +OCAML=${OCAML/./_} + +DEFAULT=${DEFAULT:-master} + +# prints +# - "$2" if it is a branch name in remote $1, +# - else "$DEFAULT" if it is set and $DEFAULT is a branch name in remote $1, +# - else master +get_matching_branch () { + if git ls-remote --quiet --exit-code "$1" "$2" >/dev/null 2>/dev/null; + then echo "$2" + elif git ls-remote --quiet --exit-code "$1" "$DEFAULT" >/dev/null 2>/dev/null; + then echo "$DEFAULT" + else echo master + fi +} + +# fc-dir nix-dir +fc_dir="$(dirname "$(dirname "$(readlink -f "$0")")")" + +git_current_branch="$(git branch --show-current)" +: "${git_current_branch:=${CI_COMMIT_BRANCH:-}}" +echo "currently on branch $git_current_branch" + +temporary="$(mktemp -d)" +callsite="$(pwd)" + +cleanup () { + cd $callsite + if [[ -n $temporary ]]; + then rm -rf $temporary + fi + git worktree prune +} + +trap cleanup EXIT + +git worktree add $temporary $(git rev-parse HEAD) +cd $temporary + +declare -A plugins=( ) + +if [[ ! -f "./nix/external-plugins.txt" ]]; then + echo "NO ./nix/external-plugins.txt FOUND!" + exit 2 +fi + +while read -r var value; do + plugins[$var]=$value +done < "./nix/external-plugins.txt" + +for plugin in ${!plugins[@]}; do + repo=${plugins[$plugin]} + branch="$(get_matching_branch "$repo" "$git_current_branch")" + git clone --depth=1 --branch="$branch" "$repo" "src/plugins/$plugin" +done + +nix-build --no-out-link "./nix/pkgs.nix" -A ocaml-ng.ocamlPackages_$OCAML.internal-tests diff --git a/nix/kernel-tests.nix b/nix/kernel-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..03b05e9c2ab553a727c28a2e1badb52b57b21e7d --- /dev/null +++ b/nix/kernel-tests.nix @@ -0,0 +1,19 @@ +{ mk_tests } : + +mk_tests { + tests-name = "kernel-tests"; + tests-command = '' + dune exec -- frama-c-ptests tests + dune build -j1 --display short \ + @tests/cil/ptests \ + @tests/compliance/ptests \ + @tests/jcdb/ptests \ + @tests/libc/ptests \ + @tests/misc/ptests \ + @tests/pretty_printing/ptests \ + @tests/saveload/ptests \ + @tests/spec/ptests \ + @tests/syntax/ptests \ + @tests/test/ptests + ''; +} diff --git a/nix/lint.nix b/nix/lint.nix new file mode 100644 index 0000000000000000000000000000000000000000..6f79ef2ff81350c5d295e72f36ac5ed7fc57b125 --- /dev/null +++ b/nix/lint.nix @@ -0,0 +1,41 @@ +# TODO: +# - enable lint E-ACSL C files +# - enable check-headers + +{ lib +, stdenv +, bc +# , clang_10 +, frama-c +# , headache +, ocp-indent +} : + +stdenv.mkDerivation rec { + pname = "lint"; + version = frama-c.version; + slang = frama-c.slang; + + src = frama-c.src; + + nativeBuildInputs = frama-c.nativeBuildInputs; + + buildInputs = frama-c.buildInputs ++ [ + bc + # headache + ocp-indent + # clang_10 + ]; + + preConfigure = frama-c.preConfigure; + + buildPhase = '' + make lint + make stats-lint + # STRICT_HEADERS=yes make check-headers + ''; + + installPhase = '' + touch $out + ''; +} diff --git a/nix/manuals.nix b/nix/manuals.nix new file mode 100644 index 0000000000000000000000000000000000000000..1b9cb776c261c89e40cf1224a71a20ef96b99966 --- /dev/null +++ b/nix/manuals.nix @@ -0,0 +1,54 @@ +{ lib +, stdenv +, frama-c +, headache +, texlive +} : + +stdenv.mkDerivation rec { + pname = "manuals"; + version = frama-c.version; + slang = frama-c.slang; + + + build_dir = frama-c.build_dir + "/dir.tar"; + acsl = fetchGit { + url = "https://github.com/acsl-language/acsl.git"; + name = "acsl"; + }; + srcs = [ + build_dir + acsl + ] ; + + sourceRoot = "."; + + buildInputs = frama-c.buildInputs ++ [ + frama-c + headache + texlive.combined.scheme-full + ]; + + postUnpack = '' + mv acsl doc + '' ; + + postPatch = '' + patchShebangs . + '' ; + + # Keep main configuration + configurePhase = '' + true + ''; + + buildPhase = '' + make -C doc NO_SUFFIX=yes all + ''; + + installPhase = '' + mkdir -p $out + cp ./doc/manuals/*.pdf $out + cp ./doc/manuals/*.tgz $out + ''; +} diff --git a/nix/mk_plugin.nix b/nix/mk_plugin.nix new file mode 100644 index 0000000000000000000000000000000000000000..c5280b67f10b90d63d1230e1fb55aefbc930da6f --- /dev/null +++ b/nix/mk_plugin.nix @@ -0,0 +1,126 @@ +# This template is meant to build external plugins +# +# Input variables: +# +# - plugin-name (mandatory): +# The name used for the derivation. It is also used for the name of the Opam +# file during the INSTALL phase. However, it is only necessary if the plugin +# is a dependency for another, so the installation of this file can be +# disabled with the 'install-opam' variable described below. +# +# - plugin-src (mandatory): +# The source files used for building, generally 'gitignoreSource ./..'. It +# must be provided in the plugin because from this './..' is the Frama-C +# directory +# +# - additional-build-inputs (optional, defaults to []) +# Additional Nix packages that are added to the 'buildInput' variable, +# originally it contains Frama-C + all its dependencies +# +# - additional-check-inputs (optional, defaults to []) +# Additional Nix packages that are added to the 'checkInput' variable, +# originally it contains 'time' +# +# - has-wp-proofs (optional, defaults to 'false') +# Indicates whether the plugin execute WP proofs during tests, if it the case +# the derivation receives an additional check-input 'alt-ergo'. Furthermore, +# it configures Why3 before check phase and export the WP global cache. Note +# however that this cache is used only if the tests use the option '-wp-cache-env' +# +# - install-opam (optional, default to 'true') +# Indicates whether the generated Opam file should be installed. Unless it is +# not possible: +# - if your plugin does not provide an Opam file or, +# - *if the derivation name does not correspond to the name of the plugin* +# (see for example the Frama-Clang plugin) +# There is no reason to disable this. +# +# The plugin must have: +# - a '@frama-c-configure' Dune rule +# - a LICENSE file + +{ lib +, stdenv +, alt-ergo +, frama-c +, time +}: + +{ plugin-name +, plugin-src +, additional-build-inputs ? [] +, additional-check-inputs ? [] +, has-wp-proofs ? false +, install-opam ? true +}: + +stdenv.mkDerivation { + name = plugin-name; + src = plugin-src; + + buildInputs = frama-c.buildInputs ++ [ + frama-c + ] + ++ additional-build-inputs ; + + checkInputs = [ + time + ] + ++ (if has-wp-proofs then [ alt-ergo ] else []) + ++ additional-check-inputs ; + + # Note: no check is performed, it is just used to show dependencies + configurePhase = '' + dune build @frama-c-configure + ''; + + # Do not use default parallel building, but allow 2 cores for Frama-C build + enableParallelBuilding = false; + + # Some plugins have sh scripts during build + preBuild = '' + patchShebangs . + ''; + buildPhase = '' + runHook preBuild + dune build -j2 --display short @install + ''; + + wp_cache = + if has-wp-proofs + then fetchGit "git@git.frama-c.com:frama-c/wp-cache.git" + else "" ; + + doCheck = true; + + # Some plugins have sh scripts during check + preCheck = '' + patchShebangs . + '' + (if has-wp-proofs then '' + mkdir home + HOME=$(pwd)/home + why3 config detect + export FRAMAC_WP_CACHE=offline + export FRAMAC_WP_CACHEDIR=$wp_cache + '' + else "") ; + + checkPhase = '' + runHook preCheck + make run-ptests + dune build -j1 --display short @tests/ptests + ''; + + installFlags = [ + "INSTALLDIR=$(out)" + ]; + + postInstall = if install-opam then '' + cp frama-c-$name.opam $out/lib/frama-c-$name/opam + '' else "" ; + + # Required so that tests of external plugins can be excuted + postFixup = '' + cp -r $out/share/doc $out/doc + ''; +} diff --git a/nix/mk_tests.nix b/nix/mk_tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..4241026860bcff77cdc51a27b028e3a258de6257 --- /dev/null +++ b/nix/mk_tests.nix @@ -0,0 +1,89 @@ +# This template is meant to execute Frama-C tests +# +# Input variables: +# +# - tests-name (mandatory): +# The name used for the derivation. +# +# - tests-command (mandatory): +# The tests command to execute, generally something like: +# '' +# dune exec -- frama-c-ptests tests src/plugins/e-acsl/tests +# dune build -j1 --display short @src/plugins/e-acsl/tests/ptests +# '' +# +# - has-wp-proofs (optional, defaults to 'false') +# Indicates whether the tests execute WP proofs, if it the case the derivation +# receives an additional build-input 'alt-ergo'. Furthermore, it configures +# Why3 before build phase and export the WP global cache. Note however that +# this cache is used only if the tests use the option '-wp-cache-env' + +{ lib +, alt-ergo +, frama-c +, perl +, stdenvNoCC +, time +, unixtools +, which +} : + +{ tests-name +, tests-command +, has-wp-proofs ? false +} : + +stdenvNoCC.mkDerivation { + pname = tests-name ; + version = frama-c.version; + slang = frama-c.slang; + + src = frama-c.build_dir + "/dir.tar"; + sourceRoot = "."; + + buildInputs = frama-c.buildInputs ++ [ + frama-c + perl + time + unixtools.getopt + which + ] ++ + (if has-wp-proofs then [ alt-ergo ] else []); + + postPatch = '' + patchShebangs . + '' ; + + # Keep main configuration + configurePhase = '' + true + ''; + + wp_cache = + if has-wp-proofs + then fetchGit "git@git.frama-c.com:frama-c/wp-cache.git" + else "" ; + + preBuild = + if has-wp-proofs + then '' + mkdir home + HOME=$(pwd)/home + why3 config detect + export FRAMAC_WP_CACHE=offline + export FRAMAC_WP_CACHEDIR=$wp_cache + '' + else "" ; + + buildPhase = '' + runHook preBuild + '' + + tests-command + '' + runHook postBuild + ''; + + # No installation required + installPhase = '' + touch $out + ''; +} diff --git a/nix/mlmpfr.nix b/nix/mlmpfr.nix new file mode 100644 index 0000000000000000000000000000000000000000..a10f2eb751d05a722bf0f0ce098d5e83a2f0c0ea --- /dev/null +++ b/nix/mlmpfr.nix @@ -0,0 +1,30 @@ + +{ lib +, fetchFromGitHub +, gmp +, mpfr +, buildDunePackage +}: + +buildDunePackage rec { + pname = "mlmpfr"; + version = "4.1.0-bugfix1"; + + minimumOCamlVersion = "4.04"; + + src = fetchFromGitHub { + owner = "thvnx"; + repo = pname; + rev = pname+"."+version; + sha256 = "13n6spgz5p6jhpjackvfsn33iinpadgr3v4gm63d5195mi9fgn8d"; + }; + + buildInputs = [ gmp mpfr ]; + + meta = { + description = "The package provides bindings for MPFR"; + license = lib.licenses.lgpl3Only; + maintainers = [ ]; + homepage = "https://github.com/thvnx/mlmpfr"; + }; +} diff --git a/nix/ocp-indent.nix b/nix/ocp-indent.nix new file mode 100644 index 0000000000000000000000000000000000000000..089d6ac9b6dc8049477d520e8fbfc8a5fba391e9 --- /dev/null +++ b/nix/ocp-indent.nix @@ -0,0 +1,29 @@ +{ lib +, fetchFromGitHub +, buildDunePackage +, cmdliner +}: + +buildDunePackage rec { + version = "1.8.1"; + pname = "ocp-indent"; + + src = fetchFromGitHub { + owner = "OCamlPro"; + repo = pname; + rev = version; + sha256 = "0h4ysh36q1fxc40inhsdq2swqpfm15lpilqqcafs5ska42pn7s68"; + }; + + minimumOCamlVersion = "4.02"; + useDune2 = true; + + buildInputs = [ cmdliner ]; + + meta = with lib; { + homepage = http://typerex.ocamlpro.com/ocp-indent.html; + description = "A customizable tool to indent OCaml code"; + license = licenses.gpl3; + maintainers = [ maintainers.jirkamarsik ]; + }; +} diff --git a/nix/odoc.nix b/nix/odoc.nix new file mode 100644 index 0000000000000000000000000000000000000000..be33056888db525743b4d173bb93ebb2339779e3 --- /dev/null +++ b/nix/odoc.nix @@ -0,0 +1,36 @@ +{ lib +, astring +, buildDunePackage +, cmdliner +, cppo +, fetchFromGitHub +, fmt +, fpath +, ocaml +, odoc-parser +, result +, tyxml +}: + +buildDunePackage rec { + pname = "odoc"; + version = "2.1.0"; + + minimumOCamlVersion = "4.02"; + + src = fetchFromGitHub { + owner = "ocaml"; + repo = pname; + rev = version; + sha256 = "1ycb468pc6vsvqj176j99bmbkrr9saxvyn9qhpazi01abbcq5d90"; + }; + + buildInputs = [ astring cmdliner cppo fmt fpath odoc-parser result tyxml ]; + + meta = { + description = "A documentation generator for OCaml"; + license = lib.licenses.isc; + maintainers = [ lib.maintainers.vbgl ]; + homepage = "https://github.com/ocaml/odoc"; + }; +} diff --git a/nix/pkgs.nix b/nix/pkgs.nix new file mode 100644 index 0000000000000000000000000000000000000000..f2750a73d4931be46008e6372d10dd8daf9bf8de --- /dev/null +++ b/nix/pkgs.nix @@ -0,0 +1,77 @@ +let + sources = import ./sources.nix {}; + ocamlOverlay = oself: osuper: { + # External Packages + alt-ergo = oself.callPackage ./alt-ergo.nix {}; + camlzip = oself.callPackage ./camlzip.nix {}; + headache = oself.callPackage ./headache.nix {}; + mlmpfr = oself.callPackage ./mlmpfr.nix {}; + ocp-indent = oself.callPackage ./ocp-indent.nix {}; + odoc = oself.callPackage ./odoc.nix {}; + psmt2-frontend = oself.callPackage ./psmt2-frontend.nix {}; + why3 = oself.callPackage ./why3.nix {}; + + # Helpers + mk_tests = oself.callPackage ./mk_tests.nix {}; + mk_plugin = oself.callPackage ./mk_plugin.nix {}; + + # Shells containing checkers (hdrck, ocp-indent, Frama-C for plugins) + frama-c-checkers-shell = oself.callPackage ./frama-c-checkers-shell.nix { + git = pkgs.git ; + }; + plugin-checkers-shell = oself.callPackage ./plugin-checkers-shell.nix { + git = pkgs.git ; + }; + + # Builds + frama-c = oself.callPackage ./frama-c.nix {}; + frama-c-hdrck = oself.callPackage ./frama-c-hdrck.nix {}; + lint = oself.callPackage ./lint.nix {}; + + # Tests + default-config-tests = oself.callPackage ./default-config-tests.nix {}; + e-acsl-tests = oself.callPackage ./e-acsl-tests.nix {}; + eva-default-tests = oself.callPackage ./eva-tests.nix { config = ""; }; + eva-bitwise-tests = oself.callPackage ./eva-tests.nix { config = "bitwise" ; }; + eva-equality-tests = oself.callPackage ./eva-tests.nix { config = "equality" ; }; + eva-gauges-tests = oself.callPackage ./eva-tests.nix { config = "gauges" ; }; + eva-multidim-tests = oself.callPackage ./eva-tests.nix { config = "multidim" ; }; + eva-octagon-tests = oself.callPackage ./eva-tests.nix { config = "octagon" ; }; + eva-symblocs-tests = oself.callPackage ./eva-tests.nix { config = "symblocs" ; }; + full-tests = oself.callPackage ./full-tests.nix {}; + kernel-tests = oself.callPackage ./kernel-tests.nix {}; + plugins-tests = oself.callPackage ./plugins-tests.nix {}; + ts-api = oself.callPackage ./ts-api.nix {}; + wp-tests = oself.callPackage ./wp-tests.nix {}; + + # Internal tests + internal-tests = oself.callPackage ./internal-tests.nix {}; + + # Release + api-doc = oself.callPackage ./api-doc.nix {}; + manuals = oself.callPackage ./manuals.nix {}; + src-distrib-tests = oself.callPackage ./src-distrib-tests.nix { + frama-c-release = oself.frama-c.override { release_mode = true ; } ; + }; + }; + overlay = self: super: { + niv = (import sources.niv {}).niv; + ocaml-ng = super.lib.mapAttrs ( + name: value: + if builtins.hasAttr "overrideScope'" value + then value.overrideScope' ocamlOverlay + else value + ) super.ocaml-ng; + inherit (super.callPackage sources."gitignore.nix" {}) gitignoreSource; + why3 = throw "don't use pkgs.why3 but ocaml-ng.ocamlPackages_4_XX.why3"; + camlzip = throw "don't use pkgs.camlzip but ocaml-ng.ocamlPackages_4_XX.camlzip"; + framac = throw "don't use pkgs.framac but ocaml-ng.ocamlPackages_4_XX.frama-c"; + frama-c = throw "don't use pkgs.framac but ocaml-ng.ocamlPackages_4_XX.frama-c"; + }; + pkgs = import sources.nixpkgs { + # alt-ergo + config.allowUnfree = true; + overlays = [ overlay ]; + }; +in +pkgs diff --git a/nix/plugin-checkers-shell.nix b/nix/plugin-checkers-shell.nix new file mode 100644 index 0000000000000000000000000000000000000000..dfb0113011f38d97e8bd6d935846c3837132083f --- /dev/null +++ b/nix/plugin-checkers-shell.nix @@ -0,0 +1,18 @@ +{ lib +, stdenv +, frama-c +, git +, gnumake +, headache +, ocp-indent +} : +stdenv.mkDerivation rec { + name = "plugin-checkers-shell"; + buildInputs = [ + frama-c + git + gnumake + headache + ocp-indent + ]; +} diff --git a/nix/plugins-tests.nix b/nix/plugins-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..6a051fe20ed3ba227b800ac941733c932e9c505e --- /dev/null +++ b/nix/plugins-tests.nix @@ -0,0 +1,30 @@ +{ mk_tests } : + +mk_tests { + tests-name = "plugins-tests"; + tests-command = '' + dune exec -- frama-c-ptests tests src/plugins/*/tests + dune build -j1 --display short \ + @tests/callgraph/ptests \ + @tests/constant_propagation/ptests \ + @tests/impact/ptests \ + @tests/metrics/ptests \ + @tests/occurrence/ptests \ + @tests/pdg/ptests \ + @tests/slicing/ptests \ + @tests/rte/ptests \ + @tests/rte_manual/ptests \ + @tests/scope/ptests \ + @tests/sparecode/ptests \ + @src/plugins/aorai/tests/ptests \ + @src/plugins/dive/tests/ptests \ + @src/plugins/instantiate/tests/ptests \ + @src/plugins/loop_analysis/tests/ptests \ + @src/plugins/markdown-report/tests/ptests \ + @src/plugins/nonterm/tests/ptests \ + @src/plugins/report/tests/ptests \ + @src/plugins/server/tests/ptests \ + @src/plugins/variadic/tests/ptests + ''; + has-wp-proofs = true ; +} diff --git a/nix/psmt2-frontend.nix b/nix/psmt2-frontend.nix new file mode 100644 index 0000000000000000000000000000000000000000..98836906d462ecce7f597e8e99df178b5c97fbe4 --- /dev/null +++ b/nix/psmt2-frontend.nix @@ -0,0 +1,48 @@ +{ callPackage +, fetchFromGitHub +, lib +, stdenv +, ocaml +, findlib +, menhir +, autoreconfHook +, which +}: + +stdenv.mkDerivation rec { + pname = "psmt2-frontend"; + version = "0.1"; + + src = fetchFromGitHub { + owner = "Coquera"; + repo = pname; + rev = version; + sha256 = "0k7jlsbkdyg7hafmvynp0ik8xk7mfr00wz27vxn4ncnmp20yz4vn"; + }; + + nativeBuildInputs = [ + autoreconfHook + which + ]; + + buildInputs = [ + ocaml + findlib + menhir + ]; + + enableParallelBuilding = true; + + configureFlags = [ "--enable-verbose-make" ]; + + createFindlibDestdir = true; + + installFlags = "LIBDIR=$(OCAMLFIND_DESTDIR)"; + + meta = { + description = "A simple parser and type-checker for polomorphic extension of the SMT-LIB 2 language"; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.vbgl ]; + inherit (src.meta) homepage; + }; +} diff --git a/bin/rebuild.sh b/nix/shell-checkers.sh similarity index 81% rename from bin/rebuild.sh rename to nix/shell-checkers.sh index f50cecdb02c21de5dcabda7ec3df1ad1655cabe2..c392a31787ec6def094c820d8e043b962a5b4f20 100755 --- a/bin/rebuild.sh +++ b/nix/shell-checkers.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash ########################################################################## # # # This file is part of Frama-C. # @@ -20,11 +21,16 @@ # # ########################################################################## -make -k clean -find src \( -name "*.cm*" -or -name "*.o" \) -delete -print -rm -fr config.status autom4te.cache/ -autoconf -f -./configure -make clean -make depend -make -kj +# OCAML must be set to the right version of OCAML (format: N_MM or N.MM) + +set -euxo pipefail + +if [ -z ${OCAML+x} ]; then + echo "OCAML variable must be set to a version of OCaml" + exit 2 +fi + +# Normalize version for Nix +OCAML=${OCAML/./_} + +nix-shell "./nix/pkgs.nix" -A ocaml-ng.ocamlPackages_$OCAML.frama-c-checkers-shell --run "$1" diff --git a/nix/sources.json b/nix/sources.json new file mode 100644 index 0000000000000000000000000000000000000000..bedb63ce514388d3a997df2c66cd1d46a9355352 --- /dev/null +++ b/nix/sources.json @@ -0,0 +1,45 @@ +{ + "gitignore.nix": { + "branch": "master", + "description": "Nix functions for filtering local git sources", + "homepage": "", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "5b9e0ff9d3b551234b4f3eb3983744fa354b17f1", + "sha256": "01l4phiqgw9xgaxr6jr456qmww6kzghqrnbc7aiiww3h6db5vw53", + "type": "tarball", + "url": "https://github.com/hercules-ci/gitignore.nix/archive/5b9e0ff9d3b551234b4f3eb3983744fa354b17f1.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, + "niv": { + "branch": "master", + "description": "Easy dependency management for Nix projects", + "homepage": "https://github.com/nmattia/niv", + "owner": "nmattia", + "repo": "niv", + "rev": "65a61b147f307d24bfd0a5cd56ce7d7b7cc61d2e", + "sha256": "17mirpsx5wyw262fpsd6n6m47jcgw8k2bwcp1iwdnrlzy4dhcgqh", + "type": "tarball", + "url": "https://github.com/nmattia/niv/archive/65a61b147f307d24bfd0a5cd56ce7d7b7cc61d2e.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, + "nixpkgs": { + "branch": "nixos-unstable", + "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", + "homepage": "https://github.com/NixOS/nixpkgs", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f4dfed73ee886b115a99e5b85fdfbeb683290d83", + "sha256": "1scpisl06f9mc31khj0m2q21yvx108bi7l9s0n9aq8f1w4fjprg6", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/f4dfed73ee886b115a99e5b85fdfbeb683290d83.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, + "why3": { + "branch": "master", + "repo": "https://gitlab.inria.fr/why3/why3.git", + "rev": "d73deb6d1b6bc6f26936c87a0793cd666d9747e1", + "type": "git", + "version": "1.5.0" + } +} diff --git a/nix/sources.nix b/nix/sources.nix new file mode 100644 index 0000000000000000000000000000000000000000..1938409dddb0b57d9f298046cf51875060283df2 --- /dev/null +++ b/nix/sources.nix @@ -0,0 +1,174 @@ +# This file has been generated by Niv. + +let + + # + # The fetchers. fetch_<type> fetches specs of type <type>. + # + + fetch_file = pkgs: name: spec: + let + name' = sanitizeName name + "-src"; + in + if spec.builtin or true then + builtins_fetchurl { inherit (spec) url sha256; name = name'; } + else + pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; + + fetch_tarball = pkgs: name: spec: + let + name' = sanitizeName name + "-src"; + in + if spec.builtin or true then + builtins_fetchTarball { name = name'; inherit (spec) url sha256; } + else + pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; + + fetch_git = name: spec: + let + ref = + if spec ? ref then spec.ref else + if spec ? branch then "refs/heads/${spec.branch}" else + if spec ? tag then "refs/tags/${spec.tag}" else + abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; + in + builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }; + + fetch_local = spec: spec.path; + + fetch_builtin-tarball = name: throw + ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. + $ niv modify ${name} -a type=tarball -a builtin=true''; + + fetch_builtin-url = name: throw + ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. + $ niv modify ${name} -a type=file -a builtin=true''; + + # + # Various helpers + # + + # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695 + sanitizeName = name: + ( + concatMapStrings (s: if builtins.isList s then "-" else s) + ( + builtins.split "[^[:alnum:]+._?=-]+" + ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name) + ) + ); + + # The set of packages used when specs are fetched using non-builtins. + mkPkgs = sources: system: + let + sourcesNixpkgs = + import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; }; + hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; + hasThisAsNixpkgsPath = <nixpkgs> == ./.; + in + if builtins.hasAttr "nixpkgs" sources + then sourcesNixpkgs + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then + import <nixpkgs> {} + else + abort + '' + Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or + add a package called "nixpkgs" to your sources.json. + ''; + + # The actual fetching function. + fetch = pkgs: name: spec: + + if ! builtins.hasAttr "type" spec then + abort "ERROR: niv spec ${name} does not have a 'type' attribute" + else if spec.type == "file" then fetch_file pkgs name spec + else if spec.type == "tarball" then fetch_tarball pkgs name spec + else if spec.type == "git" then fetch_git name spec + else if spec.type == "local" then fetch_local spec + else if spec.type == "builtin-tarball" then fetch_builtin-tarball name + else if spec.type == "builtin-url" then fetch_builtin-url name + else + abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; + + # If the environment variable NIV_OVERRIDE_${name} is set, then use + # the path directly as opposed to the fetched source. + replace = name: drv: + let + saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; + ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; + in + if ersatz == "" then drv else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; + + # Ports of functions for older nix versions + + # a Nix version of mapAttrs if the built-in doesn't exist + mapAttrs = builtins.mapAttrs or ( + f: set: with builtins; + listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) + ); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 + range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); + concatMapStrings = f: list: concatStrings (map f list); + concatStrings = builtins.concatStringsSep ""; + + # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 + optionalAttrs = cond: as: if cond then as else {}; + + # fetchTarball version that is compatible between all the versions of Nix + builtins_fetchTarball = { url, name ? null, sha256 }@attrs: + let + inherit (builtins) lessThan nixVersion fetchTarball; + in + if lessThan nixVersion "1.12" then + fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) + else + fetchTarball attrs; + + # fetchurl version that is compatible between all the versions of Nix + builtins_fetchurl = { url, name ? null, sha256 }@attrs: + let + inherit (builtins) lessThan nixVersion fetchurl; + in + if lessThan nixVersion "1.12" then + fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) + else + fetchurl attrs; + + # Create the final "sources" from the config + mkSources = config: + mapAttrs ( + name: spec: + if builtins.hasAttr "outPath" spec + then abort + "The values in sources.json should not have an 'outPath' attribute" + else + spec // { outPath = replace name (fetch config.pkgs name spec); } + ) config.sources; + + # The "config" used by the fetchers + mkConfig = + { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null + , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) + , system ? builtins.currentSystem + , pkgs ? mkPkgs sources system + }: rec { + # The sources, i.e. the attribute set of spec name to spec + inherit sources; + + # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers + inherit pkgs; + }; + +in +mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/nix/src-distrib-tests.nix b/nix/src-distrib-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..c1a52472721dbaded752b7007d2cd94ddef5943d --- /dev/null +++ b/nix/src-distrib-tests.nix @@ -0,0 +1,12 @@ +{ mk_tests, frama-c-release } : + +let mk_tests_distrib = mk_tests.override { + frama-c = frama-c-release ; +}; in +mk_tests_distrib { + tests-name = "src-distrib-tests"; + tests-command = '' + dune exec -- frama-c-ptests tests src/plugins/*/tests + dune build -j1 --display short @ptests_config + ''; +} diff --git a/nix/src-distrib.nix b/nix/src-distrib.nix new file mode 100644 index 0000000000000000000000000000000000000000..e675ec74b3f48c42a189464809bf51e65cba1170 --- /dev/null +++ b/nix/src-distrib.nix @@ -0,0 +1,39 @@ +{ lib +, stdenv +, frama-c +# , headache +, git +} : + +stdenv.mkDerivation rec { + pname = "src-distrib"; + version = frama-c.version; + slang = frama-c.slang; + + src = ./.. ; + + nativeBuildInputs = frama-c.nativeBuildInputs; + + buildInputs = frama-c.buildInputs ++ [ + # headache + git + ]; + + configurePhase = '' + autoconf + ''; + + preBuild = '' + patchShebangs ./devel_tools/make-distrib.sh + ''; + + buildPhase = '' + runHook preBuild + ./devel_tools/make-distrib.sh + ''; + + installPhase = '' + mkdir -p $out + cp frama-c.tar.gz $out + ''; +} diff --git a/nix/ts-api.nix b/nix/ts-api.nix new file mode 100644 index 0000000000000000000000000000000000000000..cda9f980c8d6ef7811f8976bf361654e0af80dc8 --- /dev/null +++ b/nix/ts-api.nix @@ -0,0 +1,38 @@ +{ lib +, stdenv +, frama-c +, headache +} : + +stdenv.mkDerivation rec { + pname = "ts-api-check"; + version = frama-c.version; + slang = frama-c.slang; + + src = frama-c.build_dir + "/dir.tar"; + sourceRoot = "."; + + buildInputs = frama-c.buildInputs ++ [ + frama-c + headache + ]; + + postPatch = '' + patchShebangs . + '' ; + preConfigure = frama-c.preConfigure; + + # Keep main configuration + configurePhase = '' + true + ''; + + buildPhase = '' + make -C ivette check-api + ''; + + # No installation required + installPhase = '' + touch $out + ''; +} diff --git a/nix/why3.nix b/nix/why3.nix new file mode 100644 index 0000000000000000000000000000000000000000..72981935f298214d005401d224633ddbabd60af3 --- /dev/null +++ b/nix/why3.nix @@ -0,0 +1,76 @@ +{ callPackage +, fetchurl +, fetchpatch +, lib +, stdenv +, ocaml +, findlib +, ocamlgraph +, zarith +, menhir +, menhirLib +, js_of_ocaml +, js_of_ocaml-ppx +, ppx_deriving +, ppx_sexp_conv +, camlzip +, sexplib +, re +, num +, lablgtk3-sourceview3 +, coqPackages +, rubber +, hevea +, emacs +, autoreconfHook +}: + +stdenv.mkDerivation rec { + pname = "why3"; + version = src.version; + + src = (import ./sources.nix {}).why3; + nativeBuildInputs = [ + autoreconfHook + ]; + buildInputs = [ + ocaml + findlib + ocamlgraph + zarith + menhir + menhirLib + # Emacs compilation of why3.el + emacs + # Documentation + rubber + hevea + # GUI + lablgtk3-sourceview3 + # WebIDE + js_of_ocaml + js_of_ocaml-ppx + # S-expression output for why3pp + ppx_deriving + ppx_sexp_conv + # Coq Support + coqPackages.coq + coqPackages.flocq + ]; + + propagatedBuildInputs = [ camlzip num re sexplib ]; + + enableParallelBuilding = true; + + configureFlags = [ "--enable-verbose-make" ]; + + installTargets = [ "install" "install-lib" ]; + + meta = with lib; { + description = "A platform for deductive program verification"; + homepage = "http://why3.lri.fr/"; + license = licenses.lgpl21; + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice vbgl ]; + }; +} diff --git a/nix/wp-tests.nix b/nix/wp-tests.nix new file mode 100644 index 0000000000000000000000000000000000000000..c431e8fe8072f253db36402f1c2888d5ff6b2186 --- /dev/null +++ b/nix/wp-tests.nix @@ -0,0 +1,10 @@ +{ mk_tests } : + +mk_tests { + tests-name = "wp-tests"; + tests-command = '' + dune exec -- frama-c-ptests src/plugins/wp/tests + dune build -j1 --display short @src/plugins/wp/tests/ptests + ''; + has-wp-proofs = true ; +} diff --git a/opam/opam b/opam/opam index e1846cc60b882731bf9e26d4b4277ef37dda1347..b4b37a5591cfa2df70110ca4c53eeeb3895f0f60 100644 --- a/opam/opam +++ b/opam/opam @@ -88,10 +88,9 @@ tags: [ build: [ ["autoconf"] {dev} - ["./configure" "--prefix" prefix - "--mandir=%{man}%" - ] - [make "-j%{jobs}%"] + ["./configure"] + [make "config.sed"] + ["dune" "build" "-j%{jobs}%" "--release" "@install"] [make "-C" "doc" "download"] {with-doc} ] @@ -101,14 +100,18 @@ install: [ ] run-test: [ - [make "-j%{jobs}%" "PTESTS_OPTS=-error-code" "tests"] { arch != "ppc64" & arch != "x86_32" & arch != "arm32" } - # tests are disabled on PPC64 due to floating-point oracle differences - # (some ULPs in libc trigonometric functions) and due to the lack of - # available hardware to test them locally + ["dune" "exec" "--" "frama-c-ptests" "tests" "src/plugins/*/tests" + ] { arch != "ppc64" & arch != "x86_32" & arch != "arm32" } + ["dune" "build" "-j%{jobs}%" "@ptests_config" + ] { arch != "ppc64" & arch != "x86_32" & arch != "arm32" } ] # Please keep depends and depopts sorted by package name depends: [ + "dune" { >= "2.8.2" } + "dune-configurator" + "dune-private-libs" + "dune-site" "conf-autoconf" { build } ( ( "lablgtk" { >= "2.18.8" } & "conf-gnomecanvas" & "conf-gtksourceview" & ("ocamlgraph" { < "2.0" } | "ocamlgraph_gtk" )) @@ -117,12 +120,13 @@ depends: [ ( "alt-ergo-free" | "alt-ergo" ) "conf-graphviz" { post } "conf-time" { with-test } + "ppx_deriving_yojson" "ocaml" { >= "4.08.1" } "ocamlfind" # needed beyond build stage, used by -load-module "ocamlgraph" { >= "1.8.8" } "why3" { >= "1.5.0" } - "yojson" {>= "1.6.0"} - "zarith" {>= "1.5"} + "yojson" { >= "1.6.0" & < "2.0.0" } + "zarith" { >= "1.5" } "ppx_deriving" "ppx_import" ] @@ -134,7 +138,6 @@ depopts: [ "apron" "coq" "mlgmpidl" - "ppx_deriving_yojson" "zmq" ] diff --git a/ptests/.merlin b/ptests/.merlin deleted file mode 100644 index 6863408c16f24b08a46a30db253008d7fa26cff8..0000000000000000000000000000000000000000 --- a/ptests/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -B +threads - diff --git a/ptests/ptests.ml b/ptests/ptests.ml deleted file mode 100644 index d797d5076b8c73de467757745cc1896a91b2452c..0000000000000000000000000000000000000000 --- a/ptests/ptests.ml +++ /dev/null @@ -1,2471 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -let system = - if Sys.os_type = "Win32" then - fun f -> - Unix.system (Format.sprintf "bash -c %S" f) - else - fun f -> - Unix.system f - -module Filename = struct - include Filename - let concat = - if Sys.os_type = "Win32" then - fun a b -> a ^ "/" ^ b - else - concat - - let cygpath r = - let cmd = - Format.sprintf - "bash -c \"cygpath -m %s\"" - (String.escaped (String.escaped r)) - in - let in_channel = Unix.open_process_in cmd in - let result = input_line in_channel in - ignore(Unix.close_process_in in_channel); - result - - let temp_file = - if Sys.os_type = "Win32" then - fun a b -> let r = temp_file a b in - cygpath r - else - fun a b -> temp_file a b - - let sanitize f = String.escaped f -end - -let string_del_suffix suffix s = - let lsuffix = String.length suffix in - let ls = String.length s in - if ls >= lsuffix && String.sub s (ls - lsuffix) lsuffix = suffix then - Some (String.sub s 0 (ls - lsuffix)) - else None - -let str_mutex = Mutex.create() - -let str_global_replace regex repl s = - Mutex.lock str_mutex; - let res = Str.global_replace regex repl s in - Mutex.unlock str_mutex; res - -(* The match may start after [pos] (instead of [str_string_match]) *) -let str_string_contains regexp s pos = - Mutex.lock str_mutex; - let res = try - ignore (Str.search_forward regexp s pos) ; - true - with Not_found -> false - in - Mutex.unlock str_mutex; res - -let str_string_contains_option opt = - let re = Str.regexp ("\\( \\|^\\)"^ opt ^ "\\( \\|=\\|$\\)") in - str_string_contains re - -let str_string_match regex s n = - Mutex.lock str_mutex; - let res = Str.string_match regex s n in - Mutex.unlock str_mutex; res - -let str_string_match1 regexp line pos = - Mutex.lock str_mutex; - let res = if Str.string_match regexp line pos then - try - Some (Str.matched_group 1 line) - with Not_found -> None - else None - in - Mutex.unlock str_mutex; res - -let str_string_match2 regexp line pos = - Mutex.lock str_mutex; - let res = if Str.string_match regexp line pos then - try - Some ((Str.matched_group 1 line), (Str.matched_group 2 line)) - with Not_found -> None - else None - in - Mutex.unlock str_mutex; res - -(* If regex1 matches inside s, adds suffix to the first occurrence of regex2. - If matched, returns (replaced string, true), otherwise returns (s, false). -*) -let str_string_match_and_replace regex1 regex2 ~suffix s = - Mutex.lock str_mutex; - let replaced_str, matched = - if Str.string_match regex1 s 0 then - Str.replace_first regex2 ("\\1" ^ suffix) s, true - else s, false - in - Mutex.unlock str_mutex; - (replaced_str, matched) - -let str_bounded_full_split regex s n = - Mutex.lock str_mutex; - let res = Str.bounded_full_split regex s n in - Mutex.unlock str_mutex; res - -let str_split regex s = - Mutex.lock str_mutex; - let res = Str.split regex s in - Mutex.unlock str_mutex; res - -let str_split_list = - (* considers blanks (not preceded by '\'), tabs and commas as separators *) - let nonsep_regexp = Str.regexp "[\\] " in (* removed for beeing reintroduced *) - let sep_regexp = Str.regexp "[\t ,]+" in - fun s -> (* splits on '\ ' first then on ' ' or ',' *) - Mutex.lock str_mutex; - let r = List.fold_left (fun acc -> function - | Str.Text s -> List.rev_append (Str.full_split sep_regexp s) acc - | (Str.Delim _ as delim) -> delim::acc) - [] - (Str.full_split nonsep_regexp s) - in (* [r] is in the reverse order and the next [fold] restores the order *) - Mutex.unlock str_mutex; - let add s (glue,prev,curr) = - if glue then false,(s^prev),curr - else false,s,(if prev = "" then curr else prev::curr) - in - let acc = List.fold_left (fun ((_,prev,curr) as acc) -> function - | Str.Delim ("\\ " as nonsep) -> - true,(nonsep^prev),curr (* restore '\ ' *) - | Str.Delim _ -> add "" acc (* separator *) - | Str.Text s -> add s acc) (false,"",[]) r - in - let _,_,res = (add "" acc) in - res - -(* removes first blanks *) -let trim_right s = - if s = "" then s else begin - let n = ref (String.length s - 1) in - let last_char_to_keep = - try - while !n > 0 do - if String.get s !n <> ' ' then raise Exit; - n := !n - 1 - done; - 0 - with Exit -> !n - in - String.sub s 0 (last_char_to_keep+1) - end - -let default_env = ref [] - -let add_default_env x y = default_env:=(x,y)::!default_env - -let add_env var value = - add_default_env var value; - Unix.putenv var value - -let print_default_env fmt = - match !default_env with - [] -> () - | l -> - Format.fprintf fmt "@[Env:@\n"; - List.iter (fun (x,y) -> Format.fprintf fmt "%s = \"%s\"@\n" x y) l; - Format.fprintf fmt "@]" - -let get_default_env var value = - try - let v = Unix.getenv var in - add_default_env (var ^ " (set from outside)") v; - v - with Not_found -> add_env var value ; value - -let default_env var value = ignore (get_default_env var value) - -let get_default_env_of_int var value = - try - int_of_string (get_default_env var (string_of_int value)) - with _ -> value - -(* 0 -> no change - 1 -> apply a filter (about pathname) to prepare oracles - 2 -> run tests from result directories (except make command) -*) -let dune_mode = ref (get_default_env_of_int "PTEST_DUNE_MODE" 2) - -(** the name of the directory-wide configuration file*) -let dir_config_file = "test_config" - -(** the files in [suites] whose name matches - the pattern [test_file_regexp] will be considered as test files *) -let test_file_regexp = ".*\\.\\(c\\|i\\)$" - -(* Splits the command string to separate the command name from the parameters - [let cmd_name,param=command_partition cmd in assert cmd=cmd_name^param] -*) -let command_partition = - let regexp_unescaped_blank = Str.regexp "[^\\ ] " in - fun cmd -> - match str_bounded_full_split regexp_unescaped_blank cmd 2 with - | [ Str.Text cmd ] -> - cmd, "" - | [ Str.Text cmd ; Str.Delim delim ] -> - cmd ^ (String.make 1 (String.get delim 0)), (String.make 1 (String.get delim 1)) - | [ Str.Text cmd ; Str.Delim delim; Str.Text options ] -> - cmd ^ (String.make 1 (String.get delim 0)), (String.make 1 (String.get delim 1)) ^ options - | [ Str.Delim delim ] -> - (String.make 1 (String.get delim 0)), (String.make 1 (String.get delim 1)) - | [ Str.Delim delim; Str.Text options ] -> - (String.make 1 (String.get delim 0)), (String.make 1 (String.get delim 1)) ^ options - | _ -> assert false - -let opt_to_byte_options = - let regex_cmxs = Str.regexp ("\\([^/]+\\)[.]cmxs\\($\\|[ \t]\\)") in - fun options -> str_global_replace regex_cmxs "\\1.cmo\\2" options - -let output_unix_error (exn : exn) = - match exn with - | Unix.Unix_error (error, _function, arg) -> - let message = Unix.error_message error in - if arg = "" then - Format.eprintf "%s@." message - else - Format.eprintf "%s: %s@." arg message - | _ -> assert false - -let mv src dest = - try - Unix.rename src dest - with Unix.Unix_error _ as e -> - output_unix_error e - -let unlink ?(silent = true) file = - let open Unix in - try - Unix.unlink file - with - | Unix_error _ when silent -> () - | Unix_error (ENOENT,_,_) -> () (* Ignore "No such file or directory" *) - | Unix_error _ as e -> output_unix_error e - -let fail s = - Format.printf "Error: %s@." s; - exit 2 - -let is_nonexisting_link filename = - let open Unix in - try - match (lstat filename).st_kind with - | S_LNK -> false - | _ -> fail ("Existing result file with the same name than one in the upper directory:" ^ filename) - with - | Unix_error (UnixLabels.ENOENT, _, _) -> (* file does not exist *) - true - | Unix_error _ as e -> - output_unix_error e; - raise e - -let is_nonexisting_file filename = - let open Unix in - try - match (lstat filename).st_kind with - | S_REG -> false - | _ -> fail ("Existing result file with the same name than one in the upper directory:" ^ filename) - with - | Unix_error (UnixLabels.ENOENT, _, _) -> (* file does not exist *) - true - | Unix_error _ as e -> - output_unix_error e; - raise e - -let is_file_empty_or_nonexisting filename = - let open Unix in - try - (Unix.stat filename).st_size = 0 - with - | Unix_error (UnixLabels.ENOENT, _, _) -> (* file does not exist *) - true - | Unix_error _ as e -> - output_unix_error e; - raise e - -let base_path = Filename.current_dir_name -(* (Filename.concat - (Filename.dirname Sys.executable_name) - Filename.parent_dir_name) -*) - -(** Command-line flags *) - -type behavior = Examine | Update | Run | Show | Gui -let behavior = ref (if 1 = (get_default_env_of_int "PTEST_UPDATE" 0) - then Update else Run) - -let verbosity = ref 0 -let dry_run = ref false -let use_byte = ref false -let use_diff_as_cmp = ref (Sys.os_type = "Win32") -let do_diffs = ref (if Sys.os_type = "Win32" then "diff --strip-trailing-cr -u" - else "diff -u") -let do_cmp = ref (if Sys.os_type="Win32" then !do_diffs - else "cmp -s") -let do_make = ref "make" -let n = ref 4 (* the level of parallelism *) - -(** special configuration, with associated oracles *) -let special_config = ref (get_default_env "PTEST_CONFIG" "") -let do_error_code = ref false - -let xunit = ref false - -let io_mutex = Mutex.create () - -let lock_fprintf f = - Mutex.lock io_mutex; - Format.kfprintf (fun _ -> Mutex.unlock io_mutex) f - -let lock_printf s = lock_fprintf Format.std_formatter s -let lock_eprintf s = lock_fprintf Format.err_formatter s - -let suites = ref [] -let make_test_suite s = - suites := s :: !suites - -let exclude_suites = ref [] -let exclude s = exclude_suites := s :: !exclude_suites - -let macro_post_options = ref "" (* value set to @PTEST_POST_OPTIONS@ macro *) -let macro_pre_options = ref "" (* value set to @PTEST_PRE_OPTIONS@ macro *) -let macro_options = ref "@PTEST_PRE_OPTIONS@ @PTEST_OPT@ @PTEST_POST_OPTIONS@" -let macro_default_options = ref "-check -no-autoload-plugins" - -let macro_frama_c_cmd = ref "@frama-c-exe@ @PTEST_DEFAULT_OPTIONS@" -let macro_frama_c = ref "@frama-c-exe@ @PTEST_DEFAULT_OPTIONS@ @PTEST_LOAD_OPTIONS@" -let default_toplevel = ref "@frama-c@" - -(* Those variables are read from a ptests_config file *) -let toplevel_path = ref "" (* value set to @frama-c-exe@ macro *) -let default_suites = ref [] - -let () = - Unix.putenv "LC_ALL" "C" (* for oracles that depend on the locale *) - -let example_msg = - Format.sprintf - "@.@[<v 0>\ - A test suite can be the name of a directory in ./tests or \ - the path to a file.@ @ \ - Directives of \"test_config[_<mode>]\" files:@ \ - COMMENT: <comment> @[<v 0># Just a comment line.@]@ \ - FILEREG: <regexp> @[<v 0># Ignores the files in suites whose name doesn't matche the pattern.@]@ \ - DONTRUN: @[<v 0># Ignores the file.@]@ \ - EXECNOW: ([LOG|BIN] <file>)+ <command> @[<v 0># Defines the command to execute to build a 'LOG' (textual) 'BIN' (binary) targets.@ \ - # NB: the textual targets are compared to oracles.@]@ \ - MODULE: <module>... @[<v 0># Compile the module and set the @@PTEST_MODULE@@ macro.@]@ \ - LIBS: <module>... @[<v 0># Don't compile the module but set the @@PTEST_LIBS@@ macro.@]@ \ - PLUGIN: <plugin>... @[<v 0># Set the @@PTEST_PLUGIN@@ macro.@]@ \ - SCRIPT: <script>... @[<v 0># Set the @@PTEST_SCRIPT@@ macro.@]@ \ - DEPS: <dependency>...@[<v 0># Set the @@PTEST_DEPS@@ macro and adds a dependency to next sub-test and execnow commands (forward compatibility).@ \ - # NB: a dependency to the included files can be added with this directive.@ \ - # That is not necessary for files mentioned into the command or options when using the %%{dep:<file>} feature of dune.@]@ \ - LOG: <file>... @[<v 0># Defines targets built by the next sub-test command.@]@ \ - CMD: <command> @[<v 0># Defines the command to execute for all tests in order to get results to be compared to oracles.@ \ - # NB: the dune feature %%{bin:tool} has to be used to access to a tool of the binary directory of Frama-C.@]@ \ - OPT: <options> @[<v 0># Defines a sub-test using the 'CMD' definition: <command> <options>@]@ \ - STDOPT: -\"<extra>\" @[<v 0># Defines a sub-test and remove the extra from the current option.@ \ - # NB: current version does not allow to remove a multiple-extra-argument.@]@ \ - STDOPT: +\"<extra>\" @[<v 0># Defines a sub-test and appends the extra to the current option.@]@ \ - STDOPT: #\"<extra>\" @[<v 0># Defines a sub-test and prepends the extra to the current option.@]@ \ - EXIT: <number> @[<v 0># Defines the exit code required for the next sub-test commands.@]@ \ - FILTER: <cmd> @[<v 0># Performs a transformation on the test result files before the comparison from the oracles.@ \ - # The oracle will be compared from the standard output of the command: cat <test-output-file> | <cmd> .@ \ - # Chaining multiple filter commands is possible by defining several FILTER directives.@ \ - # An empty command drops the previous FILTER directives.@ \ - # NB: in such a command, the @@PTEST_ORACLE@@ macro is set to the basename of the oracle.@ \ - # This allows running a 'diff' command with the oracle of another test configuration:@ \ - # FILTER: diff --new-file @@PTEST_SUITE_DIR@@/oracle_configuration/@@PTEST_ORACLE@@ @]@ \ - TIMEOUT: <delay> @[<v 0># Set a timeout for all sub-test.@]@ \ - NOFRAMAC: @[<v 0># Drops previous sub-test definitions and considers that there is no defined default sub-test.@]@ \ - GCC: @[<v 0># Deprecated.@]@ \ - MACRO: <name> <def> @[<v 0># Set a definition to the macro @@<name>@@.@]@ \ - @]@ \ - @[<v 1>\ - Default directive values:@ \ - FILEREG: %s@ \ - CMD: %s@ \ - EXIT: 0@ \ - @]@ \ - @[<v 1>\ - Some predefined macros can be used in test commands:@ \ - @@PTEST_DIR@@ # Path to the test file from the execution directory (depends from -dune-mode option).@ \ - @@PTEST_FILE@@ # Substituted by the test filename.@ \ - @@PTEST_NAME@@ # Basename of the test file.@ \ - @@PTEST_NUMBER@@ # Test command number.@ \ - @@PTEST_CONFIG@@ # Test configuration suffix.@ \ - @@PTEST_SESSION@@ # Set to the value of the environment variable FRAMAC_SESSION.@ \ - @@PTEST_SUITE_DIR@@ # Path to the directory contained the source of the test file (depends from -dune-mode option).@ \ - @@PTEST_RESULT@@ # Shorthand alias to '@@PTEST_SUITE_DIR@@/result@@PTEST_CONFIG@@' (the result directory dedicated to the tested configuration).@ \ - @@PTEST_ORACLE@@ # Basename of the current oracle file (macro only usable in FILTER directives).@ \ - @@PTEST_DEPS@@ # Current list of dependencies defined by the DEPS directive.@ \ - @@PTEST_LIBS@@ # Current list of modules defined by the LIBS directive.@ \ - @@PTEST_MODULE@@ # Current list of modules defined by the MODULE directive.@ \ - @@PTEST_PLUGIN@@ # Current list of plugins defined by the PLUGIN directive.@ \ - @@PTEST_SCRIPT@@ # Current list of ML scripts defined by the SCRIPT directive.@ \ - @@PTEST_SHARE_DIR@@ # Shorthand alias to '@@PTEST_SUITE_DIR@@/../../share (the share directory related to the test suite).@ \ - @]@ \ - Other macros can only be used in test commands (CMD and EXECNOW directives):@ \ - @@PTEST_DEFAULT_OPTIONS@@ # The default option list: %s@ \ - @@PTEST_LOAD_LIBS@@ # The '-load-module' option related to the LIBS directive.@ \ - @@PTEST_LOAD_MODULE@@ # The '-load-module' option related to the MODULE directive.@ \ - @@PTEST_LOAD_PLUGIN@@ # The '-load-module' option related to the PLUGIN directive.@ \ - @@PTEST_LOAD_SCRIPT@@ # The '-load-script' option related to the SCRIPT directive.@ \ - @@PTEST_LOAD_OPTIONS@@ # Shorthand alias to '@@PTEST_LOAD_PLUGIN@@ @@PTEST_LOAD_LIBS@@ @@PTEST_LOAD_MODULE@@ @@PTEST_LOAD_SCRIPT@@' .@ \ - @@PTEST_OPTIONS@@ # The current list of options related to OPT and STDOPT directives (for CMD directives).@ \ - @@frama-c@@ # Shortcut defined as follow: %s@ \ - @@frama-c-cmd@@ # Shortcut defined as follow: %s@ \ - @@frama-c-exe@@ # set to the value of the 'TOPLEVEL_PATH' variable defined in the './tests/ptests_config' file.@ \ - @@FRAMAC_SHARE@@ # set to the value of the 'FRAMAC_SHARE' variable defined in the './tests/ptests_config' file.@ \ - @@DEV_NULL@@ # set to 'NUL' for Windows platforms and to '/dev/null' otherwise.@ \ - @]@ \ - @[<v 1>\ - Examples:@ \ - ptests@ \ - ptests -diff \"echo diff\" -examine \ - # see again the list of tests that failed@ \ - ptests misc \ - # for a single test suite@ \ - ptests tests/misc/alias.c \ - # for a single test@ \ - ptests -examine tests/misc/alias.c \ - # to see the differences again@ \ - ptests -v -j 1 \ - # to check the time taken by each test\ - @]@ @]" - test_file_regexp - !default_toplevel - !macro_default_options - !macro_frama_c - !macro_frama_c_cmd - -let umsg = "Usage: ptests [options] [names of test suites]";; - -let rec argspec = - [ - "-examine", Arg.Unit (fun () -> behavior := Examine) , - " Examine the logs that are different from oracles."; - "-gui", Arg.Unit (fun () -> - behavior := Gui; - n := 1; (* Disable parallelism to see which GUI is launched *) - ) , - " Start the tests in Frama-C's gui."; - "-update", Arg.Unit (fun () -> behavior := Update) , - " Take the current logs as oracles. \ - \n NB: the default value can be modified in setting the environment variable PTEST_UPDATE to 1"; - "-show", Arg.Unit (fun () -> behavior := Show) , - " Show the results of the tests."; - "-run", Arg.Unit (fun () -> behavior := Run) , - " (default) Delete logs, run tests, then examine logs different from \ - oracles."; - "-v", Arg.Unit (fun () -> incr verbosity), - " Increase verbosity (up to twice)" ; - "-dry-run", Arg.Unit (fun () -> dry_run := true), - " Do not run commands (use with -v to print all commands which would be run)" ; - "-diff", Arg.String (fun s -> do_diffs := s; - if !use_diff_as_cmp then do_cmp := s), - "<command> Use command for diffs" ; - "-cmp", Arg.String (fun s -> do_cmp:=s), - "<command> Use command for comparison"; - "-make", Arg.String (fun s -> do_make := s;), - "<command> Use command instead of make"; - "-use-diff-as-cmp", - Arg.Unit (fun () -> use_diff_as_cmp:=true; do_cmp:=!do_diffs), - " Use the diff command for performing comparisons"; - "-j", Arg.Int - (fun i -> if i>=0 - then n := i - else ( lock_printf "Option -j requires nonnegative argument@."; - exit (-1))), - "<n> Use nonnegative integer n for level of parallelism" ; - "-byte", Arg.Set use_byte, - " Use bytecode toplevel"; - "-opt", Arg.Clear use_byte, - " Use native toplevel (default)"; - "-config", Arg.Set_string special_config, - " <name> Use special configuration and oracles \ - \n NB: the default value can be modified in setting the environment variable PTEST_CONFIG"; - "-add-options", Arg.Set_string macro_post_options, - "<options> Add additional options to be passed to the toplevels \ - that will be launched. <options> are added after standard test options"; - "-add-options-pre", Arg.Set_string macro_pre_options, - "<options> Add additional options to be passed to the toplevels \ - that will be launched. <options> are added before standard test options."; - "-add-options-post", Arg.Set_string macro_post_options, - "Synonym of -add-options"; - "-exclude", Arg.String exclude, - "<name> Exclude a test or a suite from the run"; - "-xunit", Arg.Set xunit, - " Create a xUnit file named xunit.xml collecting results"; - "-error-code", Arg.Set do_error_code, - " Exit with error code 1 if tests failed (useful for scripts)"; - "-dune-mode", Arg.Set_int dune_mode, - " <mode> Run test commands: \ - \n 0 -> from the plugin or frama-c directory \ - \n 1 -> same as mode 0 with some extra ptest directives giving results closer to those obtained with the mode 2 \ - \n 2 -> from the result directories of the current configuration \ - \n NB: the default value can be modified in setting the environment variable PTEST_DUNE_MODE"; - ] -and help_msg () = Arg.usage (Arg.align argspec) umsg;; - -let () = - Arg.parse - ((Arg.align - (List.sort - (fun (optname1, _, _) (optname2, _, _) -> - compare optname1 optname2 - ) argspec) - ) @ ["", Arg.Unit (fun () -> ()), example_msg;]) - make_test_suite umsg - -(** split the filename into before including "tests" dir and after including "tests" dir - NOTA: both part contains "tests" (one as suffix the other as prefix). -*) -let rec get_upper_test_dir initial dir = - let tests = Filename.dirname dir in - if tests = dir then - (* root directory *) - (fail (Printf.sprintf "Can't find a tests directory below %s" initial)) - else - let base = Filename.basename dir in - if base = "tests" then - dir, "tests" - else - let tests, suffix = get_upper_test_dir initial tests in - tests, Filename.concat suffix base - -let rec get_test_path = function - | [] -> - if Sys.file_exists "tests" && Sys.is_directory "tests" then "tests", [] - else begin - Format.eprintf "No test path found. Aborting@."; - exit 1 - end - | [f] -> let tests, suffix = get_upper_test_dir f f in - tests, [suffix] - | a::l -> - let tests, l = get_test_path l in - let a_tests, a = get_upper_test_dir a a in - if a_tests <> tests - then fail (Printf.sprintf "All the tests should be inside the same tests directory") - else tests, a::l - -let test_path = - let files, names = List.partition Sys.file_exists !suites in - let tests, l = get_test_path files in - let names = List.map (Filename.concat tests) names in - suites := names@l; - Sys.chdir (Filename.dirname tests); - "tests" - -let parse_config_line = - let regexp_blank = Str.regexp "[ ]+" in - fun (key, value) -> - match key with - | "DEFAULT_SUITES" -> - let l = str_split regexp_blank value in - default_suites := List.map (Filename.concat test_path) l - | "TOPLEVEL_PATH" -> - toplevel_path := value - | _ -> default_env key value (* Environnement variable that Frama-C reads*) - - -(** parse config files *) -let () = - let config = "tests/ptests_config" in - if Sys.file_exists config then begin - try - (*Parse the plugin configuration file for tests. Format is 'Key=value' *) - let ch = open_in config in - let regexp = Str.regexp "\\([^=]+\\)=\\(.*\\)" in - while true do - let line = input_line ch in - match str_string_match2 regexp line 0 with - | Some (key,value) -> parse_config_line (key, value) - | None -> - Format.eprintf "Cannot interpret line '%s' in ptests_config@." line; - exit 1 - done - with - | End_of_file -> - if !toplevel_path = "" then begin - Format.eprintf "Missing TOPLEVEL_PATH variable. Aborting.@."; - exit 1 - end - end - else begin - Format.eprintf - "Cannot find configuration file %s. Aborting.@." config; - exit 1 - end - -(** Must be done after reading config *) -let () = - if !use_byte then begin - match string_del_suffix "frama-c" !toplevel_path with - | Some path -> toplevel_path := path ^ "frama-c.byte" - | None -> - match string_del_suffix "toplevel.opt" !toplevel_path with - | Some path -> toplevel_path := path ^ "toplevel.byte" - | None -> - match string_del_suffix "frama-c-gui" !toplevel_path with - | Some path -> toplevel_path := path ^ "frama-c-gui.byte" - | None -> - match string_del_suffix "viewer.opt" !toplevel_path with - | Some path -> toplevel_path := path ^ "viewer.byte" - | None -> () - end; - if !behavior = Gui then begin - match string_del_suffix "toplevel.opt" !toplevel_path with - | Some s -> toplevel_path := s ^ "viewer.opt" - | None -> - match string_del_suffix "toplevel.byte" !toplevel_path with - | Some s -> toplevel_path := s ^ "viewer.byte" - | None -> - match string_del_suffix "frama-c" !toplevel_path with - | Some s -> toplevel_path := s ^ "frama-c-gui" - | None -> - match string_del_suffix "frama-c.byte" !toplevel_path with - | Some s -> toplevel_path := s ^ "frama-c-gui.byte" - | None -> () - end - -(* redefine name if special configuration expected *) -let redefine_name name = - if !special_config = "" then name else - name ^ "_" ^ !special_config - -let dir_config_file = redefine_name dir_config_file - -let gen_make_file s dir file = - Filename.concat (Filename.concat dir s) file - -module SubDir: sig - type t - - val get: t -> string - - val create: ?with_subdir:bool -> string (** dirname *) -> t - (** By default, creates the needed subdirectories if absent. - Anyway, fails if the given dirname doesn't exists *) - - val make_oracle_file: t -> string -> string - val make_result_file: t -> string -> string - val make_file: t -> string -> string - - val result_dirname: string -end = struct - type t = string - - let get s = s - - let create_if_absent dir = - if not (Sys.file_exists dir) - then Unix.mkdir dir 0o750 (** rwxr-w--- *) - else if not (Sys.is_directory dir) - then fail (Printf.sprintf "the file %s exists but is not a directory" dir) - - let oracle_dirname = redefine_name "oracle" - let result_dirname = redefine_name "result" - - let make_result_file = gen_make_file result_dirname - let make_oracle_file = gen_make_file oracle_dirname - let make_file = Filename.concat - - let create ?(with_subdir=true) dir = - if not (Sys.file_exists dir && Sys.is_directory dir) - then fail (Printf.sprintf "the directory %s must be an existing directory" dir); - if (with_subdir) then begin - create_if_absent (Filename.concat dir result_dirname); - create_if_absent (Filename.concat dir oracle_dirname) - end; - dir - -end - -let mk_symbolic_link = - let symlink = match !dune_mode with - | 0 | 1 -> fun ~unlink ~to_dir ~link_dst:_ ~link -> - if unlink then begin - if !verbosity >= 4 then lock_printf "removing symbolic link %s/%s@." (Unix.getcwd ()) link; - Unix.unlink link; - end - | _ -> fun ~unlink ~to_dir ~link_dst ~link -> - if !verbosity >= 4 then lock_printf "creating symbolic link %s/%s -> %s@." (Unix.getcwd ()) link link_dst; - if unlink then - Unix.unlink link; - Unix.symlink ~to_dir link_dst link - in - let symlink_there = match !dune_mode with - | 0 | 1 -> fun ~link -> - if !verbosity >= 4 then lock_printf "removing symbolic link %s/%s@." (Unix.getcwd ()) link; - Unix.unlink link - | _ -> fun ~link:_ -> () - in - let regexp_ignored_dir = Str.regexp "^\\(result\\|oracle\\)" in - if not (Unix.has_symlink ()) then - fail "unable to create symbolic links!"; - fun directory file -> - let dst = SubDir.make_file directory file in - let infos = Unix.stat dst in - let link = SubDir.make_result_file directory file in - let link_dst = "../" ^ file in - let mk_symlink ~to_dir = - if is_nonexisting_link link then (* not there *) - symlink ~unlink:false ~to_dir ~link_dst ~link - else if String.(link_dst <> (Unix.readlink link)) then (* goes elsewhere *) - symlink ~unlink:true ~to_dir ~link_dst ~link - else symlink_there ~link (* is already there *) - in - match infos.st_kind with - | Unix.S_LNK - | Unix.S_REG -> - mk_symlink ~to_dir:false - | Unix.S_DIR -> - if str_string_match regexp_ignored_dir file 0 then () - else mk_symlink ~to_dir:true - | _ -> () - -type does_expand = { - has_ptest_file : bool; - has_ptest_opt : bool; - has_frama_c_exe : bool; -} - -module Macros = -struct - module StringMap = Map.Make (String) - open StringMap - - type t = string StringMap.t - - let add_defaults ~defaults macros = - StringMap.merge (fun _k default cur -> - match cur with - | Some _ -> cur - | _ -> default) defaults macros - - let empty = StringMap.empty - - let print_macros macros = - lock_printf "%% Macros (%d):@." (StringMap.cardinal macros); - StringMap.iter (fun key data -> lock_printf "%% - %s -> %s@." key data) macros; - lock_printf "%% End macros@." - - let does_expand = - let macro_regex = Str.regexp "@\\([-A-Za-z_0-9]+\\)@" in - fun macros s -> - let has_ptest_file = ref false in - let has_ptest_opt = ref false in - let has_ptest_options = ref false in - let has_frama_c_exe = ref false in - if !verbosity >= 4 then lock_printf "%% Expand: %s@." s; - if !verbosity >= 5 then print_macros macros; - let nb_loops = ref 0 in - let rec aux s = - if !nb_loops > 100 then - fail "Possible infinite recursion in macro expands" - else incr nb_loops ; - let expand_macro = function - | Str.Text s -> s - | Str.Delim s -> - match str_string_match1 macro_regex s 0 with - | Some macro -> begin - (match macro with - | "PTEST_FILE" -> has_ptest_file := true - | "PTEST_OPT" -> has_ptest_opt := true - | "PTEST_OPTIONS" -> has_ptest_options := true - | "frama-c-exe" -> has_frama_c_exe := true - | _ -> ()); - if !verbosity >= 5 then lock_printf "%% - macro is %s\n%!" macro; - try - let replacement = find macro macros in - if !verbosity >= 4 then - lock_printf "%% - replacement for %s is %s\n%!" macro replacement; - aux replacement - with Not_found -> s - end - | None -> s - in - String.concat "" (List.map expand_macro (Str.full_split macro_regex s)) - in - let r = - try aux s - with e -> - lock_eprintf "Uncaught exception %s\n%!" (Printexc.to_string e); - raise e - in - if !verbosity >= 4 then lock_printf "%% Expansion result: %s@." r; - { has_ptest_file= !has_ptest_file; - has_ptest_opt= !has_ptest_opt; - has_frama_c_exe= !has_frama_c_exe; - }, r - - let expand macros s = - snd (does_expand macros s) - - let expand_directive = - let deprecated_opts = "(-load-module|-load-script)" in - let contains_deprecated_opts = str_string_contains_option "\\(-load-module\\|-load-script\\)" in - fun ~file macros s -> - let contains = contains_deprecated_opts s 0 in - if contains then lock_eprintf "%s: DEPRECATED direct use of %s option: %s@.Please use PLUGIN, MODULE, SCRIPT or LIBS directive instead of the deprecated option.@." file deprecated_opts s; - expand macros s - - - let get ?(default="") name macros = - try find name macros with Not_found -> default - - let add_list l map = - List.fold_left (fun acc (k,v) -> - if !verbosity >= 4 then - lock_printf "%% - Adds macro %s with definition %s@." k v; - add k v acc) map l - - let add_expand name def macros = - add name (expand macros def) macros - - let append_expand name def macros = - add name (get name macros ^ expand macros def) macros -end - -type execnow = - { - ex_cmd: string; (** command to launch *) - ex_make_cmd: bool; (** is it a make command *) - ex_macros: Macros.t; (** current macros *) - ex_log: string list; (** log files *) - ex_bin: string list; (** bin files *) - ex_dir: SubDir.t; (** directory of test suite *) - ex_file: string; (** test file*) - ex_once: bool; (** true iff the command has to be executed only once - per config file (otherwise it is executed for - every file of the test suite) *) - ex_done: bool ref; (** has the command been already fully executed. - Shared between all copies of this EXECNOW. Do - NOT use a mutable field here, as execnows - are duplicated using OCaml 'with' syntax. *) - ex_timeout: string; - } - - -(** configuration of a directory/test. *) -type cmd = { - toplevel: string; - make_cmd: bool; (** is it a make command *) - opts: string; - macros: Macros.t; - exit_code: string option; - logs:string list; - timeout:string -} - -module StringSet = Set.Make (String) - -type config = - { dc_test_regexp: string; (** regexp of test files. *) - dc_execnow : execnow list; (** command to be launched before - the toplevel(s) - *) - dc_load_script: string; (** load libs options. *) - dc_load_libs: string; (** load libs options. *) - dc_load_module: string; (** load module options. *) - dc_cmxs_module: StringSet.t; (** compiled modules. *) - dc_macros: Macros.t; (** existing macros. *) - dc_default_toplevel : string; - (** full path of the default toplevel. *) - dc_filter : string option; (** optional filter to apply to - standard output *) - dc_exit_code : string option; (** required exit code *) - dc_commands : cmd list; - (** toplevel full path, options to launch the toplevel on, and list - of output files to monitor beyond stdout and stderr. *) - dc_dont_run : bool; - dc_framac : bool; - dc_default_log: string list; - dc_timeout: string - } - -let launch command_string = - if !dry_run then 0 (* do not run command; return as if no error *) - else - let result = system command_string in - match result with - | Unix.WEXITED 127 -> - lock_printf "%% Couldn't execute command. Retrying once.@."; - Thread.delay 0.125; - ( match system command_string with - Unix.WEXITED r when r <> 127 -> r - | _ -> lock_printf "%% Retry failed with command:@\n%s@\nStopping@." - command_string ; - exit 1 ) - | Unix.WEXITED r -> r - | Unix.WSIGNALED s -> - lock_printf - "%% SIGNAL %d received while executing command:@\n%s@\nStopping@." - s command_string ; - exit 1 - | Unix.WSTOPPED s -> - lock_printf - "%% STOP %d received while executing command:@\n%s@\nStopping@." - s command_string; - exit 1 - -let dev_null = if Sys.os_type = "Win32" then "NUL" else "/dev/null" - -let default_filter = match !dune_mode with - | 1 -> Some "sed -e \"s| share/| FRAMAC_SHARE/|g; s|@PTEST_DIR@/||g; s|result@PTEST_CONFIG@/||g\"" - | _ -> None - -let log_default_filter = match default_filter with - | Some filter -> - let redirection = Str.regexp " > " in - fun s -> str_global_replace redirection (" | " ^ filter ^ " > ") s - | None -> fun s -> s - -module Test_config: sig - val scan_directives: drop:bool -> - SubDir.t -> file:string -> Scanf.Scanning.in_channel -> config -> config - val current_config: unit -> config - val scan_test_file: config -> SubDir.t -> string -> config -end = struct - - let default_options = - match !dune_mode with - | 0 -> !macro_default_options - | _ -> !macro_default_options ^ " -add-symbolic-path @PTEST_SESSION@:." - - let default_macros () = - let l = [ - "frama-c-exe", !toplevel_path; - "frama-c-cmd", !macro_frama_c_cmd; - "frama-c", !macro_frama_c; - "DEV_NULL", dev_null; - "FRAMAC_SHARE", get_default_env "FRAMAC_SHARE" ""; - "PTEST_SESSION", get_default_env "FRAMAC_SESSION" ""; - "PTEST_DEFAULT_OPTIONS", default_options; - "PTEST_OPTIONS", !macro_options; - "PTEST_PRE_OPTIONS", !macro_pre_options; - "PTEST_POST_OPTIONS", !macro_post_options; - "PTEST_MAKE_MODULE", "make -s"; - "PTEST_DEPS", ""; - "PTEST_LIBS", ""; - "PTEST_MODULE", ""; - "PTEST_PLUGIN", ""; - "PTEST_SCRIPT", ""; - ] - in - Macros.add_list l Macros.empty - - let default_config () = - { dc_test_regexp = test_file_regexp ; - dc_macros = default_macros (); - dc_execnow = []; - dc_filter = default_filter ; - dc_exit_code = None; - dc_default_toplevel = !default_toplevel; - dc_commands = [ { toplevel= !default_toplevel; make_cmd=false; opts=""; macros=Macros.empty; exit_code=None; logs= []; timeout= ""} ]; - dc_dont_run = false; - dc_load_module = ""; - dc_load_libs = ""; - dc_load_script = ""; - dc_cmxs_module = StringSet.empty; - dc_framac = true; - dc_default_log = []; - dc_timeout = ""; - } - - let scan_execnow ~warn ~once ~file dir ex_macros ex_timeout (s:string) = - if once=false then - lock_eprintf "%s: using EXEC directive (DEPRECATED): %s@." - file s; - let rec aux (s:execnow) = - try - Scanf.sscanf s.ex_cmd "%_[ ]LOG%_[ ]%[-A-Za-z0-9_',+=:.\\@@]%_[ ]%s@\n" - (fun name cmd -> - aux { s with ex_cmd = cmd; ex_log = name :: s.ex_log }) - with Scanf.Scan_failure _ -> - try - Scanf.sscanf s.ex_cmd "%_[ ]BIN%_[ ]%[-A-Za-z0-9_.\\@@]%_[ ]%s@\n" - (fun name cmd -> - aux { s with ex_cmd = cmd; ex_bin = name :: s.ex_bin }) - with Scanf.Scan_failure _ -> - try - Scanf.sscanf s.ex_cmd "%_[ ]make%_[ ]%s@\n" - (fun cmd -> - (* It should be better to use a specific macro into the command (such as @MAKE@) for that. *) - let s = aux ({ s with ex_cmd = cmd; }) in - let r = { s with - ex_cmd = !do_make^" "^cmd; - ex_make_cmd = true - } - in - if warn then - Format.eprintf "%s: EXEC%s directive with a make command (DEPRECATED): %s@." - file (if once then "NOW" else "") r.ex_cmd; - r) - with Scanf.Scan_failure _ -> - s - in - let execnow = aux - { ex_cmd = s; - ex_make_cmd = false; - ex_macros; - ex_log = []; - ex_bin = []; - ex_dir = dir; - ex_file = file; - ex_once = once; - ex_done = ref false; - ex_timeout; - } - in - if warn && execnow.ex_log = [] && execnow.ex_bin = [] then - Format.eprintf "%s: EXEC%s without LOG nor BIN target (DEPRECATED): %s@." - file (if once then "NOW" else "") s; - execnow - - type parsing_env = { - current_default_toplevel: string; - current_default_log: string list; - current_default_cmds: cmd list; - } - - let default_parsing_env = ref { - current_default_toplevel = "" ; - current_default_log = [] ; - current_default_cmds = [] - } - - let set_default_parsing_env config = - default_parsing_env := { - current_default_toplevel = config.dc_default_toplevel; - current_default_log = config.dc_default_log; - current_default_cmds = List.rev config.dc_commands; - } - - let make_custom_opts = - let space = Str.regexp " " in - fun ~file stdopts s -> - let rec aux opts s = - try - Scanf.sscanf s "%_[ ]%1[+#\\-]%_[ ]%S%_[ ]%s@\n" - (fun c opt rem -> - match c with - | "+" -> aux (opts @ [ opt ]) rem (* appends [opt] *) - | "#" -> aux (opt :: opts) rem (* preppends [opt] *) - | "-" -> aux (List.filter (fun x -> x <> opt) opts) rem - | _ -> assert false (* format of scanned string disallow it *)) - with - | Scanf.Scan_failure _ -> - if s <> "" then - lock_eprintf "%s: unknown STDOPT configuration string: %s@." - file s; - opts - | End_of_file -> opts - in - (* NB: current settings does not allow to remove a multiple-argument - option (e.g. -verbose 2). - *) - let opts = aux (str_split space stdopts) s in - String.concat " " opts - - (* how to process options *) - let config_exec ~warn ~once ~file dir s current = - let s = Macros.expand_directive ~file current.dc_macros s in - { current with - dc_execnow = - scan_execnow ~warn ~once ~file dir current.dc_macros current.dc_timeout s :: current.dc_execnow } - - let config_macro = - let regex = Str.regexp "[ \t]*\\([^ \t@]+\\)\\([ \t]+\\(.*\\)\\|$\\)" in - fun ~file _dir s current -> - let s = Macros.expand_directive ~file current.dc_macros s in - Mutex.lock str_mutex; - if Str.string_match regex s 0 then begin - let name = Str.matched_group 1 s in - let def = - try Str.matched_group 3 s with Not_found -> (* empty text *) "" - in - Mutex.unlock str_mutex; - if !verbosity >= 4 then - lock_printf "%% - New macro %s with definition %s\n%!" name def; - { current with dc_macros = Macros.add_expand name def current.dc_macros } - end else begin - Mutex.unlock str_mutex; - lock_eprintf "%s: cannot understand MACRO definition: %s\n%!" file s; - current - end - - let update_make_module_name s = - let s = (Filename.remove_extension s) ^ (if !use_byte then ".cmo" else ".cmxs") in - if "." = Filename.dirname s then "@PTEST_MAKE_DIR@/" ^ s else s - - let update_module_libs_name s = - let s = (Filename.remove_extension s) ^ (if !use_byte then ".cmo" else ".cmxs") in - if "." = Filename.dirname s then "@PTEST_SUITE_DIR@/" ^ s else s - - let add_make_modules ~file dir deps current = - let deps,current = List.fold_left (fun ((deps,curr) as acc) s -> - let s = update_make_module_name s in - if StringSet.mem s curr.dc_cmxs_module then acc - else - (deps ^ " " ^ s), - { curr with dc_cmxs_module = StringSet.add s curr.dc_cmxs_module }) - ("",current) deps - in - if String.(deps = "") then current - else begin - let make_cmd = Macros.expand current.dc_macros "@PTEST_MAKE_MODULE@" in - config_exec ~warn:false ~once:true ~file dir (make_cmd ^ deps) current - end - - let update_macros update_name load_option macro_def macro_load_def current modules = - let def = String.concat "," modules in - let load_def = if String.(def = "") then "" else - load_option ^ (String.concat "," (List.map update_name modules)) - in - if !verbosity >= 3 then Format.printf "%% %s: %s@." macro_def def ; - let dc_macros = Macros.add_list [ macro_def, def ; - macro_load_def, load_def ; - ] current.dc_macros in - { current with dc_macros } - - let update_script_name s = - let s = (Filename.remove_extension s) ^ ".ml" in - if "." = Filename.dirname s then "@PTEST_DIR@/" ^ s else s - - let update_module_macros = - update_macros update_module_libs_name "-load-module=" "PTEST_MODULE" "PTEST_LOAD_MODULE" - - let update_libs_macros = - update_macros update_module_libs_name "-load-module=" "PTEST_LIBS" "PTEST_LOAD_LIBS" - - let update_script_macros = - update_macros update_script_name "-load-script=" "PTEST_SCRIPT" "PTEST_LOAD_SCRIPT" - - let update_plugin_macros = - update_macros (fun name -> name) "-load-module=" "PTEST_PLUGIN" "PTEST_LOAD_PLUGIN" - - let config_deps ~file dir s current = - let macro_def = "PTEST_DEPS" in - let def = Macros.expand_directive ~file current.dc_macros s in - if !verbosity >= 3 then Format.printf "%% %s: %s@." macro_def def ; - let dc_macros = Macros.add_list [ macro_def, def ; - ] current.dc_macros in - { current with dc_macros } - - let config_module ~file dir s current = - let s = Macros.expand_directive ~file current.dc_macros s in - let deps = str_split_list s in - let current = update_module_macros current deps in - add_make_modules ~file dir deps current - - let config_libs_script_plugin update ~file dir s current = - let s = Macros.expand_directive ~file current.dc_macros s in - let deps = str_split_list s in - update current deps - - let config_options = - [ "CMD", - (fun ~file _ s current -> - let s = Macros.expand_directive ~file current.dc_macros s in - { current with dc_default_toplevel = s}); - - "OPT", - (fun ~file _ s current -> - if not (current.dc_framac) then - lock_eprintf - "%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'OPT' directive (That NOFRAMAC directive could be misleading.).@." - file; - let s = Macros.expand_directive ~file current.dc_macros s in - let t = - { toplevel= current.dc_default_toplevel; - make_cmd = false; - opts= s; - logs= current.dc_default_log; - exit_code= current.dc_exit_code; - macros= current.dc_macros; - timeout= current.dc_timeout} - in - { current with - dc_default_log = !default_parsing_env.current_default_log; - dc_commands = t :: current.dc_commands }); - - "STDOPT", - (fun ~file _ s current -> - if not current.dc_framac then - lock_eprintf - "%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'STDOPT' directive (That NOFRAMAC directive could be misleading.).@." - file; - let s = Macros.expand_directive ~file current.dc_macros s in - let new_top = - List.map - (fun command -> - { toplevel = current.dc_default_toplevel; - make_cmd = false; - opts= make_custom_opts ~file command.opts s; - logs= command.logs @ current.dc_default_log; - macros= current.dc_macros; - exit_code = current.dc_exit_code; - timeout= current.dc_timeout - }) - !default_parsing_env.current_default_cmds - in - { current with dc_commands = new_top @ current.dc_commands; - dc_default_log = !default_parsing_env.current_default_log }); - - "FILEREG", - (fun ~file _ s current -> - let s = Macros.expand_directive ~file current.dc_macros s in - { current with dc_test_regexp = s }); - - "FILTER", - (fun ~file _ s current -> - let s = Macros.expand_directive ~file current.dc_macros s in - let s = trim_right s in - match current.dc_filter with - | None when s="" -> { current with dc_filter = None } - | None -> { current with dc_filter = Some s } - | Some filter -> { current with dc_filter = Some (s ^ " | " ^ filter) }); - - "EXIT", - (fun ~file _ s current -> - let s = Macros.expand_directive ~file current.dc_macros s in - { current with dc_exit_code = Some s }); - - "GCC", - (fun ~file _ _ acc -> - lock_eprintf "%s: GCC directive (DEPRECATED)@." file; - acc); - - "COMMENT", - (fun ~file:_ _ _ acc -> acc); - - "DONTRUN", - (fun ~file:_ _ s current -> { current with dc_dont_run = true }); - - "EXECNOW", config_exec ~warn:true ~once:true; - "EXEC", config_exec ~warn:true ~once:false; - - "MACRO", config_macro; - - "MODULE", config_module; - - "DEPS", config_deps; - - "LIBS", config_libs_script_plugin update_libs_macros; - "SCRIPT", config_libs_script_plugin update_script_macros; - "PLUGIN", config_libs_script_plugin update_plugin_macros; - - "LOG", - (fun ~file _ s current -> - let s = Macros.expand_directive ~file current.dc_macros s in - { current with dc_default_log = s :: current.dc_default_log }); - - "TIMEOUT", - (fun ~file _ s current -> - let s = Macros.expand_directive ~file current.dc_macros s in - { current with dc_timeout = s }); - - "NOFRAMAC", - (fun ~file _ _ current -> - if current.dc_commands <> [] && current.dc_framac then - lock_eprintf - "%s: a NOFRAMAC directive has the effect of ignoring previous defined sub-tests (by some 'OPT' or 'STDOPT' directives that seems misleading). @." - file; - { current with dc_commands = []; dc_framac = false; }); - ] - - (** the pattern that ends the parsing of options in a test file *) - let end_comment = Str.regexp ".*\\*/" - - let scan_directives ~drop dir ~file scan_buffer default = - set_default_parsing_env default; - let r = ref { default with dc_commands = [] } in - let treat_line s = - try - Scanf.sscanf s "%[ *]%[A-Za-z0-9]: %s@\n" - (fun _ name opt -> - try - let directive = List.assoc name config_options in - if not drop then - r := directive ~file dir opt !r; - with Not_found -> - lock_eprintf "@[%s: unknown configuration option: %s@\n%!@]" file name) - with - | Scanf.Scan_failure _ -> - if str_string_match end_comment s 0 - then raise End_of_file - else () - | End_of_file -> (* ignore blank lines. *) () - in - try - while true do - if Scanf.Scanning.end_of_input scan_buffer then raise End_of_file; - Scanf.bscanf scan_buffer "%s@\n" treat_line - done; - assert false - with - End_of_file -> - (match !r.dc_commands with - | [] when !r.dc_framac -> { !r with dc_commands = default.dc_commands } - | l -> { !r with dc_commands = List.rev l }) - - let split_config = Str.regexp ",[ ]*" - - let is_config name = - let prefix = "run.config" in - let len = String.length prefix in - String.length name >= len && String.sub name 0 len = prefix - - let scan_test_file default dir f = - let f = SubDir.make_file dir f in - let exists_as_file = - try - (Unix.lstat f).Unix.st_kind = Unix.S_REG - with Unix.Unix_error _ | Sys_error _ -> false - in - if exists_as_file then begin - let scan_buffer = Scanf.Scanning.open_in f in - let rec scan_config () = - (* space in format string matches any number of whitespace *) - Scanf.bscanf scan_buffer " /* %s@\n" - (fun names -> - let is_current_config name = - name = "run.config*" || - name = "run.config" && !special_config = "" || - name = "run.config_" ^ !special_config - in - let configs = str_split split_config (String.trim names) in - if List.exists is_current_config configs then - (* Found options for current config! *) - scan_directives ~drop:false dir ~file:f scan_buffer default - else (* config name does not match: eat config and continue. - But only if the comment is still opened by the end of - the line and we are indeed reading a config - *) - (if List.exists is_config configs && - not (str_string_match end_comment names 0) then - ignore (scan_directives ~drop:true dir ~file:f scan_buffer default); - scan_config ())) - in - try - let options = scan_config () in - Scanf.Scanning.close_in scan_buffer; - options - with End_of_file | Scanf.Scan_failure _ -> - Scanf.Scanning.close_in scan_buffer; - default - end else - (* if the file has disappeared, don't try to run it... *) - { default with dc_dont_run = true } - - (* test for a possible toplevel configuration. *) - let current_config () = - let general_config_file = Filename.concat test_path dir_config_file in - if Sys.file_exists general_config_file - then begin - let scan_buffer = Scanf.Scanning.from_file general_config_file in - scan_directives ~drop:false - (SubDir.create ~with_subdir:false Filename.current_dir_name) - ~file:general_config_file - scan_buffer - (default_config ()) - end - else default_config () - -end - -type toplevel_command = - { macros: Macros.t; - log_files: string list; - file : string ; - nb_files : int ; - options : string ; - toplevel: string ; - make_cmd: bool ; - filter : string option ; - exit_code : int ; - directory : SubDir.t ; - n : int; - execnow:bool; - timeout: string; - } - -type command = - | Toplevel of toplevel_command - | Target of execnow * command Queue.t - -type log = Err | Res - -type diff = - | Command_error of toplevel_command * log - | Target_error of execnow - | Log_error of SubDir.t (** directory *) * string (** test file *) * string (** log file *) - -type cmps = - | Cmp_Toplevel of toplevel_command * bool (** returns with the required exit_code *) - | Cmp_Log of SubDir.t (** directory *) * string (** test file *) * string (** log file *) - -type shared = - { lock : Mutex.t ; - mutable building_target : bool ; - target_queue : command Queue.t ; - commands_empty : Condition.t ; - work_available : Condition.t ; - diff_available : Condition.t ; - mutable commands : command Queue.t ; (* file, options, number *) - cmps : cmps Queue.t ; - (* command that has finished its execution *) - diffs : diff Queue.t ; - (* cmp that showed some difference *) - mutable commands_finished : bool ; - mutable cmp_finished : bool ; - mutable summary_time : float ; - mutable summary_ret : int ; (* number of run with the required exit code *) - mutable summary_run : int ; - mutable summary_ok : int ; - mutable summary_log : int; - } - -let shared = - { lock = Mutex.create () ; - building_target = false ; - target_queue = Queue.create () ; - commands_empty = Condition.create () ; - work_available = Condition.create () ; - diff_available = Condition.create () ; - commands = Queue.create () ; - cmps = Queue.create () ; - diffs = Queue.create () ; - commands_finished = false ; - cmp_finished = false ; - summary_time = (Unix.times()).Unix.tms_cutime ; - summary_run = 0 ; - summary_ret = 0 ; - summary_ok = 0 ; - summary_log = 0 } - -let unlock () = Mutex.unlock shared.lock - -let lock () = Mutex.lock shared.lock - -let update_log_files dir file = - mv (SubDir.make_result_file dir file) (SubDir.make_oracle_file dir file) - -let dune_feature_cmd = (* removes dune feature such as %{deps:...} *) - let dune_cmd_features = Str.regexp "%{[a-z][a-z-]*:\\([^}]*\\)}" in - let dune_bin_features = Str.regexp "%{bin:\\([^}]*\\)}" in - let dune_bin_subst = (Filename.dirname !toplevel_path) ^ "/\\1" in - fun cmd -> - let cmd = str_global_replace dune_bin_features dune_bin_subst cmd in - str_global_replace dune_cmd_features "\\1" cmd - -module Cmd : sig - - val log_prefix : toplevel_command -> string - val oracle_prefix : toplevel_command -> string - - val expand_macros : execnow:bool -> defaults:Macros.t -> toplevel_command -> toplevel_command - - (* [basic_command_string cmd] does not redirect the outputs, and does - not overwrite the result files *) - val basic_command_string : toplevel_command -> string - - val command_string : toplevel_command -> string - - val update_toplevel_command : toplevel_command -> unit - - val get_ptest_dir : toplevel_command -> string - - val remove_results : toplevel_command -> unit - -end = struct - - let catenate_number nb_files prefix n = - if nb_files > 1 - then prefix ^ "." ^ (string_of_int n) - else prefix - - let name_without_extension command = - try - (Filename.chop_extension command.file) - with - Invalid_argument _ -> - fail ("this test file does not have any extension: " ^ - command.file) - - let gen_prefix gen_file cmd = - let prefix = gen_file cmd.directory (name_without_extension cmd) in - catenate_number cmd.nb_files prefix cmd.n - - let log_prefix = gen_prefix SubDir.make_result_file - let oracle_prefix = gen_prefix SubDir.make_oracle_file - - let get_ptest_file = match !dune_mode with - | 0 | 1 -> fun cmd -> SubDir.make_file cmd.directory cmd.file - | _ -> fun cmd -> Filename.basename cmd.file - - let get_ptest_dir = match !dune_mode with - | 0 | 1 -> fun cmd -> SubDir.get cmd.directory - | _ -> fun _ -> "." - - let get_ptest_suite_dir = match !dune_mode with - | 0 | 1 -> fun cmd -> SubDir.get cmd.directory - | _ -> fun _ -> ".." - - let ptest_share_dir = match !dune_mode with - | 0 | 1 -> "./share" - | _ -> "../../../share" - - let get_ptest_result = match !dune_mode with - | 0 | 1 -> fun cmd -> SubDir.get cmd.directory ^ "/" ^ SubDir.result_dirname - | _ -> fun _ -> "." - - let get_ptest_toplevel = match !dune_mode with - | 0 | 1 -> fun _ s -> s - | _ -> fun cmd s -> - if cmd.make_cmd then s - else Format.sprintf "(cd %s && (%s))" (SubDir.make_result_file cmd.directory "") s - - let expand_macros = - fun ~execnow ~defaults cmd -> - let ptest_config = - if !special_config = "" then "" else "_" ^ !special_config - in - let ptest_file = get_ptest_file cmd in - let ptest_name = - try Filename.chop_extension cmd.file - with Invalid_argument _ -> cmd.file - in - let ptest_file = Filename.sanitize ptest_file in - let ptest_load_plugin = Macros.get "PTEST_LOAD_PLUGIN" cmd.macros in - let ptest_load_module = Macros.get "PTEST_LOAD_MODULE" cmd.macros in - let ptest_load_libs = Macros.get "PTEST_LOAD_LIBS" cmd.macros in - let ptest_load_script = Macros.get "PTEST_LOAD_SCRIPT" cmd.macros in - let macros = - [ "PTEST_CONFIG", ptest_config; - "PTEST_DIR", get_ptest_dir cmd; - "PTEST_SHARE_DIR", ptest_share_dir; - "PTEST_SUITE_DIR", get_ptest_suite_dir cmd; - "PTEST_MAKE_DIR", SubDir.get cmd.directory; - "PTEST_RESULT", get_ptest_result cmd; - "PTEST_FILE", ptest_file; - "PTEST_NAME", ptest_name; - "PTEST_NUMBER", string_of_int cmd.n; - "PTEST_OPT", cmd.options; - "PTEST_LOAD_OPTIONS", (String.concat " " - [ ptest_load_plugin ; - ptest_load_libs ; - ptest_load_module ; - ptest_load_script ; ]) - ] - in - let macros = Macros.add_list macros cmd.macros in - let macros = Macros.add_defaults ~defaults macros in - let process_macros s = Macros.expand macros s in - let toplevel = - let toplevel = log_default_filter cmd.toplevel in - let in_toplevel,toplevel = Macros.does_expand macros toplevel in - if cmd.execnow || in_toplevel.has_ptest_opt then toplevel - else begin - let has_ptest_file,options = - let in_option,options = Macros.does_expand macros cmd.options in - (in_option.has_ptest_file || in_toplevel.has_ptest_file), - (if in_toplevel.has_frama_c_exe then - [ process_macros "@PTEST_PRE_OPTIONS@" ; - options ; - process_macros "@PTEST_POST_OPTIONS@" ; - ] - else [ options ]) - in - String.concat " " (toplevel::(if has_ptest_file then options else ptest_file::options)) - end - in - let toplevel = get_ptest_toplevel cmd (dune_feature_cmd toplevel) in - { cmd with - macros; - toplevel; - options = ""; (* no more usable *) - log_files = List.map process_macros cmd.log_files; - filter = - match cmd.filter with - | None -> None - | Some filter -> Some (process_macros filter) - } - - let basic_command_string = - fun command -> - let raw_command = - (* necessary until OPT are using direct -load-module option *) - if !use_byte then opt_to_byte_options command.toplevel - else command.toplevel - in - if command.timeout = "" then raw_command - else "ulimit -t " ^ command.timeout ^ " && " ^ raw_command - - let command_string command = - let log_prefix = log_prefix command in - let reslog,errlog = match command.filter with - | None -> log_prefix ^ ".res.log", log_prefix ^ ".err.log" - | Some _ ->log_prefix ^ ".res.unfiltered-log", log_prefix ^ ".err.unfiltered-log" - in - let reslog = Filename.sanitize reslog in - let errlog = Filename.sanitize errlog in - let command_str = basic_command_string command in - let command_str = - command_str ^ " >" ^ reslog ^ " 2>" ^ errlog - in - let command_str = - match command.timeout with - | "" -> command_str - | s -> - Printf.sprintf - "%s; if test $? -gt 127; then \ - echo 'TIMEOUT (%s); ABORTING EXECUTION' > %s; \ - fi" - command_str s errlog - in - command_str - - let update_toplevel_command command = - let log_prefix = log_prefix command in - let oracle_prefix = oracle_prefix command in - let update_oracle log oracle = - try - if is_file_empty_or_nonexisting log then - (* No, remove the oracle *) - unlink ~silent:false oracle - else - (* Yes, update the oracle*) - mv log oracle - with (* Possible error in [is_file_empty] *) - Unix.Unix_error _ -> () - in - (* Update res.oracle and err.oracle *) - update_oracle (log_prefix ^ ".res.log") (oracle_prefix ^ ".res.oracle"); - update_oracle (log_prefix ^ ".err.log") (oracle_prefix ^ ".err.oracle"); - (* Update files related to LOG directives *) - List.iter (update_log_files command.directory) command.log_files - - let remove_results cmd = - let log_prefix = log_prefix cmd in - unlink (log_prefix ^ ".res.log "); - unlink (log_prefix ^ ".err.log "); - let unlink_log_files dir file = - unlink (SubDir.make_result_file dir file) - in - List.iter (unlink_log_files cmd.directory) cmd.log_files - -end - -let rec update_command = function - | Toplevel cmd -> Cmd.update_toplevel_command cmd - | Target (execnow,cmds) -> - List.iter (update_log_files execnow.ex_dir) execnow.ex_log; - Queue.iter update_command cmds - -let remove_execnow_results execnow = - List.iter - (fun f -> unlink (SubDir.make_result_file execnow.ex_dir f)) - (execnow.ex_bin @ execnow.ex_log) - -module Make_Report(M:sig type t end)=struct - module H=Hashtbl.Make - (struct - type t = toplevel_command - let project cmd = (cmd.directory,cmd.file,cmd.n) - let compare c1 c2 = compare (project c1) (project c2) - let equal c1 c2 = (project c1)=(project c2) - let hash c = Hashtbl.hash (project c) - end) - let tbl = H.create 774 - let m = Mutex.create () - let record cmd (v:M.t) = - if !xunit then begin - Mutex.lock m; - H.add tbl cmd v; - Mutex.unlock m - end - let iter f = - Mutex.lock m; - H.iter f tbl; - Mutex.unlock m - let find k = H.find tbl k - let remove k = H.remove tbl k - -end - -module Report_run=Make_Report(struct type t=int*float -(* At some point will contain the running time*) - end) -let report_run cmd r = Report_run.record cmd r - -type cmp = { res : int; err:int ; ret:bool } -module Report_cmp=Make_Report(struct type t=cmp end) -let report_cmp = Report_cmp.record - -let pretty_report fmt = - Report_run.iter - (fun test (run_result,time_result) -> - Format.fprintf fmt - "<testcase classname=%S name=%S time=\"%f\">%s</testcase>@." - (Filename.basename (SubDir.get test.directory)) test.file time_result - (let {res;err;ret} = Report_cmp.find test in - Report_cmp.remove test; - (if res=0 && err=0 && ret then "" else - Format.sprintf "<failure type=\"Regression\">%s</failure>" - (if not ret then Format.sprintf "Unexpected return code (returns %d instead of %d)" run_result test.exit_code - else if res=1 then "Stdout oracle difference" - else if res=2 then "Stdout System Error (missing oracle?)" - else if err=1 then "Stderr oracle difference" - else if err=2 then "Stderr System Error (missing oracle?)" - else "Unexpected errror")))); - (* Test that were compared but not runned *) - Report_cmp.iter - (fun test {res;err;ret} -> - Format.fprintf fmt - "<testcase classname=%S name=%S>%s</testcase>@." - (Filename.basename (SubDir.get test.directory)) test.file - (if res=0 && err=0 && ret then "" else - Format.sprintf "<failure type=\"Regression\">%s</failure>" - (if not ret then "Unexpected return code" - else if res=1 then "Stdout oracle difference" - else if res=2 then "Stdout System Error (missing oracle?)" - else if err=1 then "Stderr oracle difference" - else if err=2 then "Stderr System Error (missing oracle?)" - else "Unexpected errror"))) - -let xunit_report () = - if !xunit then begin - let out = open_out_bin "xunit.xml" in - let fmt = Format.formatter_of_out_channel out in - Format.fprintf fmt - "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\ - @\n<testsuite errors=\"%d\" failures=\"%d\" name=\"%s\" tests=\"%d\" time=\"%f\" timestamp=\"%f\">\ - @\n%t</testsuite>@." - (shared.summary_run-shared.summary_ret) - (shared.summary_log-shared.summary_ok) - "Frama-C" - shared.summary_log - ((Unix.times()).Unix.tms_cutime -. shared.summary_time) - (Unix.gettimeofday ()) - pretty_report; - close_out out; - end - - -let do_command command = - match command with - | Toplevel command -> - (* Update : copy the logs. Do not enqueue any cmp - Run | Show: launch the command, then enqueue the cmp - Gui: launch the command in the gui - Examine : just enqueue the cmp *) - if !behavior = Update - then Cmd.update_toplevel_command command - else begin - (* Run, Show, Gui or Examine *) - if !behavior = Gui then begin - (* basic_command_string does not redirect the outputs, and does - not overwrite the result files *) - let basic_command_string = Cmd.basic_command_string command in - lock_printf "%% launch GUI: %s@." basic_command_string ; - ignore (launch basic_command_string) - end - else begin - let command_string = Cmd.command_string command in - let summary_ret = - if !behavior <> Examine - then begin - if !verbosity >= 1 - then lock_printf "%% launch TOPLEVEL: %s@." command_string ; - let launch_result = launch command_string in - let time = 0. (* Individual time is difficult to compute correctly - for now, and currently unused *) in - report_run command (launch_result, time) ; - let summary_ret = launch_result = command.exit_code in - if not summary_ret then - lock_printf "%% Unexpected code (returns %d instead of %d) for command: %s@." launch_result command.exit_code command_string ; - summary_ret - end - else false - in - lock (); - if summary_ret then - shared.summary_ret <- succ shared.summary_ret; - shared.summary_run <- succ shared.summary_run ; - Queue.push (Cmp_Toplevel (command,summary_ret)) shared.cmps; - List.iter - (fun log -> Queue.push (Cmp_Log (command.directory, command.file, log)) shared.cmps) - command.log_files; - unlock () - end - end - | Target (execnow, cmds) -> - let continue res = - lock(); - shared.summary_log <- succ shared.summary_log; - if res = 0 - then begin - shared.summary_ok <- succ shared.summary_ok; - Queue.transfer shared.commands cmds; - shared.commands <- cmds; - shared.building_target <- false; - Condition.broadcast shared.work_available; - if !behavior = Examine || !behavior = Run - then begin - List.iter - (fun log -> Queue.push (Cmp_Log(execnow.ex_dir, execnow.ex_file, log)) shared.cmps) - execnow.ex_log - end - end - else begin - let rec treat_cmd = function - Toplevel cmd -> - shared.summary_run <- succ shared.summary_run; - shared.summary_ret <- succ shared.summary_ret; - Cmd.remove_results cmd; - | Target (execnow,cmds) -> - shared.summary_run <- succ shared.summary_run; - shared.summary_ret <- succ shared.summary_ret; - remove_execnow_results execnow; - Queue.iter treat_cmd cmds - in - Queue.iter treat_cmd cmds; - Queue.push (Target_error execnow) shared.diffs; - shared.building_target <- false; - Condition.signal shared.diff_available - end; - unlock() - in - - if !behavior = Update then begin - update_command command; - lock (); - shared.building_target <- false; - Condition.signal shared.work_available; - unlock (); - end else - begin - if !behavior <> Examine && not (!(execnow.ex_done) && execnow.ex_once) - then begin - remove_execnow_results execnow; - let cmd = execnow.ex_cmd in - if !verbosity >= 1 || !behavior = Show then begin - lock_printf "%% launch EXECNOW: %s@." cmd; - end; - shared.summary_run <- succ shared.summary_run; - shared.summary_ret <- succ shared.summary_ret; - let r = launch cmd in - (* mark as already executed. For EXECNOW in test_config files, - other instances (for example another test of the same - directory), won't relaunch the command. For EXECNOW in - stand-alone tests, there is only one copy of the EXECNOW - anyway *) - execnow.ex_done := true; - continue r - end - else - continue 0 - end - -let log_ext = function Res -> ".res" | Err -> ".err" - -let launch_and_check_compare_file diff ~cmp_string ~log_file ~oracle_file = - lock(); - shared.summary_log <- shared.summary_log + 1; - unlock(); - let res = if is_nonexisting_file log_file then 2 else launch cmp_string in - begin - match res with - 0 -> - lock(); - shared.summary_ok <- shared.summary_ok + 1; - unlock() - | 1 -> - lock(); - Queue.push diff shared.diffs; - Condition.signal shared.diff_available; - unlock() - | 2 -> - lock_printf - "%% System error while comparing. Maybe one of the files is missing...@\n%s or %s@." - log_file oracle_file - | n -> - lock_printf - "%% Comparison function exited with code %d for files %s and %s. \ - Allowed exit codes are 0 (no diff), 1 (diff found) and \ - 2 (system error). This is a fatal error.@." n log_file oracle_file; - exit 2 - end; - res - -let check_file_is_empty_or_nonexisting diff ~log_file = - if is_file_empty_or_nonexisting log_file then - 0 - else begin - lock(); - (* signal that there's a problem. *) - shared.summary_log <- shared.summary_log + 1; - Queue.push diff shared.diffs; - Condition.signal shared.diff_available; - unlock(); - 1 - end - -(* Searches for executable [s] in the directories contained in the PATH - environment variable. Returns [None] if not found, or - [Some <fullpath>] otherwise. *) -let find_in_path = - let path_separator = if Sys.os_type = "Win32" then ";" else ":" in - let re_path_sep = Str.regexp path_separator in - fun s -> - let s = trim_right s in - let path_dirs = str_split re_path_sep (Sys.getenv "PATH") in - let found = ref "" in - try - List.iter (fun dir -> - let fullname = dir ^ Filename.dir_sep ^ s in - if Sys.file_exists fullname then begin - found := fullname; - raise Exit - end - ) path_dirs; - None - with Exit -> - Some !found - -(* filter commands are executed from the same directory than test commands *) -let get_filter_cmd = match !dune_mode with - | 0 | 1 -> fun _ s -> dune_feature_cmd s - | _ -> fun cmd s -> Format.sprintf "(cd %s && (%s))" - (SubDir.make_result_file cmd.directory "") - (dune_feature_cmd s) - -let get_unfiltered_log = match !dune_mode with - | 0 | 1 -> fun s -> s - | _ -> Filename.basename - -let do_filter = - let regexp_ptest_oracle = Str.regexp "@PTEST_ORACLE@" in - fun cmd kind -> - match cmd.filter with - | None -> () - | Some filter -> - let log_prefix = Cmd.log_prefix cmd in - let log_ext = log_ext kind in - let log_file = Filename.sanitize (log_prefix ^ log_ext ^ ".log") in - let foracle = (Filename.basename log_prefix) ^ log_ext ^ ".oracle" in - let filter = str_global_replace regexp_ptest_oracle foracle filter in - let exec_name, params = command_partition filter in - let exec_name = - if Sys.file_exists exec_name || not (Filename.is_relative exec_name) - then exec_name - else - match find_in_path exec_name with - | Some full_exec_name -> full_exec_name - | None -> (* must be in the suite directory *) - Filename.concat - (Cmd.get_ptest_dir cmd) - (Filename.basename exec_name) - in - let filter_cmd = - let unfiltered_file = Filename.sanitize (log_prefix ^ log_ext ^ ".unfiltered-log") in - let unfiltered_log = get_unfiltered_log unfiltered_file in - let filter_cmd = Format.sprintf "%s | %s%s" - (* the filter command can be a diff from a [@PTEST_ORACLE@] *) - (if Sys.file_exists unfiltered_file then "cat " ^ unfiltered_log else "echo \"\"") - exec_name params - in - let filter_cmd = get_filter_cmd cmd filter_cmd in - Format.sprintf "%s > %s 2> %s" filter_cmd log_file dev_null - in - if !verbosity >= 1 - then lock_printf "%% launch FILTER:@\n%s@." filter_cmd; - ignore (launch filter_cmd) - -let compare_one_file cmp log_prefix oracle_prefix log_kind = - if !behavior = Show - then begin - lock(); - Queue.push (Command_error(cmp,log_kind)) shared.diffs; - Condition.signal shared.diff_available; - unlock(); - -1 - end else - let ext = log_ext log_kind in - let log_file = Filename.sanitize (log_prefix ^ ext ^ ".log") in - let oracle_file = Filename.sanitize (oracle_prefix ^ ext ^ ".oracle") in - do_filter cmp log_kind; - if not (Sys.file_exists oracle_file) then - check_file_is_empty_or_nonexisting (Command_error (cmp,log_kind)) ~log_file - else begin - let cmp_string = Format.sprintf "%s %s %s > %s 2> %s" - !do_cmp log_file oracle_file dev_null dev_null - in - if !verbosity >= 2 then lock_printf "%% launch CMP (%d%s): %s@." - cmp.n - ext - cmp_string; - launch_and_check_compare_file (Command_error (cmp,log_kind)) - ~cmp_string ~log_file ~oracle_file - end - -let compare_one_log_file dir ~test_file ~log = - if !behavior = Show - then begin - lock(); - Queue.push (Log_error(dir,test_file,log)) shared.diffs; - Condition.signal shared.diff_available; - unlock() - end else - let log_file = Filename.sanitize (SubDir.make_result_file dir log) in - let oracle_file = Filename.sanitize (SubDir.make_oracle_file dir log) in - let cmp_string = Format.sprintf "%s %s %s > %s 2> %s" - !do_cmp log_file oracle_file dev_null dev_null in - if !verbosity >= 2 then lock_printf "%% launch CMP-LOG: %s/%s %s/%s@." (SubDir.get dir) log (SubDir.get dir) oracle_file; - ignore (launch_and_check_compare_file (Log_error (dir,test_file,log)) - ~cmp_string ~log_file ~oracle_file) - -let do_cmp = function - | Cmp_Toplevel (cmd,ret) -> - let log_prefix = Cmd.log_prefix cmd in - let oracle_prefix = Cmd.oracle_prefix cmd in - let cmp = { res = compare_one_file cmd log_prefix oracle_prefix Res; - err = compare_one_file cmd log_prefix oracle_prefix Err; - ret - } - in - report_cmp cmd cmp - | Cmp_Log(dir, test_file, log) -> - ignore (compare_one_log_file dir ~test_file ~log) - -let worker_thread () = - while true do - lock () ; - if (Queue.length shared.commands) + (Queue.length shared.cmps) < !n - then Condition.signal shared.commands_empty; - try - let cmp = Queue.pop shared.cmps in - unlock () ; - do_cmp cmp - with Queue.Empty -> - try - let rec real_command () = - let command = - try - if shared.building_target then raise Queue.Empty; - Queue.pop shared.target_queue - with Queue.Empty -> - Queue.pop shared.commands - in - match command with - Target _ -> - if shared.building_target - then begin - Queue.push command shared.target_queue; - real_command() - end - else begin - shared.building_target <- true; - command - end - | _ -> command - in - let command = real_command() in - unlock () ; - do_command command - with Queue.Empty -> - if shared.commands_finished - && Queue.is_empty shared.target_queue - && not shared.building_target - (* a target being built would mean work can still appear *) - - then (unlock () ; Thread.exit ()); - - Condition.signal shared.commands_empty; - (* we still have the lock at this point *) - - Condition.wait shared.work_available shared.lock; - (* this atomically releases the lock and suspends - the thread on the condition work_available *) - - unlock (); - done - -let diff_check_exist old_file new_file = - if Sys.file_exists old_file then begin - if Sys.file_exists new_file then begin - !do_diffs ^ " " ^ old_file ^ " " ^ new_file - end else begin - "echo \"+++ " ^ new_file ^ " does not exist. Showing " ^ - old_file ^ "\";" ^ " cat " ^ old_file - end - end else begin - "echo \"--- " ^ old_file ^ " does not exist. Showing " ^ - new_file ^ "\";" ^ " cat " ^ new_file - end - -let do_diff = - let stdout_redir_regexp = Str.regexp "[^2]> ?\\([-a-zA-Z0-9_/.]+\\)" - and stderr_redir_regexp = Str.regexp "2> ?\\([-a-zA-Z0-9_/.]+\\)"; - in - function - | Command_error (diff, kind) -> - let log_prefix = Cmd.log_prefix diff in - let log_ext = log_ext kind in - let log_file = Filename.sanitize (log_prefix ^ log_ext ^ ".log") in - do_filter diff kind ; - let test_file = SubDir.make_file diff.directory diff.file in - lock_printf "#------ Oracle difference for test file: %s@.%t@." test_file print_default_env ; - if !behavior = Show - then ignore (launch ("cat " ^ log_file)) - else - let oracle_prefix = Cmd.oracle_prefix diff in - let oracle_file = - Filename.sanitize (oracle_prefix ^ log_ext ^ ".oracle") - in - let diff_string = diff_check_exist oracle_file log_file in - if !verbosity >= 2 then lock_printf "%% launch DIFF (%d%s): %s@." - diff.n - log_ext - diff_string; - ignore (launch diff_string); - lock_printf "#- Tested file: %s #- Command:@\n%s@." test_file (Cmd.command_string diff); - | Target_error execnow -> - let test_file = SubDir.make_file execnow.ex_dir execnow.ex_file in - lock_printf "#------ Custom command failed for test file %s:@\n" test_file; - let print_redirected out redir_regexp = - try - Mutex.lock str_mutex; - ignore (Str.search_forward redir_regexp execnow.ex_cmd 0); - let file = Str.matched_group 1 execnow.ex_cmd in - Mutex.unlock str_mutex; - lock_printf "#- %s redirected to %s:@\n" out file; - if not (Sys.file_exists file) then - lock_printf "#- error: file does not exist: %s:@\n" file - else - ignore (launch ("cat " ^ file)); - with Not_found -> lock_printf "#- error: EXECNOW command without %s redirection: %s@\n" out execnow.ex_cmd - in - print_redirected "stdout" stdout_redir_regexp; - print_redirected "stderr" stderr_redir_regexp; - lock_printf "#- Tested file: %s #- Custom command: %s@\n" test_file execnow.ex_cmd; - | Log_error(dir, test_file, log) -> - let test_file = SubDir.make_file dir test_file in - lock_printf "#------ Log difference for test file: %s@." test_file ; - let result_file = - Filename.sanitize (SubDir.make_result_file dir log) - in - if !behavior = Show - then ignore (launch ("cat " ^ result_file)) - else begin - let oracle_file = - Filename.sanitize (SubDir.make_oracle_file dir log) - in - let diff_string = diff_check_exist oracle_file result_file in - if !verbosity >= 2 then lock_printf "%% launch DIFF-LOG: %s@." - diff_string; - ignore (launch diff_string) - end; - lock_printf "#- Tested file: %s #- Log file: %s@." test_file result_file - -let diff_thread () = - lock () ; - while true do - try - let diff = Queue.pop shared.diffs in - unlock (); - do_diff diff; - lock () - with Queue.Empty -> - if shared.cmp_finished then (unlock () ; Thread.exit ()); - - Condition.wait shared.diff_available shared.lock - (* this atomically releases the lock and suspends - the thread on the condition cmp_available *) - done - -let test_pattern config = - let regexp = Str.regexp config.dc_test_regexp in - fun file -> str_string_match regexp file 0 - -let files = Queue.create () - -(* if we have some references to directories in the default config, they - need to be adapted to the actual test directory. *) -let update_dir_ref dir config = - let update_execnow e = { e with ex_dir = dir } in - let dc_execnow = List.map update_execnow config.dc_execnow in - { config with dc_execnow } - -let () = - (* enqueue the test files *) - let default_suites () = - let priority = "tests/idct" in - let default = !default_suites in - if List.mem priority default - then priority :: (List.filter (fun name -> name <> priority) default) - else default - in - let suites = - match !suites with - | [] -> default_suites () - | l -> - List.fold_left (fun acc x -> - if x = "tests" - then (default_suites ()) @ acc - else x::acc - ) [] l - in - let interpret_as_file suite = - try - let ext = Filename.chop_extension suite in - ext <> "" - with Invalid_argument _ -> false - in - let exclude_suite, exclude_file = - List.fold_left - (fun (suite,test) x -> - if interpret_as_file x then (suite,x::test) else (x::suite,test)) - ([],[]) !exclude_suites - in - List.iter - (fun suite -> - if !verbosity >= 2 then lock_printf "%% producer now treating test %s\n%!" suite; - (* the "suite" may be a directory or a single file *) - let interpret_as_file = interpret_as_file suite in - let directory = - SubDir.create (if interpret_as_file - then - Filename.dirname suite - else - suite) - in - let file = SubDir.make_file directory dir_config_file in - let dir_config = Test_config.current_config () in - let dir_config = update_dir_ref directory dir_config in - let dir_config = - if Sys.file_exists file - then begin - let scan_buffer = Scanf.Scanning.from_file file in - Test_config.scan_directives ~drop:false directory - ~file scan_buffer dir_config - end - else dir_config - in - let process_dir action = - let dirname = SubDir.get directory in - let dir_files = Array.to_list (Sys.readdir dirname) in - (* ignore hidden files (starting with '.') *) - let dir_files = - List.filter (fun n -> String.get n 0 <> '.') dir_files - in - if !verbosity >= 2 then - lock_printf "%% - Look at %d entries of the directory %S ...@." - (List.length dir_files) dirname; - List.iter - (fun file -> - (* creates a symbolic link into the result directory *) - mk_symbolic_link directory file ; - assert (Filename.is_relative file); - action file) dir_files - in - if interpret_as_file then begin - if not (List.mem suite exclude_file) then begin - process_dir (fun _ -> ()) ; - Queue.push (Filename.basename suite, directory, dir_config) files - end; - end - else begin - if not (List.mem suite exclude_suite) then - process_dir - (fun file -> - if test_pattern dir_config file && - (not (List.mem (SubDir.make_file directory file) exclude_file)) - then - Queue.push (file, directory, dir_config) files; - ); - end) - suites - -let dispatcher () = - try - while true - do - lock (); - while (Queue.length shared.commands) + (Queue.length shared.cmps) >= !n - do - Condition.wait shared.commands_empty shared.lock; - done; - (* we have the lock *) - let file, directory, config = Queue.pop files in - if !verbosity >= 2 then lock_printf "%% - Process test file %s ...@." file; - let config = - Test_config.scan_test_file config directory file in - let nb_files = List.length config.dc_commands in - let make_toplevel_cmd = - let i = ref 0 in - fun {toplevel; make_cmd; opts=options; logs=log_files; macros; exit_code; timeout} -> - let n = !i in - incr i; - Cmd.expand_macros ~execnow:false ~defaults:config.dc_macros - { file; make_cmd; options; toplevel; nb_files; directory; n; log_files; - filter = config.dc_filter; macros; - exit_code = begin - match exit_code with - | None -> 0 - | Some exit_code -> - try int_of_string exit_code with - | _ -> lock_eprintf "@[%s: integer required for directive EXIT: %s (defaults to 0)@]@." file exit_code ; 0 - end; - execnow=false; - timeout; - } - in - let nb_files_execnow = List.length config.dc_execnow in - let make_execnow_cmd = - let e = ref 0 in - fun execnow -> - let n = !e in - incr e; - let cmd = Cmd.expand_macros ~execnow:true ~defaults:config.dc_macros - {file ; - nb_files = nb_files_execnow; - log_files = execnow.ex_log; - options = ""; - toplevel = execnow.ex_cmd; - make_cmd = execnow.ex_make_cmd; - exit_code = 0; - n; - directory; - filter = None; (* No filter for execnow command *) - macros = execnow.ex_macros; - execnow = true; - timeout = execnow.ex_timeout; - } - in - let process_macros s = Macros.expand cmd.macros s in - { ex_cmd = Cmd.basic_command_string cmd; - ex_make_cmd = execnow.ex_make_cmd; - ex_macros = cmd.macros; - ex_log = cmd.log_files; - ex_bin = List.map process_macros execnow.ex_bin; - ex_dir = execnow.ex_dir; - ex_file = cmd.file; - ex_once = execnow.ex_once; - ex_done = execnow.ex_done; - ex_timeout = cmd.timeout; - } - in - let treat_option q cmd = - Queue.push - (Toplevel (make_toplevel_cmd cmd)) - q; - in - if not config.dc_dont_run - then begin - (match config.dc_execnow with - | hd :: tl -> - let subworkqueue = Queue.create () in - List.iter (treat_option subworkqueue) config.dc_commands; - let target = - List.fold_left - (fun current_target execnow -> - let subworkqueue = Queue.create () in - Queue.add current_target subworkqueue; - Target(make_execnow_cmd execnow,subworkqueue)) - (Target(make_execnow_cmd hd,subworkqueue)) tl - in - Queue.push target shared.commands - | [] -> - List.iter - (treat_option shared.commands) - config.dc_commands); - Condition.broadcast shared.work_available; - end; - unlock () ; - done - with Queue.Empty -> - shared.commands_finished <- true; - unlock () - -let () = - let worker_ids = Array.init !n - (fun _ -> Thread.create worker_thread ()) - in - let diff_id = Thread.create diff_thread () in - - dispatcher (); - if !behavior = Run - then - lock_printf "%% Dispatch finished, waiting for workers to complete@."; - ignore (Thread.create - (fun () -> - while true do - Condition.broadcast shared.work_available; - Thread.delay 0.5; - done) - ()); - Array.iter Thread.join worker_ids; - - if !behavior = Run - then - lock_printf "%% Comparisons finished, waiting for diffs to complete@."; - lock(); - shared.cmp_finished <- true; - unlock(); - ignore (Thread.create - (fun () -> - while true do - Condition.broadcast shared.diff_available; - Thread.delay 0.5; - done) - ()); - Thread.join diff_id; - if !behavior = Run - then - lock_printf "%% Diffs finished. Summary:@\nRun = %d of %d@\nOk = %d of %d@\nTime = %f s.@." - shared.summary_ret shared.summary_run shared.summary_ok shared.summary_log - ((Unix.times()).Unix.tms_cutime -. shared.summary_time); - xunit_report (); - let error_code = - if !do_error_code && ((shared.summary_log <> shared.summary_ok) || (shared.summary_ret <> shared.summary_run)) - then 1 - else 0 - in - exit error_code - -(* -Local Variables: -compile-command: "LC_ALL=C make -C .. ptests" -End: -*) diff --git a/share/Makefile.clean b/share/Makefile.clean deleted file mode 100644 index 7962593f883ae94922ad7be9a7296bbd5afa4961..0000000000000000000000000000000000000000 --- a/share/Makefile.clean +++ /dev/null @@ -1,78 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# This Makefile could be inlined inside $FRAMAC/Makefile. It is standalone -# for performance reasons, as it performs many costly string operations - -PATHS := src - -SOURCES := $(shell find $(PATHS) -name '*.ml*') -SOURCES := $(basename $(SOURCES)) - -# .cm* files with no corresponding .ml*, but that must be kept nonetheless -ML_NO_SOURCE := src/plugins/wp/qed/src/Qed src/plugins/wp/qed/bin/Qed -# .o files with no corresponding .ml* -O_NO_SOURCE := src/libraries/utils/c_bindings - -ML_SOURCE := $(SOURCES) $(ML_NO_SOURCE) -O_SOURCE := $(ML_SOURCE) $(O_NO_SOURCE) - -CMO_SOURCE := $(addsuffix .cmo,$(ML_SOURCE)) -CMO_FOUND := $(shell find $(PATHS) -name '*.cmo') -CMO_SPURIOUS := $(filter-out $(CMO_SOURCE),$(CMO_FOUND)) - -CMI_SOURCE := $(addsuffix .cmi,$(ML_SOURCE)) -CMI_FOUND := $(shell find $(PATHS) -name '*.cmi') -CMI_SPURIOUS := $(filter-out $(CMI_SOURCE),$(CMI_FOUND)) - -CMX_SOURCE := $(addsuffix .cmx,$(ML_SOURCE)) -CMX_FOUND := $(shell find $(PATHS) -name '*.cmx') -CMX_SPURIOUS := $(filter-out $(CMX_SOURCE),$(CMX_FOUND)) - -CMXS_SOURCE := $(addsuffix .cmxs,$(ML_SOURCE)) -CMXS_FOUND := $(shell find $(PATHS) -name '*.cmxs') -CMXS_SPURIOUS := $(filter-out $(CMXS_SOURCE),$(CMXS_FOUND)) - -O_SOURCE := $(addsuffix .o,$(O_SOURCE)) -O_FOUND := $(shell find $(PATHS) -name '*.o') -O_SPURIOUS := $(filter-out $(O_SOURCE),$(O_FOUND)) - -CMT_SOURCE := $(addsuffix .cmt,$(ML_SOURCE)) $(addsuffix .cmti,$(ML_SOURCE)) -CMT_FOUND := $(shell find $(PATHS) -name '*.cmt' -or -name '*.cmti') -CMT_SPURIOUS := $(filter-out $(CMT_SOURCE),$(CMT_FOUND)) - -smartclean-list: - @echo CMO $(CMO_SPURIOUS) - @echo CMI $(CMI_SPURIOUS) - @echo CMX $(CMX_SPURIOUS) - @echo CMXS $(CMOXS_SPURIOUS) - @echo O $(O_SPURIOUS) - @echo CMT* $(CMT_SPURIOUS) - @echo rm -f $(CMO_SPURIOUS) $(CMI_SPURIOUS) $(CMX_SPURIOUS) $(CMXS_SPURIOUS) $(O_SPURIOUS) $(CMT_SPURIOUS) - -smartclean: - rm -f $(CMO_SPURIOUS) $(CMI_SPURIOUS) $(CMX_SPURIOUS) $(CMXS_SPURIOUS) $(O_SPURIOUS) $(CMT_SPURIOUS) - - -# Local Variables: -# mode: makefile -# End: diff --git a/share/Makefile.common b/share/Makefile.common index b7a230b2545c5f3f4b019df6bd31de113098944e..604c069a2d101c5e3b26d63abf92927a062fa098 100644 --- a/share/Makefile.common +++ b/share/Makefile.common @@ -26,90 +26,31 @@ # # ########################################################################## -include $(MAKECONFIG_DIR)/Makefile.config - -####################### -# Working directories # -####################### - -# Frama-C kernel directories -FRAMAC_SRC_DIRS= plugins/pdg_types plugins/value_types \ - libraries/stdlib libraries/utils \ - libraries/project libraries/datatype \ - kernel_internals/parsing \ - kernel_internals/typing \ - kernel_internals/runtime \ - kernel_services/parsetree \ - kernel_services/ast_data \ - kernel_services/ast_queries \ - kernel_services/ast_printing \ - kernel_services/ast_building \ - kernel_services/cmdline_parameters \ - kernel_services/plugin_entry_points \ - kernel_services/abstract_interp \ - kernel_services/visitors \ - kernel_services/analysis \ - kernel_services/ast_transformations \ - plugins/gui -FRAMAC_SRC_DIRS:= $(addprefix src/, $(FRAMAC_SRC_DIRS)) - -################## -# Flags # -################## +################# +# Make commands # +################# -# Flags to be used by ocamlc and ocamlopt when compiling Frama-C -# itself. For development versions, we add -warn-error for most -# warnings -warn-error has effect only for warnings that are -# explicitly set using '-w'. -ifeq ($(DEVELOPMENT),yes) -# Most warnings are activated by default. Those settings are inherited -# in the compilation of external plugins. -# - 4 (fragile pattern-matching) only make sense when adding a node to a type. -# OCaml GPR #1071 will make it usable -# - 6 (omit label in application) would make code clearer, but requires -# refactoring before being enabled. -# - 9 (missing field in record pattern) is much too heavy. Most of the time -# not all fields are relevant in pattern-matching Frama-C's AST. -# - 40 (constructor or label name used out of scope) -# - 41 (ambiguous constructor or label name) -# - 42 (Disambiguated constructor or label name) -# these three warnings prevents type-based disambiguation, -# a feature which is seen as a good thing by many developers -# - 44 (open shadows an identifier) -# - 45 (open shadows a label or constructor): While the use of open directives -# is supposed to stay small, it should still be possible to open modules -# that share common names, barring some mechanism to open only parts of a -# module. -# - 48 (implicit elimination of optional arguments): makes use of functions -# with optional arguments heavier in higher-order context -# - 67 (unused module parameter in functor signature): naming all parameters -# in functor signatures is a common practice that seems harmless. Warning 60 -# ensures that named functor parameters are indeed used in the implementation. -WARNINGS ?= -w +a-4-9-40-41-42-44-45-48-67 +define assert_defined +ifndef $(1) +$$(error Undefined variable $(1) please report.) +endif +endef -# - 3 (deprecated feature) cannot always be avoided for OCaml stdlib when -# supporting several OCaml versions -# - 4 (fragile pattern matching) will be activated when adding a node (see -# above), in order to let the developer decide whether a case should be -# added on relevant fragile pattern or not: a matching might very well stay -# fragile without triggering an error. -# - 3x (various categories of unused identifiers) it is sometimes useful to -# let code compile despite such warnings when in the middle of a development. -# On the other hand, a completed feature should not trigger such warnings. -# - 58 (missing cmx) is triggered by some versions of external libraries. -# Situation should probably improve as these libraries get updated, leading -# to treat this warning as error. -WARN_ERROR ?= -warn-error +a-3-4-32-33-34-35-36-37-38-39-58 +################################## +# Configure & required variables # +################################## -else +$(eval $(call assert_defined,MAKECONFIG_DIR)) -WARNINGS ?= -w -a +include $(MAKECONFIG_DIR)/Makefile.config -endif #DEVELOPMENT +#Check share/Makefile.config available +ifndef FRAMAC_ROOT_SRCDIR +$(error \ + "You should run ./configure first (or autoconf if there is no configure)") +endif -FLAGS = $(WARNINGS) $(WARN_ERROR) $(OCAML_ANNOT_OPTION) -strict-sequence \ - -safe-string -DEBUG = -g +$(eval $(call assert_defined,PLATFORM)) ############# # Verbosing # @@ -141,7 +82,6 @@ else MAKE := MAKEFLAGS="$(OLDFLAGS)" $(MAKE) endif - ################## # Shell commands # ################## @@ -172,112 +112,16 @@ eval last=\$${$$\#}; \ mv $$new_temp $$last' sed_inplace SED = LC_ALL=C sed RM = rm -f -ifeq ($(shell uname -s 2> /dev/null),Darwin) -TAR = gtar -else -TAR = tar -endif TOUCH = touch GIT = git -################## -# Make commands # -################## - -map=$(foreach a,$(2),$(call $(1),$(a))) - -define assert_defined -ifndef $(1) -$$(error Undefined variable $(1) please report.) -endif -endef - -########################### -# Command pretty printing # -########################### - -PRINT_OCAMLC =$(PRINT) 'Ocamlc '# -PRINT_OCAMLOPT =$(PRINT) 'Ocamlopt '# -PRINT_DEP =$(PRINT) 'Ocamldep '# -PRINT_OCAMLLEX =$(PRINT) 'Ocamllex '# -PRINT_OCAMLYACC =$(PRINT) 'Ocamlyacc '# -PRINT_OCAMLMKTOP=$(PRINT) 'Ocamlmktop '# -PRINT_DOC =$(PRINT) 'Ocamldoc '# -PRINT_OCAMLCP =$(PRINT) 'Profiling '# -PRINT_CAMLP4 =$(PRINT) 'Camlp4 '# -PRINT_PACKING =$(PRINT) 'Packing '# -PRINT_LINKING =$(PRINT) 'Linking '# -PRINT_INFERRING =$(PRINT) 'Inferring '# -PRINT_CC =$(PRINT) 'CC '# - -PRINT_MAKING =$(PRINT) 'Generating '# -PRINT_MV =$(PRINT) 'Moving to '# -PRINT_CP =$(PRINT) 'Copying to '# -PRINT_RM =$(PRINT) 'Cleaning '# -PRINT_EXEC =$(PRINT) 'Running '# -PRINT_TAR =$(PRINT) 'Archiving '# -PRINT_UNTAR =$(PRINT) 'Unarchiving '# -PRINT_CONFIG =$(PRINT) 'Configuring '# -PRINT_BUILD =$(PRINT) 'Building '# -PRINT_INSTALL =$(PRINT) 'Installing '# -PRINT_UPDATE =$(PRINT) 'Updating '# - -PRINT_DOT =$(PRINT) 'Dot '# -PRINT_LATEX =$(PRINT) 'Latex '# -PRINT_DVIPS =$(PRINT) 'Dvips '# -PRINT_HEVEA =$(PRINT) 'Hevea '# - -######### -# Tests # -######### - - -################# -# Documentation # -################# - -NATIVE_OCAMLDOC:=$(shell ocamlfind ocamldoc -v | grep -o ocamldoc.opt) - -ifeq ("$(NATIVE_OCAMLDOC)","ocamldoc.opt") -DOC_PLUGIN=$(DOC_DIR)/docgen.cmxs +ifeq ($(PLATFORM),MacOS) +TAR = gtar else -DOC_PLUGIN=$(DOC_DIR)/docgen.cmo +# Unix, Cygwin, Win32 +TAR = tar endif -########################## -# Plugin File Generation # -########################## - -#take the name of the plugin as argument $(1) -define include_generic_plugin_Makefile -$(call assert_defined,PLUGIN_DIR) -$(PLUGIN_DIR)/.Makefile.plugin.generated: $(MAKECONFIG_DIR)/Makefile.plugin.template - $(PRINT_MAKING) $$@ - $(SED) -e "s/@PLUGIN_NAME@/$(1)/g" $$< > $$@ - -# We still clean the old Makefile.plugin.generated (without the dot) temporarily -clean:: - rm -rf $(PLUGIN_DIR)/.Makefile.plugin.generated - rm -rf $(PLUGIN_DIR)/Makefile.plugin.generated - -#We always define this variable because it can't wait the generation -#of the Makefile.plugin.generated since the targets of rules defined in the -#Makefile of the plugins could use this variable -$(1)_DIR:=$(PLUGIN_DIR) - -sinclude $(PLUGIN_DIR)/.Makefile.plugin.generated - -endef - -%.check_mli_exists: %.mli - touch $@ - -.PHONY:common_force_rule - -%.check_mli_exists: common_force_rule - $(error "The file '$*.mli' must be provided. The simplest workaround is 'touch $*.mli') - - ########################################################################## # Local Variables: # compile-command: "make" diff --git a/share/Makefile.config.in b/share/Makefile.config.in index 12cd6881533fab745cae58091974daa54d1ca167..e3a8475d0da5176db1dea649cda72fb051e7f28a 100644 --- a/share/Makefile.config.in +++ b/share/Makefile.config.in @@ -48,181 +48,22 @@ FRAMAC_LIBDIR ?=$(LIBDIR)/frama-c FRAMAC_PLUGINDIR ?=$(FRAMAC_LIBDIR)/plugins FRAMAC_DATADIR ?=$(DATADIR)/frama-c EMACS_DATADIR ?=$(DATADIR)/emacs/site-lisp + FRAMAC_DEFAULT_CPP ?=@FRAMAC_DEFAULT_CPP@ FRAMAC_DEFAULT_CPP_ARGS ?= @FRAMAC_DEFAULT_CPP_ARGS@ FRAMAC_GNU_CPP ?=@FRAMAC_GNU_CPP@ DEFAULT_CPP_KEEP_COMMENTS?=@DEFAULT_CPP_KEEP_COMMENTS@ DEFAULT_CPP_SUPPORTED_ARCH_OPTS?=@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@ -CC =@CC@ - -############### -# Ocaml stuff # -############### - -# compilers and others executables -OCAMLC ?=@OCAMLC@ -OCAMLOPT ?=@OCAMLOPT@ -OCAMLDEP ?=@OCAMLDEP@ -slash -OCAMLLEX ?=@OCAMLLEX@ -OCAMLYACC ?=@OCAMLYACC@ -OCAMLMKTOP ?=@OCAMLMKTOP@ -OCAMLMKLIB ?=@OCAMLFIND@ ocamlmklib -OCAMLFIND ?=@OCAMLFIND@ -OCAMLDOC ?=@OCAMLDOC@ -OCAMLCP ?=@OCAMLCP@ - -# others ocaml stuffs - -# either -annot or -dtypes -OCAML_ANNOT_OPTION ?=@OCAML_ANNOT_OPTION@ -# ocaml stdlib path -OCAMLLIB ?=@OCAMLLIB@ -# either opt or byte -OCAMLBEST ?=@OCAMLBEST@ - -OCAMLVERSION ?=@OCAMLVERSION@ - -OCAMLMAJORNB ?=@OCAMLMAJORNB@ -OCAMLMINORNB ?=@OCAMLMINORNB@ -OCAMLPATCHNB ?=@OCAMLPATCHNB@ - -HAS_OCAML409 ?=@HAS_OCAML409@ -HAS_OCAML410 ?=@HAS_OCAML410@ - -PLATFORM ?=@PLATFORM@ -OCAMLWIN32 ?=@OCAMLWIN32@ -DLLEXT ?=@DLLEXT@ - -DEVELOPMENT ?=@DEVELOPMENT@ - -############# -# Libraries # -############# - -# ocamlgraph -HAS_OCAMLGRAPH_2 ?= @HAS_OCAMLGRAPH_2@ -HAS_DGRAPH ?= @HAS_DGRAPH@ - -# lablgtk -HAS_LABLGTK ?=@HAS_LABLGTK@ -HAS_LABLGTK_CUSTOM_MODEL ?=@HAS_LABLGTK@ -LABLGTK_PATH ?=@LABLGTK_PATH@ -LABLGTK ?= lablgtk@LABLGTK_VERSION@ -# lablgtksourceview -HAS_GTKSOURCEVIEW ?=@HAS_GTKSOURCEVIEW@ -#gnomecanvas -HAS_GNOMECANVAS ?=@HAS_GNOMECANVAS@ - -LABLGTK_VERSION ?=@LABLGTK_VERSION@ -ifeq ("$(LABLGTK_VERSION)","3") - GTKSOURCEVIEW:=lablgtk3-sourceview3 - THREAD:=-thread -else - GTKSOURCEVIEW:=\ - $(patsubst lablgtk%,$(LABLGTK).%,$(basename $(notdir @GTKSOURCEVIEW@))) - THREAD:= -endif - -# apron -HAS_APRON ?=@HAS_APRON@ - -# mpfr -HAS_MPFR ?=@HAS_MPFR@ - -# landmarks -HAS_LANDMARKS ?=@HAS_LANDMARKS@ - -# python 3.7 -HAS_PYTHON37 ?=@HAS_PYTHON37@ - -########################## -# Miscellaneous commands # -########################## - -OTAGS ?=@OTAGS@ -DOT ?=@DOT@ -HAS_DOT ?=@HAS_DOT@ - -HEADACHE ?= headache -c $(FRAMAC_SRC)/headers/headache_config.txt - -UNIX2DOS ?= @UNIX2DOS@ -HAS_UNIX2DOS ?= @HAS_UNIX2DOS@ ########################### # Miscellaneous variables # ########################### -VERBOSEMAKE ?=@VERBOSEMAKE@ -LOCAL_MACHDEP ?=@LOCAL_MACHDEP@ -EXE ?=@EXE@ - -# Required by Cil -UNDERSCORE_NAME ?=@UNDERSCORE_NAME@ -HAVE_BUILTIN_VA_LIST ?=@HAVE_BUILTIN_VA_LIST@ - -# test directories for ptests configuration -# Non-plugin test directories containing some ML files to compile -TEST_DIRS_AS_PLUGIN:=\ - dynamic saveload spec misc syntax cil \ - pretty_printing builtins libc value - -ifeq ($(HAS_PYTHON37),yes) -TEST_DIRS_AS_PLUGIN+= compliance fc_script jcdb -endif - -PLUGIN_TESTS_LIST+=$(TEST_DIRS_AS_PLUGIN) - -########################## -# Variables for plug-ins # -########################## - -EXTERNAL_PLUGINS ?=@EXTERNAL_PLUGINS@ - -# Integrated plugins -ENABLE_CALLGRAPH ?=@ENABLE_CALLGRAPH@ -ENABLE_CONSTANT_PROPAGATION ?=@ENABLE_SEMANTIC_CONSTANT_FOLDING@ -ENABLE_FROM_ANALYSIS ?=@ENABLE_FROM_ANALYSIS@ -ENABLE_GUI ?=@ENABLE_GUI@ -ENABLE_IMPACT ?=@ENABLE_IMPACT@ -ENABLE_INOUT ?=@ENABLE_INOUT@ -ENABLE_METRICS ?=@ENABLE_METRICS@ -ENABLE_OCCURRENCE ?=@ENABLE_OCCURRENCE@ -ENABLE_PDG ?=@ENABLE_PDG@ -ENABLE_POSTDOMINATORS ?=@ENABLE_POSTDOMINATORS@ -ENABLE_REDUC ?=@ENABLE_REDUC@ -ENABLE_RTEGEN ?=@ENABLE_RTEGEN@ -ENABLE_SCOPE ?=@ENABLE_SCOPE@ -ENABLE_SLICING ?=@ENABLE_SLICING@ -ENABLE_SPARECODE ?=@ENABLE_SPARECODE@ -ENABLE_USERS ?=@ENABLE_USERS@ -ENABLE_EVA ?=@ENABLE_EVA@ - -#bytes is part of the stdlib, but is used as a transitional package. -LIBRARY_NAMES := \ - findlib ocamlgraph unix str dynlink bytes zarith yojson bigarray \ - ppx_import ppx_deriving.eq - -ifeq ($(HAS_LANDMARKS),yes) -LIBRARY_NAMES += landmarks landmarks-ppx -endif +# Used by Makefile.common +PLATFORM ?=@PLATFORM@ -ifneq ($(ENABLE_GUI),no) - LIBRARY_NAMES_GUI = $(LABLGTK) $(GTKSOURCEVIEW) - ifeq ($(HAS_OCAMLGRAPH_2),yes) - ifeq ($(HAS_DGRAPH),yes) - LIBRARY_NAMES_GUI+=ocamlgraph_gtk - endif - else - ifeq ($(HAS_GNOMECANVAS),yes) - LIBRARY_NAMES_GUI+=lablgtk2.gnomecanvas - GRAPH_GUICMO= dgraph.cmo - GRAPH_GUICMX= dgraph.cmx - GRAPH_GUIO= dgraph.o - endif - endif -else -LIBRARY_NAMES_GUI = -endif +# Used by Makefile.common +VERBOSEMAKE ?=@VERBOSEMAKE@ ####################### # Working directories # diff --git a/share/Makefile.dynamic b/share/Makefile.dynamic deleted file mode 100644 index 6d11b5c08f447fa5d392591dcfdfda2bb006b8bf..0000000000000000000000000000000000000000 --- a/share/Makefile.dynamic +++ /dev/null @@ -1,291 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -$(eval $(call assert_defined,PLUGIN_NAME)) - -PLUGIN_ENABLE ?=yes -PLUGIN_DIR ?=. - -FRAMAC_SRC ?=$(PLUGIN_DIR)/../../.. - -FRAMAC_INTERNAL ?=no - -ifndef MAKECONFIG_DIR -MAKECONFIG_DIR :=$(FRAMAC_SHARE) -endif - -#Add required packages to merlin -MERLIN_PACKAGES+=$(PLUGIN_REQUIRES) - -#Do not generate documentation for this. -PLUGIN_UNDOC:=$(PLUGIN_UNDOC) - -ifeq ($(FRAMAC_INTERNAL),yes) -## The plugin is not compiled from an installed frama-c, ie -## internal plugin (in src/plugins or added during -## ./configure with --enable-external) -PLUGIN_RESET :=yes - -else - -# The plugin is compiled from an installed frama-c -PLUGIN_RESET :=no -include $(MAKECONFIG_DIR)/Makefile.common -include $(MAKECONFIG_DIR)/Makefile.dynamic_config - -tests:: external_tests - -ifeq ($(PLUGIN_ENABLE),no) -tests:: -doc:: -else - -.PHONY: plugin-doc/$(PLUGIN_NAME) -ifneq ($(FRAMAC_INTERNAL),yes) -plugin-doc/$(PLUGIN_NAME): - if test ! -e $(DOC_DIR)/kernel-doc.ocamldoc; then \ - echo "Frama-C kernel was not installed with code documentation \ -support. Cannot compile API documentation. To install it, run 'make doc \ -install-doc-code' in Frama-C's main directory"; \ - exit 1; \ - fi - $(MKDIR) $($(@:plugin-doc/%=%_DOC_DIR)) -else -ifeq ($(FRAMAC_INTERNAL),yes) -plugin-doc/$(PLUGIN_NAME): - : -else -plugin-doc/$(PLUGIN_NAME): - $(MKDIR) $($(@:plugin-doc/%=%_DOC_DIR)) -endif -endif - -doc:: plugin-doc/$(PLUGIN_NAME) $(PLUGIN_NAME)_DOC - -clean-doc:: $(PLUGIN_DIR)/$(PLUGIN_NAME)_CLEAN_DOC - -ifneq ($(FRAMAC_INTERNAL),yes) -install-doc-code:: $(PLUGIN_NAME)_INSTALL_DOC -endif - -$(PLUGIN_NAME)_INSTALL_DOC: plugin-doc/$(PLUGIN_NAME) - $(PRINT_CP) $(patsubst %_INSTALL_DOC,%,$@) Documentation - $(MKDIR) $(DOC_DIR)/$(@:%_INSTALL_DOC=%) - $(CP) $(patsubst %,"%",\ - $(wildcard $($(@:%_INSTALL_DOC=%_DOC_DIR))/*.css \ - $($(@:%_INSTALL_DOC=%_DOC_DIR))/*.html \ - $($(@:%_INSTALL_DOC=%_DOC_DIR))/*.png)) \ - $(DOC_DIR)/$(@:%_INSTALL_DOC=%) - -endif #PLUGIN_ENABLE -endif #FRAMAC_INTERNAL - -#Must be defined before section TESTS, because function call in make -#replace not only $(1) but all the other $(..) -PLUGIN_LIB_DIR ?= $(PLUGIN_DIR) -PLUGIN_GUI_LIB_DIR ?= $(PLUGIN_DIR)/gui -PLUGIN_INSTALL_DIR ?=$(DESTDIR)$(FRAMAC_PLUGINDIR) - -ifneq ($(PLUGIN_ENABLE),no) -######################## TESTS ################# -.PHONY: $(PLUGIN_NAME)_TESTS plugins_ptests_config - -$(eval $(call assert_defined,PLUGIN_LIB_DIR)) -$(eval $(call assert_defined,FRAMAC_SHARE)) -$(eval $(call assert_defined,FRAMAC_LIB)) - -# Do not generate tests-related rules when PLUGIN_NO_TEST is set to 'no' but -# there is no 'tests' directory. Typically useful for plugins released without -# their tests. -HAS_TESTS_DIR:=$(shell if test \! -d $(PLUGIN_DIR)/tests; then echo KO; fi) - -ifneq (,$(HAS_TESTS_DIR)$(PLUGIN_INTERNAL_TEST)$(PLUGIN_NO_TEST)) -$(PLUGIN_NAME)_TESTS: - -else -PTESTS_DEP:=$(PLUGIN_DIR)/Makefile $(FRAMAC_SHARE)/Makefile.dynamic - -plugins_ptests_config: $(PLUGIN_DIR)/tests/ptests_config - -define TESTS_template -$(PLUGIN_DIR)/tests/ptests_config: $(PTESTS_DEP) - $(PRINT_MAKING) $$@ - $(MKDIR) tests - $(RM) $$@ - $(ECHO) "DEFAULT_SUITES=" $(PLUGIN_TESTS_DIRS) > $$@ - $(ECHO) "TOPLEVEL_PATH=$(FRAMAC_OPT)" >> $$@; - $(ECHO) "FRAMAC_SHARE=$(FRAMAC_SHARE)" >> $$@ - $(ECHO) "FRAMAC_LIB=$(FRAMAC_LIB)" >> $$@ - if test "$(FRAMAC_INTERNAL)" = "no"; then \ - $(ECHO) "FRAMAC_PLUGIN=$(realpath $(PLUGIN_LIB_DIR)):$(PLUGIN_INSTALL_DIR)" >> $$@; \ - $(ECHO) "FRAMAC_PLUGIN_GUI=$(realpath $(PLUGIN_GUI_LIB_DIR)):$(PLUGIN_INSTALL_DIR)/gui" >> $$@; \ - $(ECHO) "OCAMLFIND_IGNORE_DUPS_IN=$(PLUGIN_INSTALL_DIR)" >> $$@; \ - else \ - $(ECHO) "FRAMAC_PLUGIN=$(realpath $(PLUGIN_LIB_DIR))" >> $$@; \ - $(ECHO) "FRAMAC_PLUGIN_GUI=$(realpath $(PLUGIN_GUI_LIB_DIR))" >> $$@; \ - fi - $(ECHO) "OCAMLRUNPARAM=" >> $$@ - $(CHMOD_RO) $$@ - -# OCAMLFIND_IGNORE_DUPS_IN in external mode allows to ignore a previous -# installation of the currently tested plugin. - -# $(PLUGIN_NAME)_DEFAULT_TESTS allows plugins to define rules that at -# the same time depend on $(PLUGIN_NAME)_DEFAULT_TESTS and -# $(PLUGIN_NAME)_TESTS depend on them - -.PHONY: $(PLUGIN_NAME)_DEFAULT_TESTS - -$(PLUGIN_NAME)_DEFAULT_TESTS: $$(TARGETS) $$(TARGETS_TOP) $$(TARGETS_GUI) $(PLUGIN_DIR)/tests/ptests_config - $(PRINT) TESTING PLUG-IN $(PLUGIN_NAME) - cd $(PLUGIN_DIR) && \ - time -p $(PTESTS) $$(PTESTS_OPTS) $(PLUGIN_PTESTS_OPTS) - -$(PLUGIN_NAME)_TESTS: $(PLUGIN_NAME)_DEFAULT_TESTS - -endef -$(eval $(call TESTS_template)) - -external_tests: $(PLUGIN_NAME)_TESTS - -endif -endif # PLUGIN_ENABLE -################################################ - -PLUGIN_FLAGS:=$(FLAGS) $(DEBUG) $(FRAMAC_INCLUDES) -PLUGIN_BFLAGS:=$(PLUGIN_FLAGS) $(PLUGIN_BFLAGS) -PLUGIN_OFLAGS:=$(PLUGIN_FLAGS) $(PLUGIN_OFLAGS) -ifeq ($(FRAMAC_INTERNAL),yes) -PLUGIN_DEPFLAGS:=$(PLUGIN_DEPFLAGS) -else -PLUGIN_DEPFLAGS:=$(FRAMAC_INCLUDES) $(PLUGIN_DEPFLAGS) -PLUGIN_DOC_DIR:=$(PLUGIN_DIR)/doc/code -endif -# For plugins that depends on the API of other ones, we need to add the -# directory where the plugins' .cmi are compiled -PLUGIN_DOCFLAGS:=\ - $(FRAMAC_INCLUDES) -I $(FRAMAC_COMPILED_PLUGINDIR) $(PLUGIN_DOCFLAGS) - -$(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) - -TARGETS := $(TARGET_META) $(TARGET_CMI) -TARGETS_TOP := $(TARGET_TOP_CMO) $(TARGET_TOP_CMX) \ - $(TARGET_TOP_CMA) $(TARGET_TOP_CMXS) $(TARGET_TOP_O) -TARGETS_GUI_BYTE := $(TARGET_GUI_CMI) $(TARGET_GUI_CMO) -TARGETS_GUI := $(TARGETS_GUI_BYTE) $(TARGET_GUI_CMX) $(TARGET_GUI_CMXS) $(TARGET_GUI_O) -TARGETS_BYTE:= $(TARGET_META) $(TARGET_CMI) $(TARGET_TOP_CMO) $(TARGET_TOP_CMA) -TARGETS_OPT:= $(TARGET_META) $(TARGET_CMI) $(TARGET_TOP_CMX) $(TARGET_TOP_CMXS) $(TARGET_TOP_O) - -byte:: $(TARGETS_BYTE) -opt:: $(TARGETS_OPT) -gui-byte:: $(TARGETS_GUI_BYTE) -gui-opt:: $(TARGETS_GUI) - -# do not define additional targets if you come from the Frama-C Makefile -ifneq ($(FRAMAC_INTERNAL),yes) - -################### -# Clean & Install # -################### - -.PHONY: tests all install uninstall clean depend - -dist-clean distclean: $(PLUGIN_DIR)/$(PLUGIN_NAME)_DIST_CLEAN - -all:: $(PLUGIN_DIR)/.depend byte $(OCAMLBEST) gui plugins_ptests_config - -gui: gui-$(OCAMLBEST) - -ifneq ($(PLUGIN_ENABLE),no) - -install:: - $(PRINT_CP) $(PLUGIN_INSTALL_DIR) - $(MKDIR) $(PLUGIN_INSTALL_DIR)/top - $(CP) $(TARGETS) $(PLUGIN_INSTALL_DIR) - $(CP) $(TARGETS_TOP) $(PLUGIN_INSTALL_DIR)/top - $(PRINT_CP) $(BINDIR) - if [ -f frama-c-$(PLUGIN_NAME).byte$(EXE) ]; then \ - $(CP) frama-c-$(PLUGIN_NAME).byte$(EXE) $(BINDIR); \ - fi - if [ -f frama-c-$(PLUGIN_NAME).$(OCAMLBEST)$(EXE) ]; then \ - $(CP) frama-c-$(PLUGIN_NAME).$(OCAMLBEST)$(EXE) \ - $(BINDIR)/frama-c-$(PLUGIN_NAME)$(EXE); \ - fi -ifeq ($(HAS_GUI),yes) - $(PRINT_CP) $(PLUGIN_INSTALL_DIR)/gui - $(MKDIR) $(PLUGIN_INSTALL_DIR)/gui - $(CP) $(TARGETS_GUI) $(PLUGIN_INSTALL_DIR)/gui -endif - -uninstall:: - $(PRINT_RM) installed $(PLUGIN_NAME) - $(RM) $(PLUGIN_INSTALL_DIR)/META.$(PLUGIN_PKG) - $(RM) $(PLUGIN_INSTALL_DIR)/$(PLUGIN_NAME).* - $(RM) $(BINDIR)/frama-c-$(PLUGIN_NAME).* -ifeq ($(HAS_GUI),yes) - $(RM) $(PLUGIN_INSTALL_DIR)/gui/$(PLUGIN_NAME).* -endif -endif # PLUGIN_ENABLE <> no - -########## -# Merlin # -########## - -.PHONY: create_merlin -create_merlin: -#create Merlin file for external plug-in - $(PRINT_MAKING) .merlin - echo "FLG -c $(FLAGS) $(FRAMAC_USER_MERLIN_FLAGS)" > .merlin - echo "B $(FRAMAC_LIBDIR)" >> .merlin - echo "B $(FRAMAC_LIBDIR)/plugins" >> .merlin - echo "B $(FRAMAC_LIBDIR)/plugins/gui" >> .merlin - for PKG in $(LIBRARY_NAMES); do echo PKG $$PKG >> .merlin; done - for PKG in $(LIBRARY_NAMES_GUI); do echo PKG $$PKG >> .merlin; done - for PKG in $(MERLIN_PACKAGES); do echo PKG $$PKG >> .merlin; done - for DIR in $(patsubst %/,%,$(sort $(dir $(PLUGIN_ML_SRC) $(PLUGIN_TESTS_LIB)))); do echo S $$DIR>> .merlin; echo B $$DIR >> .merlin; done - -# To allow completion of .merlin file -.PHONY: merlin -merlin:: create_merlin - -.merlin: merlin - -############ -# Cleaning # -############ - -clean:: $(PLUGIN_DIR)/$(PLUGIN_NAME)_CLEAN; - -################ -# Generic part # -################ - -include $(MAKECONFIG_DIR)/Makefile.generic - -endif # FRAMAC_INTERNAL <> yes - -PLUGIN_PTESTS_OPTS:= - -############################################################################### -# Local Variables: -# mode: makefile -# End: diff --git a/share/Makefile.generic b/share/Makefile.generic deleted file mode 100644 index 99b80b2968f212f6dff61cc5392e79ca062485b1..0000000000000000000000000000000000000000 --- a/share/Makefile.generic +++ /dev/null @@ -1,138 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -.DEFAULT_GOAL=all - -ifndef SUFFIXES_ARE_SET - -SUFFIXES_ARE_SET:=true - -# The former .SUFFIXES delete all predefined implicit rules -# The latter .SUFFIXES defines our suffix list -# See GNU Make manual, section 10.7 -# This way of declaring implicit rules is deprecated, -# but that is the only way for removing **all** predefined implicit rules -# The only other way is to remove each predefined implicit rule, one by one. -.SUFFIXES: -.SUFFIXES: .c .o .mli .ml .cmi .cmo .cmx .mll .mly .tex .dvi .ps .html .cmxs \ - .png .svg .ps - -ifdef DOT -%.png: %.dot - $(PRINT_DOT) $@ - $(DOT) -Tpng -o $@ $< - -%.svg: %.dot - $(PRINT_DOT) $@ - $(ISED) -e "s/\(digraph .*\)/\1 node [href=\"\\\\N.html\"];/" $< - $(DOT) -Tsvg -o $@ $< - -%.ps: %.dot - $(PRINT_DOT) $@ - $(DOT) -Tps -o $@ $< -%.pdf: %.dot - $(PRINT_DOT) $@ - $(DOT) -Tpdf -o $@ $< - -else -%.png: %.dot - @$(ECHO) "dot missing: generation of $@ skipped." -%.svg: %.dot - @$(ECHO) "dot missing: generation of $@ skipped." -%.ps: %.dot - @$(ECHO) "dot missing: generation of $@ skipped." -endif - -# the two rules below are used for .cmi. The first one will be preferred -# by make when a .mli exists (see GNU Make manual 10.5.4), the second is a -# fallback for mli-less (boo) source files. - -%.cmi: %.mli - $(PRINT_OCAMLC) $@ - $(OCAMLC) -c $(BFLAGS) $< - -%.cmi: %.cmo - $(TOUCH) $@ - -%.cmo: %.ml - $(PRINT_OCAMLC) $@ - $(OCAMLC) -c $(BFLAGS) $< - -%.inferred.mli: %.ml - $(PRINT_INFERRING) $@ - $(OCAMLC) -i $(BFLAGS) $< > $@ - -# Using the technique of intf-suffix given by Alain Frisch in -# http://caml.inria.fr/mantis/view.php?id=4991 -# forces ocamlopt to not create a new cmi. -%.cmx: %.ml %.cmi - $(PRINT_OCAMLOPT) $@ - $(OCAMLOPT) -intf-suffix .cmi -c $(OFLAGS) $< - -# So we can define specific variables that are not inherited -# Cf. GNU Make manual, Section 6.12 Pattern-specific Variable Values -%.cmx: OFLAGS:=$(OFLAGS) - -# .o are generated together with .cmx, but %.o %.cmx: %.ml only confuses -# make when computing dependencies... -%.o: %.cmx - $(TOUCH) $@ - -%.cmxs: %.cmx - $(PRINT_PACKING) $@ - $(OCAMLOPT) -shared -o $@ $(OFLAGS) $< - -.mll.ml: - $(PRINT_OCAMLLEX) $@ - $(RM) $@ - $(OCAMLLEX) $< - $(CHMOD_RO) $@ - -%.mli %.ml: %.mly - $(PRINT_OCAMLYACC) $@ - $(RM) $(<:.mly=.ml) $(<:.mly=.mli) - $(OCAMLYACC) -v $< - $(CHMOD_RO) $(<:.mly=.ml) $(<:.mly=.mli) - -.tex.dvi: - $(PRINT_LATEX) $@ - latex $< && latex $< - -.dvi.ps: - $(PRINT_DVIPS) $@ - dvips $< -o $@ - -.tex.html: - $(PRINT_HEVEA) $@ - hevea $< - -.c.o: - $(PRINT_OCAMLC) $@ - $(OCAMLC) $(BFLAGS) -ccopt "-o $@" $< - -endif - - -########################################################################## -# Local Variables: -# mode: makefile -# End: diff --git a/share/Makefile.headers b/share/Makefile.headers new file mode 100644 index 0000000000000000000000000000000000000000..12f55b36c3bbe6703a86587882c26220424f1ed2 --- /dev/null +++ b/share/Makefile.headers @@ -0,0 +1,226 @@ +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +##################### +# HEADER MANAGEMENT # +##################### + +############## +# Parameters + +# Must be unset (for external plugins) and set (for FRAMA-C kernel) +FRAMAC_HDRCK?= + +# Can be set to yes +# - yes: adds "-exit-on-warning" option to "frama-c-hdrck" +HEADER_STRICT?= + +# Defines where to find the header directories +HEADER_DIRS?=headers $(wildcard src/plugins/*/headers) + +# Can be set to unset/yes/no/<relative sub-directory> +# - unset: look at $(HEADER_DIRS) +# - yes: look at $(HEADER_DIRS)/open-source +# - no: look at $(HEADER_DIRS)/close-source +# - <dir>: look at $(HEADER_DIRS)/<dir> +HEADER_OPEN_SOURCE?=yes + +# Can be set to a directory +# - <dir>: directory containing the files to manage +HEADER_REPO?= + +# Can be set to a file +# - <file>: file containing the list of the files to manage +HEADER_DISTRIB_FILE?= + +# Can be set to a file +# - <file>: file containing the list of the files to ignore any way +HEADER_EXCEPTIONS?= + +# Can be set to a file +# - <files>: input file containing, for each file to manage, the "header_spec" attribute value +HEADER_SPEC?= + +# Can be set to a file +# - yes: save the "header_spec" attribute specification into the file "HEADER_SPEC" +HEADER_SAVE_SPEC?=no + +# Extra parameters for "frama-c-hdrck" +HDRCK_EXTRA?= + +########################################################################## +## Command used to execute hdrck + +# Note: the public name of hdrck.exe is frama-c-hdrck +ifeq ($(FRAMAC_HDRCK),) + +# HDRCK is external +HDRCK:= frama-c-hdrck + +else + +# HDRCK is internal +HDRCK:= dune exec --root $(FRAMAC_HDRCK_SRC) -- frama-c-hdrck + +$(FRAMAC_HDRCK): $(FRAMAC_HDRCK_SRC)/hdrck.ml + dune build --root $(FRAMAC_HDRCK_SRC) hdrck.exe + +endif + +HDRCK_OPTS:= --stdin + +###################################################################### +## Identifies how to get the header specification (from git/find/cat) +## and updates HDRCK_OPTS variable + +ifeq ($(HEADER_SPEC),) + +HEADER_HAS_GIT:=$(wildcard .git) +ifneq ($(HEADER_HAS_GIT),) + +# From git (including git work-trees) +HDRCK_SPEC:= git ls-files -z | git check-attr --stdin -z header_spec +HDRCK_OPTS+= -z + +else + +# Note: in such a case, GIT is required... +HDRCK_SPEC:= + +endif # HEADER_HAS_GIT + +else # HEADER_SPEC + +ifeq ($(HEADER_SAVE_SPEC),yes) + +HEADER_HAS_GIT:=$(wildcard .git) +ifneq ($(HEADER_HAS_GIT),) + +# From git (including git work-trees) +HDRCK_SPEC:= git ls-files -z | git check-attr --stdin -z header_spec | tee $(HEADER_SPEC) +HDRCK_OPTS+= -z + +else + +# Note: in such a case, GIT is required... +HDRCK_SPEC:= + +endif # HEADER_HAS_GIT + +else # HEADER_SAVE_SPEC + +# From a file +HDRCK_SPEC:= cat $(HEADER_SPEC) + +# The file format can be overloaded in using the var HDRCK_EXTRA +HDRCK_OPTS+= -spec-format 3-zeros + +endif # HEADER_SAVE_SPEC +endif # HEADER_SPEC + +################################ +## Updates HDRCK_OPTS variable + +ifneq ($(HEADER_DISTRIB_FILE),) +# Adds the option "-distrib-file" +HDRCK_OPTS+= -distrib-file $(HEADER_DISTRIB_FILE) +endif + +ifneq ($(HEADER_EXCEPTIONS),) +# Adds the option "-header-except-file" +HDRCK_OPTS+= -header-except-file $(HEADER_EXCEPTIONS) +endif + +ifneq ($(HEADER_REPO),) +# Adds the option "-C" +HDRCK_OPTS+= -C $(HEADER_REPO) +endif + +ifeq ($(HEADER_STRICT),yes) +# Adds the option "-exit-on-warning" +HDRCK_OPTS+= -exit-on-warning +endif + +##################################### +## Identifies where are the headers +## and updates HDRCK_OPTS variable + +ifeq ($(HEADER_OPEN_SOURCE),yes) +HDRCK_OPTS+= $(addprefix -header-dirs=,$(addsuffix /open-source,$(HEADER_DIRS))) +else +ifeq ($(HEADER_OPEN_SOURCE),no) +HDRCK_OPTS+= $(addprefix -header-dirs=,$(addsuffix /close-source,$(HEADER_DIRS))) +else +ifeq ($(HEADER_OPEN_SOURCE),) +HDRCK_OPTS+= $(addprefix -header-dirs=,$(HEADER_DIRS)) +else +HDRCK_OPTS+= $(addprefix -header-dirs=,$(addsuffix /$(HEADER_OPEN_SOURCE),$(HEADER_DIRS))) +endif +endif +endif + +################################# + +ifeq ($(HDRCK_SPEC),) + +.PHONY: check-headers +check-headers: $(FRAMAC_HDRCK) + $(error "Please set HEADER_SPEC variable to a file containing the header specification.") + + +.PHONY: headers +headers: $(FRAMAC_HDRCK) + $(error "Please set HEADER_SPEC variable to a file containing the header specification.") +else + +.PHONY: check-headers +check-headers: $(FRAMAC_HDRCK) + $(HDRCK_SPEC) | $(HDRCK) $(HDRCK_OPTS) $(HDRCK_EXTRA) + +.PHONY: headers +headers: $(FRAMAC_HDRCK) + $(HDRCK_SPEC) | $(HDRCK) -update $(HDRCK_OPTS) $(HDRCK_EXTRA) + +endif # $(HDRCK_SPEC) + +################################# + +.PHONY: headers.info +headers.info: + echo "FRAMAC_HDRCK='$(FRAMAC_HDRCK)'" + echo "HEADER_HAS_GIT='$(HEADER_HAS_GIT)'" + echo "HEADER_OPEN_SOURCE='$(HEADER_OPEN_SOURCE)'" + echo "HEADER_STRICT='$(HEADER_STRICT)'" + echo "HEADER_DIRS='$(HEADER_STRICT)'" + echo "HEADER_DISTRIB_FILE='$(HEADER_DISTRIB_FILE)'" + echo "HEADER_EXCEPTIONS='$(HEADER_EXCEPTIONS)'" + echo "HEADER_REPO='$(HEADER_REPO)'" + echo "HEADER_SPEC='$(HEADER_SPEC)'" + echo "HDRCK='$(HDRCK)'" + echo "HDRCK_SPEC='$(HDRCK_SPEC)'" + echo "HDRCK_OPTS='$(HDRCK_OPTS)'" + + +############################################################################### +# Local Variables: +# compile-command: "make" +# End: diff --git a/src/plugins/obfuscator/Makefile.in b/share/Makefile.installation similarity index 69% rename from src/plugins/obfuscator/Makefile.in rename to share/Makefile.installation index 3fe4c0886d3640c5e3a99ac962ceff6b890c1416..c5cd0159c6c77cd98ea41d9cdf866050be17f9bb 100644 --- a/src/plugins/obfuscator/Makefile.in +++ b/share/Makefile.installation @@ -20,36 +20,34 @@ # # ########################################################################## -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif -PLUGIN_DIR ?=. - -PLUGIN_ENABLE:=@ENABLE_OBFUSCATOR@ -PLUGIN_NAME:=Obfuscator +################ +# INSTALLATION # +################ -PLUGIN_CMO:= options \ - obfuscator_kind \ - dictionary \ - obfuscate \ - obfuscator_register +################################ +## Default variables -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -PLUGIN_NO_TEST:=yes +# Set this variable to request a specific installation directory +# Default: Dune installs in the Opam directory +INSTALLDIR?= -include $(FRAMAC_SHARE)/Makefile.dynamic +################################ +## Install and uninstall -# Regenerating the Makefile on need +.PHONY: install uninstall -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) +install: +ifeq ($(INSTALLDIR),) + dune install else -CONFIG_STATUS_DIR=. + dune install --prefix ${INSTALLDIR} + @echo 'DO NOT FORGET TO EXPAND YOUR OCAMLPATH VARIABLE:' + @echo ' export OCAMLPATH="${INSTALLDIR}/lib:$$OCAMLPATH"' endif -$(Obfuscator_DIR)/Makefile: $(Obfuscator_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ +uninstall: +ifeq ($(INSTALLDIR),) + dune uninstall +else + dune uninstall --prefix ${INSTALLDIR} +endif diff --git a/share/Makefile.linting b/share/Makefile.linting new file mode 100644 index 0000000000000000000000000000000000000000..85911ad2b41d6c1528a5bfe34a22327b92db937b --- /dev/null +++ b/share/Makefile.linting @@ -0,0 +1,476 @@ +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +################################ +# Code prettyfication and lint # +################################ + +# make lint includes: +# - make check-utf8: valid UTF-8 encoding +# - make check-eoleof: EOF preceded by an EOL +# - make check-syntax: EOF preceded by an EOL + no TAB + no BLANK at the end +# - make check-indent: valid indentation +# For all these targets (and the corresponding fix-XXX), it is possible to restrict the search to a sub-directory: +# - make LINT_DIR=<subdir> <lint-target> +# It is possible to force the action to given files: +# - make LINT_FILE=<file> <lint-target> +# or to the files modified between HEAD and a specific branch/commit: +# - make LINT_DIFF=<branch/commit> <lint-target> +# Notes: +# - when LINT_FILE is given, .gitattributes, LINT_DIFF and LINT_DIR are ignored; +# - when LINT_DIFF is given, LINT_DIR is ignored (but .gitattributes is used); +# - to use fix-utf8 target, the variable LINT_FROM_ENCODING=<from-encoding-name> +# has to be set. + +# make clean-lint (removing linting targets) includes +# - make clean-utf8 +# - make clean-eoleof +# - make clean-syntax +# - make clean-indent + +################################ +## Default variables + +IS_UTF8 ?= iconv -f UTF-8 -t UTF-8 +TO_UTF8 ?= iconv -t UTF-8 -f + +OCP_INDENT ?= ocp-indent +CLANG_FORMAT ?= clang-format +# wc, tail, head, cmp + +# Default values necessary for +# LINT_MAKEFILE=<this-makefile> make -f <this-makefile> <lint-target>` +# Otherwise theses variables are defined into share/Makefile.common +GREP ?= grep +TR ?= tr +SED ?= LC_ALL=C sed +ISED ?= sed -i +FIND ?= find +GIT ?= git +MKDIR ?= mkdir -p +MV ?= mv +RM ?= rm -f +RMDIR ?= rm -rf +TOUCH ?= touch + +ifeq ($(PLATFORM),MacOS) +XARGS ?= xargs +else +# Unix, Cygwin +XARGS ?= xargs --no-run-if-empty +endif + +############ + +# Can be set to the path of that makefile +LINT_MAKEFILE ?= + +# Can be set to a sub-directory to restrict the checking +LINT_DIR ?= . + +################################ + +LINT.makefile=$(wildcard $(LINT_MAKEFILE)) +ifeq ($(LINT.makefile),) + +LINT.make?=$(MAKE) --quiet +else + +LINT.make?=$(MAKE) --quiet -f $(LINT.makefile) +endif + + +################################ +## CHECK ocp-indent VERSION + +.lint/check-ocp-indent-version: + if command -v $(OCP_INDENT) >/dev/null; then \ + if [ -z "$(shell $(OCP_INDENT) --version)" ]; then echo "warning: $(OCP_INDENT) returned an empty string, assuming it is the correct version"; \ + else \ + $(eval ocp_version_major := $(shell $(OCP_INDENT) --version | $(SED) -E "s/^([0-9]+)\.[0-9]+\..*/\1/")) \ + $(eval ocp_version_minor := $(shell $(OCP_INDENT) --version | $(SED) -E "s/^[0-9]+\.([0-9]+)\..*/\1/")) \ + if [ "$(ocp_version_major)" -lt 1 -o "$(ocp_version_minor)" -lt 7 ]; then \ + echo "error: $(OCP_INDENT) 1.7.0 required for linting (got $(ocp_version_major).$(ocp_version_minor))"; \ + exit 1; \ + fi; \ + fi; \ + else \ + exit 1; \ + fi; + $(MKDIR) $(dir $@) + $(TOUCH) $@ + +.lint/check-clang-format-installed: + if ! command -v $(CLANG_FORMAT) >/dev/null; then \ + echo "error: $(CLANG_FORMAT) must be installed"; \ + exit 1; \ + fi; + $(MKDIR) $(dir $@) + $(TOUCH) $@ + +############### +## Main target + +LINT.HAS_GIT:=$(wildcard .git) +ifeq ($(LINT.HAS_GIT),) + +.PHONY: +lint: + echo "'make lint' requires a git repository but, that is not" + echo "the case for example with 'make LINT_FILE=<file> check-syntax'" + +else + +lint: check-eoleof check-syntax check-indent check-utf8 + +endif + +############################### +## Cleaning + +# Targets are generated into .lint/ directories + +.PHONY: clean-lint +clean-lint: + echo "Cleaning LINT targets..." + $(RMDIR) .lint + +clean:: clean-lint + +#### clean-check-XXX targets + +LINT.clean-targets= + +# Same list on both lines +LINT.clean-targets+= \ + clean-check-eoleof clean-check-utf8 clean-check-syntax +.PHONY: clean-check-eoleof clean-check-utf8 clean-check-syntax \ + +# Same list on both lines +LINT.clean-targets+= \ + clean-check-indent +.PHONY: clean-check-indent + +# Generic rule +$(LINT.clean-targets): + echo "[LINT] Cleaning $(patsubst clean-%,%,$@) targets..." + $(FIND) .lint -type f -name \*.$(patsubst clean-%,%,$@) | $(XARGS) -n 10 $(RM) + +############################### + +ifeq ($(LINT_FILE),) + +# No lint file given + +LINT.dir=$(wildcard $(LINT_DIR)) + +ifeq ($(LINT_DIFF),) +FILE_LIST=$(GIT) ls-files $(LINT.dir) -z +else +$(info [LINT] Looking at files modified from branch/commit: '$(LINT_DIFF)') +FILE_LIST=$(GIT) diff --name-status --cached $(LINT_DIFF) | $(GREP) -v "^D" | $(SED) "s/^.[ \t]*//" | $(TR) '\n' '\000' +endif + +#### check-XXX targets + +# Same list on both lines +LINT.check-targets= \ + check-syntax check-indent check-clang-format check-eoleof check-utf8 +.PHONY: check-syntax check-indent check-clang-format check-eoleof check-utf8 + +# Generic rule +$(LINT.check-targets): + echo "[LINT] Checking from GIT attribute $@..." + $(FILE_LIST) \ + | $(GIT) check-attr --stdin -z $@ \ + | $(SED) -zne 'x;n;n;s/^set$$//;t print;b;:print;x;p' \ + | $(XARGS) -0 -IXX sh -c '$(LINT.make) LINT_FILE="XX" $@ || exit 255' + +#### fix-XXX targets + +# Same list on both lines +LINT.fix-targets= \ + fix-eoleof fix-utf8 fix-syntax fix-indent +.PHONY: fix-eoleof fix-utf8 fix-syntax fix-indent + +# Generic rule +$(LINT.fix-targets): + echo "[LINT] Fixing from GIT attribute $(patsubst fix-%,check-%,$@)..." + $(FILE_LIST) \ + | $(GIT) check-attr --stdin -z $(patsubst fix-%,check-%,$@) \ + | $(SED) -zne 'x;n;n;s/^set$$//;t print;b;:print;x;p' \ + | $(XARGS) -0 -IXX sh -c '$(LINT.make) LINT_FILE="XX" $@ || exit 255' + + +else # LINT_FILE are given + +## Internal targets from the recursive make + +LINT_FILE.list=$(addprefix .lint/,$(wildcard $(LINT_FILE))) + +LINT_FILE.check-utf8= $(addsuffix .check-utf8,$(LINT_FILE.list)) +LINT_FILE.check-eoleof= $(addsuffix .check-eoleof,$(LINT_FILE.list)) +LINT_FILE.check-syntax= $(addsuffix .check-syntax,$(LINT_FILE.list)) +LINT_FILE.check-indent= $(addsuffix .check-indent,$(LINT_FILE.list)) + +LINT_FILE.fix-utf8= $(addsuffix .fix-utf8,$(LINT_FILE.list)) +LINT_FILE.fix-eoleof= $(addsuffix .fix-eoleof,$(LINT_FILE.list)) +LINT_FILE.fix-syntax= $(addsuffix .fix-syntax,$(LINT_FILE.list)) +LINT_FILE.fix-indent= $(addsuffix .fix-indent,$(LINT_FILE.list)) + +## Filters for the extension for check/fix-indent + +# ML filter +LINT_FILE.ml-indent = $(filter $(addsuffix .ml,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.ml-indent+= $(filter $(addsuffix .mli,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.check-ml-indent= $(addsuffix .check-indent,$(LINT_FILE.ml-indent)) +LINT_FILE.fix-ml-indent= $(addsuffix .fix-indent,$(LINT_FILE.ml-indent)) + +# C filter +LINT_FILE.c-indent =$(filter $(addsuffix .c,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.c-indent+= $(filter $(addsuffix .h,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.check-c-indent= $(addsuffix .check-indent,$(LINT_FILE.c-indent)) +LINT_FILE.fix-c-indent= $(addsuffix .fix-indent,$(LINT_FILE.c-indent)) + + +LINT_FILE.check-unknown-indent=$(filter-out $(LINT_FILE.check-ml-indent) \ + $(LINT_FILE.check-c-indent),$(LINT_FILE.check-indent)) +LINT_FILE.fix-unknown-indent=$(patsusbt %.check-indent,%.fix-indent,LINT_FILE.check-unknown-indent) + +## check-XXX targets + +.PHONY: check-utf8 +check-utf8: $(LINT_FILE.check-utf8) + +.PHONY: check-eoleof +check-eoleof: $(LINT_FILE.check-eoleof) + +.PHONY: check-syntax +check-syntax: $(LINT_FILE.check-syntax) + +# ML and C format +.PHONY: check-indent +check-indent: $(LINT_FILE.check-indent) + +## fix-XXX targets + +.PHONY: fix-utf8 +fix-utf8: $(LINT_FILE.fix-utf8) + +.PHONY: fix-eoleof +fix-eoleof: $(LINT_FILE.fix-eoleof) + +.PHONY: fix-syntax +fix-syntax: $(LINT_FILE.fix-syntax) + +# ML and C format +.PHONY: fix-indent +fix-indent: $(LINT_FILE.fix-indent) + +endif + +############################### +## UTF8 ASPECT + +$(LINT_FILE.check-utf8): .lint/%.check-utf8: % + echo "Check UTF8: $<" + if ! $(IS_UTF8) $< > /dev/null; \ + then \ + echo "File $< uses an invalid UTF-8 encoding."; \ + echo "Please fixe it manualy or in running: make LINT_FROM_ENCODING=<ENCODING-NAME> LINT_FILE=$< fix-utf8";\ + echo "The next command may help you to find that <ENCODING-NAME>: file $<";\ + exit 1; \ + fi + $(MKDIR) $(dir $@) + $(TOUCH) $@ + +ifneq ($(LINT_FROM_ENCODING),) + +.PHONY: $(LINT_FILE.fix-utf8) +$(LINT_FILE.fix-utf8): .lint/%.fix-utf8: % + if ! $(IS_UTF8) $< > /dev/null 2> /dev/null; \ + then \ + echo "Fixes UTF8 (from $(LINT_FROM_ENCODING)): $<"; \ + if ! $(TO_UTF8) $(LINT_FROM_ENCODING) $< > $<.tmp; then exit 1; fi; \ + $(MV) $<.tmp $<; \ + fi + $(MKDIR) $(dir $@) + $(TOUCH) .lint/$<.check-utf8 # no more need of check-indent + +else + +$(LINT_FILE.fix-utf8): .lint/%.fix-utf8: % .lint/check-ocp-indent-version + $(error "Target fix-utf8 requires to define LINT_FROM_ENCODING variable") + +endif # LINT_FROM_ENCODING + +############################### +## UNKNOWN INDENTATION FORMATER + +ifneq ($(LINT_FILE.check-unknown-indent),) +.PHONY: $(LINT_FILE.check-unknown-indent) +$(LINT_FILE.check-unknown-indent): .lint/%.check-indent: % + $(error "Check indent with an unknown formater: $<") +endif + +ifneq ($(LINT_FILE.fix-unknown-indent),) +.PHONY: $(LINT_FILE.fix-unknown-indent) +$(LINT_FILE.check-unknown-indent): .lint/%.fix-indent: % + $(error "Check indent with an unknown formater: $<") +endif + +############################### +## ML INDENTATION ASPECT + +$(LINT_FILE.check-ml-indent): .lint/%.check-indent: % .lint/check-ocp-indent-version + echo "Check ML indent: $<" + $(OCP_INDENT) $< > $<.tmp + if cmp -s $< $<.tmp; \ + then $(RM) $<.tmp; \ + else \ + echo "File $< is not indented correctly."; \ + echo "Please run: make LINT_FILE=$< fix-indent";\ + $(RM) $<.tmp; \ + exit 1; \ + fi + $(MKDIR) $(dir $@) + $(TOUCH) $@ + +.PHONY: $(LINT_FILE.fix-ml-indent) +$(LINT_FILE.fix-ml-indent): .lint/%.fix-indent: % .lint/check-ocp-indent-version + echo "Fixes ML indent: $<" + $(OCP_INDENT) -i $< + $(MKDIR) $(dir $@) + $(TOUCH) .lint/$<.check-indent # no more need of check-indent + +############################### +## C INDENTATION ASPECT + +$(LINT_FILE.check-c-indent): .lint/%.check-indent: % .lint/check-clang-format-installed + echo "Check C indent: $<" + $(CLANG_FORMAT) --dry-run -Werror $< + $(MKDIR) $(dir $@) + $(TOUCH) $@ + +.PHONY: $(LINT_FILE.fix-c-indent) +$(LINT_FILE.fix-c-indent): .lint/%.fix-indent: % .lint/check-clang-format-installed + echo "Fixes C indent: $<" + $(CLANG_FORMAT) -i $< + $(MKDIR) $(dir $@) + $(TOUCH) .lint/$<.check-indent # no more need of check-indent + +############################### +## EOL EOF ASPECT (included by check-syntax target) + +$(LINT_FILE.check-eoleof): .lint/%.check-eoleof: % + # See SO 1825552 on mixing grep and \t (and cry) + # For OK_NL, we have three cases: + # - for empty files, the computation boils down to 0 - 0 == 0 + # - for non-empty files with a proper \n at the end, to 1 - 1 == 0 + # - for empty files without \n, to 1 - 0 == 1 that will be catched + echo "Check EOL EOF: $<" + OK_NL=$$(($$(tail -c -1 $< | wc -c) - $$(tail -n -1 $< | wc -l))) ; \ + if test $$OK_NL -gt 0; then \ + echo "File $< does not pass syntactic checks:"; \ + echo "No newline at end of file"; \ + echo "Please run: make LINT_FILE=$< fix-eoleof"; \ + exit 1 ; \ + fi + $(MKDIR) $(dir $@) + $(TOUCH) $@ + +# The real target is a check-XXX one +.PHONY: $(LINT_FILE.fix-eoleof) +$(LINT_FILE.fix-eoleof): .lint/%.fix-eoleof: % + echo "Fixes EOL EOF: $<" + $(ISED) -e '$$a\' $< + $(MKDIR) $(dir $@) + $(TOUCH) .lint/$<.check-eoleof # no more need of this checking + +%.fix-eoleof: LC_ALL = C + +############################### +## SYNTACTICAL ASPECT + +$(LINT_FILE.check-syntax): .lint/%.check-syntax: % + # See SO 1825552 on mixing grep and \t (and cry) + # For OK_NL, we have three cases: + # - for empty files, the computation boils down to 0 - 0 == 0 + # - for non-empty files with a proper \n at the end, to 1 - 1 == 0 + # - for empty files without \n, to 1 - 0 == 1 that will be catched + echo "Check syntax: $<" + OK_TAB=$$(grep -c -e "$$(printf '^ *\t')" $<) ; \ + OK_SPACE=$$(grep -c -e '[[:blank:]]$$' $<) ; \ + OK_NL=$$(($$(tail -c -1 $< | wc -c) - $$(tail -n -1 $< | wc -l))) ; \ + OK_EMPTY=$$(tail -n -1 $< | grep -c -e '^[[:blank:]]*$$') ; \ + ERROR=$$(($$OK_TAB + $$OK_SPACE + $$OK_NL + $$OK_EMPTY)) ; \ + if test $$ERROR -gt 0; then \ + echo "File $< does not pass syntactic checks:"; \ + echo "$$OK_TAB lines indented with tabulation instead of spaces"; \ + echo "$$OK_SPACE lines with spaces at end of line"; \ + test $$OK_NL -eq 0 || echo "No newline at end of file"; \ + test $$OK_EMPTY -eq 0 || echo "Empty line(s) at end of file"; \ + echo "Please run: make LINT_FILE=$< fix-syntax"; \ + exit 1 ; \ + fi + $(MKDIR) $(dir $@) + $(TOUCH) $@ + +# The real target is a check-XXX one +.PHONY: $(LINT_FILE.fix-syntax) +$(LINT_FILE.fix-syntax): .lint/%.fix-syntax: % + echo "Fixes syntax: $<" + $(ISED) -e 's/^ *\t\+/ /' $< + $(ISED) -e 's/\(.*[^[:blank:]]\)[[:blank:]]\+$$/\1/' $< + $(ISED) -e 's/^[ \t]\+$$//' $< + if test \( $$(tail -n -1 $< | wc -l) -eq 0 \) -a \( $$(wc -c $< | cut -d " " -f 1) -gt 0 \) ; then \ + echo "" >> $<; \ + else \ + while tail -n -1 $< | grep -l -e '^[ \t]*$$'; do \ + head -n -1 $< > $<.tmp; \ + $(MV) $<.tmp $<; \ + done; \ + fi + $(MKDIR) $(dir $@) + $(TOUCH) .lint/$<.check-syntax # no more need of check-syntax + +# Avoid a UTF-8 locale at all cost: in such setting, sed does not work +# reliably if you happen to have latin-1 encoding somewhere, +# which is still unfortunately the case in some dark corners of the platform +%.fix-syntax: LC_ALL = C + +############################### +## Info + +lint.info: + echo "LINT.HAS_GIT='$(LINT.HAS_GIT)'" + echo "LINT.make='$(LINT.make)'" + echo "LINT_FILE.list='$(LINT_FILE.list)'" + echo "LINT_FILE.check-syntax='$(LINT_FILE.check-syntax)'" + echo "LINT_FILE.check-indent='$(LINT_FILE.check-indent)'" + echo "LINT_FILE.fix-syntax='$(LINT_FILE.fix-syntax)'" + echo "LINT_FILE.fix-indent='$(LINT_FILE.fix-indent)'" + +############################################################################### +# Local Variables: +# compile-command: "make" +# End: diff --git a/share/Makefile.plugin.template b/share/Makefile.plugin.template deleted file mode 100644 index a00758817d2b640aff5ea8b5d2bc8a66ec5cf39d..0000000000000000000000000000000000000000 --- a/share/Makefile.plugin.template +++ /dev/null @@ -1,1081 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -############################################################################### -# -# Generic makefile used to build plug-ins. -# Setup the following required variables before including this makefile: -# -# Warning: You should not use these variables inside of your Makefile, -# use the namespaced version (@PLUGIN_NAME@_*) at the end of this list. -# -# Usual information -# ----------------- -ifndef PLUGIN_NAME # The ML module name of the plugin - $(error PLUGIN_NAME is not set) -endif -ifndef PLUGIN_DIR # The directory containing the source files - $(error PLUGIN_DIR is not set) -endif -PLUGIN_DIR?= -PLUGIN_ENABLE?= # Whether the plugin is enabled -PLUGIN_DEPENDS?= # Deprecated (static plug-in dependencies, Frama-C only) - -# META file -# --------- -# The META for the plug-in is automatically generated, unless variable -# PLUGIN_HAS_META is set to "yes". The following optional variables can -# be set accordingly: -# -PLUGIN_HAS_META?= # defaults to empty - -# When setting PLUGIN_HAS_META to "yes", the next variables are not taken into -# account. Instead, your are responsible for providing a full featured META -# file in the PLUGIN_DIR source directory, which will be copied and installed -# with the plug-in object files. - -PLUGIN_DESCRIPTION?= # if empty then defaults to "Frama-C NAME plug-in" -PLUGIN_VERSION?= # if empty then defaults to current Frama-C version -PLUGIN_REQUIRES?= # package(s) the plug-in depends on (defaults to empty) -PLUGIN_DEPENDENCIES?= # plugins(s) the plug-in depends on (defaults to empty) - -# Remarks: -# - the package name for "MyPlugin" is defined to be "frama-c-myplugin" -# - PLUGIN_DEPENDENCIES <pkg> is a shortcut for PLUGIN_REQUIRES <frama-c-pkg> -# - the makefile adds a proper "directory" directive to both provided or -# generated META files - - -# Source files -# ------------ -PLUGIN_CMO?= # The .cmo files (do not add the plugin path and the - # extension) -PLUGIN_CMI?= # The .cmi files (only if there is no corresponding .cmo) -PLUGIN_TYPES_CMO?= # The .cmo files containing the types definitions -PLUGIN_GUI_CMI?= # The .cmi files for the GUI - # (only if there is no corresponding .cmi) -PLUGIN_GUI_CMO?= # The .cmo files to be linked with the graphical interface -PLUGIN_GENERATED?= # source files generated by the plugins, typically parsers - -# Compilation flags -# ----------------- -PLUGIN_BFLAGS?= # Additional options for the bytecode compiler -PLUGIN_OFLAGS?= # Additional options for the native compiler -PLUGIN_EXTRA_BYTE?= # Additional bytecode files to link against -PLUGIN_EXTRA_OPT?= # Additional native files to link against -PLUGIN_EXTRA_DIRS?= # Additional directories (relative to the root of the - # plugin) containing some of the source files of the - # plugin -PLUGIN_LINK_BFLAGS?= # Additional options for the bytecode linker -PLUGIN_LINK_OFLAGS?= # Additional options for the native linker -PLUGIN_LINK_GUI_BFLAGS?= # Additional options for the bytecode gui linker -PLUGIN_LINK_GUI_OFLAGS?= # Additional options for the native gui linker - - -# Dependencies -# ------------ -PLUGIN_DEPFLAGS?= # Additional options for ocamldep - -# Documentation -# ------------- -PLUGIN_DOCFLAGS?= # Additional options for ocamldoc -PLUGIN_UNDOC?= # Do not document this source files (do not add the - # plugin path) -PLUGIN_TYPES_TODOC?= # Do document this source files containing the types - # definition -PLUGIN_INTRO?= # Add this text file to the introduction of the - # documentation -PLUGIN_HAS_EXT_DOC?= # (yes/no) Plugin has a pdf manual - - -# Testing -# ------- -PLUGIN_NO_TEST?= # Set it to a non-empty value if there is no specific - # test directory for this plugin -PLUGIN_TESTS_DIRS?= # Test directories of the plugin. - # Default is tests/$(PLUGIN_DIR) -PLUGIN_TESTS_DIRS_DEFAULTS?= # Tests directories that should be run by default - # Defaults to $(PLUGIN_TESTS_DIRS) -PLUGIN_TESTS_LIB?= # Additional source (.ml) files used by tests. -PLUGIN_NO_DEFAULT_TEST?= # Set it to a non-empty value if you don't want the - # tests of your plugin to be executed systematically - # by make tests -PLUGIN_INTERNAL_TEST?= # Set it to a non-empty value if the tests of the plugin - # are in Frama-C's tests directory and not a tests - # subdirectory of the plugin (internal use only, - # obsolete and not recommended way to handle tests) - -# Distribution -# ------------ -PLUGIN_DISTRIBUTED?= # should the plugin be included in the distribution - # (yes/no) -PLUGIN_DISTRIB_EXTERNAL?= # list of files that should be distributed within the - # source distribution for this plug-in. They will be - # put at their proper place in the frama-c-$(VERSION) - # directory for a release. -PLUGIN_DISTRIB_TESTS?= # list of files that should be also distributed without - # headers checking. -PLUGIN_HEADER_SPEC?=$(DEFAULT_HEADER_SPEC) # list of files containing header - # specifications. -PLUGIN_HEADER_DIRS?=$(DEFAULT_HEADER_DIRS) # list of directories containing - # open/close-source header files. -PLUGIN_HEADER_EXCEPTIONS?=$(DEFAULT_HEADER_EXCEPTIONS) # list of distributed files allowed - # to have no entry into the - # PLUGIN_HEADER_SPEC files -PLUGIN_CEA_PROPRIETARY_FILES?=$(DEFAULT_CEA_PROPRIETARY_FILES) # list of files that cannot be - # part of an OPEN_SOURCE distribution -PLUGIN_CEA_PROPRIETARY_HEADERS?= # list of licenses that cannot - # be part of an OPEN_SOURCE distribution. - -# Kernel developers only -# ---------------------- -PLUGIN_RESET?=yes # Set it to no in order to NOT reset plug-in variable. - - -# Except for their initialization, all these variables should not be used -# outside of this Makefile. -# -# Instead, you can safely use the corresponding following variables. -# Warning: -# - They contain the extensions and the plugin path unlike the originals -# - except @PLUGIN_NAME@_DIR, they are undefined before -# Makefile.plugin.generated is created -# -# @PLUGIN_NAME@_DIR -# @PLUGIN_NAME@_CMO -# @PLUGIN_NAME@_CMX -# @PLUGIN_NAME@_CMI -# @PLUGIN_NAME@_TYPES_CMO -# @PLUGIN_NAME@_TYPES_CMX -# @PLUGIN_NAME@_TYPES_TODOC -# @PLUGIN_NAME@_BFLAGS -# @PLUGIN_NAME@_OFLAGS -# @PLUGIN_NAME@_DEPFLAGS -# @PLUGIN_NAME@_DOCFLAGS -# @PLUGIN_NAME@_GENERATED -# @PLUGIN_NAME@_TESTS_DIRS -# @PLUGIN_NAME@_TESTS_LIB -# -############################################################################### -# -# Note for the Makefile.plugin developers: -# If you add a new option to communicate with the main Makefile, -# don't forget to reset it at the end of this file. -# -############################################################################### - - -DEPEND_PKG := $(addprefix frama-c-, $(shell echo $(PLUGIN_DEPENDENCIES) | tr '[:upper:]' '[:lower:]')) - -# Where the other plug-ins to load are already installed -ifeq ($(FRAMAC_INTERNAL),yes) -INSTALLED_PLUGIN_DIR:=$(FRAMAC_ROOT_SRCDIR)/lib/plugins -# Also inform the main Makefile that there's another plug-in to be -# considered -PLUGIN_LIST+=$(PLUGIN_DIR)/@PLUGIN_NAME@ -PLUGIN_PACKAGES:=$(PLUGIN_REQUIRES) - -else - -INSTALLED_PLUGIN_DIR:=$(PLUGIN_INSTALL_DIR) -PLUGIN_PACKAGES:=$(PLUGIN_REQUIRES) $(DEPEND_PKG) - -endif - -PLUGIN_REQUIRES += $(DEPEND_PKG) - -# The plugin types .cm* files -PLUGIN_TYPES_CMO:=$(addsuffix .cmo,$(PLUGIN_TYPES_CMO)) -PLUGIN_TYPES_CMX:=$(PLUGIN_TYPES_CMO:.cmo=.cmx) -@PLUGIN_NAME@_TYPES_CMO:=$(PLUGIN_TYPES_CMO) -@PLUGIN_NAME@_TYPES_CMX:=$(PLUGIN_TYPES_CMX) -@PLUGIN_NAME@_TYPES_TODOC:=$(PLUGIN_TYPES_TODOC) - -PLUGIN_TYPES_CMO_LIST += $(PLUGIN_TYPES_CMO) -PLUGIN_TYPES_CMX_LIST += $(PLUGIN_TYPES_CMX) - -# [VP] don't exactly know why, but make has a tendency to add a -# spurious space at the beginning of PLUGIN_BASE. Fortunately, $(strip ) -# is behaving correctly. -PLUGIN_BASE:=$(strip $(if $(notdir $(PLUGIN_DIR)),$(notdir $(PLUGIN_DIR)),\ -$(notdir $(patsubst %/,%,$(PLUGIN_DIR))))) - -PLUGIN_DEPENDS:=$(PLUGIN_DEPENDS) $(PLUGIN_DEPENDENCIES) - - - -################ -# ml sources # -################ - -PLUGIN_SRC:= $(PLUGIN_DIR)/@PLUGIN_NAME@.mli \ - $(patsubst %,$(PLUGIN_DIR)/%.ml*,$(PLUGIN_CMO)) \ - $(patsubst %,$(PLUGIN_DIR)/%.mli,$(PLUGIN_CMI)) \ - $(patsubst %.cmo,%.ml*,$(PLUGIN_TYPES_CMO)) -ifneq ($(ENABLE_GUI),no) -PLUGIN_SRC:= $(PLUGIN_SRC) $(patsubst %,$(PLUGIN_DIR)/%.ml*,$(PLUGIN_GUI_CMO)) -endif - -@PLUGIN_NAME@_SRC:=$(PLUGIN_SRC) - -PLUGIN_ML_SRC:=$(patsubst %.ml*,%.ml,$(PLUGIN_SRC)) \ - $(patsubst %.ml*,%.mli,$(filter %.ml*,$(PLUGIN_SRC))) -@PLUGIN_NAME@_ML_SRC:=$(PLUGIN_ML_SRC) - -################ -# distribution # -################ - - -ifneq ($(PLUGIN_ENABLE),no) - -# for `check-header` target even if the plugin is not distributed -ifneq ("$(strip $(PLUGIN_HEADER_SPEC))","") -# Don't remove the '/./' because it is used as separator: -# i.e. filenames contained into the spec file 'src/plugins/MY-PLUGIN/./headers/header_spec.txt' -# are considered being relative from 'src/plugins/MY-PLUGIN/'. -# The wildcard is used in order to add only existing files. -PLUGIN_HEADER_SPEC_LIST +=$(strip $(wildcard $(PLUGIN_DIR)/./$(PLUGIN_HEADER_SPEC))) -endif - -ifneq ("$(strip $(PLUGIN_HEADER_DIRS))","") -# The wildcard is used in order to add only existing directory. -PLUGIN_HEADER_DIRS_LIST +=$(wildcard $(addprefix $(PLUGIN_DIR)/,$(PLUGIN_HEADER_DIRS))) -endif - -ifneq ("$(strip $(PLUGIN_HEADER_EXCEPTIONS))","") -PLUGIN_HEADER_EXCEPTIONS_LIST +=$(addprefix $(PLUGIN_DIR)/,$(PLUGIN_HEADER_EXCEPTIONS)) -endif - -ifneq ("$(strip $(PLUGIN_CEA_PROPRIETARY_HEADERS))","") -PLUGIN_CEA_PROPRIETARY_HEADERS_LIST +=$(PLUGIN_CEA_PROPRIETARY_HEADERS) -endif - -ifneq ("$(strip $(PLUGIN_CEA_PROPRIETARY_FILES))","") -# Files that cannot be part of an OPEN_SOURCE distribution. -# The wildcard is used in order to add only existing files. -PLUGIN_CEA_PROPRIETARY_FILE_LIST +=$(wildcard $(addprefix $(PLUGIN_DIR)/,$(PLUGIN_CEA_PROPRIETARY_FILES))) -endif - -ifneq ($(PLUGIN_DISTRIBUTED),no) -PLUGIN_DISTRIBUTED_LIST += $(PLUGIN_SRC) -ifeq ($(ENABLE_GUI),no) -# Also include GUI files to be distributed, even if not currently used -PLUGIN_DISTRIBUTED_LIST += \ - $(patsubst %,$(PLUGIN_DIR)/%.ml*,$(PLUGIN_GUI_CMO)) \ - $(patsubst %,$(PLUGIN_DIR)/%.mli,$(PLUGIN_GUI_CMI)) -endif - -# VP: this needs to be adapted for external plugins. -ifeq ($(PLUGIN_HAS_EXT_DOC),yes) -PLUGIN_EXT_DOC_DIR:=doc/$(PLUGIN_BASE) -PLUGIN_DIST_DOC_LIST += doc/plugins/$(PLUGIN_BASE).pdf -$(PLUGIN_EXT_DOC_DIR)/$(PLUGIN_BASE).pdf: - $(PRINT_MAKING) $@ - $(MAKE) -C $(dir $@) - -doc/plugins/$(PLUGIN_BASE).pdf: \ - $(PLUGIN_EXT_DOC_DIR)/$(PLUGIN_BASE).pdf - $(PRINT_CP) $< - $(MKDIR) doc/plugins - $(CP) $< $@ -endif -ifneq ("$(strip $(PLUGIN_DISTRIB_EXTERNAL))","") -PLUGIN_DIST_EXTERNAL_LIST += \ - $(addprefix $(PLUGIN_DIR)/,$(PLUGIN_DISTRIB_EXTERNAL)) -endif -ifneq ("$(strip $(PLUGIN_DISTRIB_TESTS))","") -PLUGIN_DIST_TESTS_LIST += \ - $(addprefix $(PLUGIN_DIR)/,$(PLUGIN_DISTRIB_TESTS)) -endif -endif #PLUGIN_DISTRIBUTED -endif #PLUGIN_ENABLE - -PLUGIN_OPT:=`echo "@PLUGIN_NAME@" | tr 'A-Z' 'a-z' ` - -# Export some variables which can be safely used outside/inside Makefile.plugin -# even if the plug-in is not enabled -ifneq ("$(PLUGIN_ENABLE)","no") - -# The .cm* files list -PLUGIN_CMO:= $(patsubst %,$(PLUGIN_DIR)/%.cmo,$(PLUGIN_CMO)) -PLUGIN_CMX:= $(PLUGIN_CMO:.cmo=.cmx) -PLUGIN_CMI_ONLY:=$(patsubst %,$(PLUGIN_DIR)/%.cmi,$(PLUGIN_CMI)) -PLUGIN_CMI:= $(PLUGIN_CMI_ONLY) $(PLUGIN_CMO:.cmo=.cmi) -PLUGIN_INFERRED_MLI:= $(PLUGIN_CMO:.cmo=.inferred.mli) - -@PLUGIN_NAME@_CMO:=$(PLUGIN_CMO) -@PLUGIN_NAME@_CMX:=$(PLUGIN_CMX) -@PLUGIN_NAME@_CMI_ONLY:=$(PLUGIN_CMI_ONLY) -@PLUGIN_NAME@_CMI:=$(PLUGIN_CMI) -@PLUGIN_NAME@_INFERRED_MLI:=$(PLUGIN_INFERRED_MLI) - -HAS_GUI:=no -ifneq ($(ENABLE_GUI),no) -ifneq ("$(PLUGIN_GUI_CMO)","") -# The .cm* gui files list -PLUGIN_GUI_CMO:= $(PLUGIN_CMO) \ - $(patsubst %,$(PLUGIN_DIR)/%.cmo,$(PLUGIN_GUI_CMO)) -PLUGIN_GUI_CMX:= $(PLUGIN_GUI_CMO:.cmo=.cmx) -PLUGIN_GUI_CMI_ONLY:=$(PLUGIN_CMI_ONLY) $(PLUGIN_GUI_CMI) -PLUGIN_GUI_CMI:= $(PLUGIN_CMI_ONLY) $(PLUGIN_GUI_CMO:.cmo=.cmi) -HAS_GUI:=yes -endif -endif - -@PLUGIN_NAME@_GUI_CMO:=$(PLUGIN_GUI_CMO) -@PLUGIN_NAME@_GUI_CMX:=$(PLUGIN_GUI_CMX) -@PLUGIN_NAME@_GUI_CMI:=$(PLUGIN_GUI_CMI) - -# Interface for the the packed plugins -TARGET_MLI:= $(PLUGIN_LIB_DIR)/@PLUGIN_NAME@.mli -TARGET_CMI:= $(TARGET_MLI:.mli=.cmi) - -# The packed files for toplevel mode (in directory 'top') -TARGET_TOP_MLI:= $(PLUGIN_LIB_DIR)/top/@PLUGIN_NAME@.mli -TARGET_TOP_CMI:= $(TARGET_TOP_MLI:.mli=.cmi) -TARGET_TOP_CMO:= $(TARGET_TOP_MLI:.mli=.cmo) -ifdef PLUGIN_EXTRA_BYTE -TARGET_TOP_CMA:= $(TARGET_TOP_CMO:.cmo=.cma) -else -TARGET_TOP_CMA:= -endif - -TARGET_TOP_CMX:= $(TARGET_TOP_CMO:.cmo=.cmx) - -TARGET_TOP_CMXS:= $(TARGET_TOP_CMX:.cmx=.cmxs) - -# The packed files for GUI mode (in directory 'gui') -ifeq ($(HAS_GUI),yes) -TARGET_GUI_MLI:=$(PLUGIN_LIB_DIR)/gui/@PLUGIN_NAME@.mli -TARGET_GUI_CMO:= $(PLUGIN_LIB_DIR)/gui/@PLUGIN_NAME@.cmo -TARGET_GUI_CMI:= $(TARGET_GUI_CMO:.cmo=.cmi) -TARGET_GUI_CMX:= $(TARGET_GUI_CMO:.cmo=.cmx) -TARGET_GUI_CMA:= $(TARGET_GUI_CMO:.cmo=.cma) -TARGET_GUI_CMXS:= $(TARGET_GUI_CMO:.cmo=.cmxs) -else -TARGET_GUI_MLI:= -TARGET_GUI_CMO:= -TARGET_GUI_CMI:= -TARGET_GUI_CMX:= -TARGET_GUI_CMA:= -endif - -# Meta-variables for the targets: -@PLUGIN_NAME@_TARGET_MLI:=$(TARGET_MLI) -@PLUGIN_NAME@_TARGET_CMI:=$(TARGET_CMI) -@PLUGIN_NAME@_TARGET_TOP_MLI:=$(TARGET_TOP_MLI) -@PLUGIN_NAME@_TARGET_TOP_CMI:=$(TARGET_TOP_CMI) -@PLUGIN_NAME@_TARGET_TOP_CMO:=$(TARGET_TOP_CMO) -@PLUGIN_NAME@_TARGET_TOP_CMA:=$(TARGET_TOP_CMA) -@PLUGIN_NAME@_TARGET_TOP_CMX:=$(TARGET_TOP_CMX) -@PLUGIN_NAME@_TARGET_TOP_CMXS:=$(TARGET_TOP_CMXS) -@PLUGIN_NAME@_TARGET_GUI_MLI:=$(TARGET_GUI_MLI) -@PLUGIN_NAME@_TARGET_GUI_CMI:=$(TARGET_GUI_CMI) -@PLUGIN_NAME@_TARGET_GUI_CMO:=$(TARGET_GUI_CMO) -@PLUGIN_NAME@_TARGET_GUI_CMA:=$(TARGET_GUI_CMA) -@PLUGIN_NAME@_TARGET_GUI_CMX:=$(TARGET_GUI_CMX) -@PLUGIN_NAME@_TARGET_GUI_CMXS:=$(TARGET_GUI_CMXS) - -# Some meta-variables for compilation flags -NAME_BFLAGS :=@PLUGIN_NAME@_BFLAGS -NAME_OFLAGS :=@PLUGIN_NAME@_OFLAGS -NAME_TEST_BFLAGS :=@PLUGIN_NAME@_TEST_BFLAGS -NAME_TEST_OFLAGS :=@PLUGIN_NAME@_TEST_OFLAGS -TARGET_OFLAGS :=@PLUGIN_NAME@_TARGET_OFLAGS -TARGET_BFLAGS :=@PLUGIN_NAME@_TARGET_BFLAGS -ifeq ($(HAS_GUI),yes) -NAME_GUI_BFLAGS :=@PLUGIN_NAME@_GUI_BFLAGS -NAME_GUI_OFLAGS :=@PLUGIN_NAME@_GUI_OFLAGS -TARGET_GUI_OFLAGS:=@PLUGIN_NAME@_GUI_TARGET_OFLAGS -TARGET_GUI_BFLAGS:=@PLUGIN_NAME@_GUI_TARGET_BFLAGS -endif -NAME_DEPFLAGS :=@PLUGIN_NAME@_DEPFLAGS -NAME_DOCFLAGS :=@PLUGIN_NAME@_DOCFLAGS - -# Export some variables which can be safely used outside/inside Makefile.plugin -@PLUGIN_NAME@_CMO:=$(PLUGIN_CMO) -@PLUGIN_NAME@_CMX:=$(PLUGIN_CMX) -@PLUGIN_NAME@_CMI:=$(PLUGIN_CMI) -@PLUGIN_NAME@_GENERATED:=$(PLUGIN_GENERATED) -@PLUGIN_NAME@_TARGET_BFLAGS:=$(PLUGIN_LINK_BFLAGS) -@PLUGIN_NAME@_TARGET_OFLAGS:=$(PLUGIN_LINK_OFLAGS) -@PLUGIN_NAME@_EXTRA_BYTE:=$(PLUGIN_EXTRA_BYTE) -@PLUGIN_NAME@_EXTRA_OPT:=$(PLUGIN_EXTRA_OPT) -@PLUGIN_NAME@_EXTRA_DIRS:=$(PLUGIN_EXTRA_DIRS) - -ifeq ($(HAS_GUI),yes) -# gui variable -@PLUGIN_NAME@_GUI_CMO:=$(PLUGIN_GUI_CMO) -@PLUGIN_NAME@_GUI_CMX:=$(PLUGIN_GUI_CMX) -@PLUGIN_NAME@_GUI_CMI:=$(PLUGIN_GUI_CMI) -@PLUGIN_NAME@_GUI_CMI_ONLY:=$(PLUGIN_GUI_CMI_ONLY) -@PLUGIN_NAME@_GUI_TARGET_BFLAGS:=$(PLUGIN_LINK_GUI_BFLAGS) -@PLUGIN_NAME@_GUI_TARGET_OFLAGS:=$(PLUGIN_LINK_GUI_OFLAGS) -endif - -PLUGIN_EXTRA_DIRS_INC:=$(patsubst %,-I $(PLUGIN_DIR)/% ,$(PLUGIN_EXTRA_DIRS)) - -# Set the compilation flags for the plugin -INCLUDE_EXT_FLAGS:=-I $(INSTALLED_PLUGIN_DIR) \ - $(addprefix -package ,$(PLUGIN_PACKAGES) $(LIBRARY_NAMES)) -INCLUDE_FLAGS:=-I $(PLUGIN_DIR) $(PLUGIN_EXTRA_DIRS_INC) $(INCLUDE_EXT_FLAGS) -$(NAME_BFLAGS):=$(BFLAGS) $(INCLUDE_FLAGS) $(PLUGIN_BFLAGS) -$(NAME_OFLAGS):=$(OFLAGS) $(INCLUDE_FLAGS) $(PLUGIN_OFLAGS) -# DO NOT include the plugin's own directory as search path for compiling -# ml test scripts: they will be loaded in a separate phase, and will only see -# the plugin through its static API -$(NAME_TEST_BFLAGS):= $(BFLAGS) $(INCLUDE_EXT_FLAGS) $(PLUGIN_BFLAGS) -w -70 -$(NAME_TEST_OFLAGS):= $(OFLAGS) $(INCLUDE_EXT_FLAGS) $(PLUGIN_OFLAGS) - -$(TARGET_BFLAGS):= $(PLUGIN_LINK_BFLAGS) -$(TARGET_OFLAGS):= $(PLUGIN_LINK_OFLAGS) -$(NAME_DOCFLAGS):= $(DOC_FLAGS) $(PLUGIN_DOCFLAGS) \ - -I $(PLUGIN_DIR) \ - $(PLUGIN_EXTRA_DIRS_INC) \ - -I $(PLUGIN_LIB_DIR) \ - $(addprefix -package ,$(PLUGIN_REQUIRES) $(LIBRARY_NAMES)) - -ifeq ($(HAS_GUI),yes) -$(NAME_GUI_BFLAGS):=$($(NAME_BFLAGS)) $(THREAD) $(addprefix -package ,$(LIBRARY_NAMES_GUI)) -$(NAME_GUI_OFLAGS):=$($(NAME_OFLAGS)) $(THREAD) $(addprefix -package ,$(LIBRARY_NAMES_GUI)) -$(TARGET_GUI_BFLAGS):= $(PLUGIN_LINK_GUI_BFLAGS) -$(TARGET_GUI_OFLAGS):= $(PLUGIN_LINK_GUI_OFLAGS) -$(NAME_DOCFLAGS) := $($(NAME_DOCFLAGS)) $(addprefix -package ,$(LIBRARY_NAMES_GUI)) -endif -$(NAME_DEPFLAGS):= -I $(PLUGIN_DIR) $(PLUGIN_DEPFLAGS) $(PLUGIN_EXTRA_DIRS_INC) - -# Add the flags to the compilation line of the plugin source files -$(PLUGIN_CMO) $(PLUGIN_CMI) $(PLUGIN_INFERRED_MLI): BFLAGS:=$($(NAME_BFLAGS)) -$(PLUGIN_CMX): OFLAGS:=$($(NAME_OFLAGS)) -for-pack @PLUGIN_NAME@ - -ifeq ($(HAS_GUI),yes) -$(PLUGIN_GUI_CMO) $(PLUGIN_GUI_CMI): BFLAGS:=$($(NAME_GUI_BFLAGS)) -$(PLUGIN_GUI_CMX): OFLAGS:=$($(NAME_GUI_OFLAGS)) -for-pack @PLUGIN_NAME@ -endif - -# META file -PLUGIN_PKG :=$(shell echo frama-c-@PLUGIN_NAME@ | tr '[:upper:]' '[:lower:]') -TARGET_META :=$(PLUGIN_LIB_DIR)/META.$(PLUGIN_PKG) -PLUGIN_GENERATED+= $(TARGET_META) - -ifneq ($(PLUGIN_HAS_META),yes) -# generated META -ifeq ($(PLUGIN_DESCRIPTION),) -PLUGIN_DESCRIPTION :="Frama-C @PLUGIN_NAME@ plug-in" -endif -ifeq ($(PLUGIN_VERSION),) -ifeq ($(FRAMAC_INTERNAL),yes) -ifeq ($(FRAMAC_ROOT_SRCDIR),) -PLUGIN_VERSION :=$(shell cat VERSION) -else -# To remove "cat: VERSION: No such file or directory" in EXECNOW target performing make commands under a plugin directory -PLUGIN_VERSION :=$(shell cat $(FRAMAC_ROOT_SRCDIR)/VERSION) -endif -else -PLUGIN_VERSION :=$(shell frama-c-config -print-version) -endif -endif -# registering package description for later use -META.$(PLUGIN_PKG).DESCRIPTION :=$(PLUGIN_DESCRIPTION) -META.$(PLUGIN_PKG).VERSION :=$(PLUGIN_VERSION) -META.$(PLUGIN_PKG).REQUIRES :=$(PLUGIN_REQUIRES) -ifdef PLUGIN_EXTRA_BYTE -META.$(PLUGIN_PKG).BYTE :=@PLUGIN_NAME@.cma -else -META.$(PLUGIN_PKG).BYTE :=@PLUGIN_NAME@.cmo -endif -META.$(PLUGIN_PKG).NATIVE :=@PLUGIN_NAME@.cmx -META.$(PLUGIN_PKG).PLUGIN :=@PLUGIN_NAME@.cmxs - -ifeq ($(FRAMAC_INTERNAL),yes) -# In internal mode, we depend on the main Makefile for plugins that do not -# have their own Makefile. To detect that, we check whether there is a -# plugin-specific Makefile in the include stack. -ifeq ($(filter $(PLUGIN_DIR)/Makefile,$(MAKEFILE_LIST)),) -$(TARGET_META): Makefile -else -$(TARGET_META): $(PLUGIN_DIR)/Makefile -endif # PLUGIN_DIR/Makefile -else -$(TARGET_META): $(PLUGIN_DIR)/Makefile -endif # FRAMAC_INTERNAL - -$(TARGET_META): - $(PRINT_MAKING) $(notdir $@) - $(RM) $@ - $(MKDIR) $(dir $@) - $(ECHO) "description = \"$($(notdir $@).DESCRIPTION)\"" >> $@ - $(ECHO) "version = \"$($(notdir $@).VERSION)\"" >> $@ - $(ECHO) "requires = \"frama-c.kernel $($(notdir $@).REQUIRES)\"" >> $@ - $(ECHO) "archive(byte) = \"top/$($(notdir $@).BYTE)\"" >> $@ - $(ECHO) "archive(native) = \"top/$($(notdir $@).NATIVE)\"" >> $@ - $(ECHO) "plugin(native) = \"top/$($(notdir $@).PLUGIN)\"" >> $@ - $(ECHO) "plugin(byte) = \"top/$($(notdir $@).BYTE)\"" >> $@ -ifeq ($(HAS_GUI),yes) - $(ECHO) "archive(byte,gui) = \"gui/$($(notdir $@).BYTE)\"" >> $@ - $(ECHO) "archive(native,gui) = \"gui/$($(notdir $@).NATIVE)\"" >> $@ - $(ECHO) "plugin(native,gui) = \"gui/$($(notdir $@).PLUGIN)\"" >> $@ - $(ECHO) "plugin(byte,gui) = \"gui/$($(notdir $@).BYTE)\"" >> $@ -endif - $(ECHO) "directory = \"\"" >> $@ - -else # PLUGIN_HAS_META -# user-defined META -$(TARGET_META): $(PLUGIN_DIR)/META - $(PRINT_CP) $(notdir $@) - $(CP) $< $@ - $(ECHO) "directory = \"\"" >> $@ -endif # PLUGIN_HAS_META - -# Now build the targets -####################### - -@PLUGIN_NAME@_PLUGIN_MLI:= $(PLUGIN_DIR)/@PLUGIN_NAME@.mli -@PLUGIN_NAME@_CHECK_PLUGIN_MLI:=$(PLUGIN_DIR)/@PLUGIN_NAME@.check_mli_exists - -$(TARGET_CMI): BFLAGS:=$($(NAME_BFLAGS)) -opaque - -$(TARGET_CMI): $(PLUGIN_CMO) - - -ifneq ($(TARGET_MLI),$(@PLUGIN_NAME@_PLUGIN_MLI)) -# Copy the plugin interface in the plugins directory -$(TARGET_MLI): $(@PLUGIN_NAME@_CHECK_PLUGIN_MLI) - $(PRINT_MAKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR) - $(RM) $@ - $(ECHO) "(* This module was generated automatically by code in Makefile and $(@PLUGIN_NAME@_PLUGIN_MLI) *)" > $@ - $(ECHO) "#1 \"$(@PLUGIN_NAME@_PLUGIN_MLI)\"" >> $@ - $(CAT) $(@PLUGIN_NAME@_PLUGIN_MLI) >> $@ - $(CHMOD_RO) $@ - -$(INSTALLED_PLUGIN_DIR)/.placeholders_ready: $(TARGET_MLI) - -PLUGIN_GENERATED+= $(TARGET_MLI) -endif - -$(TARGET_TOP_MLI): $(@PLUGIN_NAME@_CHECK_PLUGIN_MLI) $(TARGET_MLI) - $(PRINT_MAKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR)/top - $(RM) $@ - $(CP) $(@PLUGIN_NAME@_TARGET_MLI) $@ - -PLUGIN_GENERATED+= $(TARGET_TOP_MLI) - -@PLUGIN_NAME@_MLI:=$(TARGET_MLI) - -$(TARGET_TOP_CMI): $(TARGET_CMI) - $(PRINT_MAKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR)/top - $(RM) $@ - $(CP) $< $@ - - -$(TARGET_TOP_CMO): $(PLUGIN_CMO) \ - $(TARGET_CMI) $(TARGET_TOP_CMI) - $(PRINT_PACKING) $@ - $(OCAMLC) -o $(call winpath,$@) $(@PLUGIN_NAME@_BFLAGS) -pack \ - $(@PLUGIN_NAME@_TARGET_BFLAGS) \ - $(@PLUGIN_NAME@_CMI_ONLY) $(@PLUGIN_NAME@_CMO) - -$(TARGET_TOP_CMX): $(PLUGIN_CMX) \ - $(TARGET_CMI) $(TARGET_TOP_CMI) - $(PRINT_PACKING) $@ - $(OCAMLOPT) -o $(call winpath,$@) $(@PLUGIN_NAME@_OFLAGS) -pack \ - $(@PLUGIN_NAME@_TARGET_OFLAGS) \ - $(@PLUGIN_NAME@_CMI_ONLY) $(@PLUGIN_NAME@_CMX) - -$(TARGET_TOP_CMXS): $(TARGET_TOP_CMX) $(PLUGIN_EXTRA_OPT) - $(PRINT_PACKING) $@ - $(OCAMLOPT) -o $(call winpath,$@) -shared \ - $(@PLUGIN_NAME@_OFLAGS) \ - $(@PLUGIN_NAME@_EXTRA_OPT) \ - $(@:.cmxs=.cmx) - -ifdef PLUGIN_EXTRA_BYTE -$(TARGET_TOP_CMA): $(PLUGIN_EXTRA_BYTE) $(TARGET_TOP_CMO) - $(PRINT_PACKING) $@ - $(OCAMLC) -o $(call winpath,$@) $(@PLUGIN_NAME@_BFLAGS) \ - $(@PLUGIN_NAME@_TARGET_BFLAGS) \ - -a $(@PLUGIN_NAME@_EXTRA_BYTE) $(@:.cma=.cmo) -endif - -ifeq ($(HAS_GUI),yes) -# packing gui files -################### - -$(TARGET_GUI_CMI): $(TARGET_CMI) - $(PRINT_MAKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR)/gui - $(RM) $@ - $(CP) $< $@ - -PLUGIN_GENERATED+= $(TARGET_GUI_MLI) - -$(TARGET_GUI_MLI): $(@PLUGIN_NAME@_CHECK_PLUGIN_MLI) $(TARGET_MLI) - $(PRINT_MAKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR)/gui - $(RM) $@ - $(CP) $(@PLUGIN_NAME@_TARGET_MLI) $@ - -$(TARGET_GUI_CMO): $(PLUGIN_GUI_CMO) $(TARGET_CMI) $(TARGET_GUI_CMI) - $(PRINT_PACKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR)/gui - $(OCAMLC) -o $(call winpath,$@) $(@PLUGIN_NAME@_GUI_BFLAGS) -pack \ - $(@PLUGIN_NAME@_GUI_TARGET_BFLAGS) \ - $(@PLUGIN_NAME@_GUI_CMI_ONLY) \ - $(@PLUGIN_NAME@_GUI_CMO) - -$(TARGET_GUI_CMX): $(PLUGIN_GUI_CMX) $(TARGET_CMI) $(TARGET_GUI_CMI) - $(PRINT_PACKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR)/gui - $(OCAMLOPT) -o $(call winpath,$@) $(@PLUGIN_NAME@_GUI_OFLAGS) -pack \ - $(@PLUGIN_NAME@_GUI_TARGET_OFLAGS) \ - $(@PLUGIN_NAME@_GUI_CMI_ONLY) \ - $(@PLUGIN_NAME@_GUI_CMX) - -$(TARGET_GUI_CMXS): $(TARGET_GUI_CMX) - $(PRINT_PACKING) $@ - $(MKDIR) $(PLUGIN_LIB_DIR)/gui - $(OCAMLOPT) -o $(call winpath,$@) -shared \ - $(@PLUGIN_NAME@_GUI_OFLAGS) \ - $(@PLUGIN_NAME@_GUI_TARGET_OFLAGS) \ - $(@PLUGIN_NAME@_EXTRA_OPT) \ - $^ - -ifdef PLUGIN_EXTRA_BYTE -$(TARGET_GUI_CMA): $(PLUGIN_EXTRA_BYTE) $(TARGET_GUI_CMO) - $(PRINT_PACKING) $@ - $(OCAMLC) -o $(call winpath,$@) $(@PLUGIN_NAME@_GUI_BFLAGS) \ - $(@PLUGIN_NAME@_GUI_TARGET_BFLAGS) \ - -a $(@PLUGIN_NAME@_EXTRA_BYTE) $(@:.cma=.cmo) -endif - -else -# No specific gui items -TARGET_GUI_MLI:= -TARGET_GUI_CMI:= -endif # HAS_GUI - -######### - -# The following rules used some plugin info (name and path) in their names -# in order to used them in the command: -# it is not possible to use $(PLUGIN_*) in commands due to the evaluation rules -# of make - -########################## -# Internal documentation # -########################## - -MODULES_TODOC+= $(PLUGIN_TYPES_TODOC) - -PLUGIN_UNDOC := $(addprefix $(PLUGIN_DIR)/,$(PLUGIN_UNDOC)) - -PLUGIN_DOC_SRC:=$(filter-out $(PLUGIN_UNDOC),$(PLUGIN_ML_SRC)) -@PLUGIN_NAME@_DOC_SRC:=$(PLUGIN_DOC_SRC) - -ifndef PLUGIN_DOC_DIR -PLUGIN_DOC_DIR := $(DOC_DIR)/$(PLUGIN_BASE) -endif - -@PLUGIN_NAME@_DOC_DIR:= $(PLUGIN_DOC_DIR) - -@PLUGIN_NAME@_INTRO:=$(PLUGIN_INTRO) -ifdef PLUGIN_INTRO -@PLUGIN_NAME@_CAT_INTRO:= cp -f $(PLUGIN_INTRO) $(PLUGIN_DOC_DIR)/@PLUGIN_NAME@.txt -ifeq ($(PLUGIN_DISTRIBUTED),yes) -PLUGIN_DIST_EXTERNAL_LIST+= $(PLUGIN_INTRO) -endif -else -@PLUGIN_NAME@_CAT_INTRO:= echo "" > $(PLUGIN_DOC_DIR)/@PLUGIN_NAME@.txt -endif - -ifeq ($(FRAMAC_INTERNAL),yes) -DOC_INTRO:= $(DOC_DIR)/intro_kernel_plugin.txt \ - $(DOC_DIR)/intro_plugin.txt \ - $(DOC_DIR)/intro_plugin_D_and_S.txt \ - $(DOC_DIR)/intro_plugin_default.txt -else -DOC_INTRO:= -endif - -$(@PLUGIN_NAME@_DOC_DIR)/@PLUGIN_NAME@.txt: $(DOC_INTRO) $(@PLUGIN_NAME@_INTRO) - $(PRINT_MAKING) "$@" - $(MKDIR) $(dir $@) - $(@PLUGIN_NAME@_CAT_INTRO) - if [ -f "$(DOC_DIR)/html/Db.@PLUGIN_NAME@.html" ] ; then \ - if [ -f "$(DOC_DIR)/dynamic_plugins/Dynamic_plugins.@PLUGIN_NAME@.html" ] ; then \ - cat $(DOC_DIR)/intro_plugin_D_and_S.txt >> $@ ; \ - else \ - cat $(DOC_DIR)/intro_kernel_plugin.txt >> $@ ; \ - fi ; \ - elif [ -f "$(DOC_DIR)/dynamic_plugins/Dynamic_plugins.@PLUGIN_NAME@.html" ] ; then \ - cat $(DOC_DIR)/intro_plugin.txt >> $@ ; \ - else \ - cat $(DOC_DIR)/intro_plugin_default.txt >> $@ ; \ - fi - $(ISED) -e "s/_PluginName_/@PLUGIN_NAME@/g" \ - -e "/^#\*/d" $@ - -ifeq ($(FRAMAC_INTERNAL),yes) -OCAMLDOC_GEN:=$(DOC_PLUGIN) -OCAMLDOC_GEN+=$(DOC_DIR)/kernel-doc.ocamldoc - -else -OCAMLDOC_GEN:= - -# not doing kernel documentation if just compiling plugin's one - -$(DOC_DIR)/docgen.cmo: $(DOC_DIR)/docgen.ml - $(PRINT_OCAMLC) $@ - $(OCAMLC) -c -I +ocamldoc $(call winpath,$(DOC_DIR))/docgen.ml - -$(DOC_DIR)/docgen.cmxs: $(DOC_DIR)/docgen.ml - $(PRINT_PACKING) $@ - $(OCAMLOPT) -o $(call winpath,$@) -shared -I +ocamldoc \ - $(call winpath,$(DOC_DIR))/docgen.ml -endif - -OCAMLDOC_DEPEND:= $(PLUGIN_CMO) -ifneq ($(ENABLE_GUI),no) -OCAMLDOC_DEPEND:= $(OCAMLDOC_DEPEND) $(PLUGIN_GUI_CMO) -endif - -PLUGIN_DOC_DUMP:=$(@PLUGIN_NAME@_DOC_DIR)/@PLUGIN_NAME@.ocamldoc -@PLUGIN_NAME@_DOC_DUMP:=$(PLUGIN_DOC_DUMP) - -.PHONY: @PLUGIN_NAME@_DOC -@PLUGIN_NAME@_DOC: $(OCAMLDOC_DEPEND) \ - $(OCAMLDOC_GEN) \ - $(@PLUGIN_NAME@_DOC_DIR)/@PLUGIN_NAME@.txt \ - $(@PLUGIN_NAME@_DOC_DIR)/modules.svg \ - $(DOC_PLUGIN) - $(PRINT_DOC) @PLUGIN_NAME@ - $(MKDIR) $(@PLUGIN_NAME@_DOC_DIR) - $(RM) $(@PLUGIN_NAME@_DOC_DIR)/*.html -# Only generate toc for kernel's documentation if we are in Frama-C's main -# Makefile -ifeq ($(FRAMAC_INTERNAL),yes) - $(ECHO) '<li><a href="$(subst $(DOC_DIR)/,,$(@PLUGIN_NAME@_DOC_DIR))/index.html">$(subst _, ,@PLUGIN_NAME@)</a></li>' > $(DOC_DIR)/@PLUGIN_NAME@.toc -endif - $(OCAMLDOC) $(@PLUGIN_NAME@_DOCFLAGS) \ - -t "@PLUGIN_NAME@ plugin" \ - -css-style ../style.css \ - -d $(@PLUGIN_NAME@_DOC_DIR) -g $(DOC_PLUGIN) -passopt -docpath $(DOC_DIR)/html \ - -dump $(@PLUGIN_NAME@_DOC_DUMP) \ - $(addprefix -load ,$(wildcard $(DOC_DIR)/kernel-doc.ocamldoc)) \ - $(wildcard $(@PLUGIN_NAME@_DOC_SRC)) -# [rb+js] 20090619 -# pwd is required to avoid "bad directory" message on OpenBSD -# don't know why - cd `pwd`/$(@PLUGIN_NAME@_DOC_DIR); \ - for f in $(foreach f,$(@PLUGIN_NAME@_TYPES_TODOC),\ - $(basename $(notdir $f))); do \ - for g in \ - $(wildcard ../html/$(shell $(ECHO) $(f) | $(SED) 's/^./\u&/')); \ - do \ - ln -sf $$g; \ - done; \ - done; \ - for f in *.html; do \ - $(ISED) -e 's|\(doc/code/html\)|../../../\1|g' $$f ; \ - done - -PLUGIN_DOC_DUMP_LIST+=$(PLUGIN_DOC_DUMP) - -# removed dependencies: -# $(PLUGIN_DOC_DIR)/modules.ps \ -# $(PLUGIN_DOC_DIR)/modules-all.ps \ -# $(PLUGIN_DOC_DIR)/types.ps -$(PLUGIN_DOC_DIR)/modules.dot: DOC_FLAGS:=$($(NAME_DOCFLAGS)) -$(PLUGIN_DOC_DIR)/modules.dot: $(wildcard $(PLUGIN_DOC_SRC)) - $(PRINT_DOC) $@ - $(MKDIR) $(dir $@) - $(OCAMLDOC) $(DOC_FLAGS) -o $@ -dot $^ \ - || { $(RM) $@; exit 2; } # in case of error, ocamldoc still generates - # something - $(ISED) -e "s/rotate=90;//" \ - -e 's/digraph G/digraph "Plugin architecture ($(subst /,,$(subst doc/code,,$(dir $@))))"/' \ - $@ - -$(PLUGIN_DOC_DIR)/modules-all.dot: DOC_FLAGS:=$($(NAME_DOCFLAGS)) -$(PLUGIN_DOC_DIR)/modules-all.dot: $(wildcard $(PLUGIN_DOC_SRC)) - $(PRINT_DOC) $@ - $(MKDIR) $(dir $@) - $(OCAMLDOC) $(DOC_FLAGS) $($(dir $@)FLAGS) -o $@ -dot \ - -dot-include-all $^ - $(ISED) -e "s/rotate=90;//" $@ - -$(PLUGIN_DOC_DIR)/types.dot: DOC_FLAGS:=$($(NAME_DOCFLAGS)) -$(PLUGIN_DOC_DIR)/types.dot: $(wildcard $(PLUGIN_DOC_SRC)) - $(PRINT_DOC) $@ - $(MKDIR) $(dir $@) - $(OCAMLDOC) $(DOC_FLAGS) $($(dir $@)FLAGS) -o $@ -dot -dot-types $^ - $(ISED) -e "s/rotate=90;//" $@ - -.PHONY: @PLUGIN_NAME@_metrics -@PLUGIN_NAME@_metrics : $(PLUGIN_DOC_DIR)/metrics.html -$(PLUGIN_DOC_DIR)/metrics.html : $(wildcard $(PLUGIN_DOC_SRC)) - $(PRINT_DOC) $@ - ocamlmetrics $^ > $@ - -############ -# Tests # -############ - -ifneq ("$(PLUGIN_ENABLE)","no") -ifndef PLUGIN_NO_TEST -ifndef PLUGIN_TESTS_DIRS -PLUGIN_TESTS_DIRS:=$(PLUGIN_BASE) -endif -endif - -ifndef PLUGIN_TESTS_DIRS_DEFAULT -PLUGIN_TESTS_DIRS_DEFAULT:=$(PLUGIN_TESTS_DIRS) -endif - -ifndef PLUGIN_NO_DEFAULT_TEST -ifdef PLUGIN_INTERNAL_TEST -PLUGIN_TESTS_LIST += $(PLUGIN_TESTS_DIRS_DEFAULT) -endif -endif - -@PLUGIN_NAME@_TESTS_DIRS:=$(PLUGIN_TESTS_DIRS) - -@PLUGIN_NAME@_TESTS_LIB_DIR:=$(sort $(dir $(PLUGIN_TESTS_LIB))) -@PLUGIN_NAME@_TESTS_LIB_DIR_INCLUDE:=$(foreach d,$(@PLUGIN_NAME@_TESTS_LIB_DIR),-I $d ) -@PLUGIN_NAME@_EXTRA_DIRS:=$(@PLUGIN_NAME@_EXTRA_DIRS) $(@PLUGIN_NAME@_TESTS_LIB_DIR) -@PLUGIN_NAME@_TESTS_LIB_OPT:=$(PLUGIN_TESTS_LIB:%.ml=%.cmx) -@PLUGIN_NAME@_TESTS_LIB_OPT_DYN:=$(PLUGIN_TESTS_LIB:%.ml=%.cmxs) -@PLUGIN_NAME@_TESTS_LIB_BYTE:=$(PLUGIN_TESTS_LIB:%.ml=%.cmo) - -$(@PLUGIN_NAME@_TESTS_LIB_OPT): OFLAGS:=$($(NAME_TEST_OFLAGS)) $(@PLUGIN_NAME@_TESTS_LIB_DIR_INCLUDE) -$(@PLUGIN_NAME@_TESTS_LIB_OPT_DYN): OFLAGS:=$($(NAME_TEST_OFLAGS)) $(@PLUGIN_NAME@_TESTS_LIB_DIR_INCLUDE) -$(@PLUGIN_NAME@_TESTS_LIB_BYTE): BFLAGS:=$($(NAME_TEST_BFLAGS)) $(@PLUGIN_NAME@_TESTS_LIB_DIR_INCLUDE) - -# [JS 2009/03/18] both .PRECIOUS are required in order to prevent 'make' -# deletion of intermediate generated files. Such a deletion forces 'make' to -# unnecessarily recompile those files. -.PRECIOUS: $(@PLUGIN_NAME@_TESTS_LIB_OPT) \ - $(@PLUGIN_NAME@_TESTS_LIB_OPT_DYN) \ - $(@PLUGIN_NAME@_TESTS_LIB_BYTE) \ - $(@PLUGIN_NAME@_TESTS_LIB_BYTE:%.cmo=%.cmi) -endif # PLUGIN_ENABLE - -########## -# Depend # -########## - -# for reasons known to themselves, ocamldep and make are confused by ./file.ml -# hence (one of) the patsubst below in case PLUGIN_DIR is . - -# If you explicitly do "make depend" it is -# $(PLUGIN_DIR)/@PLUGIN_NAME@_DEP_REDO. it forces the computation of -# dependencies. Otherwise usual dependency for $(PLUGIN_DIR)/.depend. -.PHONY: $(@PLUGIN_NAME@_DIR)/@PLUGIN_NAME@_DEP_REDO -$(@PLUGIN_NAME@_DIR)/@PLUGIN_NAME@_DEP_REDO $(@PLUGIN_NAME@_DIR)/.depend: \ - $(PLUGIN_GENERATED) - $(PRINT_DEP) $(@PLUGIN_NAME@_DIR)/.depend - $(RM) $(@PLUGIN_NAME@_DIR)/.depend - $(OCAMLDEP) $(INCLUDES) \ - $(@PLUGIN_NAME@_DEPFLAGS) \ - $(patsubst ./%,%,\ - $(@PLUGIN_NAME@_ML_SRC) \ - $(@PLUGIN_NAME@_MLI) \ - $(@PLUGIN_NAME@_GUI_MLI)) \ - $(foreach d,$(wildcard $(@PLUGIN_NAME@_TESTS_LIB_DIR)),\ - -I $d $d*.ml $d*.mli) \ - > $(@PLUGIN_NAME@_DIR)/.depend - $(CHMOD_RO) $(@PLUGIN_NAME@_DIR)/.depend - -depend:: $(@PLUGIN_NAME@_DIR)/@PLUGIN_NAME@_DEP_REDO - -#Just for backward compatibility (19/10/2015) -$(@PLUGIN_NAME@_DIR)/@PLUGIN_NAME@_DEP: $(@PLUGIN_NAME@_DIR)/.depend - $(TOUCH) $@ - -#In internal mode wait for lib/plugins to be populated by .mli. -ifeq ($(FRAMAC_INTERNAL),yes) -$(@PLUGIN_NAME@_DIR)/@PLUGIN_NAME@_DEP_REDO $(@PLUGIN_NAME@_DIR)/.depend: $(INSTALLED_PLUGIN_DIR)/.placeholders_ready -endif - -# MAKECMDGOALS contains the targets passed to make. We set it to non-empty -# (if needed) to silence warnings about undefined variables. -MAKECMDGOALS ?= - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),distclean) -ifneq ($(MAKECMDGOALS),smartclean) -sinclude $(PLUGIN_DIR)/.depend -endif -endif -endif - -############ -# Cleaning # -############ - -.PHONY: $(PLUGIN_DIR)/@PLUGIN_NAME@_CLEAN -$(PLUGIN_DIR)/@PLUGIN_NAME@_CLEAN: - $(PRINT_RM) $(patsubst %_CLEAN,%,$(notdir $@)) - if test "$(FRAMAC_INTERNAL)" = "yes"; then \ - $(RM) $(dir $@).depend; \ - fi - $(RM) $(PLUGIN_GENERATED) - $(RM) $(@:%CLEAN=%DEP) $(@:%CLEAN=%DEP_REDO) - $(RM) $(patsubst %.cmo,%.cm*,$($(patsubst %_CLEAN,%_CMO,$(notdir $@)))) - $(RM) $(patsubst %.cmi,%.cm*,$($(patsubst %_CLEAN,%_CMI,$(notdir $@)))) - $(RM) $(patsubst %.cmo,%.annot,\ - $($(patsubst %_CLEAN,%_CMO,$(notdir $@)))) - $(RM) $(patsubst %.cmo,%.o,$($(patsubst %_CLEAN,%_CMO,$(notdir $@)))) - $(RM) $(patsubst %.cmo,%.cm*,\ - $($(patsubst %_CLEAN,%_GUI_CMO,$(notdir $@)))) - $(RM) $(patsubst %.cmi,%.cm*,\ - $($(patsubst %_CLEAN,%_GUI_CMI,$(notdir $@)))) - $(RM) $(patsubst %.cmo,%.annot,\ - $($(patsubst %_CLEAN,%_GUI_CMO,$(notdir $@)))) - $(RM) $(patsubst %.cmo,%.o,\ - $($(patsubst %_CLEAN,%_GUI_CMO,$(notdir $@)))) - $(RM) $(dir $@)*~ $(dir $@)*.cm* $(dir $@)*.o $(dir $@)*.annot - $(RM) $(foreach d,$(@:%CLEAN=%TESTS_LIB_OPT),\ - $(foreach f,$($(notdir $d)),\ - $f $(f:.cmx=.cm*) $(f:.cmx=.opt) $(f:.cmx=.byte) $(f:.cmx=.o))) - $(RM) -f $(@PLUGIN_NAME@_CHECK_PLUGIN_MLI) - - -.PHONY: $(PLUGIN_DIR)/@PLUGIN_NAME@_DIST_CLEAN -$(PLUGIN_DIR)/@PLUGIN_NAME@_DIST_CLEAN: - $(RM) $(dir $@)/tests/ptests_config - -.PHONY: $(PLUGIN_DIR)/@PLUGIN_NAME@_CLEAN_DOC $(@PLUGIN_NAME@_DOC_DIR) -$(PLUGIN_DIR)/@PLUGIN_NAME@_CLEAN_DOC: $(@PLUGIN_NAME@_DOC_DIR) - $(PRINT_RM) documentation of $(patsubst %_CLEAN_DOC,%,$(notdir $@)) - $(RM) -r $< - $(RM) $(DOC_DIR)/$(notdir $(patsubst %_CLEAN_DOC,%,$@).toc) - -# Global lists seen in Makefile - -PLUGIN_GENERATED_LIST += $(PLUGIN_GENERATED) - -PLUGIN_META_LIST += $(TARGET_META) -PLUGIN_DYN_CMI_LIST += $(TARGET_CMI) -ifdef PLUGIN_EXTRA_BYTE -.PRECIOUS: $(TARGET_TOP_CMO) -PLUGIN_DYN_CMO_LIST += $(TARGET_TOP_CMA) -else -PLUGIN_DYN_CMO_LIST += $(TARGET_TOP_CMO) -endif -PLUGIN_DYN_DEP_GUI_CMO_LIST += $(PLUGIN_GUI_CMO) -ifeq ($(HAS_GUI),yes) -PLUGIN_DYN_GUI_EXISTS:=yes -ifdef PLUGIN_EXTRA_BYTE -PLUGIN_DYN_GUI_CMO_LIST += $(TARGET_GUI_CMA) -else -PLUGIN_DYN_GUI_CMO_LIST += $(TARGET_GUI_CMO) -endif #EXTRA_BYTE -endif #HAS_GUI - -PLUGIN_DYN_DEP_GUI_CMX_LIST += $(PLUGIN_GUI_CMX) -PLUGIN_DYN_CMX_LIST += $(TARGET_TOP_CMXS) $(TARGET_TOP_CMX) $(TARGET_TOP_O) - # If P1 depends on P2, then dynamically link P1.cmxs requires to have - # compiled P1's sources wrt the P2's .cmx. -ifeq ($(HAS_GUI),yes) -PLUGIN_DYN_GUI_CMX_LIST += $(TARGET_GUI_CMXS) -endif # HAS_GUI - -PLUGIN_INTERNAL_CMO_LIST += $(PLUGIN_CMO) -PLUGIN_INTERNAL_CMX_LIST += $(PLUGIN_CMX) -PLUGIN_DOC_LIST += @PLUGIN_NAME@_DOC -PLUGIN_DOC_DIRS += $(PLUGIN_BASE) - -ifeq ($(PLUGIN_DISTRIBUTED),yes) -PLUGIN_DISTRIBUTED_NAME_LIST += @PLUGIN_NAME@ -PLUGIN_DISTRIBUTED_DIR_LIST += @PLUGIN_NAME@ -endif - -else -$(PLUGIN_DIR)/@PLUGIN_NAME@_DEP_REDO: -$(PLUGIN_DIR)/@PLUGIN_NAME@_DEP: -$(PLUGIN_DIR)/@PLUGIN_NAME@_CLEAN: -$(PLUGIN_DIR)/@PLUGIN_NAME@_CLEAN_DOC: -$(PLUGIN_DIR)/@PLUGIN_NAME@_DIST_CLEAN: -endif - -# Reset each "local" plugin variable - -ifneq ($(PLUGIN_RESET),no) -PLUGIN_RESET:= -PLUGIN_NAME:= -PLUGIN_DIR:= -PLUGIN_DESCRIPTION:= -PLUGIN_VERSION:= -PLUGIN_REQUIRES:= -PLUGIN_HAS_META:= -PLUGIN_CMI:= -PLUGIN_CMO:= -PLUGIN_BFLAGS:= -PLUGIN_OFLAGS:= -PLUGIN_DEPFLAGS:= -PLUGIN_DOCFLAGS:= -PLUGIN_GENERATED:= -PLUGIN_TYPES_CMO:= -PLUGIN_GUI_CMO:= -PLUGIN_GUI_CMX:= -PLUGIN_GUI_CMI:= -PLUGIN_GUI_MLI:= -PLUGIN_UNDOC:= -PLUGIN_TYPES_TODOC:= -PLUGIN_INTRO:= -PLUGIN_ENABLE:= -PLUGIN_NO_TEST:= -PLUGIN_TESTS_LIB:= -PLUGIN_TESTS_DIRS:= -PLUGIN_DEPENDS:= -PLUGIN_DEPENDENCIES:= -PLUGIN_DISTRIBUTED:= -PLUGIN_DISTRIB_EXTERNAL:= -PLUGIN_DISTRIB_TESTS:= -PLUGIN_HAS_EXT_DOC:= -PLUGIN_NO_DEFAULT_TEST:= -PLUGIN_TESTS_DIRS_DEFAULT:= -PLUGIN_LINK_GUI_BFLAGS:= -PLUGIN_LINK_GUI_OFLAGS:= -PLUGIN_LINK_BFLAGS:= -PLUGIN_LINK_OFLAGS:= -PLUGIN_EXTRA_BYTE:= -PLUGIN_EXTRA_OPT:= -PLUGIN_EXTRA_DIRS:= -PLUGIN_INTERNAL_TEST:= -PLUGIN_DOC_DIR:= -PLUGIN_HEADER_SPEC:=$(DEFAULT_HEADER_SPEC) -PLUGIN_HEADER_DIRS:=$(DEFAULT_HEADER_DIRS) -PLUGIN_HEADER_EXCEPTIONS:=$(DEFAULT_HEADER_EXCEPTIONS) -PLUGIN_CEA_PROPRIETARY_FILES:=$(DEFAULT_CEA_PROPRIETARY_FILES) -PLUGIN_CEA_PROPRIETARY_HEADERS:= -endif - -############################################################################### -# Local Variables: -# mode: makefile -# End: diff --git a/share/Makefile.testing b/share/Makefile.testing new file mode 100644 index 0000000000000000000000000000000000000000..121f88a0074f636910f7bc073e5104b3108e41fc --- /dev/null +++ b/share/Makefile.testing @@ -0,0 +1,210 @@ +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +########### +# TESTING # +########### + +################################ +## Default variables + +# Defines where to find the ptest_config files +# Default: only consider tests directory, it can be customized via the variable +PTEST_ALL_DIRS?=tests +# Additional options transmitted to ptests +PTEST_OPTS?= +# Selected ptests directories for testing +PTEST_DIRS?=$(PTEST_ALL_DIRS) +# Additional dependencies to build before testing +PTEST_DEPS?= +# Indicate whether we use global WP cache +PTEST_USE_WP_CACHE?=no + +############ +# Default values necessary for make -f <this-makefile> + +GREP ?= grep +RM ?= rm -f +RMDIR ?= rm -rf + +ifeq ($(PLATFORM),MacOS) +XARGS ?= xargs +else +# Unix, Cygwin +XARGS ?= xargs --no-run-if-empty +endif + +########################################################################## + +# Defines the related dune targets +PTEST_ALIASES=$(addsuffix /ptests,$(addprefix @,$(PTEST_DIRS))) + +.PHONY: tests.info +tests.info: + echo "FRAMAC_WTESTS='$(FRAMAC_WTESTS)'" + echo "WTESTS='$(WTESTS)'" + echo "FRAMAC_PTESTS='$(FRAMAC_PTESTS)'" + echo "PTESTS='$(PTESTS)'" + echo "PTEST_ALL_DIRS='$(PTEST_ALL_DIRS)'" + echo "PTEST_DIRS='$(PTEST_DIRS)'" + echo "PTEST_OPTS='$(PTEST_OPTS)'" + echo "PTEST_DEPS='$(PTEST_DEPS)'" + echo "PTEST_USE_WP_CACHE='$(PTEST_USE_WP_CACHE)'" + echo "PTEST_ALIASES='$(PTEST_ALIASES)'" + +########################################################################## +## Command used to execute ptests (in order to generate dune test files) + +# Note: +# - in the Frama-C repository: +# ptests is in the project, so this variable is used to tell where is ptests. +# - in a plug-in: +# ptests is installed and its public name is frama-c-ptests +ifeq ($(FRAMAC_PTESTS),) + +# PTESTS is external +PTESTS=frama-c-ptests + +else + +# PTESTS is internal +PTESTS=dune exec $(DUNE_BUILD_OPTS) --root $(FRAMAC_PTESTS_SRC) -- frama-c-ptests +#PTESTS=dune exec $(DUNE_BUILD_OPTS) --root $(FRAMAC_PTESTS_SRC) -- frama-c-ptests -v + +# Note: the public name of ptest.exe is frama-c-ptests +$(FRAMAC_PTESTS): $(FRAMAC_PTESTS_SRC)/ptests.ml + dune build --root $(FRAMAC_PTESTS_SRC) ptests.exe + +endif + +.PHONY: ptests-help +ptests-help: + $(PTESTS) --help + +########################################################################## +## Command used to execute wtests, the wrapper that can be used during +## dune testing (c.f. frama-c-ptests) + +# Note: +# - in the Frama-C repository: +# wtests is in the project, so this variable is used to tell where is wtests. +# - in a plug-in: +# wtests is installed and its public name is frama-c-wtests +ifeq ($(FRAMAC_WTESTS),) + +# WTESTS is external to Frama-C +WTESTS=frama-c-wtests + +else + +# WTESTS is internal to Frama-C +WTESTS=dune exec $(DUNE_BUILD_OPTS) --root $(FRAMAC_PTESTS_SRC) -- frama-c-wtests + +# Note: the public name of wtest.exe is frama-c-wtests +$(FRAMAC_WTESTS): $(FRAMAC_PTESTS_SRC)/wtests.ml + dune build --root $(FRAMAC_PTESTS_SRC) wtests.exe + +endif + +.PHONY: wtests-help +wtests-help: + $(WTESTS) --help + +########################################################################## +## Removes all dune files generated for testing + +.PHONY: purge-tests +purge-tests: + find $(PTEST_ALL_DIRS) -name dune \ + | $(GREP) -e "/oracle.*/dune\|/result.*/dune" \ + | $(XARGS) -n 10 $(RM) + +# Force the full cleaning of the testing environment +.PHONY: clean-tests +clean-tests: purge-tests + $(RMDIR) $(addprefix _build/default/,$(PTEST_ALL_DIRS)) + +########################################################################## +## Generates all dune files used for testing + +.PHONY: run-ptests +run-ptests: $(PTEST_DEPS) purge-tests $(FRAMAC_PTEST) $(FRAMAC_WTEST) + $(PTESTS) $(PTEST_OPTS) $(PTEST_DIRS) + +.PHONY: run-ptests.replay +run-ptests.replay: $(PTEST_DEPS) $(FRAMAC_PTEST) + $(PTESTS) $(PTEST_OPTS) $(PTEST_DIRS) + +# Run tests of for all configurations (and build all dune files) +.PHONY: run-tests +ifeq ($(PTEST_USE_WP_CACHE),yes) # Set WP cache only if needed +run-tests: FRAMAC_WP_CACHE=offline +endif +run-tests: run-ptests + dune build $(PTEST_ALIASES) + +# Replay tests of for all configurations (requires all dune files) +.PHONY: test.replay +ifeq ($(PTEST_USE_WP_CACHE),yes) # Set WP cache only if needed +tests.replay: FRAMAC_WP_CACHE=offline +endif +tests.replay: $(PTEST_DEPS) + dune build $(PTEST_ALIASES) + +# Update WP cache entries for all configurations (requires all dune files) +ifeq ($(PTEST_USE_WP_CACHE),yes) # Only visible when ptests use WP cache +.PHONY: tests.update-wp-cache +tests.update-wp-cache: FRAMAC_WP_CACHE=update +tests.update-wp-cache: $(PTEST_DEPS) + dune build $(PTEST_ALIASES) +endif + +.PHONY: tests +tests:: run-tests + echo "Number of *.{err,res}.log files:" + find $(addprefix _build/default/,$(PTEST_DIRS)) -name \*.err.log -or -name \*.res.log \ + | $(GREP) -c "^" + +ifneq ($(PTEST_USE_WP_CACHE),no) +ifeq ($(FRAMAC_WP_CACHEDIR),) + +tests:: + @echo "Warning: cannot run some tests related to WP plugin since FRAMAC_WP_CACHEDIR variable is undefined." + @echo "Fix proposal:" + @echo "> cd <DIR>" + @echo "> git clone git@git.frama-c.com:frama-c/wp-cache.git" + @echo "> FRAMAC_WP_CACHEDIR=<DIR>/wp-cache make tests" + @echo "Otherwise, use 'make PTEST_USE_WP_CACHE=no tests' to remove this warning" + +endif # FRAMAC_WP_CACHEDIR +endif # PTEST_USE_WP_CACHE + +.PHONY: count-tests +count-tests: + echo "Number of *.{err,res}.log files:" + find $(addprefix _build/default/,$(PTEST_DIRS)) -name \*.res.log -or -name \*.err.log \ + | $(GREP) -c "^" + +############################################################################### +# Local Variables: +# compile-command: "make" +# End: diff --git a/share/analysis-scripts/dune b/share/analysis-scripts/dune new file mode 100644 index 0000000000000000000000000000000000000000..734d21ddfdff52dac363740f37a7d0e55703e278 --- /dev/null +++ b/share/analysis-scripts/dune @@ -0,0 +1,29 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(library + (name analysis_scripts) + (public_name frama-c.analysis-scripts) + (modules list_functions) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.init frama-c.boot frama-c.kernel) +) diff --git a/share/dune b/share/dune new file mode 100644 index 0000000000000000000000000000000000000000..b0f8d4ff74f61a15acc53797f0e7f6ee289ec82d --- /dev/null +++ b/share/dune @@ -0,0 +1,308 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(install + (package frama-c) + (section (site (frama-c share))) + (files +; Useful Makefiles +(Makefile.headers as Makefile.headers) +(Makefile.linting as Makefile.linting) +(Makefile.installation as Makefile.installation) +(Makefile.testing as Makefile.testing) +; GUI Images +(frama-c.ico as frama-c.ico) +(frama-c.png as frama-c.png) +(unmark.png as unmark.png) +(switch-on.png as switch-on.png) +(switch-off.png as switch-off.png) +; Default theme +(theme/default/never_tried.png as theme/default/never_tried.png) +(theme/default/unknown.png as theme/default/unknown.png) +(theme/default/surely_valid.png as theme/default/surely_valid.png) +(theme/default/surely_invalid.png as theme/default/surely_invalid.png) +(theme/default/considered_valid.png as theme/default/considered_valid.png) +(theme/default/valid_under_hyp.png as theme/default/valid_under_hyp.png) +(theme/default/invalid_under_hyp.png as theme/default/invalid_under_hyp.png) +(theme/default/invalid_but_dead.png as theme/default/invalid_but_dead.png) +(theme/default/unknown_but_dead.png as theme/default/unknown_but_dead.png) +(theme/default/valid_but_dead.png as theme/default/valid_but_dead.png) +(theme/default/inconsistent.png as theme/default/inconsistent.png) +(theme/default/fold.png as theme/default/fold.png) +(theme/default/unfold.png as theme/default/unfold.png) +; Colorblind theme +(theme/colorblind/never_tried.png as theme/colorblind/never_tried.png) +(theme/colorblind/unknown.png as theme/colorblind/unknown.png) +(theme/colorblind/surely_valid.png as theme/colorblind/surely_valid.png) +(theme/colorblind/surely_invalid.png as theme/colorblind/surely_invalid.png) +(theme/colorblind/considered_valid.png as theme/colorblind/considered_valid.png) +(theme/colorblind/valid_under_hyp.png as theme/colorblind/valid_under_hyp.png) +(theme/colorblind/invalid_under_hyp.png as theme/colorblind/invalid_under_hyp.png) +(theme/colorblind/invalid_but_dead.png as theme/colorblind/invalid_but_dead.png) +(theme/colorblind/unknown_but_dead.png as theme/colorblind/unknown_but_dead.png) +(theme/colorblind/valid_but_dead.png as theme/colorblind/valid_but_dead.png) +(theme/colorblind/inconsistent.png as theme/colorblind/inconsistent.png) +(theme/colorblind/fold.png as theme/colorblind/fold.png) +(theme/colorblind/unfold.png as theme/colorblind/unfold.png) +; Flat theme +(theme/flat/never_tried.png as theme/flat/never_tried.png) +(theme/flat/unknown.png as theme/flat/unknown.png) +(theme/flat/surely_valid.png as theme/flat/surely_valid.png) +(theme/flat/surely_invalid.png as theme/flat/surely_invalid.png) +(theme/flat/considered_valid.png as theme/flat/considered_valid.png) +(theme/flat/valid_under_hyp.png as theme/flat/valid_under_hyp.png) +(theme/flat/invalid_under_hyp.png as theme/flat/invalid_under_hyp.png) +(theme/flat/invalid_but_dead.png as theme/flat/invalid_but_dead.png) +(theme/flat/unknown_but_dead.png as theme/flat/unknown_but_dead.png) +(theme/flat/valid_but_dead.png as theme/flat/valid_but_dead.png) +(theme/flat/inconsistent.png as theme/flat/inconsistent.png) +(theme/flat/fold.png as theme/flat/fold.png) +(theme/flat/unfold.png as theme/flat/unfold.png) +; Libc +(libc/__fc_alloc_axiomatic.h as libc/__fc_alloc_axiomatic.h) +(libc/__fc_builtin.c as libc/__fc_builtin.c) +(libc/__fc_builtin.h as libc/__fc_builtin.h) +(libc/__fc_define_blkcnt_t.h as libc/__fc_define_blkcnt_t.h) +(libc/__fc_define_blksize_t.h as libc/__fc_define_blksize_t.h) +(libc/__fc_define_clockid_t.h as libc/__fc_define_clockid_t.h) +(libc/__fc_define_dev_t.h as libc/__fc_define_dev_t.h) +(libc/__fc_define_eof.h as libc/__fc_define_eof.h) +(libc/__fc_define_fd_set_t.h as libc/__fc_define_fd_set_t.h) +(libc/__fc_define_fds.h as libc/__fc_define_fds.h) +(libc/__fc_define_file.h as libc/__fc_define_file.h) +(libc/__fc_define_fpos_t.h as libc/__fc_define_fpos_t.h) +(libc/__fc_define_fs_cnt.h as libc/__fc_define_fs_cnt.h) +(libc/__fc_define_id_t.h as libc/__fc_define_id_t.h) +(libc/__fc_define_ino_t.h as libc/__fc_define_ino_t.h) +(libc/__fc_define_intptr_t.h as libc/__fc_define_intptr_t.h) +(libc/__fc_define_iovec.h as libc/__fc_define_iovec.h) +(libc/__fc_define_key_t.h as libc/__fc_define_key_t.h) +(libc/__fc_define_locale_t.h as libc/__fc_define_locale_t.h) +(libc/__fc_define_max_open_files.h as libc/__fc_define_max_open_files.h) +(libc/__fc_define_mode_t.h as libc/__fc_define_mode_t.h) +(libc/__fc_define_nlink_t.h as libc/__fc_define_nlink_t.h) +(libc/__fc_define_null.h as libc/__fc_define_null.h) +(libc/__fc_define_off_t.h as libc/__fc_define_off_t.h) +(libc/__fc_define_pid_t.h as libc/__fc_define_pid_t.h) +(libc/__fc_define_pthread_types.h as libc/__fc_define_pthread_types.h) +(libc/__fc_define_sa_family_t.h as libc/__fc_define_sa_family_t.h) +(libc/__fc_define_seek_macros.h as libc/__fc_define_seek_macros.h) +(libc/__fc_define_sigset_t.h as libc/__fc_define_sigset_t.h) +(libc/__fc_define_size_t.h as libc/__fc_define_size_t.h) +(libc/__fc_define_sockaddr.h as libc/__fc_define_sockaddr.h) +(libc/__fc_define_ssize_t.h as libc/__fc_define_ssize_t.h) +(libc/__fc_define_stat.h as libc/__fc_define_stat.h) +(libc/__fc_define_suseconds_t.h as libc/__fc_define_suseconds_t.h) +(libc/__fc_define_time_t.h as libc/__fc_define_time_t.h) +(libc/__fc_define_timer_t.h as libc/__fc_define_timer_t.h) +(libc/__fc_define_timespec.h as libc/__fc_define_timespec.h) +(libc/__fc_define_timeval.h as libc/__fc_define_timeval.h) +(libc/__fc_define_uid_and_gid.h as libc/__fc_define_uid_and_gid.h) +(libc/__fc_define_useconds_t.h as libc/__fc_define_useconds_t.h) +(libc/__fc_define_wchar_t.h as libc/__fc_define_wchar_t.h) +(libc/__fc_define_wint_t.h as libc/__fc_define_wint_t.h) +(libc/__fc_gcc_builtins.h as libc/__fc_gcc_builtins.h) +(libc/__fc_inet.h as libc/__fc_inet.h) +(libc/__fc_integer.h as libc/__fc_integer.h) +(libc/__fc_libc.h as libc/__fc_libc.h) +(libc/__fc_machdep.h as libc/__fc_machdep.h) +(libc/__fc_machdep_linux_shared.h as libc/__fc_machdep_linux_shared.h) +(libc/__fc_runtime.c as libc/__fc_runtime.c) +(libc/__fc_select.h as libc/__fc_select.h) +(libc/__fc_string_axiomatic.h as libc/__fc_string_axiomatic.h) +(libc/aio.h as libc/aio.h) +(libc/alloca.h as libc/alloca.h) +(libc/argz.c as libc/argz.c) +(libc/argz.h as libc/argz.h) +(libc/arpa/inet.h as libc/arpa/inet.h) +(libc/assert.c as libc/assert.c) +(libc/assert.h as libc/assert.h) +(libc/byteswap.h as libc/byteswap.h) +(libc/complex.h as libc/complex.h) +(libc/cpio.h as libc/cpio.h) +(libc/ctype.c as libc/ctype.c) +(libc/ctype.h as libc/ctype.h) +(libc/dirent.h as libc/dirent.h) +(libc/dlfcn.h as libc/dlfcn.h) +(libc/endian.h as libc/endian.h) +(libc/err.h as libc/err.h) +(libc/errno.c as libc/errno.c) +(libc/errno.h as libc/errno.h) +(libc/fcntl.h as libc/fcntl.h) +(libc/features.h as libc/features.h) +(libc/fenv.c as libc/fenv.c) +(libc/fenv.h as libc/fenv.h) +(libc/float.h as libc/float.h) +(libc/fmtmsg.h as libc/fmtmsg.h) +(libc/fnmatch.h as libc/fnmatch.h) +(libc/ftw.h as libc/ftw.h) +(libc/getopt.c as libc/getopt.c) +(libc/getopt.h as libc/getopt.h) +(libc/glob.c as libc/glob.c) +(libc/glob.h as libc/glob.h) +(libc/grp.h as libc/grp.h) +(libc/iconv.h as libc/iconv.h) +(libc/ifaddrs.h as libc/ifaddrs.h) +(libc/inttypes.c as libc/inttypes.c) +(libc/inttypes.h as libc/inttypes.h) +(libc/iso646.h as libc/iso646.h) +(libc/langinfo.h as libc/langinfo.h) +(libc/libgen.h as libc/libgen.h) +(libc/limits.h as libc/limits.h) +(libc/locale.c as libc/locale.c) +(libc/locale.h as libc/locale.h) +(libc/malloc.h as libc/malloc.h) +(libc/math.c as libc/math.c) +(libc/math.h as libc/math.h) +(libc/memory.h as libc/memory.h) +(libc/monetary.h as libc/monetary.h) +(libc/mqueue.h as libc/mqueue.h) +(libc/n1336.pdf as libc/n1336.pdf) +(libc/n1362.pdf as libc/n1362.pdf) +(libc/ndbm.h as libc/ndbm.h) +(libc/net/if.h as libc/net/if.h) +(libc/netdb.c as libc/netdb.c) +(libc/netdb.h as libc/netdb.h) +(libc/netinet/in.c as libc/netinet/in.c) +(libc/netinet/in.h as libc/netinet/in.h) +(libc/netinet/ip.h as libc/netinet/ip.h) +(libc/netinet/tcp.h as libc/netinet/tcp.h) +(libc/nl_types.h as libc/nl_types.h) +(libc/poll.h as libc/poll.h) +(libc/pthread.h as libc/pthread.h) +(libc/pwd.c as libc/pwd.c) +(libc/pwd.h as libc/pwd.h) +(libc/regex.h as libc/regex.h) +(libc/resolv.h as libc/resolv.h) +(libc/sched.h as libc/sched.h) +(libc/search.h as libc/search.h) +(libc/semaphore.h as libc/semaphore.h) +(libc/setjmp.h as libc/setjmp.h) +(libc/signal.c as libc/signal.c) +(libc/signal.h as libc/signal.h) +(libc/spawn.h as libc/spawn.h) +(libc/stdalign.h as libc/stdalign.h) +(libc/stdarg.h as libc/stdarg.h) +(libc/stdatomic.c as libc/stdatomic.c) +(libc/stdatomic.h as libc/stdatomic.h) +(libc/stdbool.h as libc/stdbool.h) +(libc/stddef.h as libc/stddef.h) +(libc/stdint.h as libc/stdint.h) +(libc/stdio.c as libc/stdio.c) +(libc/stdio.h as libc/stdio.h) +(libc/stdlib.c as libc/stdlib.c) +(libc/stdlib.h as libc/stdlib.h) +(libc/stdnoreturn.h as libc/stdnoreturn.h) +(libc/string.c as libc/string.c) +(libc/string.h as libc/string.h) +(libc/strings.h as libc/strings.h) +(libc/stropts.h as libc/stropts.h) +(libc/sys/file.h as libc/sys/file.h) +(libc/sys/ioctl.h as libc/sys/ioctl.h) +(libc/sys/ipc.h as libc/sys/ipc.h) +(libc/sys/mman.h as libc/sys/mman.h) +(libc/sys/msg.h as libc/sys/msg.h) +(libc/sys/param.h as libc/sys/param.h) +(libc/sys/random.h as libc/sys/random.h) +(libc/sys/resource.h as libc/sys/resource.h) +(libc/sys/select.h as libc/sys/select.h) +(libc/sys/sem.h as libc/sys/sem.h) +(libc/sys/sendfile.h as libc/sys/sendfile.h) +(libc/sys/shm.h as libc/sys/shm.h) +(libc/sys/signal.h as libc/sys/signal.h) +(libc/sys/socket.h as libc/sys/socket.h) +(libc/sys/stat.h as libc/sys/stat.h) +(libc/sys/statvfs.h as libc/sys/statvfs.h) +(libc/sys/time.h as libc/sys/time.h) +(libc/sys/times.h as libc/sys/times.h) +(libc/sys/timex.h as libc/sys/timex.h) +(libc/sys/types.h as libc/sys/types.h) +(libc/sys/uio.h as libc/sys/uio.h) +(libc/sys/un.h as libc/sys/un.h) +(libc/sys/utsname.h as libc/sys/utsname.h) +(libc/sys/vfs.h as libc/sys/vfs.h) +(libc/sys/wait.h as libc/sys/wait.h) +(libc/syslog.h as libc/syslog.h) +(libc/tar.h as libc/tar.h) +(libc/termios.h as libc/termios.h) +(libc/tgmath.h as libc/tgmath.h) +(libc/time.c as libc/time.c) +(libc/time.h as libc/time.h) +(libc/trace.h as libc/trace.h) +(libc/ulimit.h as libc/ulimit.h) +(libc/unistd.c as libc/unistd.c) +(libc/unistd.h as libc/unistd.h) +(libc/utime.h as libc/utime.h) +(libc/utmp.h as libc/utmp.h) +(libc/utmpx.h as libc/utmpx.h) +(libc/wait.h as libc/wait.h) +(libc/wchar.c as libc/wchar.c) +(libc/wchar.h as libc/wchar.h) +(libc/wctype.h as libc/wctype.h) +(libc/wordexp.h as libc/wordexp.h) +; Analysis scripts +(analysis-scripts/analysis.mk as analysis-scripts/analysis.mk) +(analysis-scripts/benchmark_database.py as analysis-scripts/benchmark_database.py) +(analysis-scripts/bench-sqlite.sh as analysis-scripts/bench-sqlite.sh) +(analysis-scripts/build_callgraph.py as analysis-scripts/build_callgraph.py) +(analysis-scripts/build.py as analysis-scripts/build.py) +(analysis-scripts/clone.sh as analysis-scripts/clone.sh) +(analysis-scripts/cmd-dep.sh as analysis-scripts/cmd-dep.sh) +(analysis-scripts/concat-csv.sh as analysis-scripts/concat-csv.sh) +(analysis-scripts/creduce.sh as analysis-scripts/creduce.sh) +(analysis-scripts/detect_recursion.py as analysis-scripts/detect_recursion.py) +(analysis-scripts/epilogue.mk as analysis-scripts/epilogue.mk) +(analysis-scripts/estimate_difficulty.py as analysis-scripts/estimate_difficulty.py) +(analysis-scripts/fc_stubs.c as analysis-scripts/fc_stubs.c) +(analysis-scripts/find_fun.py as analysis-scripts/find_fun.py) +(analysis-scripts/flamegraph.pl as analysis-scripts/flamegraph.pl) +(analysis-scripts/frama_c_results.py as analysis-scripts/frama_c_results.py) +(analysis-scripts/function_finder.py as analysis-scripts/function_finder.py) +(analysis-scripts/git_utils.py as analysis-scripts/git_utils.py) +(analysis-scripts/heuristic_list_functions.py as analysis-scripts/heuristic_list_functions.py) +(analysis-scripts/list_files.py as analysis-scripts/list_files.py) +(analysis-scripts/list_functions.ml as analysis-scripts/list_functions.ml) +(analysis-scripts/make_wrapper.py as analysis-scripts/make_wrapper.py) +(analysis-scripts/normalize_jcdb.py as analysis-scripts/normalize_jcdb.py) +(analysis-scripts/parse-coverage.sh as analysis-scripts/parse-coverage.sh) +(analysis-scripts/plot.sh as analysis-scripts/plot.sh) +(analysis-scripts/print_callgraph.py as analysis-scripts/print_callgraph.py) +(analysis-scripts/prologue.mk as analysis-scripts/prologue.mk) +(analysis-scripts/pyproject.toml as analysis-scripts/pyproject.toml) +(analysis-scripts/readme-graph.graphml as analysis-scripts/readme-graph.graphml) +(analysis-scripts/readme-graph.svg as analysis-scripts/readme-graph.svg) +(analysis-scripts/README.md as analysis-scripts/README.md) +(analysis-scripts/results_display.py as analysis-scripts/results_display.py) +(analysis-scripts/script_for_creduce_fatal.sh as analysis-scripts/script_for_creduce_fatal.sh) +(analysis-scripts/script_for_creduce_non_fatal.sh as analysis-scripts/script_for_creduce_non_fatal.sh) +(analysis-scripts/source_filter.py as analysis-scripts/source_filter.py) +(analysis-scripts/summary.py as analysis-scripts/summary.py) +(analysis-scripts/template.mk as analysis-scripts/template.mk) +; Compliance +(compliance/c11_functions.json as compliance/c11_functions.json) +(compliance/c11_headers.json as compliance/c11_headers.json) +(compliance/compiler_builtins.json as compliance/compiler_builtins.json) +(compliance/gcc_builtins.json as compliance/gcc_builtins.json) +(compliance/glibc_functions.json as compliance/glibc_functions.json) +(compliance/nonstandard_identifiers.json as compliance/nonstandard_identifiers.json) +(compliance/posix_identifiers.json as compliance/posix_identifiers.json) +)) diff --git a/src/dune b/src/dune new file mode 100644 index 0000000000000000000000000000000000000000..dea5fe6e33dcd83ad3db62e02109826ca672841d --- /dev/null +++ b/src/dune @@ -0,0 +1,59 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Frama-C:" %{lib-available:frama-c.kernel} "\n") + (echo " - str:" %{lib-available:str} "\n") + (echo " - unix:" %{lib-available:unix} "\n") + (echo " - zarith:" %{lib-available:zarith} "\n") + (echo " - ocamlgraph:" %{lib-available:ocamlgraph} "\n") + (echo " - dynlink:" %{lib-available:dynlink} "\n") + (echo " - bytes:" %{lib-available:bytes} "\n") + (echo " - yojson:" %{lib-available:yojson} "\n") + (echo " - dune-site:" %{lib-available:dune-site} "\n") + (echo " - dune-site.plugins:" %{lib-available:dune-site.plugins} "\n") + (echo " - ppx_import:" %{lib-available:ppx_import} "\n") + (echo " - ppx_deriving.eq:" %{lib-available:ppx_deriving.eq} "\n") + ) + ) +) + +(library + (name frama_c_kernel) + (public_name frama-c.kernel) + (foreign_stubs (language c) (names c_bindings)) + (flags :standard -w -9-32-34) + (libraries frama-c.init str unix zarith ocamlgraph dynlink bytes yojson dune-site dune-site.plugins) + (preprocess (staged_pps ppx_import ppx_deriving.eq)) +) + +(generate_sites_module (module config_data) (sites frama-c) (plugins (frama-c plugins) (frama-c plugins_gui))) + +(include_subdirs unqualified) + +(alias + (name all) + (deps (file frama_c_kernel.cma)(file frama_c_kernel.cmxa)) +) diff --git a/src/kernel_internals/runtime/boot.ml b/src/init/boot/boot.ml similarity index 97% rename from src/kernel_internals/runtime/boot.ml rename to src/init/boot/boot.ml index 0140f5cb6c53aeb364e47c54cb1ed77ddd316793..db11a81677a0357933082548c3fd3aaf3b688ad0 100644 --- a/src/kernel_internals/runtime/boot.ml +++ b/src/init/boot/boot.ml @@ -21,7 +21,7 @@ (**************************************************************************) (** Frama-C Entry Point (last linked module). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) let play_analysis () = if Kernel.TypeCheck.get () then begin diff --git a/src/kernel_internals/runtime/boot.mli b/src/init/boot/boot.mli similarity index 100% rename from src/kernel_internals/runtime/boot.mli rename to src/init/boot/boot.mli diff --git a/src/init/boot/dune b/src/init/boot/dune new file mode 100644 index 0000000000000000000000000000000000000000..b3c3cee3d2318acb93da4ed67948c3b87be93dad --- /dev/null +++ b/src/init/boot/dune @@ -0,0 +1,60 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(library + (name frama_c_boot) + (public_name frama-c.boot) + (modules boot) + (flags :standard -open Frama_c_kernel) + (libraries frama_c_kernel) +) + + +(rule + (targets empty_file.ml) + (action (with-stdout-to empty_file.ml (echo ""))) +) + +(rule + (targets empty_file_gui.ml) + (deps empty_file.ml) + (action (copy# empty_file.ml empty_file_gui.ml)) +) + +(executable + (name empty_file) + (public_name frama-c) + (modules empty_file) + (package frama-c) + (flags :standard -open Frama_c_kernel -linkall) + (libraries frama-c.kernel frama-c.init.cmdline frama-c.boot) +) + +(executable + (name empty_file_gui) + (public_name frama-c-gui) + (modules empty_file_gui) + (package frama-c) + (flags :standard -open Frama_c_kernel -linkall) + (libraries threads frama-c.init.gui frama-c.kernel frama-c.gui frama-c.boot) + (optional) +) diff --git a/src/init/dune b/src/init/dune new file mode 100644 index 0000000000000000000000000000000000000000..9d32ae525481142f8200a198a6d60edac51a717a --- /dev/null +++ b/src/init/dune @@ -0,0 +1,30 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(library + (name frama_c_very_first) + (public_name frama-c.init) + (modules frama_c_init gui_init) + (virtual_modules gui_init) +) + +(include_subdirs no) diff --git a/src/kernel_internals/runtime/frama_c_init.ml b/src/init/frama_c_init.ml similarity index 100% rename from src/kernel_internals/runtime/frama_c_init.ml rename to src/init/frama_c_init.ml diff --git a/src/kernel_internals/runtime/frama_c_init.mli b/src/init/frama_c_init.mli similarity index 100% rename from src/kernel_internals/runtime/frama_c_init.mli rename to src/init/frama_c_init.mli diff --git a/src/kernel_internals/runtime/gui_init.mli b/src/init/gui_init.mli similarity index 93% rename from src/kernel_internals/runtime/gui_init.mli rename to src/init/gui_init.mli index 657cf7c6e305a2eeb8fb0918528118779dfb0470..443b0a39900b23864902b01feef92858e4e12cc7 100644 --- a/src/kernel_internals/runtime/gui_init.mli +++ b/src/init/gui_init.mli @@ -20,8 +20,10 @@ (* *) (**************************************************************************) -(** Very early initialization step required by any GUI. - This interface should be empty. *) +(** Very early initialization step that indicate using a virtual module + if we are in cmdline or gui. *) + +val is_gui: bool (* Local Variables: diff --git a/src/init/impl_cmdline/dune b/src/init/impl_cmdline/dune new file mode 100644 index 0000000000000000000000000000000000000000..2d6d40d85e658154ad58e285b62ed5de48941601 --- /dev/null +++ b/src/init/impl_cmdline/dune @@ -0,0 +1,27 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(library + (name frama_c_very_first_cmdline) + (public_name frama-c.init.cmdline) + (implements frama-c.init) +) diff --git a/src/plugins/from/From.mli b/src/init/impl_cmdline/gui_init.ml similarity index 92% rename from src/plugins/from/From.mli rename to src/init/impl_cmdline/gui_init.ml index 37c080316da19087a5b5be4601cdbfdfed815d6c..d3f07b15c64960869b878aabf8f62df07f5332db 100644 --- a/src/plugins/from/From.mli +++ b/src/init/impl_cmdline/gui_init.ml @@ -20,6 +20,6 @@ (* *) (**************************************************************************) -(* $Id: From.mli,v 1.6 2008-04-01 09:25:20 uid568 Exp $ *) +(** Frama-C Cmdline early initialization. *) -(** No function is directly exported: they are registered in {!Db.From}. *) +let is_gui = false diff --git a/src/init/impl_gui/dune b/src/init/impl_gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..0eca655010c9d8b35274086adaed2573e12bd74f --- /dev/null +++ b/src/init/impl_gui/dune @@ -0,0 +1,27 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(library + (name frama_c_very_first_gui) + (public_name frama-c.init.gui) + (implements frama-c.init) +) diff --git a/src/kernel_internals/runtime/gui_init.ml b/src/init/impl_gui/gui_init.ml similarity index 94% rename from src/kernel_internals/runtime/gui_init.ml rename to src/init/impl_gui/gui_init.ml index bafbdc5895d7bd32bd8e27d44c9629104461aba7..33023803c26c4491b2c42f99677a4dae0eb2e298 100644 --- a/src/kernel_internals/runtime/gui_init.ml +++ b/src/init/impl_gui/gui_init.ml @@ -22,12 +22,6 @@ (** Frama-C GUI early initialization. *) -let () = Fc_config.is_gui := true +let is_gui = true let () = Unix.putenv "UBUNTU_MENUPROXY" "0" - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/kernel_internals/runtime/toplevel_config.ml b/src/init/toplevel/toplevel_config.ml similarity index 100% rename from src/kernel_internals/runtime/toplevel_config.ml rename to src/init/toplevel/toplevel_config.ml diff --git a/src/plugins/value_types/README.md b/src/kernel_externals/value_types/README.md similarity index 100% rename from src/plugins/value_types/README.md rename to src/kernel_externals/value_types/README.md diff --git a/src/plugins/value_types/cilE.ml b/src/kernel_externals/value_types/cilE.ml similarity index 100% rename from src/plugins/value_types/cilE.ml rename to src/kernel_externals/value_types/cilE.ml diff --git a/src/plugins/value_types/cilE.mli b/src/kernel_externals/value_types/cilE.mli similarity index 100% rename from src/plugins/value_types/cilE.mli rename to src/kernel_externals/value_types/cilE.mli diff --git a/src/plugins/value_types/cvalue.ml b/src/kernel_externals/value_types/cvalue.ml similarity index 100% rename from src/plugins/value_types/cvalue.ml rename to src/kernel_externals/value_types/cvalue.ml diff --git a/src/plugins/value_types/cvalue.mli b/src/kernel_externals/value_types/cvalue.mli similarity index 98% rename from src/plugins/value_types/cvalue.mli rename to src/kernel_externals/value_types/cvalue.mli index 06768eed07afa94a17c98874bd19959a3aeb5cec..304c4f9c5222302a45ab44e335eddbc83216aeff 100644 --- a/src/plugins/value_types/cvalue.mli +++ b/src/kernel_externals/value_types/cvalue.mli @@ -49,7 +49,7 @@ module V : sig and type numerical_widen_hint = Location_Bytes.numerical_widen_hint and type size_widen_hint = Location_Bytes.size_widen_hint - include module type of Offsetmap_lattice_with_isotropy + include Offsetmap_lattice_with_isotropy.S with type t := t and type numerical_widen_hint := numerical_widen_hint and type size_widen_hint := size_widen_hint @@ -172,7 +172,7 @@ module V_Or_Uninitialized : sig | C_init_esc of V.t | C_init_noesc of V.t - include module type of Offsetmap_lattice_with_isotropy + include Offsetmap_lattice_with_isotropy.S with type t := t and type size_widen_hint = Location_Bytes.size_widen_hint and type numerical_widen_hint = Location_Bytes.numerical_widen_hint @@ -237,7 +237,7 @@ end (** Memory slices. They are maps from intervals to values with flags. All sizes and intervals are in bits. *) module V_Offsetmap: sig - include module type of Offsetmap_sig + include Offsetmap_sig.S with type v = V_Or_Uninitialized.t and type widen_hint = V_Or_Uninitialized.numerical_widen_hint @@ -256,7 +256,7 @@ end module Model: sig (** Functions inherited from [Lmap_sig] interface *) - include module type of Lmap_sig + include Lmap_sig.S with type v = V_Or_Uninitialized.t and type offsetmap = V_Offsetmap.t and type widen_hint_base = V_Or_Uninitialized.numerical_widen_hint diff --git a/src/plugins/value_types/function_Froms.ml b/src/kernel_externals/value_types/function_Froms.ml similarity index 100% rename from src/plugins/value_types/function_Froms.ml rename to src/kernel_externals/value_types/function_Froms.ml diff --git a/src/plugins/value_types/function_Froms.mli b/src/kernel_externals/value_types/function_Froms.mli similarity index 100% rename from src/plugins/value_types/function_Froms.mli rename to src/kernel_externals/value_types/function_Froms.mli diff --git a/src/plugins/value_types/inout_type.ml b/src/kernel_externals/value_types/inout_type.ml similarity index 100% rename from src/plugins/value_types/inout_type.ml rename to src/kernel_externals/value_types/inout_type.ml diff --git a/src/plugins/value_types/inout_type.mli b/src/kernel_externals/value_types/inout_type.mli similarity index 100% rename from src/plugins/value_types/inout_type.mli rename to src/kernel_externals/value_types/inout_type.mli diff --git a/src/plugins/value_types/precise_locs.ml b/src/kernel_externals/value_types/precise_locs.ml similarity index 100% rename from src/plugins/value_types/precise_locs.ml rename to src/kernel_externals/value_types/precise_locs.ml diff --git a/src/plugins/value_types/precise_locs.mli b/src/kernel_externals/value_types/precise_locs.mli similarity index 100% rename from src/plugins/value_types/precise_locs.mli rename to src/kernel_externals/value_types/precise_locs.mli diff --git a/src/plugins/value_types/value_types.ml b/src/kernel_externals/value_types/value_types.ml similarity index 100% rename from src/plugins/value_types/value_types.ml rename to src/kernel_externals/value_types/value_types.ml diff --git a/src/plugins/value_types/value_types.mli b/src/kernel_externals/value_types/value_types.mli similarity index 100% rename from src/plugins/value_types/value_types.mli rename to src/kernel_externals/value_types/value_types.mli diff --git a/src/plugins/value_types/widen_type.ml b/src/kernel_externals/value_types/widen_type.ml similarity index 100% rename from src/plugins/value_types/widen_type.ml rename to src/kernel_externals/value_types/widen_type.ml diff --git a/src/plugins/value_types/widen_type.mli b/src/kernel_externals/value_types/widen_type.mli similarity index 100% rename from src/plugins/value_types/widen_type.mli rename to src/kernel_externals/value_types/widen_type.mli diff --git a/src/kernel_internals/parsing/dune b/src/kernel_internals/parsing/dune new file mode 100644 index 0000000000000000000000000000000000000000..cf4a59d1192fdf952d296d6c4b61ca5393a9d7e6 --- /dev/null +++ b/src/kernel_internals/parsing/dune @@ -0,0 +1,27 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(ocamllex clexer) +(ocamllex logic_preprocess) +(ocamllex logic_lexer) +(ocamlyacc logic_parser) +(ocamlyacc cparser) diff --git a/src/kernel_internals/parsing/check_logic_parser.ml b/src/kernel_internals/parsing/tests/check_logic_parser.ml similarity index 99% rename from src/kernel_internals/parsing/check_logic_parser.ml rename to src/kernel_internals/parsing/tests/check_logic_parser.ml index 533739faa9f734dc3b785f61bf6045ac10ed67ba..38280b55d07b831d7dfdc3c5864bd4baee1c88f5 100644 --- a/src/kernel_internals/parsing/check_logic_parser.ml +++ b/src/kernel_internals/parsing/tests/check_logic_parser.ml @@ -20,7 +20,7 @@ (* *) (**************************************************************************) -let file = open_in "logic_parser.mly" +let file = open_in "../logic_parser.mly" module Strings = Set.Make(String) diff --git a/src/kernel_internals/parsing/tests/dune b/src/kernel_internals/parsing/tests/dune new file mode 100644 index 0000000000000000000000000000000000000000..c70bd4b97d48b14a94c41016f7fb9cdb85630160 --- /dev/null +++ b/src/kernel_internals/parsing/tests/dune @@ -0,0 +1,38 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(include_subdirs no) + +(executable + (name check_logic_parser) + (libraries unix str) +) + +(rule + (alias run-coding-tests) + (deps ../logic_parser.mly) + (action (run %{dep:./check_logic_parser.exe}))) + +(alias + (deps (alias run-coding-tests) ) + (name ptests) +) diff --git a/src/kernel_internals/runtime/dump_config.ml b/src/kernel_internals/runtime/dump_config.ml index 6c8f1f8e8a3d5d2f2c4c84d1153816497bbde4a5..d932f5a2f6da166f10144d7094a1c634d2fd892d 100644 --- a/src/kernel_internals/runtime/dump_config.ml +++ b/src/kernel_internals/runtime/dump_config.ml @@ -50,21 +50,17 @@ let dump_to_json () = "version_and_codename", `String Fc_config.version_and_codename ; "major_version", `Int Fc_config.major_version ; "minor_version", `Int Fc_config.minor_version ; - "is_gui", `Bool !Fc_config.is_gui ; - "lablgtk", `String Fc_config.lablgtk ; - "ocamlc", `String Fc_config.ocamlc ; - "ocamlopt", `String Fc_config.ocamlopt ; - "ocaml_wflags", `String Fc_config.ocaml_wflags ; + "is_gui", `Bool Fc_config.is_gui ; + (* "lablgtk", `String Fc_config.lablgtk ; + * "ocamlc", `String Fc_config.ocamlc ; + * "ocamlopt", `String Fc_config.ocamlopt ; + * "ocaml_wflags", `String Fc_config.ocaml_wflags ; *) "datadir", `String (Fc_config.datadir:>string) ; "datadirs", list string (Filepath.Normalized.to_string_list Fc_config.datadirs) ; "framac_libc", `String (Fc_config.framac_libc:>string) ; - "libdir", `String (Fc_config.libdir:>string) ; "plugin_dir", list string (Filepath.Normalized.to_string_list Fc_config.plugin_dir) ; - "plugin_path", `String Fc_config.plugin_path ; - "compilation_unit_names", list string Fc_config.compilation_unit_names ; - "library_names", list string Fc_config.library_names ; "preprocessor", `String Fc_config.preprocessor ; "using_default_cpp", `Bool Fc_config.using_default_cpp ; "preprocessor_is_gnu_like", `Bool Fc_config.preprocessor_is_gnu_like ; diff --git a/src/kernel_internals/runtime/dune b/src/kernel_internals/runtime/dune new file mode 100644 index 0000000000000000000000000000000000000000..e3eef67b8c04111d1a67470c8dbde7182f0635f9 --- /dev/null +++ b/src/kernel_internals/runtime/dune @@ -0,0 +1,27 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (targets fc_config.ml) + (deps fc_config.ml.in ../../../config.sed) + (action (with-stdout-to fc_config.ml (run sed -f ../../../config.sed fc_config.ml.in))) +) diff --git a/src/kernel_internals/runtime/fc_config.ml.in b/src/kernel_internals/runtime/fc_config.ml.in index d4174a62bc502b94d33a85748ca1fc2780de4a13..2889e6566f1ef4c84261db87794909a2b1c95ca4 100644 --- a/src/kernel_internals/runtime/fc_config.ml.in +++ b/src/kernel_internals/runtime/fc_config.ml.in @@ -30,60 +30,17 @@ let major_version = @MAJOR_VERSION@ let minor_version = @MINOR_VERSION@ -let is_gui = ref false +let is_gui = Frama_c_very_first.Gui_init.is_gui -let lablgtk = "@LABLGTK@" +let datadirs = (List.map Filepath.Normalized.of_string Config_data.Sites.share) +let datadir = List.hd (List.rev datadirs) -let ocamlc = "@OCAMLC@" -let ocamlopt = "@OCAMLOPT@" -let ocaml_wflags = "@WARNINGS@" +let plugin_dir = List.map Filepath.Normalized.of_string Config_data.Sites.plugins -let getenv_list name : Filepath.Normalized.t list = - let path = Sys.getenv name in - let dirs = Str.split (Str.regexp ":") path in - List.map Filepath.Normalized.of_string dirs - -let add_symbolic_dir_list name = function - | [d] -> Filepath.add_symbolic_dir name d - | ds -> - List.iteri - (fun i d -> - let path = Printf.sprintf "%s#%d" name (succ i) in - Filepath.add_symbolic_dir path d) - ds - - -let datadir = - Filepath.Normalized.of_string - (try Sys.getenv "FRAMAC_SHARE" with Not_found -> "@FRAMAC_DATADIR@") let framac_libc = Filepath.Normalized.concat datadir "libc" -let extra_datadir = try getenv_list "FRAMAC_EXTRA_SHARE" with Not_found -> [] -let () = add_symbolic_dir_list "FRAMAC_EXTRA_SHARE" extra_datadir -(* After so that it has the priority for pretty printing *) -let () = Filepath.add_symbolic_dir "FRAMAC_SHARE" datadir - -let datadirs = datadir::extra_datadir - -let libdir = - Filepath.Normalized.of_string - (try Sys.getenv "FRAMAC_LIB" with Not_found -> "@FRAMAC_LIBDIR@") -let () = Filepath.add_symbolic_dir "FRAMAC_LIB" libdir -let plugin_dir = - try - getenv_list "FRAMAC_PLUGIN" - with Not_found -> - try - let dir = - Filepath.Normalized.concat - (Filepath.Normalized.of_string (Sys.getenv "FRAMAC_LIB")) "plugins" - in - [dir] - with Not_found -> [ Filepath.Normalized.of_string "@FRAMAC_PLUGINDIR@" ] - -let plugin_path = - String.concat ":" (Filepath.Normalized.to_string_list plugin_dir) -let () = add_symbolic_dir_list "FRAMAC_PLUGIN" plugin_dir +let () = Filepath.add_symbolic_dir_list "FRAMAC_SHARE" datadirs +let () = Filepath.add_symbolic_dir_list "FRAMAC_PLUGIN" plugin_dir let default_cpp = "@FRAMAC_DEFAULT_CPP@" @@ -107,7 +64,4 @@ let preprocessor_supported_arch_options = [@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@] let preprocessor_keep_comments = env_or_default (fun _ -> true) @DEFAULT_CPP_KEEP_COMMENTS@ -let compilation_unit_names = [@COMPILATION_UNITS@] -let library_names = [@LIBRARY_NAMES@] - let dot = @OPTDOT@ diff --git a/src/kernel_internals/runtime/fc_config.mli b/src/kernel_internals/runtime/fc_config.mli index df22d0880ef93afe96b86c7c505625118f8a169f..181574f0a5ac6f285b080e1ae2db76952393de3c 100644 --- a/src/kernel_internals/runtime/fc_config.mli +++ b/src/kernel_internals/runtime/fc_config.mli @@ -42,58 +42,28 @@ val minor_version: int (** Frama-C minor version number. @since 19.0-Potassium *) -val is_gui: bool ref +val is_gui: bool (** Is the Frama-C GUI running? - @since Beryllium-20090601-beta1 *) - -val lablgtk: string -(** Name of the lablgtk version against which Frama-C has been compiled. - blank if only command-line mode is available. *) - -val ocamlc: string -(** Name of the bytecode compiler. - @since Boron-20100401 *) - -val ocamlopt: string -(** Name of the native compiler. - @since Boron-20100401 *) - -val ocaml_wflags: string -(** Warning flags used when compiling Frama-C. - @since Chlorine-20180501 *) - -val datadir: Filepath.Normalized.t -(** Directory where architecture independent files are. - Main directory, use {!datadirs} for the others *) + @since Beryllium-20090601-beta1 + @since frama-c-trunk not anymore a reference +*) val datadirs: Filepath.Normalized.t list (** Directories where architecture independent files are in order of priority. @since 19.0-Potassium *) +val datadir: Filepath.Normalized.t +(** Last directory of datadirs (the directory of frama-c installation) + @since 19.0-Potassium *) + val framac_libc: Filepath.Normalized.t (** Directory where Frama-C libc headers are. @since 19.0-Potassium *) -val libdir: Filepath.Normalized.t -(** Directory where the Frama-C kernel library is. - @since Beryllium-20090601-beta1 *) - val plugin_dir: Filepath.Normalized.t list (** Directory where the Frama-C dynamic plug-ins are. *) -val plugin_path: string -(** The colon-separated concatenation of [plugin_dir]. - @since Magnesium-20151001 *) - -val compilation_unit_names: string list -(** List of names of all kernel compilation units. - @since Boron-20100401 *) - -val library_names: string list -(** List of linked libraries. - @since Magnesium-20151001 *) - val preprocessor: string (** Name of the default command to call the preprocessor. If the CPP environment variable is set, use it diff --git a/src/kernel_internals/runtime/special_hooks.ml b/src/kernel_internals/runtime/special_hooks.ml index 95cd3898f7e219c8f942cc710317e1c7300f2166..d700d9d07fe2ce440fbbeaa4e8e844e907252d2d 100644 --- a/src/kernel_internals/runtime/special_hooks.ml +++ b/src/kernel_internals/runtime/special_hooks.ml @@ -31,11 +31,10 @@ let print_config () = "Frama-C %s@\n\ Environment:@\n \ FRAMAC_SHARE = %S@\n \ - FRAMAC_LIB = %S@\n \ FRAMAC_PLUGIN = %S%t@." Fc_config.version_and_codename - (Fc_config.datadir:>string) (Fc_config.libdir:>string) - Fc_config.plugin_path + (String.concat ":" (Filepath.Normalized.to_string_list Fc_config.datadirs)) + (String.concat ":" (Filepath.Normalized.to_string_list Fc_config.plugin_dir)) (fun fmt -> if Fc_config.preprocessor = "" then Format.fprintf fmt "@\nWarning: no default pre-processor" @@ -55,22 +54,22 @@ let print_config get value () = raise Cmdline.Exit end +let print_configl get value () = + let value = Filepath.Normalized.to_string_list value in + if get () then begin + Log.print_on_output (fun fmt -> (Format.fprintf fmt "%s%!" (String.concat "\n" value))) ; + raise Cmdline.Exit + end let print_version = print_config Kernel.PrintVersion.get Fc_config.version_and_codename let () = Cmdline.run_after_early_stage print_version -let print_sharepath = - print_config Kernel.PrintShare.get (Fc_config.datadir:>string) +let print_sharepath = print_configl Kernel.PrintShare.get Fc_config.datadirs let () = Cmdline.run_after_early_stage print_sharepath -let print_libpath = - print_config Kernel.PrintLib.get (Fc_config.libdir:>string) +let print_libpath = print_configl Kernel.PrintLib.get Fc_config.plugin_dir let () = Cmdline.run_after_early_stage print_libpath -let print_pluginpath = - print_config Kernel.PrintPluginPath.get Fc_config.plugin_path -let () = Cmdline.run_after_early_stage print_pluginpath - (**************************************************************************) (* Hooks run after loading plug-ins *) (**************************************************************************) diff --git a/src/kernel_internals/typing/cabs2cil.mli b/src/kernel_internals/typing/cabs2cil.mli index 09f58c8846332d9b56b989b15a37f8b927baa6b1..21b1100134556d614dd3af4d174aae60852eb592 100644 --- a/src/kernel_internals/typing/cabs2cil.mli +++ b/src/kernel_internals/typing/cabs2cil.mli @@ -136,7 +136,7 @@ val register_for_loop_body_hook: (Cabs.statement -> unit) -> unit *) val register_for_loop_incr_hook: (Cabs.expression -> unit) -> unit -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val convFile: Cabs.file -> Cil_types.file diff --git a/src/kernel_internals/typing/frontc.mli b/src/kernel_internals/typing/frontc.mli index 5204f0ae738a7051588e32bc0e90d41bfcc866b5..2bd29fab1e46aaf0637ff57e07ae8626aa01ecba 100644 --- a/src/kernel_internals/typing/frontc.mli +++ b/src/kernel_internals/typing/frontc.mli @@ -46,7 +46,7 @@ val setMSVCMode: unit -> unit (** add a syntactic transformation that will be applied to all freshly parsed C files. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val add_syntactic_transformation: (Cabs.file -> Cabs.file) -> unit (** the main command to parse a file. Return a thunk that can be used to diff --git a/src/kernel_services/abstract_interp/abstract_interp.mli b/src/kernel_services/abstract_interp/abstract_interp.mli index e86e3d655329493476ea2aa42181abe0fc72a9f9..0269a087479bec8420c7a9c093882d66b99681c9 100644 --- a/src/kernel_services/abstract_interp/abstract_interp.mli +++ b/src/kernel_services/abstract_interp/abstract_interp.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Functors for generic lattices implementations. - @plugin developer guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) exception Error_Top (** Raised by some functions when encountering a top value. *) diff --git a/src/kernel_services/abstract_interp/eva_lattice_type.mli b/src/kernel_services/abstract_interp/eva_lattice_type.ml similarity index 100% rename from src/kernel_services/abstract_interp/eva_lattice_type.mli rename to src/kernel_services/abstract_interp/eva_lattice_type.ml diff --git a/src/kernel_services/abstract_interp/float_interval_sig.mli b/src/kernel_services/abstract_interp/float_interval_sig.ml similarity index 100% rename from src/kernel_services/abstract_interp/float_interval_sig.mli rename to src/kernel_services/abstract_interp/float_interval_sig.ml diff --git a/src/kernel_services/abstract_interp/float_sig.mli b/src/kernel_services/abstract_interp/float_sig.ml similarity index 100% rename from src/kernel_services/abstract_interp/float_sig.mli rename to src/kernel_services/abstract_interp/float_sig.ml diff --git a/src/kernel_services/abstract_interp/int_Intervals.mli b/src/kernel_services/abstract_interp/int_Intervals.mli index 04f08710f12926d0a78d572a5dcd2fdc7bbdb9d5..0093061bae56ce156d5dc840474e9cd6fd18993f 100644 --- a/src/kernel_services/abstract_interp/int_Intervals.mli +++ b/src/kernel_services/abstract_interp/int_Intervals.mli @@ -27,7 +27,7 @@ {!Int_Intervals_sig}, and the implementation is in {!Offsetmap.Int_Intervals}. *) -include module type of Int_Intervals_sig +include Int_Intervals_sig.S with type t = Offsetmap.Int_Intervals.t diff --git a/src/kernel_services/abstract_interp/int_Intervals_sig.mli b/src/kernel_services/abstract_interp/int_Intervals_sig.ml similarity index 55% rename from src/kernel_services/abstract_interp/int_Intervals_sig.mli rename to src/kernel_services/abstract_interp/int_Intervals_sig.ml index 9bee989ee6a851f0b769ae4b022bdd230a90d1cb..cd4ae918edd852c28a13a3324c4a28f91b6402ad 100644 --- a/src/kernel_services/abstract_interp/int_Intervals_sig.mli +++ b/src/kernel_services/abstract_interp/int_Intervals_sig.ml @@ -27,51 +27,54 @@ open Abstract_interp type itv = Int.t * Int.t -include Lattice_type.Full_Lattice +module type S = sig -val is_top: t -> bool + include Lattice_type.Full_Lattice -val inject_bounds: Int.t -> Int.t -> t -val inject_itv: itv -> t -val inject: itv list -> t -val from_ival_size: Ival.t -> Int_Base.t -> t -(** Conversion from an ival, which represents the beginning of - each interval. The size if taken from the [Int_Base.t] argument. - If the result contains more than [-plevel] arguments, it is - automatically over-approximated. *) + val is_top: t -> bool -val from_ival_size_under: Ival.t -> Int_Base.t -> t -(** Same as [from_ival_size], except that the result is an under-approximation - if the ival points to too many locations *) + val inject_bounds: Int.t -> Int.t -> t + val inject_itv: itv -> t + val inject: itv list -> t + val from_ival_size: Ival.t -> Int_Base.t -> t + (** Conversion from an ival, which represents the beginning of + each interval. The size if taken from the [Int_Base.t] argument. + If the result contains more than [-plevel] arguments, it is + automatically over-approximated. *) -val project_set: t -> itv list -(** May raise [Error_Top]. - As intervals are not represented as lists, this function has an overhead. - Use iterators whenever possible instead. *) + val from_ival_size_under: Ival.t -> Int_Base.t -> t + (** Same as [from_ival_size], except that the result is an under-approximation + if the ival points to too many locations *) -val project_singleton: t -> itv option + val project_set: t -> itv list + (** May raise [Error_Top]. + As intervals are not represented as lists, this function has an overhead. + Use iterators whenever possible instead. *) -(** Iterators *) + val project_singleton: t -> itv option -val fold: (itv -> 'a -> 'a) -> t -> 'a -> 'a -(** May raise [Error_Top] *) + (** Iterators *) -val iter: (itv -> unit) -> t -> unit -(** May raise [Error_Top] *) + val fold: (itv -> 'a -> 'a) -> t -> 'a -> 'a + (** May raise [Error_Top] *) -val pretty_typ: Cil_types.typ option -> t Pretty_utils.formatter -(** Pretty-printer that supposes the intervals are subranges of - a C type, and use the type to print nice offsets *) + val iter: (itv -> unit) -> t -> unit + (** May raise [Error_Top] *) -val range_covers_whole_type: Cil_types.typ -> t -> bool -(** Does the interval cover the entire range of bits that are valid - for the given type. *) + val pretty_typ: Cil_types.typ option -> t Pretty_utils.formatter + (** Pretty-printer that supposes the intervals are subranges of + a C type, and use the type to print nice offsets *) + val range_covers_whole_type: Cil_types.typ -> t -> bool + (** Does the interval cover the entire range of bits that are valid + for the given type. *) -(**/**) -val pretty_debug: t Pretty_utils.formatter + (**/**) + val pretty_debug: t Pretty_utils.formatter + +end (* Local Variables: diff --git a/src/kernel_services/abstract_interp/lattice_type.mli b/src/kernel_services/abstract_interp/lattice_type.ml similarity index 98% rename from src/kernel_services/abstract_interp/lattice_type.mli rename to src/kernel_services/abstract_interp/lattice_type.ml index f5e0608d520c6c801358ff9a8c9a478e7cc45036..79c2456447e22286dc3b906c972bdb3b435febdf 100644 --- a/src/kernel_services/abstract_interp/lattice_type.mli +++ b/src/kernel_services/abstract_interp/lattice_type.ml @@ -21,7 +21,7 @@ (**************************************************************************) (** Lattice signatures. - @plugin developer guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module type Join_Semi_Lattice = sig include Datatype.S (** datatype of element of the lattice *) diff --git a/src/kernel_services/abstract_interp/lmap.ml b/src/kernel_services/abstract_interp/lmap.ml index dfc598b3c3d670b8ee5862b3f08230206535680c..574d0645f1d31d9ffcc86a8d79db763d62764a5e 100644 --- a/src/kernel_services/abstract_interp/lmap.ml +++ b/src/kernel_services/abstract_interp/lmap.ml @@ -34,10 +34,10 @@ type 'a default_contents = module Make_LOffset (V: sig - include module type of Offsetmap_lattice_with_isotropy + include Offsetmap_lattice_with_isotropy.S include Lattice_type.With_Top_Opt with type t := t end) - (Offsetmap: module type of Offsetmap_sig + (Offsetmap: Offsetmap_sig.S with type v = V.t and type widen_hint = V.numerical_widen_hint) (Default_offsetmap: sig diff --git a/src/kernel_services/abstract_interp/lmap.mli b/src/kernel_services/abstract_interp/lmap.mli index 5eb0e0b0e2aa6283397122fe4bda0581ef19657a..61069f42fceaeb6c65c47b4274070dad85e1cc5b 100644 --- a/src/kernel_services/abstract_interp/lmap.mli +++ b/src/kernel_services/abstract_interp/lmap.mli @@ -22,7 +22,7 @@ (** Maps from bases to memory maps. The memory maps are those of the [Offsetmap] module. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** Contents of a variable when it is not present in the state. See function [default_contents] in the functor below *) @@ -34,10 +34,10 @@ type 'a default_contents = module Make_LOffset (V: sig - include module type of Offsetmap_lattice_with_isotropy + include Offsetmap_lattice_with_isotropy.S include Lattice_type.With_Top_Opt with type t := t end) - (Offsetmap: module type of Offsetmap_sig + (Offsetmap: Offsetmap_sig.S with type v = V.t and type widen_hint = V.numerical_widen_hint) (Default_offsetmap: sig @@ -70,7 +70,7 @@ module Make_LOffset match [default_contents] on constant keys. *) end): - module type of Lmap_sig + Lmap_sig.S with type v = V.t and type widen_hint_base = V.numerical_widen_hint and type offsetmap = Offsetmap.t diff --git a/src/kernel_services/abstract_interp/lmap_bitwise.ml b/src/kernel_services/abstract_interp/lmap_bitwise.ml index a9a113e386729a4281e618da8cea4bd2ed4c8498..585fcc5ce375e23794c26dd07fb6838ff4de8dcf 100644 --- a/src/kernel_services/abstract_interp/lmap_bitwise.ml +++ b/src/kernel_services/abstract_interp/lmap_bitwise.ml @@ -38,7 +38,7 @@ module type Location_map_bitwise = sig include Lattice_type.With_Top with type t := t module LOffset : - module type of Offsetmap_bitwise_sig + Offsetmap_bitwise_sig.S with type v = v and type intervals = Int_Intervals.t diff --git a/src/kernel_services/abstract_interp/lmap_bitwise.mli b/src/kernel_services/abstract_interp/lmap_bitwise.mli index 57939a58b64dd01b87d3261667a634ec8bf9112e..8551bf7244f097ab41c78dcee90d319d96222599 100644 --- a/src/kernel_services/abstract_interp/lmap_bitwise.mli +++ b/src/kernel_services/abstract_interp/lmap_bitwise.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Functors making map indexed by zone. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Locations @@ -40,7 +40,7 @@ module type Location_map_bitwise = sig include Lattice_type.With_Top with type t := t module LOffset : - module type of Offsetmap_bitwise_sig + Offsetmap_bitwise_sig.S with type v = v and type intervals = Int_Intervals.t diff --git a/src/kernel_services/abstract_interp/lmap_sig.ml b/src/kernel_services/abstract_interp/lmap_sig.ml new file mode 100644 index 0000000000000000000000000000000000000000..6030665d5cc7ae99e879663d2c99dc68aa2f05c1 --- /dev/null +++ b/src/kernel_services/abstract_interp/lmap_sig.ml @@ -0,0 +1,232 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Signature for maps from bases to memory maps. The memory maps are intended + to be those of the [Offsetmap] module. *) + +open Locations + +module type S = sig + + (** type of the values associated to a location *) + type v + + (** type of the maps associated to a base *) + type offsetmap + + (** widening hints for each base *) + type widen_hint_base + + (** Maps from {!Base.t} to {!offsetmap} *) + type map + type lmap = private Bottom | Top | Map of map + + + include Datatype.S_with_collections with type t = lmap + + val pretty: Format.formatter -> t -> unit + val pretty_debug: Format.formatter -> t -> unit + val pretty_filter: Format.formatter -> t -> Zone.t -> unit + (** [pretty_filter m z] pretties only the part of [m] that correspond to + the bases present in [z] *) + + val pretty_diff: Format.formatter -> t -> t -> unit + + (** {2 General shape} *) + + val top: t + val is_top: t -> bool + + (** Empty map. Casual users do not need this except to create a custom + initial state. *) + val empty_map : t + val is_empty_map : t -> bool + + val bottom : t + (** Every location is associated to the value [bottom] of type [v] in this + state. This state can be reached only in dead code. *) + + val is_reachable : t -> bool + + + (** {2 Join and inclusion} *) + + val join : t -> t -> t + val is_included : t -> t -> bool + + module Make_Narrow(X: sig + include Lattice_type.With_Top with type t := v + include Lattice_type.With_Narrow with type t := v + val bottom_is_strict: bool + end): sig + val narrow : t -> t -> t + end + + (** Bases that must be widening in priority, plus widening hints for each + base. *) + type widen_hint = Base.Set.t * (Base.t -> widen_hint_base) + + val widen : widen_hint-> t -> t -> t + + (** [merge ~into t] adds all binding from [t] into [into]. *) + val merge: into:t -> t -> t + + (** {2 Finding values} *) + + val find: ?conflate_bottom:bool -> t -> location -> v + (** @raise Error_Top when the location or the state are Top, and there + is no Top value in the type {!v}. *) + + val copy_offsetmap : + Location_Bits.t -> Integer.t -> t -> offsetmap Lattice_bounds.or_bottom + (** [copy_offsetmap alarms loc size m] returns the superposition of the + ranges of [size] bits starting at [loc] within [m]. [size] must be + strictly greater than zero. Return [None] if all pointed addresses are + invalid in [m]. + + @raise Error_Top when the location or the state are Top, and there + is no Top value in the type {!v}. *) + + val find_base : Base.t -> t -> offsetmap Lattice_bounds.or_top_bottom + (** @raise Not_found if the varid is not present in the map. *) + + val find_base_or_default : + Base.t -> t -> offsetmap Lattice_bounds.or_top_bottom + (** Same as [find_base], but return the default values for bases + that are not currently present in the map. Prefer the use of this function + to [find_base], unless you explicitly want to see if the base is bound. *) + + + (** {2 Binding variables} *) + + (** [add_binding ~exact initial_mem loc v] simulates the effect of + writing [v] at location [loc], in the initial memory state given by + [initial_mem]. + If [loc] is not writable, {!bottom} is returned. + If [exact] is true, and [loc] is a precise location, a strong update + is performed. + Only locations that may be valid are written. + Returns the resulting memory after the write. *) + val add_binding: exact:bool -> t -> location -> v -> t + + (** [paste_offsetmap ~from ~dst_loc ~size ~exact m] + copies [from], which is supposed to be exactly [size] bits, and pastes + them at [dst_loc] in [m]. The copy is exact if and only if + [dst_loc] is exact, and [exact] is true. Only the locations that + may be valid are written. *) + val paste_offsetmap : + from:offsetmap -> + dst_loc:Location_Bits.t -> + size:Integer.t -> + exact:bool -> + t -> t + + val add_base : Base.t -> offsetmap -> t -> t + (** [add_base b o m] adds base [b] bound to [o], replacing any + previous bindings of [b]. No effect on [Top] or [Bottom]. *) + + val add_base_value: + Base.t -> size:Integer.t -> v -> size_v:Integer.t -> t -> t + (** Creates the offsetmap described by [size], [v] and [size_v], + and binds it to the base. No effect on [Top] or [Bottom]. *) + + + (** {2 Filters} *) + + val filter_base : (Base.t -> bool) -> t -> t + (** Remove from the map all the bases that do not satisfy the predicate. *) + + val filter_by_shape: 'a Hptmap.Shape(Base.Base).t -> t -> t + (** Remove from the map all the bases that are not also present in + the given [Base.t]-indexed tree. *) + + (** Removes the base if it is present. Does nothing otherwise. *) + val remove_base : Base.t -> t -> t + + (** [replace_bases substitition map] replaces some bases in [map] + according to [substitution]. If [substitution] conflates different bases, + the offsetmaps bound to these bases are joined. *) + val replace_base: Base.substitution -> t -> t + + + (** {2 Iterators} *) + + (** Notice that some iterators require an argument of type {!map}: the + cases {!Top} and {!Bottom} must be handled separately. All the iterators + below only present bases that are bound to non-default values, according + to the function [is_default_offsetmap] of the function {!Lmap.Make_Loffset}. + *) + + val iter: (Base.base -> offsetmap -> unit) -> map -> unit + val fold : (Base.t -> offsetmap -> 'a -> 'a) -> map -> 'a -> 'a + + (** {3 Cached iterators} *) + + (** These functions are meant to be partially applied to all their arguments + but the final one (the map). They must be called at the toplevel of OCaml + modules, as they create persistent caches. *) + + val cached_fold : + f:(Base.t -> offsetmap -> 'a) -> + cache_name:string -> temporary:bool -> + joiner:('a -> 'a -> 'a) -> empty:'a -> map -> 'a + + val cached_map : + f:(Base.t -> offsetmap -> offsetmap) -> + cache:string * int -> temporary:bool -> + t -> t + + + (** {2 Misc} *) + + val remove_variables: Cil_types.varinfo list -> t -> t + + val shape: map -> offsetmap Hptmap.Shape(Base.Base).t + (** Shape of the map. This can be used for simultaneous iterations + on other maps indexed by type {!Base.Base.t}. *) + + (** Clear the caches local to this module. Beware that they are not + project-aware, and that you must call them at every project switch. *) + val clear_caches: unit -> unit + + + (**/**) + + (** {2 Prefixes. To be used by advanced users only} *) + + type subtree + val comp_prefixes: t -> t -> unit + val find_prefix : t -> Hptmap.prefix -> subtree option + val hash_subtree : subtree -> int + val equal_subtree : subtree -> subtree -> bool + + exception Found_prefix of Hptmap.prefix * subtree * subtree + +end + + + +(* +Local Variables: +compile-command: "make -C ../../.." +End: +*) diff --git a/src/kernel_services/abstract_interp/lmap_sig.mli b/src/kernel_services/abstract_interp/lmap_sig.mli deleted file mode 100644 index 2636e657c17e6994dbbc9ad21a0bad5d07643beb..0000000000000000000000000000000000000000 --- a/src/kernel_services/abstract_interp/lmap_sig.mli +++ /dev/null @@ -1,227 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Signature for maps from bases to memory maps. The memory maps are intended - to be those of the [Offsetmap] module. *) - -open Locations - -(** type of the values associated to a location *) -type v - -(** type of the maps associated to a base *) -type offsetmap - -(** widening hints for each base *) -type widen_hint_base - -(** Maps from {!Base.t} to {!offsetmap} *) -type map -type lmap = private Bottom | Top | Map of map - -include Datatype.S_with_collections with type t = lmap - -val pretty: Format.formatter -> t -> unit -val pretty_debug: Format.formatter -> t -> unit -val pretty_filter: Format.formatter -> t -> Zone.t -> unit -(** [pretty_filter m z] pretties only the part of [m] that correspond to - the bases present in [z] *) - -val pretty_diff: Format.formatter -> t -> t -> unit - -(** {2 General shape} *) - -val top: t -val is_top: t -> bool - -(** Empty map. Casual users do not need this except to create a custom - initial state. *) -val empty_map : t -val is_empty_map : t -> bool - -val bottom : t - -(** Every location is associated to the value [bottom] of type [v] in this - state. This state can be reached only in dead code. *) -val is_reachable : t -> bool - - -(** {2 Join and inclusion} *) - -val join : t -> t -> t -val is_included : t -> t -> bool - -module Make_Narrow(X: sig - include Lattice_type.With_Top with type t := v - include Lattice_type.With_Narrow with type t := v - val bottom_is_strict: bool - end): sig - val narrow : t -> t -> t -end - -(** Bases that must be widening in priority, plus widening hints for each - base. *) -type widen_hint = Base.Set.t * (Base.t -> widen_hint_base) - -val widen : widen_hint-> t -> t -> t - -(** [merge ~into t] adds all binding from [t] into [into]. *) -val merge: into:t -> t -> t - -(** {2 Finding values} *) - -val find: ?conflate_bottom:bool -> t -> location -> v -(** @raise Error_Top when the location or the state are Top, and there - is no Top value in the type {!v}. *) - -val copy_offsetmap : - Location_Bits.t -> Integer.t -> t -> offsetmap Lattice_bounds.or_bottom -(** [copy_offsetmap alarms loc size m] returns the superposition of the - ranges of [size] bits starting at [loc] within [m]. [size] must be - strictly greater than zero. Return [None] if all pointed addresses are - invalid in [m]. - - @raise Error_Top when the location or the state are Top, and there - is no Top value in the type {!v}. *) - -val find_base : Base.t -> t -> offsetmap Lattice_bounds.or_top_bottom -(** @raise Not_found if the varid is not present in the map. *) - -val find_base_or_default : Base.t -> t -> offsetmap Lattice_bounds.or_top_bottom -(** Same as [find_base], but return the default values for bases - that are not currently present in the map. Prefer the use of this function - to [find_base], unless you explicitly want to see if the base is bound. *) - - -(** {2 Binding variables} *) - -(** [add_binding ~exact initial_mem loc v] simulates the effect of - writing [v] at location [loc], in the initial memory state given by - [initial_mem]. - If [loc] is not writable, {!bottom} is returned. - If [exact] is true, and [loc] is a precise location, a strong update - is performed. - Only locations that may be valid are written. - Returns the resulting memory after the write. *) -val add_binding: exact:bool -> t -> location -> v -> t - -(** [paste_offsetmap ~from ~dst_loc ~size ~exact m] - copies [from], which is supposed to be exactly [size] bits, and pastes - them at [dst_loc] in [m]. The copy is exact if and only if - [dst_loc] is exact, and [exact] is true. Only the locations that - may be valid are written. *) -val paste_offsetmap : - from:offsetmap -> - dst_loc:Location_Bits.t -> - size:Integer.t -> - exact:bool -> - t -> t - -val add_base : Base.t -> offsetmap -> t -> t -(** [add_base b o m] adds base [b] bound to [o], replacing any - previous bindings of [b]. No effect on [Top] or [Bottom]. *) - -val add_base_value: - Base.t -> size:Integer.t -> v -> size_v:Integer.t -> t -> t -(** Creates the offsetmap described by [size], [v] and [size_v], - and binds it to the base. No effect on [Top] or [Bottom]. *) - - -(** {2 Filters} *) - -val filter_base : (Base.t -> bool) -> t -> t -(** Remove from the map all the bases that do not satisfy the predicate. *) - -val filter_by_shape: 'a Hptmap.Shape(Base.Base).t -> t -> t -(** Remove from the map all the bases that are not also present in - the given [Base.t]-indexed tree. *) - -(** Removes the base if it is present. Does nothing otherwise. *) -val remove_base : Base.t -> t -> t - -(** [replace_bases substitition map] replaces some bases in [map] - according to [substitution]. If [substitution] conflates different bases, - the offsetmaps bound to these bases are joined. *) -val replace_base: Base.substitution -> t -> t - - -(** {2 Iterators} *) - -(** Notice that some iterators require an argument of type {!map}: the - cases {!Top} and {!Bottom} must be handled separately. All the iterators - below only present bases that are bound to non-default values, according - to the function [is_default_offsetmap] of the function {!Lmap.Make_Loffset}. -*) - -val iter: (Base.base -> offsetmap -> unit) -> map -> unit -val fold : (Base.t -> offsetmap -> 'a -> 'a) -> map -> 'a -> 'a - -(** {3 Cached iterators} *) - -(** These functions are meant to be partially applied to all their arguments - but the final one (the map). They must be called at the toplevel of OCaml - modules, as they create persistent caches. *) - -val cached_fold : - f:(Base.t -> offsetmap -> 'a) -> - cache_name:string -> temporary:bool -> - joiner:('a -> 'a -> 'a) -> empty:'a -> map -> 'a - -val cached_map : - f:(Base.t -> offsetmap -> offsetmap) -> - cache:string * int -> temporary:bool -> - t -> t - - -(** {2 Misc} *) - -val remove_variables: Cil_types.varinfo list -> t -> t - -val shape: map -> offsetmap Hptmap.Shape(Base.Base).t -(** Shape of the map. This can be used for simultaneous iterations - on other maps indexed by type {!Base.Base.t}. *) - -(** Clear the caches local to this module. Beware that they are not - project-aware, and that you must call them at every project switch. *) -val clear_caches: unit -> unit - - -(**/**) - -(** {2 Prefixes. To be used by advanced users only} *) - -type subtree -val comp_prefixes: t -> t -> unit -val find_prefix : t -> Hptmap.prefix -> subtree option -val hash_subtree : subtree -> int -val equal_subtree : subtree -> subtree -> bool - -exception Found_prefix of Hptmap.prefix * subtree * subtree - - - - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/kernel_services/abstract_interp/locations.mli b/src/kernel_services/abstract_interp/locations.mli index 982221c633d915dfc66a3f6c62ab94c7c76fa2b4..632cbb17a31e507e2c1a80c3d9d524197fde6615 100644 --- a/src/kernel_services/abstract_interp/locations.mli +++ b/src/kernel_services/abstract_interp/locations.mli @@ -21,12 +21,12 @@ (**************************************************************************) (** Memory locations. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types (** Association between bases and offsets in byte. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Location_Bytes : sig (* TODOBY: write an mli for MapLattice, and name the result. Use it there, and simplify *) @@ -231,12 +231,12 @@ module Location_Bytes : sig end (** Association between bases and offsets in bits. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Location_Bits : module type of Location_Bytes (** Association between bases and ranges of bits. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Zone : sig type map_t @@ -323,13 +323,13 @@ end (** {2 Locations} *) (** A {!Location_Bits.t} and a size in bits. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type location = private { loc : Location_Bits.t; size : Int_Base.t; } -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Location: Datatype.S with type t = location val loc_bottom : location @@ -396,7 +396,7 @@ val enumerate_bits : location -> Zone.t val enumerate_bits_under : location -> Zone.t val enumerate_valid_bits : access -> location -> Zone.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val enumerate_valid_bits_under : access -> location -> Zone.t diff --git a/src/kernel_services/abstract_interp/offsetmap.ml b/src/kernel_services/abstract_interp/offsetmap.ml index 509c41f0d5043f682f8a64c36d5fdbdbb18a5b4c..443f613e6a5662fb920da960c2d9525f99a35841 100644 --- a/src/kernel_services/abstract_interp/offsetmap.ml +++ b/src/kernel_services/abstract_interp/offsetmap.ml @@ -106,7 +106,7 @@ let get_plevel () = !plevel let debug = false -module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct +module Make (V : Offsetmap_lattice_with_isotropy.S) = struct open Format @@ -3018,8 +3018,8 @@ end the warning about unused modules. *) module Aux - (V1 : module type of Offsetmap_lattice_with_isotropy) - (V2 : module type of Offsetmap_lattice_with_isotropy) + (V1 : Offsetmap_lattice_with_isotropy.S) + (V2 : Offsetmap_lattice_with_isotropy.S) = struct module M1 = Make(V1) diff --git a/src/kernel_services/abstract_interp/offsetmap.mli b/src/kernel_services/abstract_interp/offsetmap.mli index b31f51d79613661f50b078698039db921577dcbb..3b2d0c987ae0f6ab3a256655ed589061e48e56f7 100644 --- a/src/kernel_services/abstract_interp/offsetmap.mli +++ b/src/kernel_services/abstract_interp/offsetmap.mli @@ -24,14 +24,14 @@ (** Maps from intervals to values. The documentation of the returned maps is in module {!Offsetmap_sig}. *) -module Make (V : module type of Offsetmap_lattice_with_isotropy) : - module type of Offsetmap_sig +module Make (V : Offsetmap_lattice_with_isotropy.S) : + Offsetmap_sig.S with type v = V.t and type widen_hint = V.numerical_widen_hint (**/**) (* Exported as Int_Intervals, do not use this module directly *) -module Int_Intervals: module type of Int_Intervals_sig +module Int_Intervals: Int_Intervals_sig.S (**/**) @@ -42,7 +42,7 @@ module Make_bitwise(V: sig include Lattice_type.With_Narrow with type t := t include Lattice_type.With_Top with type t := t end) : - module type of Offsetmap_bitwise_sig + Offsetmap_bitwise_sig.S with type v = V.t and type intervals = Int_Intervals.t diff --git a/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.ml b/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.ml new file mode 100644 index 0000000000000000000000000000000000000000..ff0c3857d4822ee92be6cde70b415048d447f001 --- /dev/null +++ b/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.ml @@ -0,0 +1,165 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Signature for {!Offsetmap_bitwise} module, that implement efficient maps + from intervals to values. + + Values are simpler than those of the {!Offsetmap_sig} module: given a value + [v] bound to an interval [i], all sub-intervals of [i] are implicitly also + bound to [v]. If you need e.g. to extract the k-th bit of the interval to + retrieve a more precise value, you must use the {!Offsetmap} module + instead. *) + +module type S = sig + (** Type of the values stored in the offsetmap *) + type v + + (** Datatype for the offsetmap *) + include Datatype.S + + type intervals + + (** {2 Pretty-printing} *) + + val pretty: t Pretty_utils.formatter + val pretty_generic : + ?typ:Cil_types.typ -> + ?pretty_v:(Format.formatter -> v -> unit) -> + ?skip_v:(v -> bool) -> + ?sep:string -> + unit -> + Format.formatter -> t -> unit + + val pretty_debug: t Pretty_utils.formatter + + + (** {2 Join and inclusion testing} *) + + val join : t -> t -> t + val is_included : t -> t -> bool + + + (** {2 Finding values} *) + + val find : Int_Intervals_sig.itv -> t -> v + val find_iset : validity:Base.validity -> intervals -> t -> v + + + (** {2 Adding values} *) + + val add_binding_intervals : + validity:Base.validity -> + exact:bool -> intervals -> v -> t -> t Lattice_bounds.or_bottom + + val add_binding_ival : + validity:Base.validity -> + exact:bool -> Ival.t -> size:Int_Base.t -> v -> t -> t Lattice_bounds.or_bottom + + + (** {2 Creating an offsetmap} *) + + (** [size] must be strictly greater than zero. *) + val create: size:Integer.t -> v -> t + + val empty: t + (** offsetmap containing no interval. *) + + val size_from_validity: + Base.validity -> Integer.t Lattice_bounds.or_bottom + (** [size_from_validity v] returns the size to be used when creating a + new offsetmap for a base with validity [v]. This is a convention that + should be shared by all modules that create offsetmaps. + Returns [`Bottom] iff [v] is [Invalid]. + @since Aluminium-20160501 *) + + + (** {2 Iterators} *) + + val map : (v -> v) -> t -> t + + type map2_decide = + ReturnLeft | ReturnRight | ReturnConstant of v | Recurse + (** See the documentation of type {!Offsetmap_sig.map2_decide} *) + + val map2: + Hptmap_sig.cache_type -> (t -> t -> map2_decide) -> (v -> v -> v) -> t -> t -> t + (** See the documentation of function {!Offsetmap_sig.map2_on_values}. *) + + + val fold : (intervals -> v -> 'a -> 'a) -> t -> 'a -> 'a + val fold_fuse_same: (intervals -> v -> 'a -> 'a) -> t -> 'a -> 'a + (** Same behavior as [fold], except if two disjoint intervals [r1] and [r2] + are mapped to the same value and boolean. In this case, [fold] will call + its argument [f] on [r1], then on [r2]. [fold_fuse_same] will call it + directly on [r1 U r2], where U is the join on sets of intervals. *) + + val fold_itv: + ?direction:[`LTR | `RTL] -> + entire:bool -> + (Int_Intervals_sig.itv -> v -> 'a -> 'a) -> + Int_Intervals_sig.itv -> + t -> 'a -> 'a + (** See documentation of {!Offsetmap_sig.fold_between}. *) + + (** [fold_join f join vempty itvs m] is an implementation of [fold] that + restricts itself to the intervals in [itvs]. Unlike in [fold] (where the + equivalent of [f] operates on an accumulator), [f] returns a value on each + sub-interval independently. The results are joined using [joined]. + [vempty] is the value that must be returned on {!Int_Intervals.bottom}. + This function uses a cache internally. Hence, it must be partially + applied to its first three arguments. If you do not need a cache, use + [fold] instead. *) + val fold_join_itvs: + cache:Hptmap_sig.cache_type -> + (Integer.t -> Integer.t -> v -> 'a) -> + ('a -> 'a -> 'a) -> + 'a -> + intervals -> t -> 'a + + + (** {2 Shape} *) + + val is_single_interval: t -> bool + (** [is_single_interval o] is true if the offsetmap [o] contains a single + binding. *) + + val single_interval_value: t -> v option + (** [single_interval_value o] returns [Some v] if [o] contains a single + interval, to which [v] is bound, and [None] otherwise. *) + + val is_same_value: t -> v -> bool + (** [is_same_value o v] is true if the offsetmap [o] contains a single + binding to [v], or is the empty offsetmap. *) + + + (** {2 Misc} *) + + (** Clear the caches local to this module. Beware that they are not + project-aware, and that you must call them at every project switch. *) + val clear_caches: unit -> unit + + + (**/**) + + val imprecise_write_msg: string ref + +end diff --git a/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli b/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli deleted file mode 100644 index d70edcda7c0a9e9e7f69f9c51989d30f633c98e0..0000000000000000000000000000000000000000 --- a/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli +++ /dev/null @@ -1,162 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Signature for {!Offsetmap_bitwise} module, that implement efficient maps - from intervals to values. - - Values are simpler than those of the {!Offsetmap_sig} module: given a value - [v] bound to an interval [i], all sub-intervals of [i] are implicitly also - bound to [v]. If you need e.g. to extract the k-th bit of the interval to - retrieve a more precise value, you must use the {!Offsetmap} module - instead. *) - - -(** Type of the values stored in the offsetmap *) -type v - -include Datatype.S (** Datatype for the offsetmap *) - -type intervals - -(** {2 Pretty-printing} *) - -val pretty: t Pretty_utils.formatter -val pretty_generic : - ?typ:Cil_types.typ -> - ?pretty_v:(Format.formatter -> v -> unit) -> - ?skip_v:(v -> bool) -> - ?sep:string -> - unit -> - Format.formatter -> t -> unit - -val pretty_debug: t Pretty_utils.formatter - - -(** {2 Join and inclusion testing} *) - -val join : t -> t -> t -val is_included : t -> t -> bool - - -(** {2 Finding values} *) - -val find : Int_Intervals_sig.itv -> t -> v -val find_iset : validity:Base.validity -> intervals -> t -> v - - -(** {2 Adding values} *) - -val add_binding_intervals : - validity:Base.validity -> - exact:bool -> intervals -> v -> t -> t Lattice_bounds.or_bottom - -val add_binding_ival : - validity:Base.validity -> - exact:bool -> Ival.t -> size:Int_Base.t -> v -> t -> t Lattice_bounds.or_bottom - - -(** {2 Creating an offsetmap} *) - -(** [size] must be strictly greater than zero. *) -val create: size:Integer.t -> v -> t - -val empty: t -(** offsetmap containing no interval. *) - -val size_from_validity: - Base.validity -> Integer.t Lattice_bounds.or_bottom -(** [size_from_validity v] returns the size to be used when creating a - new offsetmap for a base with validity [v]. This is a convention that - should be shared by all modules that create offsetmaps. - Returns [`Bottom] iff [v] is [Invalid]. - @since Aluminium-20160501 *) - - -(** {2 Iterators} *) - -val map : (v -> v) -> t -> t - -type map2_decide = - ReturnLeft | ReturnRight | ReturnConstant of v | Recurse - (** See the documentation of type {!Offsetmap_sig.map2_decide} *) - -val map2: - Hptmap_sig.cache_type -> (t -> t -> map2_decide) -> (v -> v -> v) -> t -> t -> t -(** See the documentation of function {!Offsetmap_sig.map2_on_values}. *) - - -val fold : (intervals -> v -> 'a -> 'a) -> t -> 'a -> 'a -val fold_fuse_same: (intervals -> v -> 'a -> 'a) -> t -> 'a -> 'a -(** Same behavior as [fold], except if two disjoint intervals [r1] and [r2] - are mapped to the same value and boolean. In this case, [fold] will call - its argument [f] on [r1], then on [r2]. [fold_fuse_same] will call it - directly on [r1 U r2], where U is the join on sets of intervals. *) - -val fold_itv: - ?direction:[`LTR | `RTL] -> - entire:bool -> - (Int_Intervals_sig.itv -> v -> 'a -> 'a) -> - Int_Intervals_sig.itv -> - t -> 'a -> 'a -(** See documentation of {!Offsetmap_sig.fold_between}. *) - -(** [fold_join f join vempty itvs m] is an implementation of [fold] that - restricts itself to the intervals in [itvs]. Unlike in [fold] (where the - equivalent of [f] operates on an accumulator), [f] returns a value on each - sub-interval independently. The results are joined using [joined]. - [vempty] is the value that must be returned on {!Int_Intervals.bottom}. - This function uses a cache internally. Hence, it must be partially - applied to its first three arguments. If you do not need a cache, use - [fold] instead. *) -val fold_join_itvs: - cache:Hptmap_sig.cache_type -> - (Integer.t -> Integer.t -> v -> 'a) -> - ('a -> 'a -> 'a) -> - 'a -> - intervals -> t -> 'a - - -(** {2 Shape} *) - -val is_single_interval: t -> bool -(** [is_single_interval o] is true if the offsetmap [o] contains a single - binding. *) - -val single_interval_value: t -> v option -(** [single_interval_value o] returns [Some v] if [o] contains a single - interval, to which [v] is bound, and [None] otherwise. *) - -val is_same_value: t -> v -> bool -(** [is_same_value o v] is true if the offsetmap [o] contains a single - binding to [v], or is the empty offsetmap. *) - - -(** {2 Misc} *) - -(** Clear the caches local to this module. Beware that they are not - project-aware, and that you must call them at every project switch. *) -val clear_caches: unit -> unit - - -(**/**) - -val imprecise_write_msg: string ref diff --git a/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.ml b/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.ml new file mode 100644 index 0000000000000000000000000000000000000000..e953048880ff4063286f41665f9761583052924d --- /dev/null +++ b/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.ml @@ -0,0 +1,103 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Type of the arguments of functor {!Offsetmap.Make} *) + +open Lattice_type + +module type S = sig + + type numerical_widen_hint + type size_widen_hint = Integer.t + + include Bounded_Join_Semi_Lattice + include With_Widening with type t := t and type widen_hint = size_widen_hint * numerical_widen_hint + include With_Cardinal_One with type t := t + + val pretty_typ: Cil_types.typ option -> t Pretty_utils.formatter + + + (** {1 Isotropy} *) + + (** Are the bits independent? *) + val is_isotropic : t -> bool + + val topify_with_origin : Origin.t -> t -> t + (** Force a value to be isotropic, when a loss of imprecision occurs. + The resulting value must verify {!is_isotropic}. *) + + + (** {1 Reading bits of values} *) + + val extract_bits : + topify:Origin.kind -> + start:Integer.t -> stop:Integer.t -> size:Integer.t -> + t -> + bool * t + (** Extract the bits between {!start} and {!stop} in the value of type [t], + assuming this value has {!size} bits. Return the corresponding value, and + a boolean indicating that an imprecision occurred during the operation. + In the latter case, the origin of the imprecision is flagged as having kind + [topify]. *) + + val shift_bits: + topify:Origin.kind -> + offset:Integer.t -> + size:Integer.t -> + t -> t + (** Left-shift the given value, of size [size], by [offset] bits. + [topify] indicates which operation caused this shift to take place, + for imprecision tracking. *) + + val merge_distinct_bits: + topify:Origin.kind -> + conflate_bottom:bool -> + t -> t -> t + (** Merge the bits of the two given values, that span disjoint bit ranges + by construction. (So either an abstraction of [+] or [|] are correct + implementations.) + + The [conflate_bottom] argument deals with {!bottom} + values in either of the arguments. If [conflate_bottom] holds, any + pre-existing {!bottom} value must result in {!bottom}. Otherwise, + the {!bottom} value is ignored. + + [topify] indicates which operation caused this merge to take place, + for imprecision tracking. + *) + + val merge_neutral_element: t + (** Value that can be passed to {!merge_distinct_bits} as the starting value. + This value must be neutral wrt. merging of values. *) + + val anisotropic_cast : size:Integer.t -> t -> t + (** Optionnally change the representation of the given value, under the + assumption that it fits in [size] bits. Returning the value argument + is alwas correct. *) + +end + +(* +Local Variables: +compile-command: "make -C ../../.." +End: +*) diff --git a/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli b/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli deleted file mode 100644 index 47bb5074272d92e1156b013646bf20f07eb299a1..0000000000000000000000000000000000000000 --- a/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli +++ /dev/null @@ -1,100 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Type of the arguments of functor {!Offsetmap.Make} *) - -open Lattice_type - -type numerical_widen_hint -type size_widen_hint = Integer.t - -include Bounded_Join_Semi_Lattice -include With_Widening with type t := t and type widen_hint = size_widen_hint * numerical_widen_hint -include With_Cardinal_One with type t := t - -val pretty_typ: Cil_types.typ option -> t Pretty_utils.formatter - - -(** {1 Isotropy} *) - -(** Are the bits independent? *) -val is_isotropic : t -> bool - -val topify_with_origin : Origin.t -> t -> t -(** Force a value to be isotropic, when a loss of imprecision occurs. - The resulting value must verify {!is_isotropic}. *) - - -(** {1 Reading bits of values} *) - -val extract_bits : - topify:Origin.kind -> - start:Integer.t -> stop:Integer.t -> size:Integer.t -> - t -> - bool * t -(** Extract the bits between {!start} and {!stop} in the value of type [t], - assuming this value has {!size} bits. Return the corresponding value, and - a boolean indicating that an imprecision occurred during the operation. - In the latter case, the origin of the imprecision is flagged as having kind - [topify]. *) - -val shift_bits: - topify:Origin.kind -> - offset:Integer.t -> - size:Integer.t -> - t -> t -(** Left-shift the given value, of size [size], by [offset] bits. - [topify] indicates which operation caused this shift to take place, - for imprecision tracking. *) - -val merge_distinct_bits: - topify:Origin.kind -> - conflate_bottom:bool -> - t -> t -> t -(** Merge the bits of the two given values, that span disjoint bit ranges - by construction. (So either an abstraction of [+] or [|] are correct - implementations.) - - The [conflate_bottom] argument deals with {!bottom} - values in either of the arguments. If [conflate_bottom] holds, any - pre-existing {!bottom} value must result in {!bottom}. Otherwise, - the {!bottom} value is ignored. - - [topify] indicates which operation caused this merge to take place, - for imprecision tracking. -*) - -val merge_neutral_element: t -(** Value that can be passed to {!merge_distinct_bits} as the starting value. - This value must be neutral wrt. merging of values. *) - -val anisotropic_cast : size:Integer.t -> t -> t -(** Optionnally change the representation of the given value, under the - assumption that it fits in [size] bits. Returning the value argument - is alwas correct. *) - - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/kernel_services/abstract_interp/offsetmap_sig.ml b/src/kernel_services/abstract_interp/offsetmap_sig.ml new file mode 100644 index 0000000000000000000000000000000000000000..a3eaddf8e10463cb7e50d33ae405c9fd0524e65b --- /dev/null +++ b/src/kernel_services/abstract_interp/offsetmap_sig.ml @@ -0,0 +1,305 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Signature for {!Offsetmap} module, that implement efficient maps from + intervals to arbitrary values. *) +(* This module is declared as a pure mli to avoid duplicating the + interface of [Offsetmap] in the .ml and in the .mli files. *) + +open Abstract_interp + +module type S = sig + + (** Type of the values stored in the offsetmap *) + type v + type widen_hint + + (** Datatype for the offsetmaps *) + include Datatype.S + + + (** {2 Pretty-printing} *) + + val pretty_generic: + ?typ:Cil_types.typ -> + ?pretty_v:(Cil_types.typ option -> Format.formatter -> v -> unit) -> + ?skip_v:(v -> bool) -> + ?sep:string -> + unit -> + Format.formatter -> t -> unit + + (** {2 Creating basic offsetmaps} *) + + val create: size:Int.t -> v -> size_v:Int.t -> t + (** [create ~size v ~size_v] creates an offsetmap of size [size] in which the + intervals [k*size_v .. (k+1)*size_v-1] with [0<= k <= size/size_v] are all + mapped to [v]. *) + + val create_isotropic: size:Int.t -> v -> t + (** Same as {!create}, but for values that are isotropic. In this case, + [size_v] is automatically computed. *) + + val of_list: ((t -> v -> t) -> t -> 'l -> t) -> 'l -> Int.t -> t + (** [from_list fold c size] creates an offsetmap by applying the iterator + [fold] to the container [c], the elements of [c] being supposed to + be of size [size]. [c] must be such that [fold] is called at least + once. *) + + val empty: t + (** offsetmap containing no interval. *) + + val size_from_validity: Base.validity -> Integer.t Lattice_bounds.or_bottom + (** [size_from_validity v] returns the size to be used when creating a + new offsetmap for a base with validity [v]. This is a convention that + must be shared by all modules that create offsetmaps, because operations + such as {!join} or {!is_included} require offsetmaps of the same . + Returns [`Bottom] iff [v] is {!Base.Invalid}. + @since Aluminium-20160501 *) + + + (** {2 Iterators} *) + + val iter: + ((Int.t * Int.t) -> (v * Int.t * Rel.t) -> unit) -> + t -> unit + (** [iter f m] calls [f] on all the intervals bound in [m], in increasing + order. The arguments of [f (min, max) (v, size, offset)] are as follows: + - [(start, stop)] are the bounds of the interval, inclusive. + - [v] is the value bound to the interval, and [size] its size; if [size] + is less than [stop-start+1], [v] repeats itself until [stop]. + - [offset] is the offset at which [v] starts in the interval; + it ranges over [0..size-1]. If [offset] is [0], [v] starts + at the beginning of the interval. Otherwise, it starts at [offset-size]. + *) + + val fold: + ((Int.t * Int.t) -> (v * Int.t * Rel.t) -> 'a -> 'a) -> + t -> 'a -> 'a + (** Same as [iter], but with an accumulator. *) + + val fold_between: + ?direction:[`LTR | `RTL] -> + entire:bool -> + Int.t * Int.t -> + ((Int.t * Int.t) -> (v * Int.t * Rel.t) -> 'a -> 'a) -> + t -> 'a -> 'a + (** [fold_between ~direction:`LTR ~entire (start, stop) m acc] is similar to + [fold f m acc], except that only the intervals that intersect [start..stop] + (inclusive) are presented. If [entire] is true, intersecting intervals are + presented whole (ie. they may be bigger than [start..stop]). If [entire] + is [false], only the intersection with [ib..ie] is presented. + [fold_between ~direction:`RTL] reverses the iteration order: interval + are passed in decreasing order. Default is [`LTR]. *) + + + (** {2 Interval-unaware iterators} *) + + val iter_on_values: (v -> unit) -> t -> unit + (** [iter_on_values f m] iterates on the entire contents of [m], but [f] + receives only the value bound to each interval. Interval bounds, the + alignment of the value and its size are not computed. *) + + val fold_on_values: (v -> 'a -> 'a) -> t -> 'a -> 'a + (** Same as [iter_on_values] but with an accumulator *) + + val map_on_values: (v -> v) -> t -> t + (** [map_on_values f m ] creates the map derived from [m] by applying [f] to + each interval. For each interval, the size of the new value and its offset + relative to the beginning of the interval is kept unchanged. *) + + type map2_decide = + ReturnLeft | ReturnRight | ReturnConstant of v | Recurse + (** This type describes different possibilities to accelerate a simultaneous + iteration on two offsetmaps. {!ReturnLeft} (resp. {!ReturnRight}) means + 'return the left (resp. right) operand unchanged, and stop the recursive + descent'. [ReturnConstant v] means 'return a constant offsetmap of the good + size and that contains [v] everywhere'. It is always correct to return + {!Recurse}, which will force the recursion until the maps have been fully + decomposed. + + Typical usage include functions that verify [f v v = v], maps [m] such that + [f m m' = m'], etc. *) + + val map2_on_values: + Hptmap_sig.cache_type -> (t -> t -> map2_decide) -> (v -> v -> v) -> t -> t -> t + (** [map2_on_values cache decide join m1 m2] applies [join] pointwise to + all the elements of [m1] and [m2] and builds the resulting map. This function + can only be called if [m1] and [m2] contain isotropic values. [decide] + is called during the iteration, and can be used to return early; it is + always correct to return {!Recurse}. Depending on [cache], the results of + the partially applied function [map2_on_values cache decide join] will be + cached between different calls. *) + + + (** {2 Join and inclusion testing} *) + + include Lattice_type.Join_Semi_Lattice with type t := t + + val widen : widen_hint -> t -> t -> t + (** [widen wh m1 m2] performs a widening step on [m2], assuming that + [m1] was the previous state. The relation [is_included m1 m2] must hold *) + + (** {2 Narrowing} *) + + module Make_Narrow (X: sig + include Lattice_type.With_Top with type t := v + include Lattice_type.With_Narrow with type t := v + end) : sig + val narrow: t -> t -> t + (** Over-approximation of the intersection of abstract values, without + considering (bitwise) reinterpretations. In particular, values with + equivalent representations (e.g. [-1] and [0xFF] on 8 bits) may be + considered different, leading to empty intersections. + This may result in unsound results; the function {!narrow_reinterpret} + below should be preferred in general. *) + + val narrow_reinterpret: t -> t -> t + (** Variant of the function above that bitwise-reinterprets values before + performing the intersection (in order to get normal forms). This may + lead to situations where the result is not included in the arguments, + but this function should be preferred to {!narrow}. *) + end + + + (** {2 Searching values} *) + + val find : + validity:Base.validity -> + ?conflate_bottom:bool -> + offsets:Ival.t -> size:Integer.t -> + t -> v + (** Find the value bound to a set of intervals, expressed as an ival, in the + given rangemap. *) + + val find_imprecise: validity:Base.validity-> t -> v + (** [find_imprecise ~validity m] returns an imprecise join of the values bound + in [m], in the range described by [validity]. *) + + val find_imprecise_everywhere: t -> v + (** Returns an imprecise join of all the values bound in the offsetmap. *) + + val copy_slice: + validity:Base.validity -> + offsets:Ival.t -> size:Integer.t -> + t -> t Lattice_bounds.or_bottom + (** [copy_slice ~validity ~offsets ~size m] copies and merges the slices of + [m] starting at offsets [offsets] and of size [size]. Offsets invalid + according to [validity] are removed. [size] must be strictly greater + than zero. *) + + (** {2 Adding values} *) + + val add : ?exact:bool -> (Int.t * Int.t) -> (v * Int.t * Rel.t) -> t -> t + (** [add (min, max) (v, size, offset) m] maps the interval + [min..max] (inclusive) to the value [v] in [m]. [v] is assumed as having + size [size]. If [stop-start+1] is greater than [size], [v] repeats itself + until the entire interval is filled. [offset] is the offset at which [v] + starts in the interval, interpreted as for {!iter}. Offsetmaps cannot + contain holes, so [m] must already bind at least the intervals [0..start-1]. + *) + + val update : + ?origin:Origin.t -> + validity:Base.validity -> + exact:bool -> + offsets:Ival.t -> + size:Int.t -> + v -> + t -> t Lattice_bounds.or_bottom + (** [update ?origin ~validity ~exact ~offsets ~size v m] writes [v], + of size [size], each [offsets] in [m]; [m] must be of the size implied by + [validity]. [~exact=true] results in a strong update, while + [~exact=false] performs a weak update. If [offsets] contains too many + offsets, or if [offsets] and [size] are not compatible, [offsets] and/or + [v] are over-approximated. In this case, [origin] is used as the source of + the resulting imprecision. Returns [`Bottom] when all offsets are invalid. *) + + val update_under : + validity:Base.validity -> + exact:bool -> + offsets:Ival.t -> + size:Int.t -> + v -> + t -> t Lattice_bounds.or_bottom + (** Same as {!update}, except that no over-approximation on the set + of offsets or on the value written occurs. In case of imprecision, + [m] is not updated. *) + + + val update_imprecise_everywhere: + validity:Base.validity -> + Origin.t -> v -> + t -> t Lattice_bounds.or_bottom + (** [update_everywhere ~validity o v m] computes the offsetmap resulting + from imprecisely writing [v] potentially anywhere where [m] is valid + according to [validity]. If a value becomes too imprecise, [o] is used + as origin. *) + + val paste_slice: + validity:Base.validity -> + exact:bool -> + from:t -> + size:Int.t -> + offsets:Ival.t -> + t -> t Lattice_bounds.or_bottom + + + (** {2 Shape} *) + + val cardinal_zero_or_one: t -> bool + (** Returns [true] if and only if all the interval bound in the + offsetmap are mapped to values with cardinal at most 1. *) + + val is_single_interval: t -> bool + (** [is_single_interval o] is true if the offsetmap [o] contains a single + binding. *) + + val single_interval_value: t -> v option + (** [single_interval_value o] returns [Some v] if [o] contains a single + interval, to which [v] is bound, and [None] otherwise. *) + + val is_same_value: t -> v -> bool + (** [is_same_value o v] is true if the offsetmap [o] contains a single + binding to [v], or is the empty offsetmap. *) + + + (** {2 Misc} *) + + val imprecise_write_msg: string ref + (** The message "more than N <imprecise_msg_write>. Approximating." is displayed + when the offsetmap must update too many locations in one operation. *) + + (** Clear the caches local to this module. Beware that they are not + project-aware, and that you must call them at every project switch. *) + val clear_caches: unit -> unit + + (**/**) + + val pretty_debug: t Pretty_utils.formatter + +end + +(* +Local Variables: +compile-command: "make -C ../../.." +End: +*) diff --git a/src/kernel_services/abstract_interp/offsetmap_sig.mli b/src/kernel_services/abstract_interp/offsetmap_sig.mli deleted file mode 100644 index c653a13f9a4b79ff887e126d661f2b13bf0595fc..0000000000000000000000000000000000000000 --- a/src/kernel_services/abstract_interp/offsetmap_sig.mli +++ /dev/null @@ -1,299 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Signature for {!Offsetmap} module, that implement efficient maps from - intervals to arbitrary values. *) -(* This module is declared as a pure mli to avoid duplicating the - interface of [Offsetmap] in the .ml and in the .mli files. *) - -open Abstract_interp - -(** Type of the values stored in the offsetmap *) -type v -type widen_hint -include Datatype.S (** Datatype for the offsetmaps *) - - -(** {2 Pretty-printing} *) - -val pretty_generic: - ?typ:Cil_types.typ -> - ?pretty_v:(Cil_types.typ option -> Format.formatter -> v -> unit) -> - ?skip_v:(v -> bool) -> - ?sep:string -> - unit -> - Format.formatter -> t -> unit - -(** {2 Creating basic offsetmaps} *) - -val create: size:Int.t -> v -> size_v:Int.t -> t -(** [create ~size v ~size_v] creates an offsetmap of size [size] in which the - intervals [k*size_v .. (k+1)*size_v-1] with [0<= k <= size/size_v] are all - mapped to [v]. *) - -val create_isotropic: size:Int.t -> v -> t -(** Same as {!create}, but for values that are isotropic. In this case, - [size_v] is automatically computed. *) - -val of_list: ((t -> v -> t) -> t -> 'l -> t) -> 'l -> Int.t -> t -(** [from_list fold c size] creates an offsetmap by applying the iterator - [fold] to the container [c], the elements of [c] being supposed to - be of size [size]. [c] must be such that [fold] is called at least - once. *) - -val empty: t -(** offsetmap containing no interval. *) - -val size_from_validity: Base.validity -> Integer.t Lattice_bounds.or_bottom -(** [size_from_validity v] returns the size to be used when creating a - new offsetmap for a base with validity [v]. This is a convention that - must be shared by all modules that create offsetmaps, because operations - such as {!join} or {!is_included} require offsetmaps of the same . - Returns [`Bottom] iff [v] is {!Base.Invalid}. - @since Aluminium-20160501 *) - - -(** {2 Iterators} *) - -val iter: - ((Int.t * Int.t) -> (v * Int.t * Rel.t) -> unit) -> - t -> unit -(** [iter f m] calls [f] on all the intervals bound in [m], in increasing - order. The arguments of [f (min, max) (v, size, offset)] are as follows: - - [(start, stop)] are the bounds of the interval, inclusive. - - [v] is the value bound to the interval, and [size] its size; if [size] - is less than [stop-start+1], [v] repeats itself until [stop]. - - [offset] is the offset at which [v] starts in the interval; - it ranges over [0..size-1]. If [offset] is [0], [v] starts - at the beginning of the interval. Otherwise, it starts at [offset-size]. -*) - -val fold: - ((Int.t * Int.t) -> (v * Int.t * Rel.t) -> 'a -> 'a) -> - t -> 'a -> 'a -(** Same as [iter], but with an accumulator. *) - -val fold_between: - ?direction:[`LTR | `RTL] -> - entire:bool -> - Int.t * Int.t -> - ((Int.t * Int.t) -> (v * Int.t * Rel.t) -> 'a -> 'a) -> - t -> 'a -> 'a -(** [fold_between ~direction:`LTR ~entire (start, stop) m acc] is similar to - [fold f m acc], except that only the intervals that intersect [start..stop] - (inclusive) are presented. If [entire] is true, intersecting intervals are - presented whole (ie. they may be bigger than [start..stop]). If [entire] - is [false], only the intersection with [ib..ie] is presented. - [fold_between ~direction:`RTL] reverses the iteration order: interval - are passed in decreasing order. Default is [`LTR]. *) - - -(** {2 Interval-unaware iterators} *) - -val iter_on_values: (v -> unit) -> t -> unit -(** [iter_on_values f m] iterates on the entire contents of [m], but [f] - receives only the value bound to each interval. Interval bounds, the - alignment of the value and its size are not computed. *) - -val fold_on_values: (v -> 'a -> 'a) -> t -> 'a -> 'a -(** Same as [iter_on_values] but with an accumulator *) - -val map_on_values: (v -> v) -> t -> t -(** [map_on_values f m ] creates the map derived from [m] by applying [f] to - each interval. For each interval, the size of the new value and its offset - relative to the beginning of the interval is kept unchanged. *) - -type map2_decide = - ReturnLeft | ReturnRight | ReturnConstant of v | Recurse - (** This type describes different possibilities to accelerate a simultaneous - iteration on two offsetmaps. {!ReturnLeft} (resp. {!ReturnRight}) means - 'return the left (resp. right) operand unchanged, and stop the recursive - descent'. [ReturnConstant v] means 'return a constant offsetmap of the good - size and that contains [v] everywhere'. It is always correct to return - {!Recurse}, which will force the recursion until the maps have been fully - decomposed. - - Typical usage include functions that verify [f v v = v], maps [m] such that - [f m m' = m'], etc. *) - -val map2_on_values: - Hptmap_sig.cache_type -> (t -> t -> map2_decide) -> (v -> v -> v) -> t -> t -> t -(** [map2_on_values cache decide join m1 m2] applies [join] pointwise to - all the elements of [m1] and [m2] and builds the resulting map. This function - can only be called if [m1] and [m2] contain isotropic values. [decide] - is called during the iteration, and can be used to return early; it is - always correct to return {!Recurse}. Depending on [cache], the results of - the partially applied function [map2_on_values cache decide join] will be - cached between different calls. *) - - -(** {2 Join and inclusion testing} *) - -include Lattice_type.Join_Semi_Lattice with type t := t - -val widen : widen_hint -> t -> t -> t -(** [widen wh m1 m2] performs a widening step on [m2], assuming that - [m1] was the previous state. The relation [is_included m1 m2] must hold *) - -(** {2 Narrowing} *) - -module Make_Narrow (X: sig - include Lattice_type.With_Top with type t := v - include Lattice_type.With_Narrow with type t := v - end) : sig - val narrow: t -> t -> t - (** Over-approximation of the intersection of abstract values, without - considering (bitwise) reinterpretations. In particular, values with - equivalent representations (e.g. [-1] and [0xFF] on 8 bits) may be - considered different, leading to empty intersections. - This may result in unsound results; the function {!narrow_reinterpret} - below should be preferred in general. *) - - val narrow_reinterpret: t -> t -> t - (** Variant of the function above that bitwise-reinterprets values before - performing the intersection (in order to get normal forms). This may - lead to situations where the result is not included in the arguments, - but this function should be preferred to {!narrow}. *) -end - - -(** {2 Searching values} *) - -val find : - validity:Base.validity -> - ?conflate_bottom:bool -> - offsets:Ival.t -> size:Integer.t -> - t -> v -(** Find the value bound to a set of intervals, expressed as an ival, in the - given rangemap. *) - -val find_imprecise: validity:Base.validity-> t -> v -(** [find_imprecise ~validity m] returns an imprecise join of the values bound - in [m], in the range described by [validity]. *) - -val find_imprecise_everywhere: t -> v -(** Returns an imprecise join of all the values bound in the offsetmap. *) - -val copy_slice: - validity:Base.validity -> - offsets:Ival.t -> size:Integer.t -> - t -> t Lattice_bounds.or_bottom -(** [copy_slice ~validity ~offsets ~size m] copies and merges the slices of - [m] starting at offsets [offsets] and of size [size]. Offsets invalid - according to [validity] are removed. [size] must be strictly greater - than zero. *) - -(** {2 Adding values} *) - -val add : ?exact:bool -> (Int.t * Int.t) -> (v * Int.t * Rel.t) -> t -> t -(** [add (min, max) (v, size, offset) m] maps the interval - [min..max] (inclusive) to the value [v] in [m]. [v] is assumed as having - size [size]. If [stop-start+1] is greater than [size], [v] repeats itself - until the entire interval is filled. [offset] is the offset at which [v] - starts in the interval, interpreted as for {!iter}. Offsetmaps cannot - contain holes, so [m] must already bind at least the intervals [0..start-1]. -*) - -val update : - ?origin:Origin.t -> - validity:Base.validity -> - exact:bool -> - offsets:Ival.t -> - size:Int.t -> - v -> - t -> t Lattice_bounds.or_bottom -(** [update ?origin ~validity ~exact ~offsets ~size v m] writes [v], - of size [size], each [offsets] in [m]; [m] must be of the size implied by - [validity]. [~exact=true] results in a strong update, while - [~exact=false] performs a weak update. If [offsets] contains too many - offsets, or if [offsets] and [size] are not compatible, [offsets] and/or - [v] are over-approximated. In this case, [origin] is used as the source of - the resulting imprecision. Returns [`Bottom] when all offsets are invalid. *) - -val update_under : - validity:Base.validity -> - exact:bool -> - offsets:Ival.t -> - size:Int.t -> - v -> - t -> t Lattice_bounds.or_bottom -(** Same as {!update}, except that no over-approximation on the set - of offsets or on the value written occurs. In case of imprecision, - [m] is not updated. *) - - -val update_imprecise_everywhere: - validity:Base.validity -> - Origin.t -> v -> - t -> t Lattice_bounds.or_bottom -(** [update_everywhere ~validity o v m] computes the offsetmap resulting - from imprecisely writing [v] potentially anywhere where [m] is valid - according to [validity]. If a value becomes too imprecise, [o] is used - as origin. *) - -val paste_slice: - validity:Base.validity -> - exact:bool -> - from:t -> - size:Int.t -> - offsets:Ival.t -> - t -> t Lattice_bounds.or_bottom - - -(** {2 Shape} *) - -val cardinal_zero_or_one: t -> bool -(** Returns [true] if and only if all the interval bound in the - offsetmap are mapped to values with cardinal at most 1. *) - -val is_single_interval: t -> bool -(** [is_single_interval o] is true if the offsetmap [o] contains a single - binding. *) - -val single_interval_value: t -> v option -(** [single_interval_value o] returns [Some v] if [o] contains a single - interval, to which [v] is bound, and [None] otherwise. *) - -val is_same_value: t -> v -> bool -(** [is_same_value o v] is true if the offsetmap [o] contains a single - binding to [v], or is the empty offsetmap. *) - - -(** {2 Misc} *) - -val imprecise_write_msg: string ref -(** The message "more than N <imprecise_msg_write>. Approximating." is displayed - when the offsetmap must update too many locations in one operation. *) - -(** Clear the caches local to this module. Beware that they are not - project-aware, and that you must call them at every project switch. *) -val clear_caches: unit -> unit - -(**/**) - -val pretty_debug: t Pretty_utils.formatter - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/kernel_services/ast_data/annotations.mli b/src/kernel_services/ast_data/annotations.mli index b6503eb9fb79995dc437c234be4968fc00987c6b..81e0911b96c4836b5e5a63e538e95cac0aebda85 100644 --- a/src/kernel_services/ast_data/annotations.mli +++ b/src/kernel_services/ast_data/annotations.mli @@ -22,7 +22,7 @@ (** Annotations in the AST. The AST should be computed before calling functions of this module. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types @@ -288,19 +288,19 @@ val add_assert: Emitter.t -> ?kf:kernel_function -> stmt -> predicate -> unit (** Add an assertion attached to the given statement. If [kf] is provided, the function runs faster. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val add_check: Emitter.t -> ?kf:kernel_function -> stmt -> predicate -> unit (** Add a checking assertion attached to the given statement. If [kf] is provided, the function runs faster. -*) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val add_admit: Emitter.t -> ?kf:kernel_function -> stmt -> predicate -> unit (** Add an hypothesis assertion attached to the given statement. If [kf] is provided, the function runs faster. -*) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val add_global: Emitter.t -> global_annotation -> unit (** Add a new global annotation into the program. *) diff --git a/src/kernel_services/ast_data/ast.ml b/src/kernel_services/ast_data/ast.ml index bccc202c69171fec1e03c6651b02dc0fadee11f0..ab9a0eab3f1673d2f55e62ad669867258703e2f0 100644 --- a/src/kernel_services/ast_data/ast.ml +++ b/src/kernel_services/ast_data/ast.ml @@ -87,7 +87,9 @@ let () = Cil_datatype.Varinfo.Hptset.self ]; add_monotonic_state Cil_datatype.Stmt.Hptset.self; add_monotonic_state Cil_datatype.Varinfo.Hptset.self; - Cil.set_dependencies_of_ast self; + State_dependency_graph.add_dependencies ~from:self + [Cabshelper.Comments.self;Cil.selfFormalsDecl; Cil.selfTypSize; + Cil_builtins.Frama_c_builtins.self;Cil.switch_case_state_self]; Logic_env.init_dependencies self; exception Bad_Initialization of string diff --git a/src/kernel_services/ast_data/ast.mli b/src/kernel_services/ast_data/ast.mli index b8fbba2777c77e3f1b1f7196c5bb437d1d8f36b2..4667c234bba5a311e28aaa7f8f6fc54b61785bf5 100644 --- a/src/kernel_services/ast_data/ast.mli +++ b/src/kernel_services/ast_data/ast.mli @@ -56,7 +56,7 @@ val get: unit -> Cil_types.file @raise Bad_Initialization if neither {!File.init_from_c_files} nor {!File.init_project_from_cil_file} nor {!File.init_from_cmdline} was called before. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val compute: unit -> unit (** Enforce the computation of the AST. @@ -71,14 +71,14 @@ val mark_as_changed: unit -> unit (** call this function whenever you've made some changes in place inside the AST @since Oxygen-20120901 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val mark_as_grown: unit -> unit (** call this function whenever you have added something to the AST, without modifying the existing nodes @since Oxygen-20120901 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val add_monotonic_state: State.t -> unit @@ -88,12 +88,12 @@ val add_monotonic_state: State.t -> unit not erase such states, while {!Ast.mark_as_changed} and clearing Ast.self itself will. @since Oxygen-20120901 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val self: State.t (** The state kind associated to the cil AST. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val apply_after_computed: (Cil_types.file -> unit) -> unit (** Apply the given hook just after building the AST. diff --git a/src/kernel_services/ast_data/cil_types.mli b/src/kernel_services/ast_data/cil_types.ml similarity index 94% rename from src/kernel_services/ast_data/cil_types.mli rename to src/kernel_services/ast_data/cil_types.ml index 8964d35f9f3c9fdcda49281a24ee38ebd19f0c31..21a599460d2fdb73bd81e6e805e3c075424be978 100644 --- a/src/kernel_services/ast_data/cil_types.mli +++ b/src/kernel_services/ast_data/cil_types.ml @@ -42,7 +42,7 @@ (****************************************************************************) (** The Abstract Syntax of CIL. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (**************************** WARNING ***************************************) (* Remember to reflect any change here into the visitor and pretty-printer *) @@ -68,7 +68,7 @@ {!Cil.dummyFile} when you need a {!Cil_types.file} as a placeholder. For each global item CIL stores the source location where it appears (using the type {!Cil_types.location}) - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type file = { mutable fileName: Filepath.Normalized.t; (** The complete file name *) @@ -92,7 +92,7 @@ type file = { (** The main type for representing global declarations and definitions. A list of these form a CIL file. The order of globals in the file is generally important. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and global = | GType of typeinfo * location (** A typedef. All uses of type names (through the [TNamed] constructor) @@ -144,8 +144,7 @@ and global = | GFun of fundec * location (** A function definition. - @plugin development guide - *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | GAsm of string * location (** Global asm statement. These ones can contain only a template *) @@ -341,7 +340,7 @@ and attrparam = (** The definition of a structure or union type. Use {!Cil.mkCompInfo} to make one and use {!Cil.copyCompInfo} to copy one (this ensures that a new key is assigned and that the fields have the right pointers to parents.). - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and compinfo = { mutable cstruct: bool; @@ -389,7 +388,7 @@ and compinfo = { with the type of the field). *) (** Information about a struct/union field. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and fieldinfo = { mutable fcomp: compinfo; (** The host structure that contains this field. There can be only one @@ -449,7 +448,7 @@ and fieldinfo = { enumeration. Make sure you have a [GEnumTag] for each of these. *) (** Information about an enumeration. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and enuminfo = { eorig_name: string; (** original name as found in C file. *) @@ -478,7 +477,7 @@ and enumitem = { } (** Information about a defined type. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and typeinfo = { torig_name: string; (** original name as found in C file. *) @@ -523,7 +522,7 @@ and typeinfo = { formals. *) (** Information about a variable. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and varinfo = { mutable vname: string; (** The name of the variable. Cannot be empty. It is primarily your @@ -686,7 +685,7 @@ and exp_node = | BinOp of binop * exp * exp * typ (** Binary operation. Includes the type of the result. The arithmetic conversions are made explicit for the arguments. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | CastE of typ * exp (** Use {!Cil.mkCast} to make casts. *) @@ -758,9 +757,9 @@ and binop = | MinusPP (** pointer - pointer *) | Mult (** * *) | Div (** / - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Mod (** % - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Shiftlt (** shift left *) | Shiftrt (** shift right *) @@ -848,7 +847,7 @@ and lhost = certain kinds of lvalues and its effect is that it advances the starting address of the lvalue and changes the denoted type, essentially focussing to some smaller lvalue that is contained in the original one. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and offset = | NoOffset (** No offset. Can be applied to any lvalue and does not change either the @@ -936,7 +935,7 @@ and local_init = {!Cil.makeFormalVar} and {!Cil.setFormals}. *) (** Function definitions. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and fundec = { mutable svar: varinfo; (** Holds the name and type as a variable, so we can refer to it easily @@ -1024,7 +1023,7 @@ and block = { {!Cfg.computeCFGInfo} to do it. *) (** Statements. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and stmt = { mutable labels: label list; (** Whether the statement starts with some labels, case statements or @@ -1070,11 +1069,11 @@ and stmtkind = | Instr of instr (** An instruction that does not contain control flow. Control implicitly falls through. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Return of exp option * location (** The return statement. This is a leaf in the CFG. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Goto of stmt ref * location (** A goto statement. Appears from actual goto's in the code or from goto's @@ -1082,21 +1081,21 @@ and stmtkind = statement that is the target of the Goto. This means that you have to update the reference whenever you replace the target statement. The target statement MUST have at least a label. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Break of location (** A break to the end of the nearest enclosing Loop or Switch. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Continue of location (** A continue to the start of the nearest enclosing [Loop]. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | If of exp * block * block * location (** A conditional. Two successors, the "then" and the "else" branches (in this order). Both branches fall-through to the successor of the If statement. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Switch of exp * block * (stmt list) * location (** A switch statement. [exp] is the index of the switch. [block] is @@ -1106,7 +1105,7 @@ and stmtkind = cannot appear more than once in the list, and statements in [stmt list] can have several labels corresponding to several cases. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Loop of code_annotation list * block * location * (stmt option) * (stmt option) @@ -1115,12 +1114,12 @@ and stmtkind = first stmt option will point to the stmt containing the continue label for this loop and the second will point to the stmt containing the break label for this loop. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Block of block (** Just a block of statements. Use it as a way to keep some block attributes local. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | UnspecifiedSequence of (stmt * lval list * lval list * lval list * stmt ref list) list @@ -1150,7 +1149,7 @@ and stmtkind = In case you do not care about this feature just handle it like a block (see {!Cil.block_from_unspecified_sequence}). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Throw of (exp * typ) option * location (** Throws an exception, C++ style. @@ -1167,7 +1166,7 @@ and stmtkind = (** On MSVC we support structured exception handling. This is what you might expect. Control can get into the finally block either from the end of the body block, or if an exception is thrown. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | TryExcept of block * (instr list * exp) * block * location (** On MSVC we support structured exception handling. The try/except @@ -1185,7 +1184,7 @@ and stmtkind = After that, depending on the value of the expression the control goes to the handler, propagates the exception, or retries the exception. The location corresponds to the try keyword. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** Kind of exceptions that are caught by a given clause. *) and catch_binder = @@ -1432,7 +1431,7 @@ and term_offset = (** index. Note that a range is denoted by [TIndex(Trange(i1,i2),ofs)] *) (** description of a logic function or predicate. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and logic_info = { (* mutable l_name : string; (** name of the function. *) @@ -1466,7 +1465,7 @@ and logic_body = (** inductive definition *) (** Description of a logic type. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and logic_type_info = { mutable lt_name: string; lt_params : string list; (** type parameters*) @@ -1492,7 +1491,7 @@ and logic_var_kind = | LVLocal (** local \let *) (** description of a logic variable - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and logic_var = { mutable lv_name : string; (** name of the variable. *) mutable lv_id : int; (** unique identifier *) @@ -1507,7 +1506,7 @@ and logic_var = { } (** Description of a constructor of a logic sum-type. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and logic_ctor_info = { mutable ctor_name: string; (** name of the constructor. *) ctor_type: logic_type_info; (** type to which the constructor belongs. *) @@ -1529,7 +1528,7 @@ and relation = | Rle | Rge | Req - | Rneq (** Different @plugin development guide *) + | Rneq (** Different @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** predicates *) @@ -1659,7 +1658,7 @@ and spec = { different levels (e.g. [global] and [behavior]), as this would make the grammar ambiguous. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and acsl_extension = { ext_id : int; ext_name : string; @@ -1668,7 +1667,7 @@ and acsl_extension = { ext_kind : acsl_extension_kind } -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and acsl_extension_kind = | Ext_id of int (** id used internally by the extension itself. *) | Ext_terms of term list @@ -1677,7 +1676,7 @@ and acsl_extension_kind = | Ext_annot of string * acsl_extension list (** Where are we expected to find corresponding extension keyword. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since 18.0-Argon *) and ext_category = @@ -1685,7 +1684,7 @@ and ext_category = | Ext_global | Ext_code_annot of ext_code_annot_context -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and ext_code_annot_context = | Ext_here (** at current program point. *) | Ext_next_stmt (** covers next statement. *) @@ -1695,7 +1694,7 @@ and ext_code_annot_context = (** Behavior of a function or statement. This type shares the name of its constructors with {!Logic_ptree.behavior}. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and behavior = { mutable b_name : string; (** name of the behavior. *) @@ -1706,7 +1705,7 @@ and behavior = { mutable b_assigns : assigns; (** assignments. *) mutable b_allocation : allocation; (** frees, allocates. *) mutable b_extended : acsl_extension list - (** extensions *) + (** extensions *) } (** kind of termination a post-condition applies to. See ACSL manual. *) @@ -1772,7 +1771,7 @@ and code_annotation_node = Boolean flag is true for loop extensions and false for code extensions @since Silicon-20161101 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** function contract. *) @@ -1812,7 +1811,7 @@ and global_annotation = argument of type t *) | Dextended of acsl_extension * attributes * location (** Extended global clause. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type kinstr = @@ -1860,7 +1859,7 @@ type syntactic_scope = belongs. *) (** Definition of a machine model (architecture + compiler). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type mach = { sizeof_short: int; (* Size of "short" *) sizeof_int: int; (* Size of "int" *) diff --git a/src/kernel_services/ast_data/globals.mli b/src/kernel_services/ast_data/globals.mli index fe2b181766a2d67c8e146a76f1d0d7e2a7b94b6b..2ae3a939ec7f7f64f9eac03812de91dd0022d011 100644 --- a/src/kernel_services/ast_data/globals.mli +++ b/src/kernel_services/ast_data/globals.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Operations on globals. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types @@ -99,7 +99,7 @@ module Functions: sig val get: varinfo -> kernel_function (** @raise Not_found if the given varinfo has no associated kernel function and is not a built-in. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val get_params: kernel_function -> varinfo list val get_vi: kernel_function -> varinfo @@ -286,7 +286,7 @@ val set_entry_point : string -> bool -> unit [Kernel.LibEntry] to [lib]. Moreover, clear the results of all the analysis which depend on [Kernel.MainFunction] or [Kernel.LibEntry]. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val is_entry_point : ?when_lib_entry:bool -> kernel_function -> bool (** @return [true] iff the given kernel function is the entry point. diff --git a/src/kernel_services/ast_data/kernel_function.mli b/src/kernel_services/ast_data/kernel_function.mli index 6c0f43f21885c29655969ce02d377623b53f4a70..1f3534a0d558942334464100e077f0ba32daf9cd 100644 --- a/src/kernel_services/ast_data/kernel_function.mli +++ b/src/kernel_services/ast_data/kernel_function.mli @@ -25,7 +25,7 @@ functions (like iterators over kernel functions). This kind of operations is stored in module {!Globals.Functions}. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types @@ -209,7 +209,7 @@ val is_return_stmt: t -> stmt -> bool (* ************************************************************************* *) val dummy: unit -> t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val get_vi : t -> varinfo val get_id: t -> int @@ -244,7 +244,7 @@ val get_statics : t -> varinfo list exception No_Definition val get_definition : t -> fundec (** @raise No_Definition if the given function is not a definition. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val has_definition : t -> bool (** @return [true] iff the given kernel function has a defintion. @@ -287,7 +287,7 @@ val get_called : exp -> t option (* ************************************************************************* *) (** Hashtable indexed by kernel functions and dealing with project. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Make_Table(Data: Datatype.S)(Info: State_builder.Info_with_size): State_builder.Hashtbl with type key = t and type data = Data.t diff --git a/src/kernel_services/ast_data/property.mli b/src/kernel_services/ast_data/property.mli index eaf6c8bc0db251ebc066d74efacee36d742d1a6b..af54a56f5721c77d18783a3897b1154558f7e86c 100644 --- a/src/kernel_services/ast_data/property.mli +++ b/src/kernel_services/ast_data/property.mli @@ -22,7 +22,7 @@ (** ACSL comparable property. @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types diff --git a/src/kernel_services/ast_data/property_status.mli b/src/kernel_services/ast_data/property_status.mli index 3252bc6eaf56fda2255248801eb65f64cddcf8ca..bbe2f162668e8d475022dc3730dd77d5d541cd79 100644 --- a/src/kernel_services/ast_data/property_status.mli +++ b/src/kernel_services/ast_data/property_status.mli @@ -22,7 +22,7 @@ (** Status of properties. @since Nitrogen-20111001 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************ *) (** {2 Local status} diff --git a/src/kernel_services/ast_printing/printer_api.mli b/src/kernel_services/ast_printing/printer_api.ml similarity index 100% rename from src/kernel_services/ast_printing/printer_api.mli rename to src/kernel_services/ast_printing/printer_api.ml diff --git a/src/kernel_services/ast_queries/acsl_extension.mli b/src/kernel_services/ast_queries/acsl_extension.mli index a651c98bf1f72df4f4ded14dda5d38bdcfaca299..6b581a5ec04b8b33ce937789375801bdd1676f4e 100644 --- a/src/kernel_services/ast_queries/acsl_extension.mli +++ b/src/kernel_services/ast_queries/acsl_extension.mli @@ -95,7 +95,7 @@ type extension_printer = | _ -> typing_context.error loc "expecting a predicate after keyword FOO" let () = Acsl_extension.register_behavior "FOO" foo_typer false ] - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_behavior: string -> ?preprocessor:extension_preprocessor -> extension_typer -> @@ -105,7 +105,7 @@ val register_behavior: (** Registers extension for global annotation. See [register_behavior]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_global: string -> ?preprocessor:extension_preprocessor -> extension_typer -> @@ -115,7 +115,7 @@ val register_global: (** Registers extension for global block annotation. See [register_behavior]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_global_block: string -> ?preprocessor:extension_preprocessor_block -> extension_typer_block -> @@ -126,7 +126,7 @@ val register_global_block: (** Registers extension for code annotation to be evaluated at _current_ program point. See [register_behavior]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_code_annot: string -> ?preprocessor:extension_preprocessor -> extension_typer -> @@ -137,7 +137,7 @@ val register_code_annot: (** Registers extension for code annotation to be evaluated for the _next_ statement. See [register_behavior]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_code_annot_next_stmt: string -> ?preprocessor:extension_preprocessor -> extension_typer -> @@ -147,7 +147,7 @@ val register_code_annot_next_stmt: (** Registers extension for loop annotation. See [register_behavior]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_code_annot_next_loop: string -> ?preprocessor:extension_preprocessor -> extension_typer -> @@ -158,7 +158,7 @@ val register_code_annot_next_loop: (** Registers extension both for code and loop annotations. See [register_behavior]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_code_annot_next_both: string -> ?preprocessor:extension_preprocessor -> extension_typer -> diff --git a/src/kernel_services/ast_queries/cil.ml b/src/kernel_services/ast_queries/cil.ml index 9f02a5b5590b5d8b724c0653fd4633652eaf35a9..9f06014cbb857fee989f7119f69b2874675b85b9 100644 --- a/src/kernel_services/ast_queries/cil.ml +++ b/src/kernel_services/ast_queries/cil.ml @@ -70,11 +70,6 @@ let () = Log.set_current_source (fun () -> fst (CurrentLoc.get ())) let pp_thisloc fmt = Location.pretty fmt (CurrentLoc.get ()) -let set_dependencies_of_ast, dependency_on_ast = - let list_self = ref [] in - (fun ast -> State_dependency_graph.add_dependencies ~from:ast !list_self), - (fun state -> list_self := state :: !list_self) - let voidType = Cil_const.voidType let intType = TInt(IInt,[]) let uintType = TInt(IUInt,[]) @@ -712,7 +707,6 @@ module FormalsDecl = end) let selfFormalsDecl = FormalsDecl.self -let () = dependency_on_ast selfFormalsDecl let makeFormalsVarDecl ?ghost (n,t,a) = let vi = makeVarinfo ?ghost ~temp:false false true n t in @@ -3965,7 +3959,6 @@ let find_sizeof t f = raise e let selfTypSize = TypSize.self -let () = dependency_on_ast selfTypSize (* Some basic type utilities *) let rank : ikind -> int = function @@ -6915,7 +6908,8 @@ module Switch_cases = let dependencies = [] let size = 49 end) -let () = dependency_on_ast Switch_cases.self + +let switch_case_state_self = Switch_cases.self let separate_switch_succs = Switch_cases.memo separate_switch_succs class dropAttributes ?select () = object(self) diff --git a/src/kernel_services/ast_queries/cil.mli b/src/kernel_services/ast_queries/cil.mli index 2fdf4cdfb8459f70ffcc6da3f75418a8b6e4ac51..84bc7f86f3189b98f4e940d1ed7fae540e5f37e5 100644 --- a/src/kernel_services/ast_queries/cil.mli +++ b/src/kernel_services/ast_queries/cil.mli @@ -46,7 +46,7 @@ CIL original API documentation is available as an html version at http://manju.cs.berkeley.edu/cil. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types open Cil_datatype @@ -1079,7 +1079,7 @@ val mkEmptyStmt: ?ghost:bool -> ?valid_sid:bool -> ?sattr:attributes -> val dummyInstr: instr (** A statement consisting of just [dummyInstr]. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val dummyStmt: stmt (** Create an instruction equivalent to a pure expression. The new instruction @@ -1493,33 +1493,33 @@ val typeAddGhost : typ -> typ (** Different visiting actions. 'a will be instantiated with [exp], [instr], etc. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type 'a visitAction = | SkipChildren (** Do not visit the children. Return the node as it is. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | DoChildren (** Continue with the children of this node. Rebuild the node on return if any of the children changes (use == test). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | DoChildrenPost of ('a -> 'a) (** visit the children, and apply the given function to the result. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | JustCopy (** visit the children, but only to make the necessary copies (only useful for copy visitor). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | JustCopyPost of ('a -> 'a) (** same as JustCopy + applies the given function to the result. - @plugin development guide*) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide*) | ChangeTo of 'a (** Replace the expression with the given one. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | ChangeToPost of 'a * ('a -> 'a) (** applies the expression to the function and gives back the result. Useful to insert some actions in an inheritance chain. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | ChangeDoChildrenPost of 'a * ('a -> 'a) (** First consider that the entire exp is replaced by the first parameter. Then continue with the children. On return rebuild the node if any of the children has changed and then apply the function on the node. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val mk_behavior : ?name:string -> @@ -1566,11 +1566,11 @@ val find_default_requires: behavior list -> identified_predicate list {!Visitor.generic_frama_c_visitor} instead of {!genericCilVisitor} or {!nopCilVisitor} - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) class type cilVisitor = object method behavior: Visitor_behavior.t (** the kind of behavior expected for the behavior. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method project: Project.t option (** Project the visitor operates on. Non-nil for copy visitor. @@ -1581,7 +1581,7 @@ class type cilVisitor = object method vfile: file -> file visitAction (** visit a whole file. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vvdec: varinfo -> varinfo visitAction (** Invoked for each variable declaration. The children to be traversed @@ -1591,20 +1591,20 @@ class type cilVisitor = object formals and locals of function definitions. This means that the list of formals of a function may be traversed multiple times if there exists both a declaration and a definition, or multiple declarations. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vvrbl: varinfo -> varinfo visitAction (** Invoked on each variable use. Here only the [SkipChildren] and [ChangeTo] actions make sense since there are no subtrees. Note that the type and attributes of the variable are not traversed for a variable use. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vexpr: exp -> exp visitAction (** Invoked on each expression occurrence. The subtrees are the subexpressions, the types (for a [Cast] or [SizeOf] expression) or the variable use. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlval: lval -> lval visitAction (** Invoked on each lvalue occurrence *) @@ -1613,7 +1613,7 @@ class type cilVisitor = object (** Invoked on each offset occurrence that is *not* as part of an initializer list specification, i.e. in an lval or recursively inside an offset. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vinitoffs: offset -> offset visitAction (** Invoked on each offset appearing in the list of a @@ -1630,7 +1630,7 @@ class type cilVisitor = object [Goto] and [Case] statements that point to the original statement. If you use the [ChangeTo] action then you should take care of preserving that sharing yourself. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vblock: block -> block visitAction (** Block. *) @@ -1640,7 +1640,7 @@ class type cilVisitor = object method vglob: global -> global list visitAction (** Global (vars, types, etc.) - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vinit: varinfo -> offset -> init -> init visitAction (** Initializers. Pass the global where this occurs, and the offset *) @@ -1692,7 +1692,7 @@ class type cilVisitor = object (** [Kstmt stmt] when visiting statement stmt, [Kglobal] when called outside of a statement. @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method push_stmt : stmt -> unit method pop_stmt : stmt -> unit @@ -1715,29 +1715,29 @@ class type cilVisitor = object method vterm_offset: term_offset -> term_offset visitAction method vlogic_label: logic_label -> logic_label visitAction method vlogic_info_decl: logic_info -> logic_info visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlogic_info_use: logic_info -> logic_info visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlogic_type_info_decl: logic_type_info -> logic_type_info visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlogic_type_info_use: logic_type_info -> logic_type_info visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlogic_type_def: logic_type_def -> logic_type_def visitAction method vlogic_ctor_info_decl: logic_ctor_info -> logic_ctor_info visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlogic_ctor_info_use: logic_ctor_info -> logic_ctor_info visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlogic_var_decl: logic_var -> logic_var visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vlogic_var_use: logic_var -> logic_var visitAction - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method vquantifiers: quantifiers -> quantifiers visitAction @@ -1773,11 +1773,11 @@ class type cilVisitor = object method fill_global_tables: unit (** fill the global environment tables at the end of a full copy in a new project. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method get_filling_actions: (unit -> unit) Queue.t (** get the queue of actions to be performed at the end of a full copy. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) end @@ -1831,19 +1831,19 @@ val doVisitList: (** Visit a file. This will re-cons all globals TWICE (so that it is * tail-recursive). Use {!Cil.visitCilFileSameGlobals} if your visitor will * not change the list of globals. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val visitCilFileCopy: cilVisitor -> file -> file (** Same thing, but the result is ignored. The given visitor must thus be an inplace visitor. Nothing is done if the visitor is a copy visitor. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val visitCilFile: cilVisitor -> file -> unit (** A visitor for the whole file that does not *physically* change the globals (but maybe changes things inside the globals through side-effects). Use this function instead of {!Cil.visitCilFile} whenever appropriate because it is more efficient for long files. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val visitCilFileSameGlobals: cilVisitor -> file -> unit (** Same as {!visitCilFilesSameGlobals}, but only visits function definitions @@ -2122,6 +2122,9 @@ val isSigned: ikind -> bool an lvalue which is a bitfield, the size of the bitfield is returned. *) val bitsSizeOfBitfield: typ -> int +val selfTypSize: State.t +(** Cache for sizeof *) + (** Returns a unique number representing the integer conversion rank. *) val rank: ikind -> int @@ -2274,7 +2277,7 @@ val cvar_to_term: loc:location -> varinfo -> term val make_temp_logic_var: logic_type -> logic_var (** The constant logic term zero. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val lzero : ?loc:location -> unit -> term (** The constant logic term 1. *) @@ -2337,14 +2340,7 @@ val separate_if_succs: stmt -> stmt * stmt (**/**) -val dependency_on_ast: State.t -> unit -(** indicates that the given state depends on the AST. *) - -val set_dependencies_of_ast : State.t -> unit -(** Makes all states that have been marked as depending on the AST by - {!dependency_on_ast} depend on the given state. Should only be used - once when creating the AST state. -*) +val switch_case_state_self: State.t val pp_typ_ref: (Format.formatter -> typ -> unit) ref val pp_global_ref: (Format.formatter -> global -> unit) ref diff --git a/src/kernel_services/ast_queries/cil_builtins.ml b/src/kernel_services/ast_queries/cil_builtins.ml index 9a825e39a8e08641d6d7de780e0b363fbed8d1cc..a596fa02ee7f098980ea4cab714e14b823a564d0 100644 --- a/src/kernel_services/ast_queries/cil_builtins.ml +++ b/src/kernel_services/ast_queries/cil_builtins.ml @@ -56,8 +56,6 @@ module Frama_c_builtins = let size = 3 end) -let () = Cil.dependency_on_ast Frama_c_builtins.self - let is_builtin v = Cil.hasAttribute "FC_BUILTIN" v.vattr let is_unused_builtin v = is_builtin v && not v.vreferenced diff --git a/src/kernel_services/ast_queries/cil_datatype.mli b/src/kernel_services/ast_queries/cil_datatype.mli index 9b37f9017f7c12fd90bf9fb31dae9bbbdfbaa1e5..d348749d99889ed6d083d637c0820eff1b796bf0 100644 --- a/src/kernel_services/ast_queries/cil_datatype.mli +++ b/src/kernel_services/ast_queries/cil_datatype.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Datatypes of some useful CIL types. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* This module should not be exported, but we need the alias and OCaml requires us to export it. *) @@ -261,7 +261,7 @@ module Typeinfo: S_with_collections with type t = typeinfo module Varinfo_Id: Hptmap.Id_Datatype with type t = varinfo -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Varinfo: sig include S_with_collections_pretty with type t = varinfo module Hptset: sig diff --git a/src/kernel_services/ast_queries/cil_state_builder.mli b/src/kernel_services/ast_queries/cil_state_builder.mli index 516ac23c060daeeb7bc6e86fadc1568e2b52514d..cd5240d4ac97fd1f3405ea387d7786c278278445 100644 --- a/src/kernel_services/ast_queries/cil_state_builder.mli +++ b/src/kernel_services/ast_queries/cil_state_builder.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Functors for building computations which use kernel datatypes. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Stmt_set_ref(Info: State_builder.Info) : State_builder.Set_ref with type elt = Cil_types.stmt @@ -29,7 +29,7 @@ module Stmt_set_ref(Info: State_builder.Info) : module Kinstr_hashtbl(Data:Datatype.S)(Info: State_builder.Info_with_size) : State_builder.Hashtbl with type key = Cil_types.kinstr and type data = Data.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Stmt_hashtbl(Data:Datatype.S)(Info: State_builder.Info_with_size) : State_builder.Hashtbl with type key = Cil_types.stmt and type data = Data.t diff --git a/src/kernel_services/ast_queries/file.ml b/src/kernel_services/ast_queries/file.ml index b3fa4fca000d301cbed097f3017df518d490e658..7f19c90190bad23e96d5828f19b7f01b1d5364b7 100644 --- a/src/kernel_services/ast_queries/file.ml +++ b/src/kernel_services/ast_queries/file.ml @@ -1856,7 +1856,7 @@ let init_from_cmdline () = Project.set_current prj2; end; let files = Kernel.Files.get () in - if files = [] && not !Fc_config.is_gui then Kernel.warning "no input file."; + if files = [] && not Fc_config.is_gui then Kernel.warning "no input file."; let files = List.map (fun f -> from_filename f) files in try init_from_c_files files; diff --git a/src/kernel_services/ast_queries/file.mli b/src/kernel_services/ast_queries/file.mli index 8042cf4420e9f471b83b2c6d9dc6ae000bd45e90..10473c5178bb005926953ea4ea2b1e84b601aceb 100644 --- a/src/kernel_services/ast_queries/file.mli +++ b/src/kernel_services/ast_queries/file.mli @@ -50,7 +50,7 @@ val new_file_type: string -> (string -> Cil_types.file * Cabs.file) -> unit (** [new_file_type suffix func funcname] registers a new type of files (with corresponding suffix) as recognized by Frama-C through [func]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val new_machdep: string -> Cil_types.mach -> unit @@ -60,7 +60,7 @@ val new_machdep: string -> Cil_types.mach -> unit (fun () -> File.new_machdep "my_machdep" my_machdep_implem)] @since Nitrogen-20111001 @raise Invalid_argument if the given name already exists - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val machdep_macro: string -> string (** [machdep_macro machine] returns the name of a macro __FC_MACHDEP_XXX so @@ -110,7 +110,7 @@ val add_code_transformation_before_cleanup: At this level, globals and ACSL annotations have not been registered. @since Neon-20140301 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val add_code_transformation_after_cleanup: ?deps:(module Parameter_sig.S) list -> @@ -124,7 +124,7 @@ val add_code_transformation_after_cleanup: Note that it is the responsibility of the hook to use {!Ast.mark_as_changed} or {!Ast.mark_as_grown} whenever it is the case. @since Neon-20140301 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val constfold: code_transformation_category (** category for syntactic constfolding (done after cleanup) @@ -135,7 +135,7 @@ val must_recompute_cfg: Cil_types.fundec -> unit when they modify statements in function [f]. This will trigger a recomputation of the cfg of [f] after the transformation. @since Neon-20140301 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val get_suffixes: unit -> string list (** @return the list of accepted suffixes of input source files @@ -172,14 +172,14 @@ val init_from_c_files: t list -> unit (** Initialize the cil file representation of the current project. Should be called at most once per project. @raise File_types.Bad_Initialization if called more than once. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val init_project_from_cil_file: Project.t -> Cil_types.file -> unit (** Initialize the cil file representation with the given file for the given project from the current one. Should be called at most once per project. @raise File_types.Bad_Initialization if called more than once. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val init_project_from_visitor: ?reorder:bool -> Project.t -> Visitor.frama_c_visitor -> unit @@ -190,7 +190,7 @@ val init_project_from_visitor: if [reorder] is [true] (default is [false]) the new AST in [prj] will be reordered. @since Oxygen-20120901 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val create_project_from_visitor: @@ -207,7 +207,7 @@ val create_project_from_visitor: file (i.e. it should use {!Cil.copy_visit} at some point). @raise File_types.Bad_Initialization if called more than once. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val create_rebuilt_project_from_visitor: ?reorder:bool -> ?last:bool -> ?preprocess:bool -> @@ -233,7 +233,7 @@ val init_from_cmdline: unit -> unit command line. Should be called at most once per project. @raise File_types.Bad_Initialization if called more than once. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val reorder_ast: unit -> unit (** reorder globals so that all uses of an identifier are preceded by its diff --git a/src/kernel_services/ast_queries/logic_const.ml b/src/kernel_services/ast_queries/logic_const.ml index 8b0030707084d570c0765af217a5a9fe898789a8..459a8569510d28889fdc4f2ca6e1e1108fa6efde 100644 --- a/src/kernel_services/ast_queries/logic_const.ml +++ b/src/kernel_services/ast_queries/logic_const.ml @@ -25,7 +25,7 @@ open Cil_types (** Smart constructors for the logic. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** {1 Identification Numbers} *) @@ -261,7 +261,7 @@ let addTermOffsetLval toadd (b, off) : term_lval = (** {2 Terms} *) (* empty line for ocamldoc *) -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) let term ?(loc=Cil_datatype.Location.unknown) term typ = { term_node = term; term_type = typ; @@ -406,7 +406,7 @@ let piff ?(loc=Cil_datatype.Location.unknown) (p2,p3) = | _, Ptrue -> p2 | _,_ -> unamed ~loc (Piff (p2,p3)) -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) let prel ?(loc=Cil_datatype.Location.unknown) (a,b,c) = unamed ~loc (Prel(a,b,c)) diff --git a/src/kernel_services/ast_queries/logic_const.mli b/src/kernel_services/ast_queries/logic_const.mli index 2a7d97c98f428e97ff7f5cbba534aa74270a7f91..5bbc7457d3e8f2e574fd4845811ffc42b4e8da7c 100644 --- a/src/kernel_services/ast_queries/logic_const.mli +++ b/src/kernel_services/ast_queries/logic_const.mli @@ -23,7 +23,7 @@ (**************************************************************************) (** Smart constructors for logic annotations. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types open Cil_datatype @@ -65,7 +65,7 @@ val toplevel_predicate: ?kind:predicate_kind -> predicate -> toplevel_predicate val new_predicate: ?kind:predicate_kind -> predicate -> identified_predicate (** creates a new acsl_extension with a fresh id. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Chlorine-20180501 *) val new_acsl_extension: @@ -162,7 +162,7 @@ val pif: val piff: ?loc:location -> predicate * predicate -> predicate (** Binary relation. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val prel: ?loc:location -> relation * term * term -> predicate (** \forall *) diff --git a/src/kernel_services/ast_queries/logic_typing.mli b/src/kernel_services/ast_queries/logic_typing.mli index ed6332ae3be24476939b6755313235ee1ee6f3a8..ef8c2d3c9ffe5eb8231fa04760fdbd083f3fa8c2 100644 --- a/src/kernel_services/ast_queries/logic_typing.mli +++ b/src/kernel_services/ast_queries/logic_typing.mli @@ -80,15 +80,15 @@ module Lenv : sig end +type type_namespace = Typedef | Struct | Union | Enum (** The different namespaces a C type can belong to, used when we are searching a type by its name. *) -type type_namespace = Typedef | Struct | Union | Enum module Type_namespace: Datatype.S with type t = type_namespace (** Functions that can be called when type-checking an extension of ACSL. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type typing_context = { is_loop: unit -> bool; diff --git a/src/kernel_services/ast_queries/logic_utils.mli b/src/kernel_services/ast_queries/logic_utils.mli index 47640ad176d0f60eb76f190d1882b3c2514399ed..6a58e95a87d18225ce75c5d49d7c632cf1bf2653 100644 --- a/src/kernel_services/ast_queries/logic_utils.mli +++ b/src/kernel_services/ast_queries/logic_utils.mli @@ -23,7 +23,7 @@ (**************************************************************************) (** Utilities for ACSL constructs. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types @@ -33,7 +33,7 @@ exception Not_well_formed of location * string (** basic utilities for logic terms and predicates. See also {! Logic_const} to build terms and predicates. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** add a logic function in the environment. See {!Logic_env.add_logic_function_gen}*) diff --git a/src/kernel_services/cmdline_parameters/cmdline.ml b/src/kernel_services/cmdline_parameters/cmdline.ml index 2c79c7550cc7202859a342c271d64bbcf0e02a90..16882810a482eb983e10567e1d055eafcbc01eb4 100644 --- a/src/kernel_services/cmdline_parameters/cmdline.ml +++ b/src/kernel_services/cmdline_parameters/cmdline.ml @@ -86,7 +86,7 @@ let long_plugin_name s = if s = Log.kernel_label_name then "Frama-C" else "Plug-in " ^ s let additional_info () = - if !Fc_config.is_gui then + if Fc_config.is_gui then "\nReverting to previous state.\n\ Check the Console tab for additional information." else diff --git a/src/kernel_services/cmdline_parameters/cmdline.mli b/src/kernel_services/cmdline_parameters/cmdline.mli index be3762b11cb77aa4587f19a17d06241c83298c09..7092c071da5cc1a8f426646d13b92aa5a58f4443 100644 --- a/src/kernel_services/cmdline_parameters/cmdline.mli +++ b/src/kernel_services/cmdline_parameters/cmdline.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Command line parsing. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************** *) (** {2 Stage configurations} @@ -33,39 +33,39 @@ type stage = | Early (** Initial stage for very specific almost hard-coded options. Do not use it. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Extending (** Before loading plug-ins. Run only once. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Extended (** The stage where plug-ins are loaded. It is also the first stage each time the Frama-C main loop is run (e.g. after each "-then"). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Exiting (** Run once when exiting Frama-C. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Loading (** After {!Extended}, the stage where a previous Frama-C internal states is restored (e.g. the one specified by -load or by running the journal). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Configuring (** The stage where all the parameters which were not already set may be modified to take into account cmdline options. Just after this stage, Frama-C will run the plug-in mains. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** The different stages, from the first to be executed to the last one. @since Beryllium-20090601-beta1 *) val run_after_early_stage: (unit -> unit) -> unit (** Register an action to be executed at the end of the early stage. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Beryllium-20090901 *) val run_during_extending_stage: (unit -> unit) -> unit (** Register an action to be executed during the extending stage. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Beryllium-20090901 *) val run_after_extended_stage: (unit -> unit) -> unit (** Register an action to be executed at the end of the extended stage. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Beryllium-20090901 *) type exit @@ -73,21 +73,21 @@ type exit val nop : exit (** @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) exception Exit (** @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val run_after_exiting_stage: (unit -> exit) -> unit (** Register an action to be executed at the end of the exiting stage. The guarded action must finish by [exit n]. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Beryllium-20090601-beta1 *) val run_after_loading_stage: (unit -> unit) -> unit (** Register an action to be executed at the end of the loading stage. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Beryllium-20090601-beta1 *) val is_going_to_load: unit -> unit @@ -95,17 +95,17 @@ val is_going_to_load: unit -> unit It is not necessary to call this function if the running action is set by an option put on the command line. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val run_after_configuring_stage: (unit -> unit) -> unit (** Register an action to be executed at the end of the configuring stage. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Beryllium-20090601-beta1 *) val run_after_setting_files: (string list -> unit) -> unit (** Register an action to be executed just after setting the files put on the command line. The argument of the function is the list of files. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Carbon-20101201 *) val at_normal_exit: (unit -> unit) -> unit @@ -220,7 +220,7 @@ val nb_given_options: unit -> int Should not be called before the end of the command line parsing. @since Beryllium-20090601-beta1 *) -val use_cmdline_files: (Datatype.Filepath.t list -> unit) -> unit +val use_cmdline_files: (Filepath.Normalized.t list -> unit) -> unit (** What to do with the list of files put on the command lines. @since Beryllium-20090601-beta1 *) diff --git a/src/kernel_services/cmdline_parameters/parameter_customize.mli b/src/kernel_services/cmdline_parameters/parameter_customize.mli index 4576d52168e884dcbbf452272a03faa9fbabd770..0c809681c05a7039564f51db235b0a82e5487cb4 100644 --- a/src/kernel_services/cmdline_parameters/parameter_customize.mli +++ b/src/kernel_services/cmdline_parameters/parameter_customize.mli @@ -26,7 +26,7 @@ provided by the functor {!Plugin.Register} and generating a new parameter. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val set_cmdline_stage: Cmdline.stage -> unit (** Set the stage where the option corresponding to the parameter is @@ -54,7 +54,7 @@ val set_negative_option_name: string -> unit Assume that the given string is a valid option name or empty. If it is empty, no negative option is created. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val set_negative_option_help: string -> unit (** For boolean parameters, set the help message of the negative diff --git a/src/kernel_services/cmdline_parameters/parameter_sig.mli b/src/kernel_services/cmdline_parameters/parameter_sig.ml similarity index 94% rename from src/kernel_services/cmdline_parameters/parameter_sig.mli rename to src/kernel_services/cmdline_parameters/parameter_sig.ml index b5558a5aa42f0b5a808ff2402cb2480d6afc9354..e032660b655222f1a79e1d730d0e6aff30886573 100644 --- a/src/kernel_services/cmdline_parameters/parameter_sig.mli +++ b/src/kernel_services/cmdline_parameters/parameter_sig.ml @@ -216,7 +216,7 @@ end (* ************************************************************************** *) (** Signature for a boolean parameter. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module type Bool = sig include S with type t = bool @@ -230,7 +230,7 @@ module type Bool = sig end (** Signature for an integer parameter. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module type Int = sig include S with type t = int @@ -437,7 +437,7 @@ module type String_set = (** Set of defined kernel functions. If you want to also include pure prototype, use {!Parameter_customize.argument_may_be_fundecl}. @since Sodium-20150201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module type Kernel_function_set = Set with type elt = Cil_types.kernel_function and type t = Cil_datatype.Kf.Set.t @@ -515,7 +515,7 @@ module type Filepath_map = (** Signatures containing the different functors which may be used to generate new command line options. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module type Builder = sig val no_element_of_string: string -> 'a @@ -526,26 +526,26 @@ module type Builder = sig module Bool(X:sig include Input val default: bool end): Bool module Action(X: Input) : Bool - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module False(X: Input) : Bool - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module True(X: Input) : Bool module WithOutput (X: sig include Input val output_by_default: bool end): With_output - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Int(X: sig include Input_with_arg val default: int end): Int - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Zero(X: Input_with_arg): Int - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module String(X: sig include Input_with_arg val default: string end): String - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Empty_string(X: Input_with_arg): String module Fc_Filepath = Filepath @@ -568,7 +568,7 @@ module type Builder = sig (X: sig include Input_collection val default: E.Set.t end): Set with type elt = E.t and type t = E.Set.t - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module String_set(X: Input_with_arg): String_set module Filled_string_set @@ -577,7 +577,7 @@ module type Builder = sig val default: Datatype.String.Set.t end): String_set - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Kernel_function_set(X: Input_with_arg): Kernel_function_set module Fundec_set(X: Input_with_arg): Fundec_set diff --git a/src/kernel_services/cmdline_parameters/parameter_state.mli b/src/kernel_services/cmdline_parameters/parameter_state.mli index 1329f9bff5f0deab8a912e1f22c3db725177eed0..e4be535b2ab3d648e8e8662ae7a1c054f52cccf0 100644 --- a/src/kernel_services/cmdline_parameters/parameter_state.mli +++ b/src/kernel_services/cmdline_parameters/parameter_state.mli @@ -33,7 +33,7 @@ val get_selection: ?is_set:bool -> unit -> State_selection.t [is_set] is [true] by default (for backward compatibility): in such a case, for each option, the extra internal state indicating whether it is set also belongs to the selection. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val get_reset_selection: ?is_set:bool -> unit -> State_selection.t (** Selection of resettable parameters in case of copy with a visitor. diff --git a/src/kernel_services/parsetree/cabs.mli b/src/kernel_services/parsetree/cabs.ml similarity index 98% rename from src/kernel_services/parsetree/cabs.mli rename to src/kernel_services/parsetree/cabs.ml index 5313481fd20a90ef97ce08562d05128293185d6c..309a515159c8e40cb3c7c78826ce85f3c482c475 100644 --- a/src/kernel_services/parsetree/cabs.mli +++ b/src/kernel_services/parsetree/cabs.ml @@ -42,7 +42,7 @@ (****************************************************************************) (** Untyped AST. - @plugin development guide **) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide **) (* ** Types @@ -175,7 +175,7 @@ and definition = | GLOBANNOT of Logic_ptree.decl list (** the file name, and then the list of toplevel forms. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) and file = Datatype.Filepath.t * (bool * definition) list diff --git a/src/kernel_services/parsetree/cabshelper.ml b/src/kernel_services/parsetree/cabshelper.ml index 539e06499c9577704aa9506441db1f44fad2e1e4..7c67c2cfeb56c64b7af25c5bc7c601a92a359277 100644 --- a/src/kernel_services/parsetree/cabshelper.ml +++ b/src/kernel_services/parsetree/cabshelper.ml @@ -71,7 +71,6 @@ struct let default () = MyTable.empty end) let self = MyState.self - let () = Cil.dependency_on_ast self (* What matters is the beginning of the comment. *) let add (first,last) comment = diff --git a/src/kernel_services/parsetree/logic_ptree.mli b/src/kernel_services/parsetree/logic_ptree.ml similarity index 100% rename from src/kernel_services/parsetree/logic_ptree.mli rename to src/kernel_services/parsetree/logic_ptree.ml diff --git a/src/kernel_services/plugin_entry_points/db.ml b/src/kernel_services/plugin_entry_points/db.ml index 64e5c108ab5c3840e18f335d49f175bf582864d0..4d69ac1a7f47a72f2d819c48e4655f08e40f7fa6 100644 --- a/src/kernel_services/plugin_entry_points/db.ml +++ b/src/kernel_services/plugin_entry_points/db.ml @@ -708,86 +708,6 @@ module From = struct end end -(* ************************************************************************* *) -(** {2 PDG} *) -(* ************************************************************************* *) - -module Pdg = struct - type t = PdgTypes.Pdg.t - - type t_nodes_and_undef = - ((PdgTypes.Node.t * Locations.Zone.t option) list * Locations.Zone.t option) - - exception Top = PdgTypes.Pdg.Top - exception Bottom = PdgTypes.Pdg.Bottom - - let self = ref State.dummy - - let get = mk_fun "Pdg.get" - - let from_same_fun pdg1 pdg2 = - let kf1 = PdgTypes.Pdg.get_kf pdg1 in - let kf2 = PdgTypes.Pdg.get_kf pdg2 in - Kernel_function.equal kf1 kf2 - - let node_key = mk_fun "Pdg.node_key" - - let find_decl_var_node = mk_fun "Pdg.find_decl_var_node" - let find_input_node = mk_fun "Pdg.find_input_nodes" - let find_ret_output_node = mk_fun "Pdg.find_ret_output_node" - let find_output_nodes = mk_fun "Pdg.find_output_nodes" - let find_all_inputs_nodes = mk_fun "Pdg.find_all_inputs_nodes" - let find_stmt_and_blocks_nodes = mk_fun "Pdg.find_stmt_and_blocks_nodes" - let find_simple_stmt_nodes = mk_fun "Pdg.find_simplestmt_nodes" - let find_stmt_node = mk_fun "Pdg.find_stmt_node" - let find_label_node = mk_fun "Pdg.find_label_node" - let find_entry_point_node = mk_fun "Pdg.find_entry_point_node" - let find_top_input_node = mk_fun "Pdg.find_top_input_node" - let find_call_ctrl_node = mk_fun "Pdg.find_call_ctrl_node" - let find_location_nodes_at_stmt = mk_fun "Pdg.find_location_nodes_at_stmt" - let find_location_nodes_at_end = mk_fun "Pdg.find_location_nodes_at_end" - let find_location_nodes_at_begin = mk_fun "Pdg.find_location_nodes_at_begin" - let find_call_input_node = mk_fun "Pdg.find_call_input_node" - let find_call_output_node = mk_fun "Pdg.find_call_output_node" - let find_code_annot_nodes = mk_fun "Pdg.find_code_annot_nodes" - let find_fun_precond_nodes = mk_fun "Pdg.find_fun_precond_nodes" - let find_fun_postcond_nodes = mk_fun "Pdg.find_fun_postcond_nodes" - let find_fun_variant_nodes = mk_fun "Pdg.find_fun_variant_nodes" - - let find_call_out_nodes_to_select = mk_fun "Pdg.find_call_out_nodes_to_select" - let find_in_nodes_to_select_for_this_call = - mk_fun "Pdg.find_in_nodes_to_select_for_this_call" - - let direct_dpds = mk_fun "Pdg.direct_dpds" - let direct_ctrl_dpds = mk_fun "Pdg.direct_ctrl_dpds" - let direct_data_dpds = mk_fun "Pdg.direct_data_dpds" - let direct_addr_dpds = mk_fun "Pdg.direct_addr_dpds" - - let all_dpds = mk_fun "Pdg.all_dpds" - let all_ctrl_dpds = mk_fun "Pdg.all_ctrl_dpds" - let all_data_dpds = mk_fun "Pdg.all_data_dpds" - let all_addr_dpds = mk_fun "Pdg.all_addr_dpds" - - let direct_uses = mk_fun "Pdg.direct_uses" - let direct_ctrl_uses = mk_fun "Pdg.direct_ctrl_uses" - let direct_data_uses = mk_fun "Pdg.direct_data_uses" - let direct_addr_uses = mk_fun "Pdg.direct_addr_uses" - - let all_uses = mk_fun "Pdg.all_uses" - - let custom_related_nodes = mk_fun "Pdg.custom_related_nodes" - - let find_call_stmts = mk_fun "Pdg.find_call_stmts" - - let iter_nodes = mk_fun "Pdg.iter_nodes" - - let extract = mk_fun "Pdg.extract" - let pretty = ref (fun ?bw:_ _ _ -> mk_labeled_fun "Pdg.pretty") - let pretty_node = mk_fun "Pdg.pretty_node" - let pretty_key = mk_fun "Pdg.pretty_key" - -end - (* ************************************************************************* *) (** {2 Properties} *) (* ************************************************************************* *) diff --git a/src/kernel_services/plugin_entry_points/db.mli b/src/kernel_services/plugin_entry_points/db.mli index a3619aec348d0cc83547ec00ec64e13d5d6955a9..62334a53e2eda38fd43e4b647ac20c2b526507ff 100644 --- a/src/kernel_services/plugin_entry_points/db.mli +++ b/src/kernel_services/plugin_entry_points/db.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Database in which static plugins are registered. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** Modules providing general services: @@ -68,12 +68,12 @@ val register_guarded_compute: (** Frama-C main interface. @since Lithium-20081201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Main: sig val extend : (unit -> unit) -> unit (** Register a function to be called by the Frama-C main entry point. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val play: (unit -> unit) ref (** Run all the Frama-C analyses. This function should be called only by @@ -117,7 +117,7 @@ module Value : sig val self : State.t (** Internal state of the value analysis from projects viewpoint. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val mark_as_computed: unit -> unit (** Indicate that the value analysis has been done already. *) @@ -129,11 +129,11 @@ module Value : sig @raise Db.Value.Incorrect_number_of_arguments if some arguments are specified for the entry point using {!Db.Value.fun_set_args}, and an incorrect number of them is given. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val is_computed: unit -> bool (** Return [true] iff the value analysis has been done. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Table_By_Callstack: State_builder.Hashtbl with type key = stmt @@ -226,7 +226,7 @@ module Value : sig val get_stmt_state : ?after:bool -> stmt -> state (** [after] is false by default. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val fold_stmt_state_callstack : (state -> 'a -> 'a) -> 'a -> after:bool -> stmt -> 'a @@ -291,7 +291,7 @@ module Value : sig val is_accessible : kinstr -> bool val is_reachable : state -> bool - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val is_reachable_stmt : stmt -> bool @@ -563,7 +563,7 @@ end (* ************************************************************************* *) (** Dealing with logical properties. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Properties : sig (** Interpretation of logic terms. *) @@ -844,329 +844,6 @@ module Security : sig end -(** Program Dependence Graph. - @see <../pdg/index.html> PDG internal documentation. *) -module Pdg : sig - - exception Bottom - (** Raised by most function when the PDG is Bottom because we can hardly do - nothing with it. It happens when the function is unreachable because we - have no information about it. *) - - exception Top - (** Raised by most function when the PDG is Top because we can hardly do - nothing with it. It happens when we didn't manage to compute it, for - instance for a variadic function. *) - - type t = PdgTypes.Pdg.t - (** PDG type *) - - type t_nodes_and_undef = - ((PdgTypes.Node.t * Locations.Zone.t option) list * Locations.Zone.t option) - (** type for the return value of many [find_xxx] functions when the - answer can be a list of [(node, z_part)] and an [undef zone]. - For each node, [z_part] can specify which part of the node - is used in terms of zone ([None] means all). - *) - - val self : State.t ref - - (** {3 Getters} *) - - val get : (kernel_function -> t) ref - (** Get the PDG of a function. Build it if it doesn't exist yet. *) - - val node_key : (PdgTypes.Node.t -> PdgIndex.Key.t) ref - - val from_same_fun : t -> t -> bool - - (** {3 Finding PDG nodes} *) - - val find_decl_var_node : (t -> Cil_types.varinfo -> PdgTypes.Node.t) ref - (** Get the node corresponding the declaration of a local variable or a - formal parameter. - @raise Not_found if the variable is not declared in this function. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_ret_output_node : (t -> PdgTypes.Node.t) ref - (** Get the node corresponding return stmt. - @raise Not_found if the output state in unreachable - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_output_nodes : - (t -> PdgIndex.Signature.out_key -> t_nodes_and_undef) ref - (** Get the nodes corresponding to a call output key in the called pdg. - @raise Not_found if the output state in unreachable - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_input_node : (t -> int -> PdgTypes.Node.t) ref - (** Get the node corresponding to a given input (parameter). - @raise Not_found if the number is not an input number. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_all_inputs_nodes : (t -> PdgTypes.Node.t list) ref - (** Get the nodes corresponding to all inputs. - {!node_key} can be used to know their numbers. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_stmt_node : (t -> Cil_types.stmt -> PdgTypes.Node.t) ref - (** Get the node corresponding to the statement. - It shouldn't be a call statement. - See also {!find_simple_stmt_nodes} or {!find_call_stmts}. - @raise Not_found if the given statement is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. - @raise PdgIndex.CallStatement if the given stmt is a function - call. *) - - - val find_simple_stmt_nodes : (t -> Cil_types.stmt -> PdgTypes.Node.t list) ref - (** Get the nodes corresponding to the statement. - It is usually composed of only one node (see {!find_stmt_node}), - except for call statement. - Be careful that for block statements, it only returns a node - corresponding to the elementary stmt - (see {!find_stmt_and_blocks_nodes} for more) - @raise Not_found if the given statement is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_label_node : (t -> Cil_types.stmt -> Cil_types.label -> PdgTypes.Node.t) ref - (** Get the node corresponding to the label. - @raise Not_found if the given label is not in the PDG. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_stmt_and_blocks_nodes : (t -> Cil_types.stmt -> PdgTypes.Node.t list) ref - (** Get the nodes corresponding to the statement like - * {!find_simple_stmt_nodes} but also add the nodes of the enclosed - * statements if [stmt] contains blocks. - @raise Not_found if the given statement is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_top_input_node : (t -> PdgTypes.Node.t) ref - (** @raise Not_found if there is no top input in the PDG. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_entry_point_node : (t -> PdgTypes.Node.t) ref - (** Find the node that represent the entry point of the function, i.e. the - higher level block. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_location_nodes_at_stmt : - (t -> Cil_types.stmt -> before:bool -> Locations.Zone.t - -> t_nodes_and_undef) ref - (** Find the nodes that define the value of the location at the given - program point. Also return a zone that might be undefined at that - point. - @raise Not_found if the given statement is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_location_nodes_at_end : - (t -> Locations.Zone.t -> t_nodes_and_undef) ref - (** Same than {!find_location_nodes_at_stmt} for the program point located - at the end of the function. - @raise Not_found if the output state is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_location_nodes_at_begin : - (t -> Locations.Zone.t -> t_nodes_and_undef) ref - (** Same than {!find_location_nodes_at_stmt} for the program point located - at the beginning of the function. - Notice that it can only find formal argument nodes. - The remaining zone (implicit input) is returned as undef. - @raise Not_found if the output state is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_call_stmts: - (kernel_function -> caller:kernel_function -> Cil_types.stmt list) ref - (** Find the call statements to the function (can maybe be somewhere - else). - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_call_ctrl_node : (t -> Cil_types.stmt -> PdgTypes.Node.t) ref - (** @raise Not_found if the call is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_call_input_node : (t -> Cil_types.stmt -> int -> PdgTypes.Node.t) ref - (** @raise Not_found if the call is unreachable or has no such input. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_call_output_node : (t -> Cil_types.stmt -> PdgTypes.Node.t) ref - (** @raise Not_found if the call is unreachable or has no output node. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_code_annot_nodes : - (t -> Cil_types.stmt -> Cil_types.code_annotation -> - PdgTypes.Node.t list * PdgTypes.Node.t list * (t_nodes_and_undef option)) ref - (** The result is composed of three parts : - - the first part of the result are the control dependencies nodes - of the annotation, - - the second part is the list of declaration nodes of the variables - used in the annotation; - - the third part is similar to [find_location_nodes_at_stmt] result - but for all the locations needed by the annotation. - When the third part is globally [None], - it means that we were not able to compute this information. - @raise Not_found if the statement is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val find_fun_precond_nodes : - (t -> Cil_types.predicate -> PdgTypes.Node.t list * (t_nodes_and_undef option)) ref - (** Similar to [find_code_annot_nodes] (no control dependencies nodes) *) - - val find_fun_postcond_nodes : - (t -> Cil_types.predicate -> PdgTypes.Node.t list * (t_nodes_and_undef option)) ref - (** Similar to [find_fun_precond_nodes] *) - - val find_fun_variant_nodes : - (t -> Cil_types.term -> (PdgTypes.Node.t list * t_nodes_and_undef option)) ref - (** Similar to [find_fun_precond_nodes] *) - - (** {3 Propagation} - See also [Pdg.mli] for more function that cannot be here because - they use polymorphic types. - **) - - val find_call_out_nodes_to_select : - (t -> PdgTypes.NodeSet.t -> t -> Cil_types.stmt -> PdgTypes.Node.t list) ref - (** [find_call_out_nodes_to_select pdg_called called_selected_nodes - pdg_caller call_stmt] - @return the call outputs nodes [out] such that - [find_output_nodes pdg_called out_key] - intersects [called_selected_nodes]. *) - - val find_in_nodes_to_select_for_this_call : - (t -> PdgTypes.NodeSet.t -> Cil_types.stmt -> t -> PdgTypes.Node.t list) ref - (** [find_in_nodes_to_select_for_this_call - pdg_caller caller_selected_nodes call_stmt pdg_called] - @return the called input nodes such that the corresponding nodes - in the caller intersect [caller_selected_nodes] - @raise Not_found if the statement is unreachable. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - (** {3 Dependencies} *) - - val direct_dpds : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** Get the nodes to which the given node directly depend on. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val direct_ctrl_dpds : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** Similar to {!direct_dpds}, but for control dependencies only. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val direct_data_dpds : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** Similar to {!direct_dpds}, but for data dependencies only. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val direct_addr_dpds : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** Similar to {!direct_dpds}, but for address dependencies only. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val all_dpds : (t -> PdgTypes.Node.t list -> PdgTypes.Node.t list) ref - (** Transitive closure of {!direct_dpds} for all the given nodes. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val all_data_dpds : (t -> PdgTypes.Node.t list -> PdgTypes.Node.t list) ref - (** Gives the data dependencies of the given nodes, and recursively, all - the dependencies of those nodes (regardless to their kind). - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val all_ctrl_dpds : (t -> PdgTypes.Node.t list -> PdgTypes.Node.t list) ref - (** Similar to {!all_data_dpds} for control dependencies. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val all_addr_dpds : (t -> PdgTypes.Node.t list -> PdgTypes.Node.t list) ref - (** Similar to {!all_data_dpds} for address dependencies. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val direct_uses : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** build a list of all the nodes that have direct dependencies on the - given node. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val direct_ctrl_uses : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** Similar to {!direct_uses}, but for control dependencies only. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val direct_data_uses : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** Similar to {!direct_uses}, but for data dependencies only. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val direct_addr_uses : (t -> PdgTypes.Node.t -> PdgTypes.Node.t list) ref - (** Similar to {!direct_uses}, but for address dependencies only. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val all_uses : (t -> PdgTypes.Node.t list -> PdgTypes.Node.t list) ref - (** build a list of all the nodes that have dependencies (even indirect) on - the given nodes. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val custom_related_nodes : - ((PdgTypes.Node.t -> PdgTypes.Node.t list) -> PdgTypes.Node.t list -> PdgTypes.Node.t list) ref - (** [custom_related_nodes get_dpds node_list] build a list, starting from - the node in [node_list], and recursively add the nodes given by the - function [get_dpds]. For this function to work well, it is important - that [get_dpds n] returns a subset of the nodes directly related to - [n], ie a subset of [direct_uses] U [direct_dpds]. - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - val iter_nodes : ((PdgTypes.Node.t -> unit) -> t -> unit) ref - (** apply a given function to all the PDG nodes - @raise Bottom if given PDG is bottom. - @raise Top if the given pdg is top. *) - - (** {3 Pretty printing} *) - - val extract : (t -> string -> unit) ref - (** Pretty print pdg into a dot file. - @see <../pdg/index.html> PDG internal documentation. *) - - val pretty_node : (bool -> Format.formatter -> PdgTypes.Node.t -> unit) ref - (** Pretty print information on a node : with [short=true], only the id - of the node is printed.. *) - - val pretty_key : (Format.formatter -> PdgIndex.Key.t -> unit) ref - (** Pretty print information on a node key *) - - val pretty : (?bw:bool -> Format.formatter -> t -> unit) ref - (** For debugging... Pretty print pdg information. - Print codependencies rather than dependencies if [bw=true]. *) - -end - - (** Signature common to some Inout plugin options. The results of the computations are available on a per function basis. *) module type INOUTKF = sig @@ -1257,7 +934,7 @@ module Derefs : INOUT with type t = Locations.Zone.t (** This function should be called from time to time by all analysers taking time. In GUI mode, this will make the interface reactive. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @deprecated 21.0-Scandium *) val progress: (unit -> unit) ref [@@ deprecated "Use Db.yield instead."] diff --git a/src/kernel_services/plugin_entry_points/dynamic.ml b/src/kernel_services/plugin_entry_points/dynamic.ml index 7e6fa5480075aea0ca8ceca8f94efe99fdfccbca..4db425f44967bae4992b9483f10a54d46bb78414 100644 --- a/src/kernel_services/plugin_entry_points/dynamic.ml +++ b/src/kernel_services/plugin_entry_points/dynamic.ml @@ -122,235 +122,39 @@ let is_object base = (* --- Package Loading --- *) (* -------------------------------------------------------------------------- *) -let packages = Hashtbl.create 64 - -let () = List.iter (fun p -> Hashtbl.add packages p ()) ("frama-c.kernel"::Fc_config.library_names) - -let missing pkg = not (Hashtbl.mem packages pkg) - -let once pkg = - if Hashtbl.mem packages pkg then false - else ( Hashtbl.add packages pkg () ; true ) - -let is_loaded pkg = Hashtbl.mem packages pkg - -exception ArchiveError of string - -let load_archive pkg base file = - let path = - try Findlib.resolve_path ~base file - with Not_found -> - let msg = Printf.sprintf "archive '%s' not found in '%s'" file base in - raise (ArchiveError msg) - in dynlib_module pkg path - -let mem_package pkg = - try ignore (Findlib.package_directory pkg) ; true - with Findlib.No_such_package _ -> false - -let is_virtual pkg = - try ignore (Findlib.package_property [] pkg "archive") ; false - with Not_found -> true - let load_packages pkgs = - Klog.debug ~dkey "trying to load %a" - (Pretty_utils.pp_list ~sep:"@, " Format.pp_print_string) pkgs; - try - let pkgs = List.filter missing pkgs in - List.iter - begin fun pkg -> - if once pkg then - let base = Findlib.package_directory pkg in - (* The way plugins are specified in META have been - normalized late. So people started to - specified it in different ways: - - archive(byte,plugin) - - archive(byte) - - archive(native,plugin) - - archive(plugin) - - The normalized one are: - - plugin(byte) - - plugin(native) - *) - let gui = if !Fc_config.is_gui then ["gui"] else [] in - let predicates = - (* The order is important for the archive cases *) - if Dynlink.is_native then - [ - "plugin", ["native"]@gui; - "archive", ["plugin"]@gui; - "archive", ["native";"plugin"]@gui; - ] - else - [ - "plugin", ["byte"]@gui; - "archive", ["byte";"plugin"]@gui; - "archive", ["byte"]@gui; - ] - in - let rec find_package_archives = function - - (* Search by priority order *) - | (var,predicates)::others -> - begin - try Some (Findlib.package_property predicates pkg var) - with Not_found -> find_package_archives others - end - - (* Look for virtual package *) - | [] -> - if is_virtual pkg then None else - let msg = Printf.sprintf - "package '%s' doesn't contains any known \ - specification for dynamic linking" - pkg - in raise (ArchiveError msg) - - in match find_package_archives predicates with - | None -> (* virtual package *) () - | Some archive -> - let archives = split_word archive in - if archives = [] then - Klog.warning "no archive to load for package '%s'" pkg - else - List.iter (load_archive pkg base) archives - end - (Findlib.package_deep_ancestors - (if Dynlink.is_native then [ "native" ] else [ "byte" ]) - pkgs) - with - | Findlib.No_such_package(pkg,details) -> - Cmdline.add_loading_failures pkg; - Klog.error "[findlib] package '%s' not found (%s)" pkg details - | Findlib.Package_loop pkg -> - Cmdline.add_loading_failures pkg; - Klog.error "[findlib] cyclic dependencies for package '%s'" pkg - | ArchiveError msg -> - Cmdline.add_loading_failures "unknown package"; - Klog.error "[findlib] %s" msg - -(* -------------------------------------------------------------------------- *) -(* --- Load Objects --- *) -(* -------------------------------------------------------------------------- *) - -let load_path = ref [] (* initialized by load_modules *) - -let load_script base = - Klog.feedback ~dkey "compiling script '%s.ml'" base ; - let cmd = Buffer.create 80 in - let fmt = Format.formatter_of_buffer cmd in - begin - if Dynlink.is_native then - Format.fprintf fmt "%s -shared -o %S.cmxs" Fc_config.ocamlopt base - else - Format.fprintf fmt "%s -c" Fc_config.ocamlc ; - Format.fprintf fmt - " -g %s -w -70 -warn-error a -I %s" Fc_config.ocaml_wflags (Fc_config.libdir :> string) ; - if !Fc_config.is_gui && Fc_config.lablgtk <> "" then - Format.fprintf fmt " -package %s" Fc_config.lablgtk; - List.iter (fun p -> Format.fprintf fmt " -I %s" p) !load_path ; - Format.fprintf fmt " %S.ml" base ; - Format.pp_print_flush fmt () ; - let cmd = Buffer.contents cmd in - Klog.feedback ~dkey "running '%s'" cmd ; - begin - let res = Sys.command cmd in - if res <> 0 - then Klog.error "compilation of '%s.ml' failed" base - else - let pkg = Filename.basename base in - if Dynlink.is_native then - dynlib_module pkg (base ^ ".cmxs") - else - dynlib_module pkg (base ^ ".cmo") ; - end ; - let erase = Printf.sprintf "rm -f %s.cm* %s.o" base base in - Klog.feedback ~dkey "running '%s'" erase ; - let st = Sys.command erase in - if st <> 0 then - Klog.warning "Error when cleaning '%s.[o|cm*]' files" base ; - end + List.iter Dune_site_plugins.V1.load pkgs (* -------------------------------------------------------------------------- *) (* --- Command-Line Entry Points --- *) (* -------------------------------------------------------------------------- *) -(* See https://github.com/ocaml/dune/pull/636 about why the path separator for - ocamlfind is ';' on Cygwin. *) -let ocamlfind_path_separator = if Sys.cygwin || Sys.win32 then ";" else ":" - -let set_module_load_path path = - let add_dir ~user d ps = - if is_dir d then d::ps else - ( if user then Klog.warning "cannot load '%s' (not a directory)" d - ; ps ) in - let plugin_path = Filepath.Normalized.to_string_list Fc_config.plugin_dir in - Klog.debug ~dkey "plugin_dir: %s" - (String.concat ocamlfind_path_separator plugin_path); - load_path := - List.fold_right (add_dir ~user:true) path - (List.fold_right (add_dir ~user:false) - ((Fc_config.libdir :> string) :: plugin_path) []); - let env_ocamlpath = - try Str.split (Str.regexp ocamlfind_path_separator) (Sys.getenv "OCAMLPATH") - with Not_found -> [] - in - let findlib_path = - String.concat ocamlfind_path_separator (!load_path@env_ocamlpath) - in - Klog.debug ~dkey "setting findlib path to %s" findlib_path; - Findlib.init ~env_ocamlpath:findlib_path () - let load_plugin_path () = - let scan_directory pkgs dir = - Klog.feedback ~dkey "Loading directory '%s'" dir ; - try - let content = Sys.readdir dir in - Array.sort String.compare content ; - Array.iter - (fun name -> - if is_meta name then - (* name starts with "META.frama-c-" *) - let pkg = String.sub name 5 (String.length name - 5) in - pkgs := pkg :: !pkgs - ) content ; - with Sys_error error -> - Klog.error "impossible to read '%s' (%s)" dir error - in - let pkgs = ref [] in - List.iter (scan_directory pkgs) !load_path ; - load_packages (List.rev !pkgs) + if Fc_config.is_gui then Config_data.Plugins.Plugins_gui.load_all (); + Config_data.Plugins.Plugins.load_all () + +let load_plugin m = + Config_data.Plugins.Plugins.load m let load_module m = let base,ext = split_ext m in match ext with | ".ml" -> - begin - (* force script compilation *) - match is_file base ".ml" with - | Some _ -> load_script base - | None -> Klog.error "Missing source file '%s'" m - end - | "" | "." | ".cmo" | ".cma" | ".cmxs" -> + Klog.error "Script loading as been deprecated in favor of the command frama-c-init-plugin" + | _ -> begin (* load object or compile script or find package *) match is_object base with | Some file -> dynlib_module (Filename.basename base) file | None -> match is_file base ".ml" with - | Some _ -> load_script base + | Some _ -> + Klog.error "Script loading as been deprecated in favor of the command frama-c-init-plugin" | None -> - if is_package m && mem_package m then load_packages [m] + if is_package m && Dune_site_plugins.V1.available m then load_packages [m] else - let fc = - "frama-c-" ^ String.lowercase_ascii m - in - if mem_package fc then load_packages [fc] - else Klog.error "package or module '%s' not found" m + load_plugin m end - | _ -> - Klog.error "don't know what to do with '%s' (unexpected %s)" m ext (* ************************************************************************* *) (** {2 Registering and accessing dynamic values} *) diff --git a/src/kernel_services/plugin_entry_points/dynamic.mli b/src/kernel_services/plugin_entry_points/dynamic.mli index 57422faed10585232c41154fbb7e135fd921bcd0..d6d44246446f891d9237de0478945762d0fe7422 100644 --- a/src/kernel_services/plugin_entry_points/dynamic.mli +++ b/src/kernel_services/plugin_entry_points/dynamic.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Value accesses through dynamic typing. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************* *) (** {2 Registration} *) @@ -37,7 +37,7 @@ val register: cannot register a value with the same name twice. @before Frama-C+dev there was a labeled argument [journalized], that has been removed when Journalization has been removed. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************* *) (** {2 Access} *) @@ -60,7 +60,7 @@ val get: plugin:string -> string -> 'a Type.t -> 'a @raise Incompatible_type if the name is not registered with a compatible type @raise Failure _ in the -no-obj mode - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val iter: (string -> 'a Type.t -> 'a -> unit) -> unit val iter_comment : (string -> string -> unit) -> unit @@ -72,7 +72,7 @@ val iter_comment : (string -> string -> unit) -> unit (** Module to use for accessing parameters of plug-ins. Assume that the plug-in is already loaded. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Parameter : sig (** Set of common operations on parameters. *) @@ -100,7 +100,7 @@ module Parameter : sig (**/**) (** Boolean parameters. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Bool: sig include Common with type t = bool val on: string -> unit -> unit @@ -157,27 +157,16 @@ end *) val load_packages: string list -> unit -(** Load the module specification. See -load-module option. - @modify Magnesium-20151001 new API. *) +(** Load the module specification. See -load-module option. *) val load_module: string -> unit -(** Sets the load path for modules in FRAMAC_PLUGIN, prepending it with [path]. - Does not load any plugins. - Must be invoked only once from boot during extending stage. - @since Phosphorus-20170501-beta1. *) -val set_module_load_path : string list -> unit - -(** [is_loaded package] returns [true] iff [package] has already been loaded. - @since 23.0-Vanadium -*) -val is_loaded: string -> bool +val load_plugin: string -> unit (**/**) val load_plugin_path: unit -> unit (** Load all plugins in the path set with [set_module_load_path]. Must be invoked only once from boot during extending stage. - @since Magnesium-20151001 new API. - @modify Phosphorus-20170501-beta1 changed signature. *) + @since Magnesium-20151001 new API. *) (**/**) (* diff --git a/src/kernel_services/plugin_entry_points/emitter.mli b/src/kernel_services/plugin_entry_points/emitter.mli index 0da83cb0b710ac6047360386ad0213799464dfbf..96e4ae157d547da175a300d28f0a2def5ef33e85 100644 --- a/src/kernel_services/plugin_entry_points/emitter.mli +++ b/src/kernel_services/plugin_entry_points/emitter.mli @@ -49,7 +49,7 @@ val create: become valid or invalid, but a valid status cannot become invalid). The given name must be unique. @raise Invalid_argument if an emitter with the given name already exist - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val get_name: t -> string diff --git a/src/kernel_services/plugin_entry_points/kernel.ml b/src/kernel_services/plugin_entry_points/kernel.ml index 9c2da0653eaf6df1e10fd9afc4c02432d4322fe4..e74a9d56bb29f89c21dfc3fea853c2e61aa60468 100644 --- a/src/kernel_services/plugin_entry_points/kernel.ml +++ b/src/kernel_services/plugin_entry_points/kernel.ml @@ -688,7 +688,7 @@ module PrintLibc = let option_name = "-print-libc" let help = "when pretty-printing C code, keep prototypes coming \ from Frama-C standard library" - let default = !Fc_config.is_gui (* always print by default on the GUI *) + let default = Fc_config.is_gui (* always print by default on the GUI *) end) let () = Parameter_customize.set_group inout_source @@ -847,18 +847,6 @@ module LoadState = let help = "load a previously-saved session from file <filename>" end) -let () = Parameter_customize.set_group saveload -let () = Parameter_customize.set_cmdline_stage Cmdline.Extending -let () = Parameter_customize.do_not_projectify () -module AddPath = - String_list - (struct - let option_name = "-add-path" - let module_name = "AddPath" - let arg_name = "DIR,..." - let help = "Prepend directories to FRAMAC_PLUGIN for loading dynamic plug-ins" - end) - let () = Parameter_customize.set_group saveload let () = Parameter_customize.set_cmdline_stage Cmdline.Extending let () = Parameter_customize.do_not_projectify () @@ -868,13 +856,25 @@ module LoadModule = let option_name = "-load-module" let module_name = "LoadModule" let arg_name = "SPEC,..." - let help = "Dynamically load plug-ins, modules and scripts. \ + let help = "Dynamically load modules and scripts. \ Each <SPEC> can be an OCaml source or object file, with \ or without extension, or a Findlib package. \ Loading order is preserved and \ additional dependencies can be listed in *.depend files." end) -let () = LoadModule.add_aliases [ "-load-script" ] + +let () = Parameter_customize.set_group saveload +let () = Parameter_customize.set_cmdline_stage Cmdline.Extending +let () = Parameter_customize.do_not_projectify () +module LoadPlugin = + String_list + (struct + let option_name = "-load-plugin" + let module_name = "LoadPlugin" + let arg_name = "SPEC,..." + let help = "Dynamically load plug-ins. \ + Loading order is preserved." + end) let () = Parameter_customize.set_group saveload let () = Parameter_customize.set_cmdline_stage Cmdline.Extending @@ -889,8 +889,8 @@ module AutoLoadPlugins = let bootstrap_loader () = begin - Dynamic.set_module_load_path (AddPath.get ()); if AutoLoadPlugins.get () then Dynamic.load_plugin_path () ; + List.iter Dynamic.load_plugin (LoadPlugin.get()) ; List.iter Dynamic.load_module (LoadModule.get()) ; end diff --git a/src/kernel_services/plugin_entry_points/kernel.mli b/src/kernel_services/plugin_entry_points/kernel.mli index ab6ff6dd95dbce1b514fdc89d174d1864e74da84..15a26b10d975adf07b32a47e0a96a53bffd0f694 100644 --- a/src/kernel_services/plugin_entry_points/kernel.mli +++ b/src/kernel_services/plugin_entry_points/kernel.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Provided services for kernel developers. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************* *) (** {2 Log Machinery} *) @@ -285,14 +285,14 @@ module Quiet: Parameter_sig.Bool module Permissive: Parameter_sig.Bool (** Behavior of option "-permissive" *) -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Unicode: sig include Parameter_sig.Bool val without_unicode: ('a -> 'b) -> 'a -> 'b (** Execute the given function as if the option [-unicode] was not set. *) end (** Behavior of option "-unicode". - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Time: Parameter_sig.String (** Behavior of option "-time" *) @@ -324,7 +324,7 @@ module PrintReturn : Parameter_sig.Bool @since Sulfur-20171101 *) (** Behavior of option "-ocode". - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module CodeOutput : sig include Parameter_sig.Filepath val output: (Format.formatter -> unit) -> unit @@ -573,7 +573,7 @@ module UnspecifiedAccess: Parameter_sig.Bool module SafeArrays: Parameter_sig.Bool (** Behavior of option "-safe-arrays". - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module SignedOverflow: Parameter_sig.Bool (** Behavior of option "-warn-signed-overflow" *) diff --git a/src/kernel_services/plugin_entry_points/log.mli b/src/kernel_services/plugin_entry_points/log.mli index c69aee458996254efa3f61462857a26ceea731f6..d1b3621e3bc4eff714dd8daec0a6c08f7d06c343 100644 --- a/src/kernel_services/plugin_entry_points/log.mli +++ b/src/kernel_services/plugin_entry_points/log.mli @@ -68,7 +68,7 @@ type ('a,'b) pretty_aborter = (* -------------------------------------------------------------------------- *) (** {2 Exception Registry} - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @since Beryllium-20090601-beta1 *) (* -------------------------------------------------------------------------- *) @@ -118,7 +118,7 @@ type warn_status = | Wabort (** emit a message and abort execution *) (** @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module type Messages = sig type category @@ -156,45 +156,45 @@ module type Messages = sig val result : ?level:int -> ?dkey:category -> 'a pretty_printer (** Results of analysis. Default level is 1. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val feedback : ?ontty:ontty -> ?level:int -> ?dkey:category -> 'a pretty_printer (** Progress and feedback. Level is tested against the verbosity level. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val debug : ?level:int -> ?dkey:category -> 'a pretty_printer (** Debugging information dedicated to Plugin developers. Default level is 1. The debugging key is used in message headers. See also [set_debug_keys] and [set_debug_keyset]. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val warning : ?wkey:warn_category -> 'a pretty_printer (** Hypothesis and restrictions. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val error : 'a pretty_printer (** user error: syntax/typing error, bad expected input, etc. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val abort : ('a,'b) pretty_aborter (** user error stopping the plugin. @raise AbortError with the channel name. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val failure : 'a pretty_printer (** internal error of the plug-in. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val fatal : ('a,'b) pretty_aborter (** internal error of the plug-in. @raise AbortFatal with the channel name. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val verify : bool -> ('a,bool) pretty_aborter (** If the first argument is [true], return [true] and do nothing else, @@ -203,7 +203,7 @@ module type Messages = sig The intended usage is: [assert (verify e "Bla...") ;]. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val not_yet_implemented : ?current:bool -> ?source:Filepath.position -> ('a,formatter,unit,'b) format4 -> 'a @@ -251,7 +251,7 @@ module type Messages = sig - [log ~verbose:n ~debug:m]: any debugging or verbosity level is sufficient. @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val logwith : (event option -> 'b) -> ?wkey:warn_category -> ?emitwith:(event -> unit) -> ?once:bool -> @@ -393,7 +393,7 @@ val set_echo : ?plugin:string -> ?kind:kind list -> bool -> unit (** Turns echo on or off. Applies to all channel unless specified, and all kind of messages unless specified. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val add_listener : ?plugin:string -> ?kind:kind list -> (event -> unit) -> unit (** Register a hook that is called each time an event is @@ -404,7 +404,7 @@ val add_listener : ?plugin:string -> ?kind:kind list -> (event -> unit) -> unit temporarily deactivated in order to avoid infinite recursion. @since Beryllium-20090601-beta1 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val echo : event -> unit (** Display an event of the terminal, unless echo has been turned off. @@ -426,13 +426,13 @@ type channel val new_channel : string -> channel (** @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val log_channel : channel -> ?kind:kind -> 'a pretty_printer (** logging function to user-created channel. @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val kernel_channel_name: string (** the reserved channel name used by the Frama-C kernel. @@ -459,7 +459,7 @@ val clean : unit -> unit val set_output : ?isatty:bool -> (string -> int -> int -> unit) -> (unit -> unit) -> unit (** This function has the same parameters as Format.make_formatter. @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val print_on_output : (Format.formatter -> unit) -> unit (** Direct printing on output. @@ -469,7 +469,7 @@ val print_on_output : (Format.formatter -> unit) -> unit Can not be recursively invoked. @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val print_delayed : (Format.formatter -> unit) -> unit (** Direct printing on output. Same as [print_on_output], except @@ -479,7 +479,7 @@ val print_delayed : (Format.formatter -> unit) -> unit Can not be recursively invoked. @since Beryllium-20090901 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (**/**) val set_current_source : (unit -> Filepath.position) -> unit diff --git a/src/kernel_services/plugin_entry_points/plugin.ml b/src/kernel_services/plugin_entry_points/plugin.ml index c7ff75869fc85686e3b5c56cd5a6a3c2a6ad9306..a2c3b6c252cc5664bbc694788e5f360f8038eac0 100644 --- a/src/kernel_services/plugin_entry_points/plugin.ml +++ b/src/kernel_services/plugin_entry_points/plugin.ml @@ -21,6 +21,7 @@ (**************************************************************************) module CamlString = String +module FramacFilepath = Filepath let empty_string = "" @@ -317,12 +318,13 @@ struct end) let mk_dir d = + let d' = FramacFilepath.Normalized.of_string d in try Extlib.mkdir ~parents:true d 0o755; - L.warning "creating %s directory `%s'" O.option_name d; + L.warning "creating %s directory `%a'" O.option_name FramacFilepath.Normalized.pretty d'; d with Unix.Unix_error _ -> - L.abort "cannot create %s directory `%s'" O.option_name d + L.abort "cannot create %s directory `%a'" O.option_name FramacFilepath.Normalized.pretty d' let set filepath = Dir_name.set filepath let get () = Dir_name.get () @@ -370,7 +372,18 @@ struct in match dir with | None -> - L.abort "no directory %s exist in %s directories" s O.option_name + let pp_path fmt (path:Dir_name.t) = + Format.pp_print_string fmt (path :> string) + in + let pp_subdir fmt = function + | "." -> () + | s -> Format.fprintf fmt " sub-directory %s in " s + in + L.abort "there is no%a %s directories: %a" + pp_subdir s + O.option_name + (Format.pp_print_list ~pp_sep:(fun fmt () -> Format.fprintf fmt ", ") pp_path) + (base_dirs ()) | Some d -> d end | _ -> @@ -413,7 +426,7 @@ struct | `Must_exist -> if Sys.file_exists (filepath :> string) then filepath - else L.abort "no file %s exist in %s directories" s O.option_name + else L.abort "there is no file %s in %s directories" (filepath :> string) O.option_name | `Normalize_only -> filepath | `Create_path -> diff --git a/src/kernel_services/plugin_entry_points/plugin.mli b/src/kernel_services/plugin_entry_points/plugin.mli index 519e496481632cec9455cabbfebe582f8641e96d..1fe199d746e526e02e1220d96c914bf90f2805aa 100644 --- a/src/kernel_services/plugin_entry_points/plugin.mli +++ b/src/kernel_services/plugin_entry_points/plugin.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Plugin registration and general services. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** Special signature for Kernel services, whose messages are handled in @@ -76,7 +76,7 @@ end (** Provided plug-general services for plug-ins. @since Beryllium-20090601-beta1 -*) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module type S = sig include Log.Messages include S_no_log @@ -107,7 +107,7 @@ val register_kernel: unit -> unit (** Functors for registering a new plug-in. It provides access to several services. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Register (P: sig val name: string diff --git a/src/kernel_services/visitors/visitor.ml b/src/kernel_services/visitors/visitor.ml index cbfdfbc2c3f0d07e732ec888097fcac4845d81ec..2319f0376797b78387fcc6ffb2d08d5941485d81 100644 --- a/src/kernel_services/visitors/visitor.ml +++ b/src/kernel_services/visitors/visitor.ml @@ -35,7 +35,7 @@ class type frama_c_visitor = object method vstmt_aux: Cil_types.stmt -> Cil_types.stmt visitAction method vglob_aux: Cil_types.global -> Cil_types.global list visitAction method current_kf: kernel_function option - (** @plugin development guide *) + (** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method set_current_kf: kernel_function -> unit method reset_current_kf: unit -> unit diff --git a/src/kernel_services/visitors/visitor.mli b/src/kernel_services/visitors/visitor.mli index 8469257aaf4bd60e3e2d32ffa9a83a1bbeffa4e5..1413219ed8406bd58488698d92eba9553ac2c2c0 100644 --- a/src/kernel_services/visitors/visitor.mli +++ b/src/kernel_services/visitors/visitor.mli @@ -59,17 +59,17 @@ class type frama_c_visitor = object method vstmt_aux: stmt -> stmt Cil.visitAction (** Replacement of vstmt. - @plugin development guide*) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide*) method vglob_aux: global -> global list Cil.visitAction (** Replacement of vglob. - @plugin development guide*) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide*) method current_kf: kernel_function option (** link to the kernel function currently being visited. {b NB:} for copy visitors, the link is to the original kf (anyway, the new kf is created only after the visit is over). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method set_current_kf: kernel_function -> unit (** Internal use only. *) @@ -80,7 +80,7 @@ end class frama_c_inplace: frama_c_visitor (** in-place visitor; always act in the current project. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) class frama_c_copy: Project.t -> frama_c_visitor (** Copying visitor. The [Project.t] argument specifies in which project the @@ -97,7 +97,7 @@ class frama_c_refresh: Project.t -> frama_c_visitor class generic_frama_c_visitor: Visitor_behavior.t -> frama_c_visitor (** Generic class that abstracts over [frama_c_inplace] and [frama_c_copy]. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** Visit a file. This will re-cons all globals TWICE (so that it is tail-recursive). Use {!Cil.visitCilFileSameGlobals} if your visitor will @@ -112,7 +112,7 @@ val visitFramacFile: frama_c_visitor -> file -> unit changes things inside the globals). Use this function instead of {!Visitor.visitFramacFile} whenever appropriate because it is more efficient for long files. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val visitFramacFileSameGlobals: frama_c_visitor -> file -> unit (** Visit all function definitions of a file. Use this function instead of @@ -142,7 +142,7 @@ val visitFramacGlobal: frama_c_visitor -> global -> global list val visitFramacKf: frama_c_visitor -> Kernel_function.t -> Kernel_function.t (** Visit a function definition. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val visitFramacFunction: frama_c_visitor -> fundec -> fundec (** Visit an expression *) diff --git a/src/kernel_services/visitors/visitor_behavior.mli b/src/kernel_services/visitors/visitor_behavior.mli index 273fb6189e542df940daf6eee1960a27da530225..2c0e74433bddc466861e551265247c814b7109b5 100644 --- a/src/kernel_services/visitors/visitor_behavior.mli +++ b/src/kernel_services/visitors/visitor_behavior.mli @@ -32,11 +32,11 @@ type t (** How the visitor should behave in front of mutable fields: in place modification or copy of the structure. This type is abstract. Use one of the two values below in your classes. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val inplace: unit -> t (** In-place modification. Behavior of the original cil visitor. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val copy: Project.t -> t (** Makes fresh copies of the mutable structures. @@ -46,7 +46,7 @@ val copy: Project.t -> t AST. This allows for instance to copy a function with its formals and local variables, and to keep the references to other globals in the function's body. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val refresh: Project.t -> t (** Makes fresh copies of the mutable structures and provides fresh id @@ -74,7 +74,7 @@ val get_project: t -> Project.t option AST elements in [vis]. For example for {!Cil_types.varinfo}: [Reset.varinfo vis]. @since 20.0-Calcium - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Reset: sig val varinfo: t -> unit @@ -120,7 +120,7 @@ end [Get.varinfo vis vi]. @since 20.0-Calcium - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Get: Get @@ -132,7 +132,7 @@ module Get: Get {!Cil_types.varinfo}: [Get_orig.varinfo vis new_vi]. @since 20.0-Calcium - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Get_orig: Get @@ -145,7 +145,7 @@ module Get_orig: Get {!Cil_types.varinfo}: [Memo.varinfo vis vi]. @since 20.0-Calcium - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Memo: Get @@ -178,7 +178,7 @@ end {!Cil_types.varinfo}: [Set.varinfo vis vi new_representative]. @since 20.0-Calcium - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Set: Set diff --git a/src/libraries/datatype/datatype.mli b/src/libraries/datatype/datatype.mli index e018aa74480eae27b98deb9846b3583923beb834..3729d9019e6a9c6c02d0a32c25af16d15446d193 100644 --- a/src/libraries/datatype/datatype.mli +++ b/src/libraries/datatype/datatype.mli @@ -23,7 +23,7 @@ (** A datatype provides useful values for types. It is a high-level API on top of module {!Type}. @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ********************************************************************** *) (** {2 Type declarations} *) @@ -118,12 +118,12 @@ val mem_project: 'a Type.t -> (Project_skeleton.t -> bool) -> 'a -> bool val undefined: 'a -> 'b (** Must be used if you don't want to implement a required function. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val identity: 'a -> 'a (** Must be used if you want to implement a required function by [fun x -> x]. Only useful for implementing [rehash] and [copy]. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val from_compare: 'a -> 'a -> bool (** Must be used for [equal] in order to implement it by [compare x y = 0] @@ -132,10 +132,10 @@ val from_compare: 'a -> 'a -> bool val never_any_project: (Project_skeleton.t -> bool) -> 'a -> bool (** Must be used for [mem_project] if values of your type does never contain any project. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (** Sub-signature of {!S}. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @before Frama-C+dev there was several additional values only used for Journalization that has been removed. @@ -165,7 +165,7 @@ module Undefined: Undefined (** Same as {!Undefined}, but the type is supposed to be marshallable by the standard OCaml way (in particular, no hash-consing or projects inside the type). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Serializable_undefined: Undefined (* ********************************************************************** *) @@ -212,7 +212,7 @@ module type Make_input = sig end (** Generic datatype builder. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Make(X: Make_input): S with type t = X.t (** Additional info for building [Set], [Map] and [Hashtbl]. *) @@ -299,17 +299,17 @@ module With_collections(X: S)(Info: Functor_info): module Unit: S_with_collections with type t = unit val unit: unit Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Bool: S_with_collections with type t = bool val bool: bool Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Int: S_with_collections with type t = int val int: int Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Int32: S_with_collections with type t = int32 val int32: int32 Type.t @@ -325,12 +325,12 @@ val float: float Type.t module Char: S_with_collections with type t = char val char: char Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module String: S_with_collections with type t = string val string: string Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Formatter: S with type t = Format.formatter val formatter: Format.formatter Type.t @@ -361,7 +361,7 @@ module type Polymorphic = sig end (** Functor for polymorphic types with only 1 type variable. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @before Frama-C+dev the functor had several additional values only used for Journalization that has been removed. @@ -388,7 +388,7 @@ module type Polymorphic2 = sig end (** Functor for polymorphic types with 2 type variables. - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @before Frama-C+dev the functor had several additional values only used for Journalization that has been removed. @@ -422,7 +422,7 @@ end (** Functor for polymorphic types with 3 type variables. @since Oxygen-20120901 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @before Frama-C+dev the functor had several additional values only used for Journalization that has been removed. *) @@ -463,7 +463,7 @@ end (** Functor for polymorphic types with 4 type variables. @since Oxygen-20120901 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide @before Frama-C+dev the functor had several additional values only used for Journalization that has been removed. *) @@ -506,7 +506,7 @@ module Polymorphic4 module Poly_pair: Polymorphic2 with type ('a, 'b) poly = 'a * 'b -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Pair(T1: S)(T2: S): S with type t = T1.t * T2.t module Pair_with_collections(T1: S)(T2: S)(Info: Functor_info): S_with_collections with type t = T1.t * T2.t @@ -514,7 +514,7 @@ val pair: 'a Type.t -> 'b Type.t -> ('a * 'b) Type.t module Poly_ref: Polymorphic with type 'a poly = 'a ref -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Ref(T: S) : S with type t = T.t ref val t_ref: 'a Type.t -> 'a ref Type.t @@ -529,7 +529,7 @@ val option: 'a Type.t -> 'a option Type.t module Poly_list: Polymorphic with type 'a poly = 'a list -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module List(T: S) : S with type t = T.t list module List_with_collections(T:S)(Info:Functor_info): @@ -537,7 +537,7 @@ module List_with_collections(T:S)(Info:Functor_info): (** @since Fluorine-20130401 *) val list: 'a Type.t -> 'a list Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Poly_array: Polymorphic with type 'a poly = 'a array (** @since Neon-20140301 *) @@ -576,7 +576,7 @@ module Quadruple_with_collections (T1: S)(T2: S)(T3: S)(T4:S)(Info: Functor_info): S_with_collections with type t = T1.t * T2.t * T3.t * T4.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Function (T1: sig include S val label: (string * (unit -> t) option) option end) (T2: S) @@ -586,7 +586,7 @@ val func: ?label:string * (unit -> 'a) option -> 'a Type.t -> 'b Type.t -> ('a -> 'b) Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val optlabel_func: string -> (unit -> 'a) -> 'a Type.t -> 'b Type.t -> ('a -> 'b) Type.t @@ -598,7 +598,7 @@ val func2: ?label2:string * (unit -> 'b) option -> 'b Type.t -> 'c Type.t -> ('a -> 'b -> 'c) Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val func3: ?label1:string * (unit -> 'a) option -> 'a Type.t -> @@ -606,7 +606,7 @@ val func3: ?label3:string * (unit -> 'c) option -> 'c Type.t -> 'd Type.t -> ('a -> 'b -> 'c -> 'd) Type.t -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val func4: ?label1:string * (unit -> 'a) option -> 'a Type.t -> diff --git a/src/libraries/datatype/structural_descr.mli b/src/libraries/datatype/structural_descr.mli index ff1106d9e5902956e1636f8bd0d578d813372021..0d5b8d69f2240a9c4a3c737ea566ccbbbabb43b4 100644 --- a/src/libraries/datatype/structural_descr.mli +++ b/src/libraries/datatype/structural_descr.mli @@ -58,7 +58,7 @@ type t = private | Structure of structure (** Provide a description of the representation of data. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | T_pack of single_pack (** Internal use only. Do not use it outside the library *) @@ -71,7 +71,7 @@ and structure = private of their declarations in that type). Each element of this latter array is an array of [t] that describes (in order) the fields of the corresponding constructor. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Array of pack (** The data is an array of values of the same type, each value being described by the pack. *) @@ -82,7 +82,7 @@ and structure = private val pack: t -> pack (** Pack a structural descriptor in order to embed it inside another one. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val recursive_pack: recursive -> pack (** Pack a recursive descriptor. @@ -145,7 +145,7 @@ val p_abstract: pack val p_unit : pack val p_int : pack -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val p_string : pack val p_float : pack diff --git a/src/libraries/datatype/tests/dune b/src/libraries/datatype/tests/dune new file mode 100644 index 0000000000000000000000000000000000000000..a781af5dae00d77537ebacdfc7e8b97e658cd76a --- /dev/null +++ b/src/libraries/datatype/tests/dune @@ -0,0 +1,23 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(include_subdirs no) diff --git a/src/libraries/datatype/unmarshal_hashtbl_test.ml b/src/libraries/datatype/tests/unmarshal_hashtbl_test.ml similarity index 100% rename from src/libraries/datatype/unmarshal_hashtbl_test.ml rename to src/libraries/datatype/tests/unmarshal_hashtbl_test.ml diff --git a/src/libraries/datatype/unmarshal_test.ml b/src/libraries/datatype/tests/unmarshal_test.ml similarity index 100% rename from src/libraries/datatype/unmarshal_test.ml rename to src/libraries/datatype/tests/unmarshal_test.ml diff --git a/src/libraries/datatype/type.mli b/src/libraries/datatype/type.mli index 256d9de8edabbdd3ef9dd07eb3a7371b906e7269..e950e09f18abcd76bd7b34571d78205394f9e055 100644 --- a/src/libraries/datatype/type.mli +++ b/src/libraries/datatype/type.mli @@ -24,7 +24,7 @@ type. This API is quite low level. Prefer to use module {!Datatype} instead whenever possible. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ****************************************************************************) (** {2 Type declaration} *) @@ -34,7 +34,7 @@ type 'a t (** Type of type values. For each monomorphic type [ty], a value of type [ty t] dynamically represents the type [ty]. Such a value is called a type value and should be unique for each static monomorphic type. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type 'a ty = 'a t @@ -45,8 +45,12 @@ type 'a ty = 'a t (** Precedences used for generating the minimal number of parenthesis in combination with function {!par} below. *) type precedence = - | Basic (** Normal precedence @plugin development guide *) - | Call (** Instantiation of polymorphic type @plugin development guide *) + | Basic + (** Normal precedence + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) + | Call + (** Instantiation of polymorphic type + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) | Tuple | List | NoPar @@ -62,7 +66,7 @@ type precedence = let myself = Call in par p_caller myself fmt pp] - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val par: precedence -> precedence -> Format.formatter -> (Format.formatter -> unit) -> unit @@ -78,7 +82,7 @@ val par_ty_name: ('a t -> bool) -> 'a t -> string exception AlreadyExists of string (** May be raised by {!register}. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register: ?closure:bool -> @@ -103,14 +107,14 @@ exception No_abstract_type of string (** Apply this functor to access to the abstract type of the given name. @raise No_abstract_type if no such abstract type was registered. @since Nitrogen-20111001 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Abstract(T: sig val name: string end): sig type t val ty: t ty end val name: 'a t -> string -(** @plugin development name *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val structural_descr: 'a t -> Structural_descr.t val reprs: 'a t -> 'a list diff --git a/src/libraries/project/project.mli b/src/libraries/project/project.mli index d8e02413dbc01689c78934278d12e5d35c9728de..93816c8685e6f407b206a27e5ccded9e463b8454 100644 --- a/src/libraries/project/project.mli +++ b/src/libraries/project/project.mli @@ -27,7 +27,7 @@ possible to have many projects at the same time. For registering a new state in the Frama-C projects, apply the functor {!State_builder.Register}. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************* *) (** {2 Types for project} *) @@ -67,7 +67,7 @@ exception NoProject val current: unit -> t (** The current project. @raise NoProject if there is no project. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val is_current: t -> bool (** Check whether the given project is the current one or not. *) @@ -116,7 +116,7 @@ val set_current: ?on:bool -> ?selection:State_selection.t -> t -> unit (** Set the current project with the given one. The flag [on] is not for casual users. @raise Invalid_argument if the given project does not exist anymore. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_after_set_current_hook: user_only:bool -> (t -> unit) -> unit (** [register_after_set_current_hook f] adds a hook on function @@ -132,7 +132,7 @@ val on: ?selection:State_selection.t -> t -> ('a -> 'b) -> 'a -> 'b (** [on p f x] sets the current project to [p], computes [f x] then restores the current project. You should use this function if you use a project different of [current ()]. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val set_keep_current: bool -> unit (** [set_keep_current b] keeps the current project forever (even after the end @@ -171,7 +171,7 @@ val clear: ?selection:State_selection.t -> ?project:t -> unit -> unit (** Clear the given project. Default project is [current ()]. All the internal states of the given project are now empty (wrt the action registered with {!register_todo_on_clear}). - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_todo_before_clear: (t -> unit) -> unit (** Register an action performed just before clearing a project. @@ -205,7 +205,7 @@ exception IOError of string val save: ?selection:State_selection.t -> ?project:t -> Filepath.Normalized.t -> unit (** Save a given project in a file. Default project is [current ()]. @raise IOError if the project cannot be saved. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val load: ?selection:State_selection.t -> ?name:string -> Filepath.Normalized.t -> t (** Load a file into a new project given by its name. @@ -219,7 +219,7 @@ val load: ?selection:State_selection.t -> ?name:string -> Filepath.Normalized.t } @raise IOError if the project cannot be loaded @return the new project containing the loaded data. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val save_all: ?selection:State_selection.t -> Filepath.Normalized.t -> unit (** Save all the projects in a file. diff --git a/src/libraries/project/project_skeleton.mli b/src/libraries/project/project_skeleton.mli index 454b1c0d861a91732fc214dba62ee624203679f8..a651b6c5e5884647308abe2dd020be8b183b29ce 100644 --- a/src/libraries/project/project_skeleton.mli +++ b/src/libraries/project/project_skeleton.mli @@ -41,7 +41,7 @@ end type t = private { pid: int; mutable name: string; mutable unique_name: string } (** @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) type project = t (** @since Carbon-20101201 *) diff --git a/src/libraries/project/state.mli b/src/libraries/project/state.mli index cc8bbff434a8554900d9beb62461e2d1e2de79e4..a992a10252800811d2370a5cc733192c0ded0787 100644 --- a/src/libraries/project/state.mli +++ b/src/libraries/project/state.mli @@ -22,7 +22,7 @@ (** A state is a project-compliant mutable value. @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Project_skeleton @@ -100,7 +100,7 @@ val unique_name_from_name: string -> string val dummy: t (** A dummy state. @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val dummy_unique_name: string diff --git a/src/libraries/project/state_builder.mli b/src/libraries/project/state_builder.mli index c3a630b794a3869907eeaf8819e7a541622ae9f3..a6917f55689a1b2e368ed36cdeadfb0c6cb8a823 100644 --- a/src/libraries/project/state_builder.mli +++ b/src/libraries/project/state_builder.mli @@ -24,7 +24,7 @@ Provide ways to implement signature [State_builder.S]. Depending on the builder, also provide some additional useful information. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************* *) (* ************************************************************************* *) @@ -85,7 +85,7 @@ end [Datatype] represents the datatype of a state, [Local_state] explains how to deal with the client-side state and [Info] are additional required information. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Register (Datatype: Datatype.S) (Local_state: State.Local with type t = Datatype.t) @@ -119,7 +119,7 @@ module type Ref = sig (** Reset the reference to its default value. *) end -(** @plugin development guide *) +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module Ref (Data:Datatype.S) (Info:sig @@ -358,7 +358,7 @@ module type Hashtbl = sig val remove: key -> unit end -(** @plugin development guide +(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide - [H] is the hashtable implementation - [Data] is the datatype for values stored in the table *) diff --git a/src/libraries/project/state_selection.mli b/src/libraries/project/state_selection.mli index 3a97d3488988fd17848791879149d62e84ca23b5..3711690d96c8b959aaa6c38c1e7e9ae6513954d5 100644 --- a/src/libraries/project/state_selection.mli +++ b/src/libraries/project/state_selection.mli @@ -23,7 +23,7 @@ (** A state selection is a set of states with operations for easy handling of state dependencies. @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ************************************************************************** *) (** {2 Type declarations} *) @@ -32,7 +32,7 @@ type t (** Type of a state selection. @since Carbon-20101201 - @plugin development guide + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val ty: t Type.t @@ -85,13 +85,13 @@ val mem: t -> State.t -> bool val with_dependencies: State.t -> t (** The selection containing the given state and all its dependencies. @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val only_dependencies: State.t -> t (** The selection containing all the dependencies of the given state (but not this state itself). @since Carbon-20101201 - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val with_codependencies: State.t -> t (** The selection containing the given state and all its co-dependencies. diff --git a/src/libraries/stdlib/transitioning.ml.in b/src/libraries/stdlib/transitioning.ml similarity index 100% rename from src/libraries/stdlib/transitioning.ml.in rename to src/libraries/stdlib/transitioning.ml diff --git a/src/libraries/utils/command.ml b/src/libraries/utils/command.ml index fdc761de511e6f0c4b6ade48b094cf351f5b0576..dc9cadf4c7b9487a36e07d0353df8b1861b66331 100644 --- a/src/libraries/utils/command.ml +++ b/src/libraries/utils/command.ml @@ -240,7 +240,7 @@ let command_async ?stdout ?stderr cmd args = command_generic ~async:true ?stdout ?stderr cmd args let command ?(timeout=0) ?stdout ?stderr cmd args = - if !Fc_config.is_gui || timeout > 0 then + if Fc_config.is_gui || timeout > 0 then let f = command_generic ~async:true ?stdout ?stderr cmd args in let res = ref(Unix.WEXITED 99) in let ftimeout = float_of_int timeout in diff --git a/src/libraries/utils/dune b/src/libraries/utils/dune new file mode 100644 index 0000000000000000000000000000000000000000..c38dc5bea4518d6fde687fb229feaa7c0ac3c27a --- /dev/null +++ b/src/libraries/utils/dune @@ -0,0 +1,23 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(ocamllex json) diff --git a/src/libraries/utils/filepath.ml b/src/libraries/utils/filepath.ml index 0e0acf70a001aa491a39a3c0efe4949d44f165d3..a6a0ea1c7fca322632fb4e565aed3a7dc23953c0 100644 --- a/src/libraries/utils/filepath.ml +++ b/src/libraries/utils/filepath.ml @@ -188,6 +188,10 @@ let add_symbolic_dir name dir = Hashtbl.replace symbolic_dirs dir name ; (insert cwd (dir:>string)).symbolic_name <- Some name +(** Initialize using Config *) +let add_symbolic_dir_list name = + List.iter (fun d -> add_symbolic_dir name d) + let reset_symbolic_dirs () = Hashtbl.clear symbolic_dirs let all_symbolic_dirs () = diff --git a/src/libraries/utils/filepath.mli b/src/libraries/utils/filepath.mli index 570d89f7e3443d5b63f3f3866591b02a200eb62b..fd21410cf3e7e042804a4ec6b094fc327c08b247 100644 --- a/src/libraries/utils/filepath.mli +++ b/src/libraries/utils/filepath.mli @@ -179,6 +179,8 @@ val is_relative: ?base_name:Normalized.t -> Normalized.t -> bool printed identically in different machines. *) val add_symbolic_dir: string -> Normalized.t -> unit +val add_symbolic_dir_list: string -> Normalized.t list -> unit + (** Remove all symbolic dirs that have been added earlier. @since 23.0-Vanadium *) val reset_symbolic_dirs: unit -> unit diff --git a/src/libraries/utils/hptmap_sig.mli b/src/libraries/utils/hptmap_sig.ml similarity index 100% rename from src/libraries/utils/hptmap_sig.mli rename to src/libraries/utils/hptmap_sig.ml diff --git a/src/libraries/utils/pretty_utils.mli b/src/libraries/utils/pretty_utils.mli index 9520988353c06d43fb3e27b64638c83a59ac0fa0..74af92e038c3750d93354fe2c302cbcaa51a7e31 100644 --- a/src/libraries/utils/pretty_utils.mli +++ b/src/libraries/utils/pretty_utils.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** Pretty-printer utilities. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) (* ********************************************************************** *) (** {2 null formatters} *) diff --git a/src/plugins/.gitattributes b/src/plugins/.gitattributes index 856f653c296e134de64d231bc6fe9342dbc5a1ca..cea710139fe09495eae28c33486ae8a294f5bbcc 100644 --- a/src/plugins/.gitattributes +++ b/src/plugins/.gitattributes @@ -2,6 +2,9 @@ # HEADER_SPEC: CEA_LGPL_OR_PROPRIETARY # ######################################## +dune-project header_spec=CEA_LGPL_OR_PROPRIETARY +dune header_spec=CEA_LGPL_OR_PROPRIETARY + config* header_spec=CEA_LGPL_OR_PROPRIETARY makefile* header_spec=CEA_LGPL_OR_PROPRIETARY Make* header_spec=CEA_LGPL_OR_PROPRIETARY diff --git a/src/plugins/aorai/.gitattributes b/src/plugins/aorai/.gitattributes index 94782b4119b1bf3cc8abf8b3a569b2e12580b692..5826b9f0868c9512df4016b87c359b6f1be595f2 100644 --- a/src/plugins/aorai/.gitattributes +++ b/src/plugins/aorai/.gitattributes @@ -2,6 +2,9 @@ # HEADER_SPEC: AORAI_LGPL # ########################### +dune-project header_spec=AORAI_LGPL +dune header_spec=AORAI_LGPL + /configure.ac header_spec=AORAI_LGPL /Makefile header_spec=AORAI_LGPL diff --git a/src/plugins/aorai/.gitignore b/src/plugins/aorai/.gitignore index 1b77fb8deb8db509c14ac4bd15afc70dca627d69..ad6e08d6507d65fbc0cf193acc21fda8a2f174cd 100644 --- a/src/plugins/aorai/.gitignore +++ b/src/plugins/aorai/.gitignore @@ -1,21 +1,7 @@ -/tests/ptests_config /aorai_eva_analysis.ml /Makefile -/ltllexer.ml -/ltlparser.ml -/ltlparser.mli -/promelalexer.ml -/promelalexer_withexps.ml -/promelaparser.mli -/promelaparser.ml -/promelaparser_withexps.ml -/promelaparser_withexps.mli -/yalexer.ml -/yaparser.ml -/yaparser.mli /*parser*.output /ptests_local_config.ml /tests/*/result -/tests/test_config_prove /tests/*/result_prove /top diff --git a/src/plugins/aorai/Aorai.mli b/src/plugins/aorai/Aorai.ml similarity index 100% rename from src/plugins/aorai/Aorai.mli rename to src/plugins/aorai/Aorai.ml diff --git a/src/plugins/aorai/Makefile.in b/src/plugins/aorai/Makefile.in deleted file mode 100644 index 944a500bab9091dba2766758958f44328e3e0196..0000000000000000000000000000000000000000 --- a/src/plugins/aorai/Makefile.in +++ /dev/null @@ -1,169 +0,0 @@ -########################################################################## -# # -# This file is part of Aorai plug-in of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# INRIA (Institut National de Recherche en Informatique et en # -# Automatique) # -# INSA (Institut National des Sciences Appliquees) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Makefile for compiling Aorai independently of Frama-C. -# -# To be used independently of Frama-C, a version of Frama-C compatible with -# Aorai has to be properly installed as long as the Aorai-specific stuff. - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif -PLUGIN_DIR ?=. - -PLUGIN_ENABLE:=@ENABLE_AORAI@ -PLUGIN_NAME:=Aorai -PLUGIN_GENERATED:= $(addprefix ${PLUGIN_DIR}/, \ - aorai_eva_analysis.ml \ - promelalexer_withexps.ml promelaparser_withexps.ml \ - promelaparser_withexps.mli \ - promelalexer.ml promelaparser.ml promelaparser.mli \ - ltllexer.ml ltlparser.ml ltlparser.mli \ - yalexer.ml yaparser.ml yaparser.mli) -PLUGIN_CMO:= bool3 \ - aorai_option \ - path_analysis \ - promelaoutput \ - logic_simplification \ - aorai_graph \ - aorai_metavariables \ - data_for_aorai \ - aorai_utils \ - ltl_output \ - utils_parser \ - ltlparser \ - ltllexer \ - yaparser \ - yalexer \ - promelaparser \ - promelalexer \ - promelaparser_withexps \ - promelalexer_withexps \ - aorai_dataflow \ - aorai_visitors \ - aorai_eva_analysis \ - aorai_register -PLUGIN_CMI:= ltlast promelaast - -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= \ - aorai_eva_analysis.enabled.ml aorai_eva_analysis.disabled.ml \ - Makefile.in configure.ac configure -PLUGIN_HAS_EXT_DOC:=no # [JS 2010/07/28] was 'yes' - # but prevent 'make src-distrib to work -PLUGIN_DEPENDENCIES:= - -# Dynamic dependencies - -ifneq "$(ENABLE_EVA)" "no" -PLUGIN_DEPENDENCIES+= Eva -AORAI_EVA_ANALYSIS:= $(PLUGIN_DIR)/aorai_eva_analysis.enabled.ml -else -AORAI_EVA_ANALYSIS:= $(PLUGIN_DIR)/aorai_eva_analysis.disabled.ml -endif - -$(PLUGIN_DIR)/aorai_eva_analysis.ml: $(AORAI_EVA_ANALYSIS) - $(PRINT_MAKING) $@ - $(CP) $(AORAI_EVA_ANALYSIS) $@ - $(CHMOD_RO) $@ - -$(PLUGIN_DIR)/aorai_eva_analysis.ml: $(PLUGIN_DIR)/Makefile share/Makefile.config - -# Tests - -# aorai_ya can always be run -PLUGIN_TESTS_DIRS:=ya - -ifeq (@HAS_LTLTOBA@,yes) -PLUGIN_TESTS_DIRS+=ltl -endif - -PLUGIN_TESTS_LIB:=$(PLUGIN_DIR)/tests/Aorai_test.ml $(PLUGIN_DIR)/tests/ya/name_projects.ml - -include $(FRAMAC_SHARE)/Makefile.dynamic - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -AORAI_WP_SHARE=-aorai-test-wp-share $(FRAMAC_ROOT_SRCDIR)/src/plugins/wp/share -else -CONFIG_STATUS_DIR=. -AORAI_WP_SHARE= -endif - -TEST_DEPENDENCIES:= \ - $(Aorai_DIR)/tests/Aorai_test.cmxs \ - $(Aorai_DIR)/tests/Aorai_test.cmo \ - $(Aorai_DIR)/tests/ya/name_projects.cmxs \ - $(Aorai_DIR)/tests/ya/name_projects.cmo - -Aorai_DEFAULT_TESTS: $(TEST_DEPENDENCIES) - -# 'prove' ptests config: ensure ACSL and C instrumentation coincide -# Launch this configuration for all tests with -# make aorai-test-prove -# To launch only one test, you can use PTESTS_OPTS, as in -# PTESTS_OPTS="tests/ya/stack.i -add-options '-wp-verbose 1'" make aorai-test-prove -# -# This requires to have a copy of the wp-cache repository -# (see ../wp/tests/README.md for more information). If it is not -# in its default place of ../wp-cache, use AORAI_WP_CACHE variable to give the -# proper absolute path. -# Don't forget to add the new cache files to the repo if needed, -# in particular if CI complains about its aorai-prove target. - -$(Aorai_DIR)/tests/ptests_config: $(Aorai_DIR)/tests/test_config_prove - -$(Aorai_DIR)/tests/test_config_prove: \ - $(Aorai_DIR)/tests/test_config_prove.in $(Aorai_DIR)/Makefile - $(PRINT_MAKING) $@ - $(RM) $@ - $(SED) -e 's!@AORAI_WP_SHARE@!$(AORAI_WP_SHARE)!' $< > $@ - $(CHMOD_RO) $@ - -AORAI_WP_CACHEDIR?=$(abspath $(Aorai_DIR)/../wp-cache) -AORAI_WP_CACHE?=update - -.PHONY: aorai-test-prove -aorai-test-prove: $(TEST_DEPENDENCIES) $(Aorai_DIR)/tests/test_config_prove - FRAMAC_WP_CACHE=$(AORAI_WP_CACHE) \ - FRAMAC_WP_CACHEDIR=$(AORAI_WP_CACHEDIR) \ - PTESTS_OPTS="$$PTESTS_OPTS -config prove" \ - $(MAKE) Aorai_TESTS - -# Regenerating the Makefile on need - -$(Aorai_DIR)/Makefile: $(Aorai_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ - -headers:: - $(SED) -e 's/This file is/Files in this archive are/' \ - $(FRAMAC_SRC)/headers/open-source/INSA_INRIA_LGPL \ - > $(FRAMAC_SRC)/doc/aorai/example/LICENSE diff --git a/src/plugins/aorai/dune b/src/plugins/aorai/dune new file mode 100644 index 0000000000000000000000000000000000000000..9e8608f15a64f2ce3f23017d58ea993570fba0f1 --- /dev/null +++ b/src/plugins/aorai/dune @@ -0,0 +1,52 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Aorai plug-in of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; INRIA (Institut National de Recherche en Informatique et en ;; +;; Automatique) ;; +;; INSA (Institut National des Sciences Appliquees) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Aorai:" %{lib-available:frama-c-aorai.core} "\n") + (echo " - (optional) Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name aorai) + (optional) + (public_name frama-c-aorai.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel + (select aorai_eva_analysis.ml from + (frama-c-eva.core -> aorai_eva_analysis.enabled.ml) + ( -> aorai_eva_analysis.disabled.ml) + ) + ) +) + +(ocamllex promelalexer_withexps promelalexer ltllexer yalexer) +(ocamlyacc promelaparser_withexps promelaparser ltlparser yaparser) + +(plugin (optional) (name aorai) (libraries frama-c-aorai.core) (site (frama-c plugins))) diff --git a/src/plugins/aorai/dune-project b/src/plugins/aorai/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..6310f54128592bdb3969562b7a0000369b24fd76 --- /dev/null +++ b/src/plugins/aorai/dune-project @@ -0,0 +1,28 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Aorai plug-in of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; INRIA (Institut National de Recherche en Informatique et en ;; +;; Automatique) ;; +;; INSA (Institut National des Sciences Appliquees) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-aorai) +(using dune_site 0.1) diff --git a/nix/empty b/src/plugins/aorai/frama-c-aorai.opam similarity index 100% rename from nix/empty rename to src/plugins/aorai/frama-c-aorai.opam diff --git a/src/plugins/aorai/ltlast.mli b/src/plugins/aorai/ltlast.ml similarity index 100% rename from src/plugins/aorai/ltlast.mli rename to src/plugins/aorai/ltlast.ml diff --git a/src/plugins/aorai/promelaast.mli b/src/plugins/aorai/promelaast.ml similarity index 100% rename from src/plugins/aorai/promelaast.mli rename to src/plugins/aorai/promelaast.ml diff --git a/src/plugins/aorai/tests/dune b/src/plugins/aorai/tests/dune new file mode 100644 index 0000000000000000000000000000000000000000..653468ced57099cf32c752a565b3d3821c8a3a5d --- /dev/null +++ b/src/plugins/aorai/tests/dune @@ -0,0 +1,7 @@ +; Used by the ptests directive `LIBS: ../../Aorai_test` in `tests_config` files. +(library + (name Aorai_test) + (modules Aorai_test) + (libraries frama-c.init.cmdline frama-c.boot frama-c.kernel frama-c-wp.core) + (flags -open Frama_c_kernel) +) diff --git a/src/plugins/aorai/tests/ltl/goto.c b/src/plugins/aorai/tests/ltl/goto.c index 4051a1c7461bebeccbc938ee835d02f08dcf42e6..b8685eec176b5ff0400d728af807018ade5571ee 100644 --- a/src/plugins/aorai/tests/ltl/goto.c +++ b/src/plugins/aorai/tests/ltl/goto.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ int status=0; diff --git a/src/plugins/aorai/tests/ltl/test_boucle.c b/src/plugins/aorai/tests/ltl/test_boucle.c index 47794157e8d1c20902db348db6355a853dd3b29c..242401c8d41a5c9b4a97646e6c6c5cebeae180d8 100644 --- a/src/plugins/aorai/tests/ltl/test_boucle.c +++ b/src/plugins/aorai/tests/ltl/test_boucle.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ /*@ requires \true; diff --git a/src/plugins/aorai/tests/ltl/test_boucle1.c b/src/plugins/aorai/tests/ltl/test_boucle1.c index 5aa255651392ad16af77e6accd80803e74a6e101..3f24248397ef975cbd10cb7b8f794b5735b7bdcd 100644 --- a/src/plugins/aorai/tests/ltl/test_boucle1.c +++ b/src/plugins/aorai/tests/ltl/test_boucle1.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ int cpt=3; diff --git a/src/plugins/aorai/tests/ltl/test_boucle2.c b/src/plugins/aorai/tests/ltl/test_boucle2.c index 4145427d820836707432eaca4eba6999d714c69c..a37e79e10971fbe6ed463bf315bfa4fbcbc60704 100644 --- a/src/plugins/aorai/tests/ltl/test_boucle2.c +++ b/src/plugins/aorai/tests/ltl/test_boucle2.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ int status=0; diff --git a/src/plugins/aorai/tests/ltl/test_boucle3.c b/src/plugins/aorai/tests/ltl/test_boucle3.c index 013fc8878c153ebe299d2f12c8b99fa9b0e0a209..3cd384b94a561399d1536d315f09008026ec004e 100644 --- a/src/plugins/aorai/tests/ltl/test_boucle3.c +++ b/src/plugins/aorai/tests/ltl/test_boucle3.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ diff --git a/src/plugins/aorai/tests/ltl/test_config b/src/plugins/aorai/tests/ltl/test_config new file mode 100644 index 0000000000000000000000000000000000000000..96c1d0d716a3ae949b1bd19b2fd92a2b13ccfbd8 --- /dev/null +++ b/src/plugins/aorai/tests/ltl/test_config @@ -0,0 +1,2 @@ +ENABLED_IF: %{bin-available:ltl2ba} +STDOPT: diff --git a/src/plugins/aorai/tests/ltl/test_config_prove b/src/plugins/aorai/tests/ltl/test_config_prove new file mode 100644 index 0000000000000000000000000000000000000000..96c1d0d716a3ae949b1bd19b2fd92a2b13ccfbd8 --- /dev/null +++ b/src/plugins/aorai/tests/ltl/test_config_prove @@ -0,0 +1,2 @@ +ENABLED_IF: %{bin-available:ltl2ba} +STDOPT: diff --git a/src/plugins/aorai/tests/ltl/test_factorial.c b/src/plugins/aorai/tests/ltl/test_factorial.c index 3a47201d2f6459ece6a01d9809ce9da7f1fa21a8..009b6db869a7439b1fcda0bd16ea439e39b00490 100644 --- a/src/plugins/aorai/tests/ltl/test_factorial.c +++ b/src/plugins/aorai/tests/ltl/test_factorial.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} */ diff --git a/src/plugins/aorai/tests/ltl/test_recursion1.c b/src/plugins/aorai/tests/ltl/test_recursion1.c index 781af6b7a8e4dd537958d298e11616822fb82004..bed9bf66e83256498aae83e2faa46b693e5cb92c 100644 --- a/src/plugins/aorai/tests/ltl/test_recursion1.c +++ b/src/plugins/aorai/tests/ltl/test_recursion1.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ diff --git a/src/plugins/aorai/tests/ltl/test_recursion2.c b/src/plugins/aorai/tests/ltl/test_recursion2.c index 53277aac6823f3c0d423616c3017312483749fc6..a51847f8c6b5473bd08eb35f9ffa995b2b6b11e6 100644 --- a/src/plugins/aorai/tests/ltl/test_recursion2.c +++ b/src/plugins/aorai/tests/ltl/test_recursion2.c @@ -1,6 +1,6 @@ /* run.config* - OPT: -aorai-buchi @PTEST_DIR@/@PTEST_NAME@.promela -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ - OPT: -aorai-buchi %{dep:@PTEST_DIR@/test_recursion3.promela} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-buchi %{dep:@PTEST_NAME@.promela} -aorai-acceptance + STDOPT: -aorai-buchi %{dep:test_recursion3.promela} -aorai-acceptance */ /* Calcul de la longueur cumulee des chaines de caracteres prises en parametre */ diff --git a/src/plugins/aorai/tests/ltl/test_switch2.c b/src/plugins/aorai/tests/ltl/test_switch2.c index b489cf8ac42af7cf66e06fc8de4a9265f36d7a66..77290f3f226e7c9f42bac747c78b41f648e1232b 100644 --- a/src/plugins/aorai/tests/ltl/test_switch2.c +++ b/src/plugins/aorai/tests/ltl/test_switch2.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ int status=0; diff --git a/src/plugins/aorai/tests/ltl/test_switch3.c b/src/plugins/aorai/tests/ltl/test_switch3.c index 6954b71bb89ef6d2358260465765c77d74764065..090c0769545f6092b0ef082458e88f1153e6059a 100644 --- a/src/plugins/aorai/tests/ltl/test_switch3.c +++ b/src/plugins/aorai/tests/ltl/test_switch3.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ /* Calcul de la longueur cumulee des chaines de caracteres prises en parametre */ diff --git a/src/plugins/aorai/tests/ltl/test_switch3_et_recursion.c b/src/plugins/aorai/tests/ltl/test_switch3_et_recursion.c index 7315eb493f479f40b2ed17aa210dab9493388e88..9756ddb36ee09942926236b1920eb63db685071e 100644 --- a/src/plugins/aorai/tests/ltl/test_switch3_et_recursion.c +++ b/src/plugins/aorai/tests/ltl/test_switch3_et_recursion.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl @PTEST_DIR@/@PTEST_NAME@.ltl -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_NAME@.ltl} -aorai-acceptance */ /* Calcul de la longueur cumulee des chaines de caracteres prises en parametre */ diff --git a/src/plugins/aorai/tests/ltl/test_switch3_if.c b/src/plugins/aorai/tests/ltl/test_switch3_if.c index 9fd6094996fa13fe4b773afe5c58b4bdab8ba52f..f79a2dd7b113bd8ae03f4482ad03cc9909306c47 100644 --- a/src/plugins/aorai/tests/ltl/test_switch3_if.c +++ b/src/plugins/aorai/tests/ltl/test_switch3_if.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl %{dep:@PTEST_DIR@/test_switch3.ltl} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_DIR@/test_switch3.ltl} -aorai-acceptance */ /* Calcul de la longueur cumulee des chaines de caracteres prises en parametre */ diff --git a/src/plugins/aorai/tests/ltl/test_switch3_return.c b/src/plugins/aorai/tests/ltl/test_switch3_return.c index 06dbc5fbcd6602de1aa867e5c19d10440548251b..9723ebe712b6c06db4fdb2dec6f5e0f157446c18 100644 --- a/src/plugins/aorai/tests/ltl/test_switch3_return.c +++ b/src/plugins/aorai/tests/ltl/test_switch3_return.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-ltl %{dep:@PTEST_DIR@/test_switch3.ltl} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-ltl %{dep:@PTEST_DIR@/test_switch3.ltl} -aorai-acceptance */ /* Calcul de la longueur cumulee des chaines de caracteres prises en parametre */ diff --git a/src/plugins/aorai/tests/ptests_config b/src/plugins/aorai/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..7fc044169e395ade683964186f5cbf36c046eea5 --- /dev/null +++ b/src/plugins/aorai/tests/ptests_config @@ -0,0 +1,2 @@ +DEFAULT_SUITES= ya ltl +prove_SUITES= ya ltl diff --git a/src/plugins/aorai/tests/test_config b/src/plugins/aorai/tests/test_config index 9ff1b014011bbb31f78dfc53604b40012240b119..cc2f79cac4fa9f38d4f244fc7ea5d6972dd6bbe0 100644 --- a/src/plugins/aorai/tests/test_config +++ b/src/plugins/aorai/tests/test_config @@ -1,6 +1,7 @@ -PLUGIN: aorai eva,from,scope report wp,rtegen +PLUGIN: aorai eva,from,scope,inout report wp,rtegen COMMENT: Path to the library from the test file LIBS: @PTEST_SUITE_DIR@/../Aorai_test -MACRO: PROVE_OPTIONS +DEPS: +OPT: -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ diff --git a/src/plugins/aorai/tests/test_config_prove b/src/plugins/aorai/tests/test_config_prove new file mode 100644 index 0000000000000000000000000000000000000000..14ad045ed7358a3168785aabdfa59ef6afc5ba11 --- /dev/null +++ b/src/plugins/aorai/tests/test_config_prove @@ -0,0 +1,7 @@ +PLUGIN: aorai eva,from,scope report wp,rtegen + +COMMENT: Path to the library from the test file +LIBS: @PTEST_SUITE_DIR@/../Aorai_test + +DEPS: env_var:FRAMAC_WP_CACHEDIR env_var:FRAMAC_WP_CACHE +OPT: -wp-cache-env -aorai-test-prove-aux-spec -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ diff --git a/src/plugins/aorai/tests/test_config_prove.in b/src/plugins/aorai/tests/test_config_prove.in deleted file mode 100644 index ae55e4b9462edc364bdedae55565fd7485e11342..0000000000000000000000000000000000000000 --- a/src/plugins/aorai/tests/test_config_prove.in +++ /dev/null @@ -1,6 +0,0 @@ -PLUGIN: aorai eva,from,scope report wp,rtegen - -COMMENT: Path to the library from the test file -LIBS: @PTEST_SUITE_DIR@/../Aorai_test - -MACRO: PROVE_OPTIONS @AORAI_WP_SHARE@ -wp-cache-env -aorai-test-prove-aux-spec diff --git a/src/plugins/aorai/tests/ya/aorai_ptr_field.i b/src/plugins/aorai/tests/ya/aorai_ptr_field.i index 6d48d76cff3d1a9322c5639f04b27776a24fd456..5db8ef5186c7250e985d3ad7134bb65cb88011e9 100644 --- a/src/plugins/aorai/tests/ya/aorai_ptr_field.i +++ b/src/plugins/aorai/tests/ya/aorai_ptr_field.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ struct S { int x; }; diff --git a/src/plugins/aorai/tests/ya/assigns.c b/src/plugins/aorai/tests/ya/assigns.c index 40f4cb8e76945fe8ddd102ae7d48d632990f4218..0bc1220eb21241cc334d597b56bebfec1435d140 100644 --- a/src/plugins/aorai/tests/ya/assigns.c +++ b/src/plugins/aorai/tests/ya/assigns.c @@ -1,6 +1,6 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ - OPT: -aorai-automata %{dep:@PTEST_DIR@/assigns_det.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/assigns_det.ya} MODULE: name_projects LIBS: OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -then -print diff --git a/src/plugins/aorai/tests/ya/bts1289.i b/src/plugins/aorai/tests/ya/bts1289.i index 9b018dd840ebb0ffa9fdde3eeb3befeed4408b5b..e80a9c5f728075ecdc3f8be68101f684b795783f 100644 --- a/src/plugins/aorai/tests/ya/bts1289.i +++ b/src/plugins/aorai/tests/ya/bts1289.i @@ -1,6 +1,6 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@-2.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@-2.ya} */ void a(void) {} diff --git a/src/plugins/aorai/tests/ya/declared_function.i b/src/plugins/aorai/tests/ya/declared_function.i index 2cd6b702ca4e74c7d101bb1d6320639bed89482f..7a1e3bdfc83fa2e9b4f88cfb14d97dde3871e527 100644 --- a/src/plugins/aorai/tests/ya/declared_function.i +++ b/src/plugins/aorai/tests/ya/declared_function.i @@ -1,5 +1,5 @@ /* run.config* -OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ int f(void); diff --git a/src/plugins/aorai/tests/ya/deterministic.i b/src/plugins/aorai/tests/ya/deterministic.i index 91db6c9ba342ceea82dbc1e1a66bfd3e9690a1c7..b211e6f5d4b008f5928112d9329f00f88ac8737f 100644 --- a/src/plugins/aorai/tests/ya/deterministic.i +++ b/src/plugins/aorai/tests/ya/deterministic.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ int X; diff --git a/src/plugins/aorai/tests/ya/dune b/src/plugins/aorai/tests/ya/dune new file mode 100644 index 0000000000000000000000000000000000000000..1a8230ea13cee57153d2c7fef0529fabdff0761e --- /dev/null +++ b/src/plugins/aorai/tests/ya/dune @@ -0,0 +1,6 @@ +(library + (name Name_projects) + (modules Name_projects) + (libraries frama-c.init.cmdline frama-c.boot frama-c.kernel) + (flags -open Frama_c_kernel) +) diff --git a/src/plugins/aorai/tests/ya/formals.i b/src/plugins/aorai/tests/ya/formals.i index 7cd6e26c65e12719a3ddd1dfe4e8e1370369d4a7..9e2c8f1f54ed3bab747152078d60e989eab2116a 100644 --- a/src/plugins/aorai/tests/ya/formals.i +++ b/src/plugins/aorai/tests/ya/formals.i @@ -1,5 +1,5 @@ /* run.config* -OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ int f(int x) { return x; } diff --git a/src/plugins/aorai/tests/ya/generate_assigns_bts1290.i b/src/plugins/aorai/tests/ya/generate_assigns_bts1290.i index cd8ec32a8440120cc27fc69d41712bdcd4f0eb97..1c1f969ec371d340126ee968038d24a450bb8937 100644 --- a/src/plugins/aorai/tests/ya/generate_assigns_bts1290.i +++ b/src/plugins/aorai/tests/ya/generate_assigns_bts1290.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ void main(void) { diff --git a/src/plugins/aorai/tests/ya/hoare_seq.i b/src/plugins/aorai/tests/ya/hoare_seq.i index 213f469ea1acaaf6c6478d4b987feec89a919cd0..4004035e243dfd8bb1bb29ec8f26d3b8ecb9a10c 100644 --- a/src/plugins/aorai/tests/ya/hoare_seq.i +++ b/src/plugins/aorai/tests/ya/hoare_seq.i @@ -1,5 +1,5 @@ /* run.config* -OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ void f(void) { } diff --git a/src/plugins/aorai/tests/ya/incorrect.i b/src/plugins/aorai/tests/ya/incorrect.i index fad205dde2be66a2dbfddee5473ba46dd140ff87..a301da7b70e16c0c23566cbb0d5fceb7b17ea44f 100644 --- a/src/plugins/aorai/tests/ya/incorrect.i +++ b/src/plugins/aorai/tests/ya/incorrect.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ int f(void); diff --git a/src/plugins/aorai/tests/ya/logical_operators.i b/src/plugins/aorai/tests/ya/logical_operators.i index e70aa15ac821e50fdee3bfb33d49684350c735a2..7ea6dc39a863fcd567c2e7bc7e5112e1ea272f0d 100644 --- a/src/plugins/aorai/tests/ya/logical_operators.i +++ b/src/plugins/aorai/tests/ya/logical_operators.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ void f(int x) {} diff --git a/src/plugins/aorai/tests/ya/loop_bts1050.i b/src/plugins/aorai/tests/ya/loop_bts1050.i index 7ee8431f8e46826c223b7f9df8c60ae7dc81a2a1..b47c0974753351cddb17fcd4b0a669cfea3e02f9 100644 --- a/src/plugins/aorai/tests/ya/loop_bts1050.i +++ b/src/plugins/aorai/tests/ya/loop_bts1050.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ void f(){}; diff --git a/src/plugins/aorai/tests/ya/metavariables-incompatible.i b/src/plugins/aorai/tests/ya/metavariables-incompatible.i index 0654e388f0d77060f17d6a6a69c47d20383e9744..907ea985b9cf115b5b2d57d0381f51158390f7fd 100644 --- a/src/plugins/aorai/tests/ya/metavariables-incompatible.i +++ b/src/plugins/aorai/tests/ya/metavariables-incompatible.i @@ -1,5 +1,5 @@ /* run.config* EXIT: 1 - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ void main(void) {} diff --git a/src/plugins/aorai/tests/ya/metavariables-right.i b/src/plugins/aorai/tests/ya/metavariables-right.i index 2d51676f37c310c85389194d485329208781f581..3891653355a949e580d8bc868c965825d42c1070 100644 --- a/src/plugins/aorai/tests/ya/metavariables-right.i +++ b/src/plugins/aorai/tests/ya/metavariables-right.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ void f(int x) {} diff --git a/src/plugins/aorai/tests/ya/metavariables-wrong.i b/src/plugins/aorai/tests/ya/metavariables-wrong.i index 86c3fea665572e8e103d04f2e91bdcb1474b0dd8..130102d4f1b2e6e702040a952c0706b8aae48f17 100644 --- a/src/plugins/aorai/tests/ya/metavariables-wrong.i +++ b/src/plugins/aorai/tests/ya/metavariables-wrong.i @@ -1,6 +1,6 @@ /* run.config* EXIT: 1 - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ void f(int x) {} void g(void) {} diff --git a/src/plugins/aorai/tests/ya/monostate.i b/src/plugins/aorai/tests/ya/monostate.i index 306c7473dc11a52b88dabe8fcbb6d5607c4448a3..8dc7942ca00320782a2a538046c04b9ea117d02b 100644 --- a/src/plugins/aorai/tests/ya/monostate.i +++ b/src/plugins/aorai/tests/ya/monostate.i @@ -1,7 +1,9 @@ /* run.config -OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} +*/ +/* run.config_prove + DONTRUN: */ - void f(void) {} void main(void) { diff --git a/src/plugins/aorai/tests/ya/not_prm.i b/src/plugins/aorai/tests/ya/not_prm.i index e633a78721bae2a0234a8b38fc944165afdda96d..edd20eb2a8a7ac1e5691e45976936831735cd306 100644 --- a/src/plugins/aorai/tests/ya/not_prm.i +++ b/src/plugins/aorai/tests/ya/not_prm.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -main f -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -main f */ int f(int x) { diff --git a/src/plugins/aorai/tests/ya/observed.i b/src/plugins/aorai/tests/ya/observed.i index 0e289248335e13dc700fdd49bd628a8b7b5d295f..9eb7db20d8483282f65eb5923057e9982125dcc3 100644 --- a/src/plugins/aorai/tests/ya/observed.i +++ b/src/plugins/aorai/tests/ya/observed.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ void f(void) {} diff --git a/src/plugins/aorai/tests/ya/oracle/monostate.res.oracle b/src/plugins/aorai/tests/ya/oracle/monostate.res.oracle index 071567fcd96ef48b2762990dd8b3853fcef9d103..a9b448b9b7ec3c488447c1a870cb38e485d0947e 100644 --- a/src/plugins/aorai/tests/ya/oracle/monostate.res.oracle +++ b/src/plugins/aorai/tests/ya/oracle/monostate.res.oracle @@ -1,6 +1,6 @@ [kernel] Parsing monostate.i (no preprocessing) [aorai] Warning: Call to main does not follow automaton's specification. This path is assumed to be dead -[aorai] monostate.i:8: Warning: +[aorai] monostate.i:10: Warning: Call to main not conforming to automaton (pre-cond). Assuming it is on a dead path [kernel] Parsing TMPDIR/aorai_monostate_0.i (no preprocessing) /* Generated by Frama-C */ diff --git a/src/plugins/aorai/tests/ya/oracle_prove/monostate.res.oracle b/src/plugins/aorai/tests/ya/oracle_prove/monostate.res.oracle deleted file mode 100644 index da8b11c285cb1df1c13f47ad5865cd36256ed01a..0000000000000000000000000000000000000000 --- a/src/plugins/aorai/tests/ya/oracle_prove/monostate.res.oracle +++ /dev/null @@ -1 +0,0 @@ -[kernel] Parsing monostate.i (no preprocessing) diff --git a/src/plugins/aorai/tests/ya/other.c b/src/plugins/aorai/tests/ya/other.c index 8362960d7563ce2ed5566a52ec3278bdfb20d262..c4b00e283bbfd259fc7f6f80739f81ce119b21d7 100644 --- a/src/plugins/aorai/tests/ya/other.c +++ b/src/plugins/aorai/tests/ya/other.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ int x=0; diff --git a/src/plugins/aorai/tests/ya/seq.i b/src/plugins/aorai/tests/ya/seq.i index 24ad34ad46684603c1efdfc844515d42debd44a4..12ca5498910bd6c6fc0745c18a6c9067a4440855 100644 --- a/src/plugins/aorai/tests/ya/seq.i +++ b/src/plugins/aorai/tests/ya/seq.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ void f() { } diff --git a/src/plugins/aorai/tests/ya/seq_loop.i b/src/plugins/aorai/tests/ya/seq_loop.i index 7c6dd8e7f027bbb113ddab4b4c7dd829904cd555..0dffe8e0a154e9f11af5bbbd87ef16305c3230e0 100644 --- a/src/plugins/aorai/tests/ya/seq_loop.i +++ b/src/plugins/aorai/tests/ya/seq_loop.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ void f() {} diff --git a/src/plugins/aorai/tests/ya/serial.c b/src/plugins/aorai/tests/ya/serial.c index 52bdcce277f31da80de99ac0ce33ba67734364b1..0c4d68c1b552fbead932965cf4fe801f323973d4 100644 --- a/src/plugins/aorai/tests/ya/serial.c +++ b/src/plugins/aorai/tests/ya/serial.c @@ -1,8 +1,8 @@ /* run.config - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-smoke-tests -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ -aorai-no-acceptance -aorai-instrumentation-history 2 -aorai-no-generate-annotations -aorai-no-generate-deterministic-lemmas -then-last -eva -eva-partition-value n -eva-ilevel 256 + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-smoke-tests -aorai-no-acceptance -aorai-instrumentation-history 2 -aorai-no-generate-annotations -aorai-no-generate-deterministic-lemmas -then-last -eva -eva-partition-value n -eva-ilevel 256 */ /* run.config_prove -OPT: -cpp-extra-args="-DFOR_WP" -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@_wp.ya} -aorai-smoke-tests -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ -aorai-no-acceptance @PROVE_OPTIONS@ + STDOPT: -cpp-extra-args="-DFOR_WP" -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@_wp.ya} -aorai-smoke-tests -aorai-no-acceptance */ #include "__fc_builtin.h" diff --git a/src/plugins/aorai/tests/ya/single_call.i b/src/plugins/aorai/tests/ya/single_call.i index cf46f34cf511be0300f8485c9b997fdfd282dcb3..a2bb07b69cccdf40627b6c01809d8302e7dc3982 100644 --- a/src/plugins/aorai/tests/ya/single_call.i +++ b/src/plugins/aorai/tests/ya/single_call.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ int main () {} diff --git a/src/plugins/aorai/tests/ya/singleassignment-right.i b/src/plugins/aorai/tests/ya/singleassignment-right.i index 049a066fa4a53e6ee736731e8844445127eb1c3c..cf4738658c4d27818e96152907806060cf23d767 100644 --- a/src/plugins/aorai/tests/ya/singleassignment-right.i +++ b/src/plugins/aorai/tests/ya/singleassignment-right.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ void main(int *x, int *y) diff --git a/src/plugins/aorai/tests/ya/singleassignment-wrong.i b/src/plugins/aorai/tests/ya/singleassignment-wrong.i index 945ecd965c27ee7fbe4481867f39bf2ed93af29d..15a2e8499e9c2eb062d6de93a95ee7dae9abfe20 100644 --- a/src/plugins/aorai/tests/ya/singleassignment-wrong.i +++ b/src/plugins/aorai/tests/ya/singleassignment-wrong.i @@ -1,6 +1,6 @@ /* run.config* EXIT: 1 - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ int main(int x) { diff --git a/src/plugins/aorai/tests/ya/stack.i b/src/plugins/aorai/tests/ya/stack.i index 1e54c03921d948971878f9204d9b22cb4bb02054..5be9fa31d9f97cbb71a4730cf14e363a93141872 100644 --- a/src/plugins/aorai/tests/ya/stack.i +++ b/src/plugins/aorai/tests/ya/stack.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ diff --git a/src/plugins/aorai/tests/ya/test_acces_params.c b/src/plugins/aorai/tests/ya/test_acces_params.c index cf25d86e35dc068e4c801de1c5a65730268bb61f..3fdd7931639abaa45c59f4b6448f44de334ce7b2 100644 --- a/src/plugins/aorai/tests/ya/test_acces_params.c +++ b/src/plugins/aorai/tests/ya/test_acces_params.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ int status=0; diff --git a/src/plugins/aorai/tests/ya/test_acces_params2.c b/src/plugins/aorai/tests/ya/test_acces_params2.c index 220cfe50c1eec403cbd72b214b4d6580d8adfd64..eabaf7fb492b1700eae08c0ecffb5d7ae127f85d 100644 --- a/src/plugins/aorai/tests/ya/test_acces_params2.c +++ b/src/plugins/aorai/tests/ya/test_acces_params2.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ diff --git a/src/plugins/aorai/tests/ya/test_boucle_rechercheTableau.c b/src/plugins/aorai/tests/ya/test_boucle_rechercheTableau.c index 3adf3ad465a27d19e498b17dc82bd8710cd31fb4..08d0662bd83312b12878a2e7e76724eadabca2f2 100644 --- a/src/plugins/aorai/tests/ya/test_boucle_rechercheTableau.c +++ b/src/plugins/aorai/tests/ya/test_boucle_rechercheTableau.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ diff --git a/src/plugins/aorai/tests/ya/test_factorial.c b/src/plugins/aorai/tests/ya/test_factorial.c index a132cdd62ddc2de84a3257fd7e186e7f13c31e0f..5b7b93b28555091f6745711827f3e3e10542137a 100644 --- a/src/plugins/aorai/tests/ya/test_factorial.c +++ b/src/plugins/aorai/tests/ya/test_factorial.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} */ diff --git a/src/plugins/aorai/tests/ya/test_recursion4.c b/src/plugins/aorai/tests/ya/test_recursion4.c index d07f4ba8ce6f6f36ffc103bf9c96f6b6c9636d4e..41119f495f30894fc53a67bbb0e92c0b61f8d447 100644 --- a/src/plugins/aorai/tests/ya/test_recursion4.c +++ b/src/plugins/aorai/tests/ya/test_recursion4.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ # pragma JessieIntegerModel(math) diff --git a/src/plugins/aorai/tests/ya/test_recursion5.c b/src/plugins/aorai/tests/ya/test_recursion5.c index f8eb2402586c7093fe9a87bafe08506f55995e08..3aae3fc01b7547c9351b5f92e98823c01780fa5e 100644 --- a/src/plugins/aorai/tests/ya/test_recursion5.c +++ b/src/plugins/aorai/tests/ya/test_recursion5.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ diff --git a/src/plugins/aorai/tests/ya/test_struct.c b/src/plugins/aorai/tests/ya/test_struct.c index 4566f8296cc71900c3ce3d487970f7c493c4b1a1..18e24febebca0d44e7e3a77cd8bb823ae990260a 100644 --- a/src/plugins/aorai/tests/ya/test_struct.c +++ b/src/plugins/aorai/tests/ya/test_struct.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance -aorai-test-id @PTEST_NUMBER@@PTEST_CONFIG@ @PROVE_OPTIONS@ + STDOPT: -aorai-automata %{dep:@PTEST_DIR@/@PTEST_NAME@.ya} -aorai-acceptance */ struct People{ diff --git a/ivette/src/frama-c/api_generator.ml b/src/plugins/api-generator/api_generator.ml similarity index 97% rename from ivette/src/frama-c/api_generator.ml rename to src/plugins/api-generator/api_generator.ml index 5e29fab1eb556a5c6925f9f7eaafc9369d33c2bd..58e8852eef68efba8f3e7ca90c3bb20189f5e495 100644 --- a/ivette/src/frama-c/api_generator.ml +++ b/src/plugins/api-generator/api_generator.ml @@ -559,20 +559,22 @@ let makePackage pkg path fmt = (* -------------------------------------------------------------------------- *) let generate () = - begin - Pkg.iter - begin fun pkg -> - let path = pkg_path ~plugin:pkg.p_plugin ~package:pkg.p_package in - Self.feedback "Package %s" path ; - let out = OUT.get () in - let file = Printf.sprintf "%s/%s/index.ts" out path in - let dir = Filename.dirname file in - if not (Sys.file_exists dir && Sys.is_directory dir) then - Extlib.mkdir ~parents:true dir 0o755 ; - Command.print_file file (makePackage pkg path) ; - end - end - -let () = Db.Main.extend generate + if TSC.get () then + begin + Pkg.iter + begin fun pkg -> + let path = pkg_path ~plugin:pkg.p_plugin ~package:pkg.p_package in + Self.feedback "Package %s" path ; + let out = OUT.get () in + let file = Printf.sprintf "%s/%s/index.ts" out path in + let dir = Filename.dirname file in + if not (Sys.file_exists dir && Sys.is_directory dir) then + Extlib.mkdir ~parents:true dir 0o755 ; + Command.print_file file (makePackage pkg path) ; + end + end + +let () = + Db.Main.extend generate (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/api-generator/dune b/src/plugins/api-generator/dune new file mode 100644 index 0000000000000000000000000000000000000000..b62d113b162fb00e0ab037a7125d14bc40f0c512 --- /dev/null +++ b/src/plugins/api-generator/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +( library + (name api_generator) + (optional) + (public_name frama-c-api-generator.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-server.core) +) + +(plugin (optional) (name api_generator) (libraries frama-c-api-generator.core) (site (frama-c plugins))) diff --git a/src/plugins/api-generator/dune-project b/src/plugins/api-generator/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..572790587d344dcbc049c3f6cabe6a6302532763 --- /dev/null +++ b/src/plugins/api-generator/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-api-generator) +(using dune_site 0.1) diff --git a/src/plugins/api-generator/frama-c-api-generator.opam b/src/plugins/api-generator/frama-c-api-generator.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/callgraph/callgraph.ml b/src/plugins/callgraph/callgraph.ml new file mode 100644 index 0000000000000000000000000000000000000000..a7fab38b88acfce6edfcd1857d69622cae2ffa36 --- /dev/null +++ b/src/plugins/callgraph/callgraph.ml @@ -0,0 +1,26 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module Options = Options +module Cg = Cg +module Services = Services +module Uses = Uses diff --git a/src/plugins/callgraph/Callgraph.mli b/src/plugins/callgraph/callgraph.mli similarity index 96% rename from src/plugins/callgraph/Callgraph.mli rename to src/plugins/callgraph/callgraph.mli index 6cb4ac6abb6ec76cc0d8283bfa86b19546868eef..175a4de16183527c9262b04efc96d80ba66ed6e9 100644 --- a/src/plugins/callgraph/Callgraph.mli +++ b/src/plugins/callgraph/callgraph.mli @@ -23,11 +23,13 @@ (** Callgraph plugin. *) module Options: sig + include Plugin.S module Filename: Parameter_sig.Filepath module Service_roots: Parameter_sig.Kernel_function_set module Uncalled: Parameter_sig.Bool module Uncalled_leaf: Parameter_sig.Bool module Services: Parameter_sig.Bool + module Roots : Parameter_sig.Kernel_function_set end module Cg: module type of Cg diff --git a/src/plugins/callgraph/callgraph_api.mli b/src/plugins/callgraph/callgraph_api.ml similarity index 100% rename from src/plugins/callgraph/callgraph_api.mli rename to src/plugins/callgraph/callgraph_api.ml diff --git a/src/plugins/callgraph/dune b/src/plugins/callgraph/dune new file mode 100644 index 0000000000000000000000000000000000000000..8e92d9212bd18f2270f791962043c9ba1c04ec60 --- /dev/null +++ b/src/plugins/callgraph/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Callgraph:" %{lib-available:frama-c-callgraph.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name callgraph) + (optional) + (public_name frama-c-callgraph.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core) +) + +(plugin (optional) (name callgraph) (libraries frama-c-callgraph.core) (site (frama-c plugins))) diff --git a/src/plugins/callgraph/dune-project b/src/plugins/callgraph/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..f0c8f918da8eee6f140dc0ccec184570c1d9fe56 --- /dev/null +++ b/src/plugins/callgraph/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-callgraph) +(using dune_site 0.1) diff --git a/src/plugins/callgraph/frama-c-callgraph.opam b/src/plugins/callgraph/frama-c-callgraph.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/callgraph/cg_viewer.yes.ml b/src/plugins/callgraph/gui/cg_viewer.ml similarity index 99% rename from src/plugins/callgraph/cg_viewer.yes.ml rename to src/plugins/callgraph/gui/cg_viewer.ml index 7885f9f43dab46a5e8934f5633c4168bfb423d79..c3f460858deff77aa07ad0e1f66bd5dfce731a7c 100644 --- a/src/plugins/callgraph/cg_viewer.yes.ml +++ b/src/plugins/callgraph/gui/cg_viewer.ml @@ -20,7 +20,7 @@ (* *) (**************************************************************************) -open DGRAPH_MODULE +open Graph.S let ($) f x = f x diff --git a/src/plugins/callgraph/cg_viewer.mli b/src/plugins/callgraph/gui/cg_viewer.mli similarity index 100% rename from src/plugins/callgraph/cg_viewer.mli rename to src/plugins/callgraph/gui/cg_viewer.mli diff --git a/src/plugins/callgraph/gui/dune b/src/plugins/callgraph/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..ff7cfa689b1b5ac29dc40677ad8628516ddf2836 --- /dev/null +++ b/src/plugins/callgraph/gui/dune @@ -0,0 +1,50 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Callgraph GUI:" %{lib-available:frama-c-callgraph.gui} "\n") + (echo " - Frama-C GUI:" %{lib-available:frama-c.gui} "\n") + (echo " - Callgraph:" %{lib-available:frama-c-callgraph.core} "\n") + (echo " - Ocamlgraph_gtk:" %{lib-available:ocamlgraph_gtk} "\n") + (echo " - Ocamlgraph Dgraph:" %{lib-available:ocamlgraph.dgraph} "\n") + ) + ) +) + +( library + (name callgraph_gui) + (public_name frama-c-callgraph.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Callgraph :standard -w -9) + (libraries + frama-c.kernel frama-c.gui frama-c-callgraph.core + (select graph.ml from + (ocamlgraph.dgraph -> graph.dgraph.ml) + (ocamlgraph_gtk -> graph.gtk.ml) + ) + ) +) + +(plugin (optional) (name callgraph-gui) (libraries frama-c-callgraph.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/callgraph/gui/graph.dgraph.ml b/src/plugins/callgraph/gui/graph.dgraph.ml new file mode 100644 index 0000000000000000000000000000000000000000..560157d8b49dc545e5e3ccc81d6b1f356af7ece7 --- /dev/null +++ b/src/plugins/callgraph/gui/graph.dgraph.ml @@ -0,0 +1,23 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module S = Dgraph diff --git a/src/plugins/callgraph/gui/graph.gtk.ml b/src/plugins/callgraph/gui/graph.gtk.ml new file mode 100644 index 0000000000000000000000000000000000000000..4e838b8a12d9ab70f6ea52415f7fe3ac89d2b529 --- /dev/null +++ b/src/plugins/callgraph/gui/graph.gtk.ml @@ -0,0 +1,23 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module S = Graph_gtk diff --git a/src/plugins/callgraph/services.ml b/src/plugins/callgraph/services.ml index 6ff1bb2aa2f462c83e3dadb1b559943c41152dd2..26a8c186d0ceb27d450c32844e015186ba018a72 100644 --- a/src/plugins/callgraph/services.ml +++ b/src/plugins/callgraph/services.ml @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +module type S = Graph.Graphviz.GraphWithDotAttrs + let initial_service_roots cg = let roots = Options.Service_roots.get () in let roots = diff --git a/src/plugins/constant_propagation/Constant_Propagation.mli b/src/plugins/constant_propagation/Constant_Propagation.ml similarity index 99% rename from src/plugins/constant_propagation/Constant_Propagation.mli rename to src/plugins/constant_propagation/Constant_Propagation.ml index 10d9dddf5981b91fc373b6473cf7eb0283ad66e9..9b41e2182f907d231bf02c5b2c5ac47ae6155c19 100644 --- a/src/plugins/constant_propagation/Constant_Propagation.mli +++ b/src/plugins/constant_propagation/Constant_Propagation.ml @@ -38,4 +38,4 @@ module Api : sig val self: State.t (** Internal state of the constant propagation plugin. *) -end +end = Api diff --git a/src/plugins/constant_propagation/dune b/src/plugins/constant_propagation/dune new file mode 100644 index 0000000000000000000000000000000000000000..14b9dbea7cc71cb83956803de3fb275681a56dab --- /dev/null +++ b/src/plugins/constant_propagation/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Constant Propagation:" %{lib-available:frama-c-constant_propagation.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name Constant_Propagation) + (optional) + (public_name frama-c-constant_propagation.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core) +) + +(plugin (optional) (name constant_propagation) (libraries frama-c-constant_propagation.core) (site (frama-c plugins))) diff --git a/src/plugins/constant_propagation/dune-project b/src/plugins/constant_propagation/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..e455736b22b6e7e1b7129d532ec861a17930799b --- /dev/null +++ b/src/plugins/constant_propagation/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-constant_propagation) +(using dune_site 0.1) diff --git a/src/plugins/constant_propagation/frama-c-constant_propagation.opam b/src/plugins/constant_propagation/frama-c-constant_propagation.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/dive/.gitignore b/src/plugins/dive/.gitignore index b9f44a02f3c684cc2b3080dc8d5e96a4e758cf1a..2da34c702bc6458d352da4d681c3928c90cca5ee 100644 --- a/src/plugins/dive/.gitignore +++ b/src/plugins/dive/.gitignore @@ -1,3 +1,3 @@ /Makefile /tests/*/result -/tests/ptests_config +/tests/**/dune diff --git a/src/plugins/dive/Dive.mli b/src/plugins/dive/Dive.ml similarity index 100% rename from src/plugins/dive/Dive.mli rename to src/plugins/dive/Dive.ml diff --git a/src/plugins/dive/Makefile.in b/src/plugins/dive/Makefile.in deleted file mode 100644 index 3efa3bc692c896dae500621825880f7771866e8e..0000000000000000000000000000000000000000 --- a/src/plugins/dive/Makefile.in +++ /dev/null @@ -1,71 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -####################### -# Frama-C Environment # -####################### - -ifndef FRAMAC_SHARE -FRAMAC_SHARE := $(shell frama-c-config -print-share-path) -endif - -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR := $(shell frama-c-config -print-libpath) -endif - -######################### -# Plug-in configuration # -######################### - -PLUGIN_DIR ?=. -PLUGIN_ENABLE:=@ENABLE_DIVE@ -PLUGIN_NAME := Dive -PLUGIN_CMO := self callstack node_kind node_range dive_graph context build \ - main server_interface -PLUGIN_CMI := dive_types -PLUGIN_DEPENDENCIES:= Eva Studia Server -PLUGIN_HAS_MLI:= yes -PLUGIN_TESTS_DIRS:=dive -PLUGIN_GENERATED:= -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR:=$(FRAMAC_SRC) -CONFIG_STATUS_DIR_DEP:= -else -CONFIG_STATUS_DIR:=$(Dive_DIR) -CONFIG_STATUS_DIR_DEP:=$(CONFIG_STATUS_DIR)/config.status -endif - -$(Dive_DIR)/Makefile: $(Dive_DIR)/Makefile.in $(CONFIG_STATUS_DIR_DEP) - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/dive/dive_types.mli b/src/plugins/dive/dive_types.ml similarity index 100% rename from src/plugins/dive/dive_types.mli rename to src/plugins/dive/dive_types.ml diff --git a/src/plugins/dive/dune b/src/plugins/dive/dune new file mode 100644 index 0000000000000000000000000000000000000000..15bca5e49896d8b1dd899c7075e88290db641cbf --- /dev/null +++ b/src/plugins/dive/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Dive:" %{lib-available:frama-c-dive.core} "\n") + (echo " - Studia:" %{lib-available:frama-c-studia.core} "\n") + (echo " - Server:" %{lib-available:frama-c-server.core} "\n") + ) + ) +) + +( library + (name dive) + (optional) + (public_name frama-c-dive.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-studia.core frama-c-server.core) +) + +(plugin (optional) (name dive) (libraries frama-c-dive.core) (site (frama-c plugins))) diff --git a/src/plugins/dive/dune-project b/src/plugins/dive/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..0a45c5e58bba18590aa1c31aac005ddadca7a2f0 --- /dev/null +++ b/src/plugins/dive/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-dive) +(using dune_site 0.1) diff --git a/src/plugins/dive/frama-c-dive.opam b/src/plugins/dive/frama-c-dive.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/dive/tests/ptests_config b/src/plugins/dive/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..d8848b508138bc2bee1fe99b2d72d5a9cc25d475 --- /dev/null +++ b/src/plugins/dive/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= dive diff --git a/src/plugins/e-acsl/.gitignore b/src/plugins/e-acsl/.gitignore index 4d4e1b4e3be4ba690d9db38bfe4e027e7b5a0632..6f12194ddbc0198d72df30192cb7f036339c617c 100644 --- a/src/plugins/e-acsl/.gitignore +++ b/src/plugins/e-acsl/.gitignore @@ -7,7 +7,6 @@ /config.log /Makefile /.depend -/local_config.ml /config.status /autom4te.cache /ptests_local_config.ml @@ -50,11 +49,8 @@ /doc/userman/*.log /doc/userman/*.lof /doc/userman/eacslversion.tex -/tests/test_config -/tests/test_config_dev /tests/*/result*/* .frama-c -tests/ptests_config META.frama-c-e_acsl .merlin .Makefile.plugin.generated @@ -70,5 +66,4 @@ lib/libeacsl-rtl-bittree.a lib/libeacsl-rtl-segment.a lib/libeacsl-rtl-bittree-dbg.a lib/libeacsl-rtl-segment-dbg.a -src/local_config.ml src/dependencies/dep_eva.ml diff --git a/src/plugins/e-acsl/E_ACSL.ml b/src/plugins/e-acsl/E_ACSL.ml new file mode 100644 index 0000000000000000000000000000000000000000..cd493091bd32093ea5aa49357269efaef7926c87 --- /dev/null +++ b/src/plugins/e-acsl/E_ACSL.ml @@ -0,0 +1,37 @@ +(**************************************************************************) +(* *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) +(* *) +(* Copyright (C) 2012-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** E-ACSL. *) + +module Options = Options +module Error = Error + +module Translate_terms = Translate_terms +module Translate_predicates = Translate_predicates + +module Functions = Functions + +(* +Local Variables: +compile-command: "make" +End: +*) diff --git a/src/plugins/e-acsl/Makefile.in b/src/plugins/e-acsl/Makefile.in deleted file mode 100644 index 8bfa6aa9f51ab92b34b9ca2abd70cc564130bc97..0000000000000000000000000000000000000000 --- a/src/plugins/e-acsl/Makefile.in +++ /dev/null @@ -1,588 +0,0 @@ -########################################################################## -# # -# This file is part of the Frama-C's E-ACSL plug-in. # -# # -# Copyright (C) 2012-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -####################### -# Frama-C Environment # -####################### - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -################### -# Plug-in sources # -################### - -# libraries -SRC_LIBRARIES:= \ - error \ - builtins \ - functions \ - misc \ - gmp_types \ - logic_aggr \ - varname -SRC_LIBRARIES:=$(addprefix src/libraries/, $(SRC_LIBRARIES)) - -# project initializer -SRC_PROJECT_INITIALIZER:= \ - rtl \ - prepare_ast -SRC_PROJECT_INITIALIZER:=\ - $(addprefix src/project_initializer/, $(SRC_PROJECT_INITIALIZER)) - -# analyses -ANALYSES_CMI:= \ - analyses_types -ANALYSES_CMI:=$(addprefix src/analyses/, $(ANALYSES_CMI)) - -SRC_ANALYSES:= \ - lscope \ - analyses_datatype \ - rte \ - e_acsl_visitor \ - logic_normalizer \ - bound_variables \ - interval \ - typing \ - labels \ - literal_strings \ - memory_tracking \ - exit_points \ - analyses -SRC_ANALYSES:=$(addprefix src/analyses/, $(SRC_ANALYSES)) - -# code generator -CODE_GENERATOR_CMI:= \ - contract_types -CODE_GENERATOR_CMI:=$(addprefix src/code_generator/, $(CODE_GENERATOR_CMI)) - -SRC_CODE_GENERATOR:= \ - translation_error \ - smart_exp \ - smart_stmt \ - gmp \ - env \ - assert \ - rational \ - typed_number \ - assigns \ - logic_functions \ - loops \ - quantif \ - memory_translate \ - logic_array \ - translate_utils \ - translate_ats \ - translate_terms \ - translate_predicates \ - translate_rtes \ - contract \ - translate_annots \ - temporal \ - memory_observer \ - literal_observer \ - global_observer \ - libc \ - injector -SRC_CODE_GENERATOR:=$(addprefix src/code_generator/, $(SRC_CODE_GENERATOR)) - -######################### -# Plug-in configuration # -######################### - -PLUGIN_DIR ?=. -PLUGIN_EXTRA_DIRS:=\ - src \ - src/libraries \ - src/analyses \ - src/project_initializer \ - src/code_generator -PLUGIN_ENABLE:=@ENABLE_E_ACSL@ -PLUGIN_NAME:=E_ACSL -PLUGIN_CMO:= src/local_config \ - src/options \ - $(SRC_LIBRARIES) \ - $(SRC_PROJECT_INITIALIZER) \ - $(SRC_ANALYSES) \ - $(SRC_CODE_GENERATOR) \ - src/main -PLUGIN_CMI:= \ - $(LIBRARIES_CMI) \ - $(ANALYSES_CMI) \ - $(CODE_GENERATOR_CMI) -PLUGIN_HAS_MLI:=yes -PLUGIN_DISTRIBUTED:=yes -PLUGIN_DEPENDENCIES:= RteGen -PLUGIN_GENERATED:= - -# We "save" this variable so that it can be used once PLUGIN_DIR has been reset -EACSL_PLUGIN_DIR:=$(PLUGIN_DIR) - -# Suppress a spurious warning with OCaml >= 4.04.0 -$(EACSL_PLUGIN_DIR)/src/analyses/memory_tracking.cmo \ -$(EACSL_PLUGIN_DIR)/src/analyses/memory_tracking.cmi: E_ACSL_BFLAGS+= -w -60 -$(EACSL_PLUGIN_DIR)/src/analyses/memory_tracking.cmx: E_ACSL_OFLAGS+= -w -60 - -############### -# Local Flags # -############### -# Do not edit the line below: it is automatically set by 'make e-acsl-distrib' -IS_DISTRIBUTED:=no - -####################### -# Local configuration # -####################### - -PLUGIN_GENERATED += $(EACSL_PLUGIN_DIR)/src/local_config.ml - -VERSION_FILE=$(FRAMAC_ROOT_SRCDIR)/VERSION - -################ -# Version # -################ - -EACSL_VERSION:=$(shell sed -e 's/\\(.*\\)/\\1/' $(VERSION_FILE)) - -$(EACSL_PLUGIN_DIR)/src/local_config.ml: $(EACSL_PLUGIN_DIR)/Makefile $(VERSION_FILE) - $(PRINT_MAKING) $@ - $(RM) $@ - $(ECHO) "(* This file was automatically generated from $<. Don't edit it. *)" >> $@ - $(ECHO) "let version = \""$(EACSL_VERSION)"\"" >> $@ - $(CHMOD_RO) $@ - -########### -# Testing # -########### - -ifeq (@MAY_RUN_TESTS@,yes) - --include in_frama_ci - -PLUGIN_TESTS_DIRS := \ - examples \ - bts \ - concurrency \ - constructs \ - arith \ - memory \ - gmp-only \ - full-mtracking \ - format \ - temporal \ - special \ - builtin \ - libc - -PLUGIN_TESTS_LIB := $(EACSL_PLUGIN_DIR)/tests/E_ACSL_test.ml - -DEV?= -ifeq ("$(DEV)","yes") - EACSL_TEST_CONFIG:=dev -endif - -ifdef EACSL_TEST_CONFIG - # Prepend PTESTS_OPTS with the test config to use. If the user-provided - # PTESTS_OPTS variable contains another -config instruction, then it will be - # prioritized over the one selected by the Makefile. - E_ACSL_TESTS E_ACSL_DEFAULT_TESTS: override PTESTS_OPTS:=-config $(EACSL_TEST_CONFIG) $(PTESTS_OPTS) -endif - -TEST_DEPENDENCIES:= \ - $(EACSL_PLUGIN_DIR)/tests/ptests_config \ - $(EACSL_PLUGIN_DIR)/tests/test_config \ - $(EACSL_PLUGIN_DIR)/tests/test_config_dev \ - $(EACSL_PLUGIN_DIR)/tests/E_ACSL_test.cmo \ - $(EACSL_PLUGIN_DIR)/tests/wrapper.sh - -ifeq ($(OCAMLBEST),opt) -TEST_DEPENDENCIES += \ - $(EACSL_PLUGIN_DIR)/tests/E_ACSL_test.cmxs -endif - -ifneq ("$(PLUGIN_ENABLE)","no") -# Add the test dependencies to the test targets, but also to -# `plugins_ptests_config` so that they are built along with the main target. -plugins_ptests_config: $(TEST_DEPENDENCIES) -E_ACSL_TESTS E_ACSL_DEFAULT_TESTS: $(TEST_DEPENDENCIES) -tests:: $(TEST_DEPENDENCIES) -endif - -clean:: - for d in $(E_ACSL_EXTRA_DIRS); do \ - $(RM) $$d/*~; \ - done - $(PRINT_RM) cleaning generated test files - $(RM) $(E_ACSL_DIR)/tests/*.cm* $(E_ACSL_DIR)/tests/*.o - $(RM) $(foreach dir, $(PLUGIN_TESTS_DIRS), tests/$(dir)/result/*) - -endif - -################################################ -# Third-party C libraries # -################################################ - -EACSL_LIBDIR := $(EACSL_PLUGIN_DIR)/lib - -############ -# DLMALLOC # -############ - -EACSL_DLMALLOC_REL_DIR := contrib/libdlmalloc -EACSL_DLMALLOC_DIR := $(EACSL_PLUGIN_DIR)/$(EACSL_DLMALLOC_REL_DIR) -EACSL_DLMALLOC_LIBNAME = libeacsl-dlmalloc.a -EACSL_DLMALLOC_LIB = $(EACSL_LIBDIR)/$(EACSL_DLMALLOC_LIBNAME) -EACSL_DLMALLOC_SRC = $(EACSL_DLMALLOC_DIR)/dlmalloc.c -EACSL_DLMALLOC_OBJ = dlmalloc.o -# Don't forget to update "e-acsl-gcc.sh" if the flags are updated -EACSL_DLMALLOC_FLAGS = \ - -DHAVE_MORECORE=0 \ - -DHAVE_MMAP=1 \ - -DNO_MALLINFO=1 \ - -DNO_MALLOC_STATS=1 \ - -DMSPACES=1 \ - -DONLY_MSPACES \ - -DMALLOC_ALIGNMENT=32 \ - -DMSPACE_PREFIX="__e_acsl_" \ - -DUSE_LOCKS=1 \ - -DUSE_SPIN_LOCKS=1 - -$(EACSL_DLMALLOC_LIB): $(EACSL_DLMALLOC_SRC) $(EACSL_PLUGIN_DIR)/Makefile - $(MKDIR) $(EACSL_LIBDIR) - echo 'CC $<' - $(CC) $< -c -O2 -g3 -o$(EACSL_DLMALLOC_OBJ) $(EACSL_DLMALLOC_FLAGS) - echo 'AR $@' - $(AR) crus $@ $(EACSL_DLMALLOC_OBJ) - echo 'RANLIB $@' - ranlib $@ - -ifneq ("$(PLUGIN_ENABLE)","no") -all:: $(EACSL_DLMALLOC_LIB) - -clean:: - $(RM) $(EACSL_DLMALLOC_LIB) -endif - -############ -# Cleaning # -############ - -EACSL_CLEANFILES = doc/doxygen/doxygen.cfg \ - Makefile config.log config.status configure .depend autom4te.cache/* \ - META.frama-c-e_acsl Makefile.plugin.generated src/local_config.ml \ - top/* \ - $(TEST_DEPENDENCIES) - -e-acsl-distclean: clean - $(PRINT_RM) generated project files - $(RM) $(wildcard $(addprefix $(E_ACSL_DIR)/, $(EACSL_CLEANFILES))) - -################################################################# -# Common variables between source distribution and installation # -################################################################# - -EACSL_C_DIRECTORIES := \ - e-acsl \ - e-acsl/internals \ - e-acsl/instrumentation_model \ - e-acsl/observation_model \ - e-acsl/observation_model/internals \ - e-acsl/observation_model/bittree_model \ - e-acsl/observation_model/segment_model \ - e-acsl/numerical_model \ - e-acsl/libc_replacements - -EACSL_SCRIPTS := \ - scripts/e-acsl-gcc.sh - -EACSL_BASHCOMPS := \ - scripts/e-acsl-gcc.sh.comp - -EACSL_MANPAGES := \ - man/e-acsl-gcc.sh.1 - -################################ -# Building source distribution # -################################ - -EACSL_CONTRIB_FILES = \ - $(EACSL_DLMALLOC_REL_DIR)/dlmalloc.c - -EACSL_DOC_FILES = \ - doc/doxygen/doxygen.cfg.in \ - doc/Changelog \ - $(EACSL_MANPAGES) - -EACSL_TEST_FILES = \ - tests/test_config_dev \ - tests/test_config \ - tests/wrapper.sh \ - tests/gmp-only/test_config \ - tests/gmp-only/test_config_dev \ - tests/full-mtracking/test_config \ - tests/full-mtracking/test_config_dev \ - tests/builtin/test_config \ - tests/builtin/test_config_dev \ - tests/temporal/test_config \ - tests/temporal/test_config_dev \ - tests/format/test_config \ - tests/format/test_config_dev \ - tests/concurrency/test_config \ - tests/concurrency/test_config_dev \ - tests/E_ACSL_test.ml - -EACSL_TESTS_C_FILES = \ - $(foreach dir, $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/*.[ich] \ - ) \ - tests/utils/signalled.h - -# Test files without header management -EACSL_DISTRIB_TESTS = \ - $(EACSL_TESTS_C_FILES) \ - $(foreach dir, $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/test_config \ - $(dir)/test_config_dev \ - $(dir)/oracle/* \ - $(dir)/oracle_dev/* \ - ) \ - tests/builtin/utils \ - tests/format/utils - -EACSL_RTL_FILES = $(EACSL_RTL_SRC) - -EACSL_SCRIPT_FILES = $(EACSL_SCRIPTS) - -EACSL_BASHCOMP_FILES = $(EACSL_BASHCOMPS) - -EACSL_LICENSE_FILES = \ - license/CEA_LGPL license/SPARETIMELABS \ - license/headache_config.txt license/LGPLv2.1 - -EACSL_MISC_FILES = \ - configure.ac Makefile.in README tab-in-changelog.sh - -EACSL_SHARE_FILES = \ - $(addprefix share/,$(addsuffix /*.[ch],$(EACSL_C_DIRECTORIES))) - -EACSL_DISTRIB_EXTERNAL =\ - $(EACSL_SHARE_FILES) \ - $(EACSL_MISC_FILES) \ - $(EACSL_DOC_FILES) \ - $(EACSL_TEST_FILES) \ - $(EACSL_RTL_FILES) \ - $(EACSL_SCRIPT_FILES) \ - $(EACSL_BASHCOMP_FILES) \ - $(EACSL_LICENSE_FILES) \ - $(EACSL_CONTRIB_FILES) - -PLUGIN_DISTRIB_EXTERNAL:= $(EACSL_DISTRIB_EXTERNAL) - -# Files of `DISTRIB_FILES` without header and not listed in file -# `headers/header_specs.txt`. -PLUGIN_HEADER_EXCEPTIONS:= - -# Files that are not listed in `DISTRIB_FILES` -# and dedicated to distributed tests -PLUGIN_DISTRIB_TESTS:= $(EACSL_DISTRIB_TESTS) - -######## -# Misc # -######## - -wc: - ocamlwc -p $(EACSL_OCAML_FILES) - -# Files to format with clang-format -EACSL_CLANG_FORMAT_SRC:=\ - $(addprefix $(EACSL_PLUGIN_DIR)/,$(EACSL_TESTS_C_FILES)) \ - $(addprefix $(EACSL_PLUGIN_DIR)/,$(EACSL_SHARE_FILES)) - -# Format C files -eacsl-clang-format: - if command -v clang-format >/dev/null; then \ - echo "Formatting E-ACSL C files with clang-format..."; \ - clang-format -i $(EACSL_CLANG_FORMAT_SRC); \ - else \ - echo "clang-format should be installed to check the formatting of E-ACSL C files"; \ - fi; - -# Check if C files are correctly formatted -eacsl-lint-c: - if command -v clang-format >/dev/null; then \ - echo "Checking formatting of E-ACSL C files..."; \ - clang-format --dry-run -Werror $(EACSL_CLANG_FORMAT_SRC); \ - else \ - echo "clang-format should be installed to check the formatting of E-ACSL C files"; \ - fi; - -# Check for the absence of <TAB> characters in the changelog -eacsl-lint-changelog: - echo "Checking changelog of E-ACSL for the absence of <TAB> characters..." - $(EACSL_PLUGIN_DIR)/tab-in-changelog.sh - -# Extend lint step with E-ACSL specific lint -lint:: eacsl-lint-changelog eacsl-lint-c - -########## -# Header # -########## - -ifneq ("$(FRAMAC_INTERNAL)","yes") - -EACSL_SPARETIMELABS= \ - $(EACSL_PLUGIN_DIR)/share/e-acsl/internals/e_acsl_rtl_io.h \ - $(EACSL_PLUGIN_DIR)/share/e-acsl/internals/e_acsl_rtl_io.c - -EACSL_SHARE_BARE= \ - $(addprefix share/,$(addsuffix /*.[ch],$(EACSL_C_DIRECTORIES))) -EACSL_SHARE=$(addprefix $(EACSL_PLUGIN_DIR)/, $(EACSL_SHARE_BARE)) -EACSL_CEA_SHARE=$(filter-out $(EACSL_SPARETIMELABS), $(wildcard $(EACSL_SHARE))) - -EACSL_CEA_LGPL_BARE= src/*.ml src/*/*.ml src/*.mli src/*/*.mli \ - E_ACSL.mli \ - Makefile.in configure.ac tab-in-changelog.sh \ - scripts/*.sh \ - scripts/*.comp \ - tests/E_ACSL_test.ml \ - tests/wrapper.sh \ - man/e-acsl-gcc.sh.1 -EACSL_CEA_LGPL=$(addprefix $(EACSL_PLUGIN_DIR)/, $(EACSL_CEA_LGPL_BARE)) \ - $(EACSL_CEA_SHARE) - -# valid values: open-source, close-source -EACSL_HEADERS?=open-source -headers:: - @echo "Applying $(EACSL_HEADERS) headers..." - headache -c $(EACSL_PLUGIN_DIR)/license/headache_config.txt \ - -h $(EACSL_PLUGIN_DIR)/headers/$(EACSL_HEADERS)/CEA_LGPL_OR_PROPRIETARY.E_ACSL \ - $(EACSL_CEA_LGPL) - headache -c $(EACSL_PLUGIN_DIR)/license/headache_config.txt \ - -h $(EACSL_PLUGIN_DIR)/headers/$(EACSL_HEADERS)/MODIFIED_SPARETIMELABS \ - $(EACSL_SPARETIMELABS) - headache -c $(EACSL_PLUGIN_DIR)/license/headache_config.txt \ - -h $(EACSL_PLUGIN_DIR)/headers/$(EACSL_HEADERS)/MODIFIED_DLMALLOC \ - $(EACSL_PLUGIN_DIR)/contrib/libdlmalloc/dlmalloc.c - -endif - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -########### -# Install # -########### - -EACSL_INSTALL_SCRIPTS=$(addprefix $(E_ACSL_DIR)/,$(EACSL_SCRIPTS)) - -EACSL_INSTALL_MANPAGES=$(addprefix $(E_ACSL_DIR)/,$(EACSL_MANPAGES)) - -EACSL_INSTALL_BASHCOMPS=$(addprefix $(E_ACSL_DIR)/,$(EACSL_BASHCOMPS)) - -EACSL_INSTALL_LIB_DIR :=$(FRAMAC_LIBDIR)/e-acsl - -EACSL_INSTALL_CONTRIB_DIR :=$(FRAMAC_DATADIR)/e-acsl/contrib - -install:: clean-install - $(PRINT_INSTALL) E-ACSL share files - for dir in $(EACSL_C_DIRECTORIES); do \ - $(MKDIR) $(FRAMAC_DATADIR)/$$dir && \ - $(CP) $(E_ACSL_DIR)/share/$$dir/*.[ch] $(FRAMAC_DATADIR)/$$dir ; \ - done - $(PRINT_INSTALL) E-ACSL libraries - $(MKDIR) $(EACSL_INSTALL_LIB_DIR) - $(CP) $(EACSL_LIBDIR)/libeacsl-*.a $(EACSL_INSTALL_LIB_DIR) - $(MKDIR) $(EACSL_INSTALL_CONTRIB_DIR)/libdlmalloc - $(CP) $(EACSL_DLMALLOC_SRC) $(EACSL_INSTALL_CONTRIB_DIR)/libdlmalloc - $(PRINT_INSTALL) E-ACSL scripts - $(MKDIR) $(BINDIR) - $(CP) $(EACSL_INSTALL_SCRIPTS) $(BINDIR)/ - $(MKDIR) $(BASHCOMPDIR) - $(foreach file, $(EACSL_INSTALL_BASHCOMPS), \ - $(CP) $(file) \ - $(addprefix $(BASHCOMPDIR)/,$(basename $(notdir $(file)))) \ - &&) true - $(PRINT_INSTALL) E-ACSL man pages - $(MKDIR) $(MANDIR)/man1 - $(CP) $(EACSL_INSTALL_MANPAGES) $(MANDIR)/man1/ - - -EACSL_INSTALLED_SCRIPTS=$(addprefix $(BINDIR)/,$(notdir $(EACSL_SCRIPTS))) - -EACSL_INSTALLED_BASHCOMPS=$(addprefix $(BASHCOMPDIR)/,$(basename $(notdir $(EACSL_BASHCOMPS)))) - -EACSL_INSTALLED_MANPAGES=$(addprefix $(MANDIR)/man1/,$(notdir $(EACSL_MANPAGES))) - -uninstall:: - $(PRINT_RM) E-ACSL share files - $(RM) -r $(FRAMAC_DATADIR)/e-acsl - $(PRINT_RM) E-ACSL libraries - $(RM) -r $(EACSL_INSTALL_LIB_DIR) - $(PRINT_RM) E-ACSL scripts - $(RM) $(EACSL_INSTALLED_SCRIPTS) - $(RM) $(EACSL_INSTALLED_BASHCOMPS) - $(PRINT_RM) E-ACSL man pages - $(RM) $(EACSL_INSTALLED_MANPAGES) - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR:=$(FRAMAC_SRC) -CONFIG_STATUS_DIR_DEP:= -else -CONFIG_STATUS_DIR:=$(E_ACSL_DIR) -CONFIG_STATUS_DIR_DEP:=$(CONFIG_STATUS_DIR)/config.status -endif - -$(E_ACSL_DIR)/Makefile: $(E_ACSL_DIR)/Makefile.in $(CONFIG_STATUS_DIR_DEP) - cd $(CONFIG_STATUS_DIR) && ./config.status - -##################################### -# Doxygen # -##################################### - -DOXYGEN = @DOXYGEN@ -doxygen: - if ! test $(DOXYGEN) = "no"; then \ - $(DOXYGEN) $(E_ACSL_DIR)/doc/doxygen/doxygen.cfg ; \ - else \ - echo "Warning: Skip doxygen documentation: \ -Doxygen executable not found."; \ - fi - -doc:: doxygen - -clean:: - $(PRINT_RM) generated documentation - $(RM) $(E_ACSL_DIR)/doc/doxygen/html/* - $(RM) $(E_ACSL_DIR)/doc/code/* - $(RM) $(E_ACSL_DIR)/doc/doxygen/warn.log diff --git a/src/plugins/e-acsl/contrib/libdlmalloc/Makefile b/src/plugins/e-acsl/contrib/libdlmalloc/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..5ae8edb667f529d3c2c92523019542d235649c8f --- /dev/null +++ b/src/plugins/e-acsl/contrib/libdlmalloc/Makefile @@ -0,0 +1,45 @@ +########################################################################## +# # +# This file is part of the Frama-C's E-ACSL plug-in. # +# # +# Copyright (C) 2012-2022 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It 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 Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +EACSL_DLMALLOC_LIB = libeacsl-dlmalloc.a +EACSL_DLMALLOC_SRC = dlmalloc.c +EACSL_DLMALLOC_OBJ = dlmalloc.o +# Don't forget to update "e-acsl-gcc.sh" if the flags are updated +EACSL_DLMALLOC_FLAGS = \ + -DHAVE_MORECORE=0 \ + -DHAVE_MMAP=1 \ + -DNO_MALLINFO=1 \ + -DNO_MALLOC_STATS=1 \ + -DMSPACES=1 \ + -DONLY_MSPACES \ + -DMALLOC_ALIGNMENT=32 \ + -DMSPACE_PREFIX="__e_acsl_" \ + -DUSE_LOCKS=1 \ + -DUSE_SPIN_LOCKS=1 + +$(EACSL_DLMALLOC_LIB): $(EACSL_DLMALLOC_SRC) + @echo 'CC $<' + @$(CC) $< -c -O2 -g3 -o$(EACSL_DLMALLOC_OBJ) $(EACSL_DLMALLOC_FLAGS) + @echo 'AR $@' + @$(AR) crus $@ $(EACSL_DLMALLOC_OBJ) + @echo 'RANLIB $@' + @ranlib $@ diff --git a/src/plugins/e-acsl/dune b/src/plugins/e-acsl/dune new file mode 100644 index 0000000000000000000000000000000000000000..f7772d7430a911863c133702cdd8eb39fb202b23 --- /dev/null +++ b/src/plugins/e-acsl/dune @@ -0,0 +1,139 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of the Frama-C's E-ACSL plug-in. ;; +;; ;; +;; Copyright (C) 2012-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; BUILD LIBDLMALLOC +(data_only_dirs contrib) + +(rule + (deps (source_tree contrib)) + (targets libeacsl-dlmalloc.a) + (action + (no-infer + (progn + (chdir contrib/libdlmalloc (run make)) + (copy contrib/libdlmalloc/libeacsl-dlmalloc.a libeacsl-dlmalloc.a))))) + + +; CONTRIB FILE +(install + (package frama-c-e-acsl) + (section + (site + (frama-c-e-acsl contrib))) + (files + (contrib/libdlmalloc/dlmalloc.c as libdlmalloc/dlmalloc.c))) + +; LIB DLMALLOC +(install + (package frama-c-e-acsl) + (section lib) + (files + (libeacsl-dlmalloc.a as libeacsl-dlmalloc.a))) + +; SCRIPT +(install + (package frama-c-e-acsl) + (section bin) + (files + (scripts/e-acsl-gcc.sh as e-acsl-gcc.sh))) + +; SHARE +(install + (package frama-c-e-acsl) + (section (site (frama-c share))) + (files +; main header +(share/e-acsl/e_acsl.h as e-acsl/e_acsl.h) +; (numerical_model) +(share/e-acsl/numerical_model/e_acsl_floating_point.h as e-acsl/numerical_model/e_acsl_floating_point.h) +(share/e-acsl/numerical_model/e_acsl_floating_point.c as e-acsl/numerical_model/e_acsl_floating_point.c) +(share/e-acsl/numerical_model/e_acsl_gmp_api.h as e-acsl/numerical_model/e_acsl_gmp_api.h) +; (libc_replacements) +(share/e-acsl/libc_replacements/e_acsl_string.h as e-acsl/libc_replacements/e_acsl_string.h) +(share/e-acsl/libc_replacements/e_acsl_stdio.c as e-acsl/libc_replacements/e_acsl_stdio.c) +(share/e-acsl/libc_replacements/e_acsl_string.c as e-acsl/libc_replacements/e_acsl_string.c) +(share/e-acsl/libc_replacements/e_acsl_stdio.h as e-acsl/libc_replacements/e_acsl_stdio.h) +; (instrumentation_model) +(share/e-acsl/instrumentation_model/e_acsl_temporal.c as e-acsl/instrumentation_model/e_acsl_temporal.c) +(share/e-acsl/instrumentation_model/e_acsl_assert_data.h as e-acsl/instrumentation_model/e_acsl_assert_data.h) +(share/e-acsl/instrumentation_model/e_acsl_contract.h as e-acsl/instrumentation_model/e_acsl_contract.h) +(share/e-acsl/instrumentation_model/e_acsl_temporal.h as e-acsl/instrumentation_model/e_acsl_temporal.h) +(share/e-acsl/instrumentation_model/e_acsl_contract.c as e-acsl/instrumentation_model/e_acsl_contract.c) +(share/e-acsl/instrumentation_model/e_acsl_assert_data_api.c as e-acsl/instrumentation_model/e_acsl_assert_data_api.c) +(share/e-acsl/instrumentation_model/e_acsl_assert.c as e-acsl/instrumentation_model/e_acsl_assert.c) +(share/e-acsl/instrumentation_model/e_acsl_assert.h as e-acsl/instrumentation_model/e_acsl_assert.h) +(share/e-acsl/instrumentation_model/e_acsl_temporal_timestamp.h as e-acsl/instrumentation_model/e_acsl_temporal_timestamp.h) +(share/e-acsl/instrumentation_model/e_acsl_assert_data_api.h as e-acsl/instrumentation_model/e_acsl_assert_data_api.h) +; (observation_model) +(share/e-acsl/observation_model/e_acsl_observation_model.h as e-acsl/observation_model/e_acsl_observation_model.h) +(share/e-acsl/observation_model/e_acsl_heap.h as e-acsl/observation_model/e_acsl_heap.h) +; (observation_model/segment_model) +(share/e-acsl/observation_model/segment_model/e_acsl_segment_timestamp_retrieval.c as e-acsl/observation_model/segment_model/e_acsl_segment_timestamp_retrieval.c) +(share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.h as e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.h) +(share/e-acsl/observation_model/segment_model/e_acsl_segment_observation_model.c as e-acsl/observation_model/segment_model/e_acsl_segment_observation_model.c) +(share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.h as e-acsl/observation_model/segment_model/e_acsl_shadow_layout.h) +(share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c as e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c) +(share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.h as e-acsl/observation_model/segment_model/e_acsl_segment_tracking.h) +(share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c as e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c) +(share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.c as e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.c) +(share/e-acsl/observation_model/segment_model/e_acsl_segment_omodel_debug.c as e-acsl/observation_model/segment_model/e_acsl_segment_omodel_debug.c) +(share/e-acsl/observation_model/e_acsl_observation_model.c as e-acsl/observation_model/e_acsl_observation_model.c) +; (observation_model/bittree_model) +(share/e-acsl/observation_model/bittree_model/e_acsl_bittree_omodel_debug.c as e-acsl/observation_model/bittree_model/e_acsl_bittree_omodel_debug.c) +(share/e-acsl/observation_model/bittree_model/e_acsl_bittree.c as e-acsl/observation_model/bittree_model/e_acsl_bittree.c) +(share/e-acsl/observation_model/bittree_model/e_acsl_bittree.h as e-acsl/observation_model/bittree_model/e_acsl_bittree.h) +(share/e-acsl/observation_model/bittree_model/e_acsl_bittree_timestamp_retrieval.c as e-acsl/observation_model/bittree_model/e_acsl_bittree_timestamp_retrieval.c) +(share/e-acsl/observation_model/bittree_model/e_acsl_bittree_observation_model.c as e-acsl/observation_model/bittree_model/e_acsl_bittree_observation_model.c) +; (observation_model/internals) +(share/e-acsl/observation_model/internals/e_acsl_patricia_trie.c as e-acsl/observation_model/internals/e_acsl_patricia_trie.c) +(share/e-acsl/observation_model/internals/e_acsl_safe_locations.h as e-acsl/observation_model/internals/e_acsl_safe_locations.h) +(share/e-acsl/observation_model/internals/e_acsl_safe_locations.c as e-acsl/observation_model/internals/e_acsl_safe_locations.c) +(share/e-acsl/observation_model/internals/e_acsl_patricia_trie.h as e-acsl/observation_model/internals/e_acsl_patricia_trie.h) +(share/e-acsl/observation_model/internals/e_acsl_heap_tracking.h as e-acsl/observation_model/internals/e_acsl_heap_tracking.h) +(share/e-acsl/observation_model/internals/e_acsl_omodel_debug.h as e-acsl/observation_model/internals/e_acsl_omodel_debug.h) +(share/e-acsl/observation_model/internals/e_acsl_timestamp_retrieval.h as e-acsl/observation_model/internals/e_acsl_timestamp_retrieval.h) +(share/e-acsl/observation_model/internals/e_acsl_heap_tracking.c as e-acsl/observation_model/internals/e_acsl_heap_tracking.c) +(share/e-acsl/observation_model/e_acsl_heap.c as e-acsl/observation_model/e_acsl_heap.c) +(share/e-acsl/e_acsl_rtl.c as e-acsl/e_acsl_rtl.c) +; (internals) +(share/e-acsl/internals/e_acsl_concurrency.h as e-acsl/internals/e_acsl_concurrency.h) +(share/e-acsl/internals/e_acsl_debug.c as e-acsl/internals/e_acsl_debug.c) +(share/e-acsl/internals/e_acsl_rtl_error.c as e-acsl/internals/e_acsl_rtl_error.c) +(share/e-acsl/internals/e_acsl_malloc.c as e-acsl/internals/e_acsl_malloc.c) +(share/e-acsl/internals/e_acsl_bits.c as e-acsl/internals/e_acsl_bits.c) +(share/e-acsl/internals/e_acsl_shexec.c as e-acsl/internals/e_acsl_shexec.c) +(share/e-acsl/internals/e_acsl_trace.c as e-acsl/internals/e_acsl_trace.c) +(share/e-acsl/internals/e_acsl_trace.h as e-acsl/internals/e_acsl_trace.h) +(share/e-acsl/internals/e_acsl_debug.h as e-acsl/internals/e_acsl_debug.h) +(share/e-acsl/internals/e_acsl_shexec.h as e-acsl/internals/e_acsl_shexec.h) +(share/e-acsl/internals/e_acsl_rtl_string.c as e-acsl/internals/e_acsl_rtl_string.c) +(share/e-acsl/internals/e_acsl_rtl_io.h as e-acsl/internals/e_acsl_rtl_io.h) +(share/e-acsl/internals/e_acsl_rtl_error.h as e-acsl/internals/e_acsl_rtl_error.h) +(share/e-acsl/internals/e_acsl_alias.h as e-acsl/internals/e_acsl_alias.h) +(share/e-acsl/internals/e_acsl_rtl_string.h as e-acsl/internals/e_acsl_rtl_string.h) +(share/e-acsl/internals/e_acsl_malloc.h as e-acsl/internals/e_acsl_malloc.h) +(share/e-acsl/internals/e_acsl_private_assert.c as e-acsl/internals/e_acsl_private_assert.c) +(share/e-acsl/internals/e_acsl_private_assert.h as e-acsl/internals/e_acsl_private_assert.h) +(share/e-acsl/internals/e_acsl_bits.h as e-acsl/internals/e_acsl_bits.h) +(share/e-acsl/internals/e_acsl_rtl_io.c as e-acsl/internals/e_acsl_rtl_io.c) +(share/e-acsl/internals/e_acsl_config.h as e-acsl/internals/e_acsl_config.h) +)) diff --git a/src/plugins/e-acsl/dune-project b/src/plugins/e-acsl/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..0b479545c886aec70e2641247c72343264ed482a --- /dev/null +++ b/src/plugins/e-acsl/dune-project @@ -0,0 +1,26 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of the Frama-C's E-ACSL plug-in. ;; +;; ;; +;; Copyright (C) 2012-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-e-acsl) +(using dune_site 0.1) +(package (name frama-c-e-acsl) (sites (share contrib))) diff --git a/src/plugins/e-acsl/frama-c-e-acsl.opam b/src/plugins/e-acsl/frama-c-e-acsl.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/e-acsl/headers/header_spec.txt b/src/plugins/e-acsl/headers/header_spec.txt deleted file mode 100644 index b7744174c9546fc79de00c3eac1f52f84188f988..0000000000000000000000000000000000000000 --- a/src/plugins/e-acsl/headers/header_spec.txt +++ /dev/null @@ -1,202 +0,0 @@ -E_ACSL.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -Makefile.in: CEA_LGPL_OR_PROPRIETARY.E_ACSL -README: .ignore -configure.ac: CEA_LGPL_OR_PROPRIETARY.E_ACSL -tab-in-changelog.sh: CEA_LGPL_OR_PROPRIETARY.E_ACSL -contrib/libdlmalloc/dlmalloc.c: MODIFIED_DLMALLOC -doc/Changelog: .ignore -doc/doxygen/doxygen.cfg.in: .ignore -license/CEA_LGPL: .ignore -license/LGPLv2.1: .ignore -license/SPARETIMELABS: .ignore -license/headache_config.txt: .ignore -man/e-acsl-gcc.sh.1: CEA_LGPL_OR_PROPRIETARY.E_ACSL -scripts/e-acsl-gcc.sh: CEA_LGPL_OR_PROPRIETARY.E_ACSL -scripts/e-acsl-gcc.sh.comp: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_assert.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_assert.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_assert_data.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_assert_data_api.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_assert_data_api.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_contract.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_contract.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_temporal.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_temporal.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/instrumentation_model/e_acsl_temporal_timestamp.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_alias.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_bits.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_bits.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_concurrency.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_config.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_debug.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_debug.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_malloc.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_malloc.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_private_assert.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_private_assert.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_rtl_error.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_rtl_error.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_rtl_io.c: MODIFIED_SPARETIMELABS -share/e-acsl/internals/e_acsl_rtl_io.h: MODIFIED_SPARETIMELABS -share/e-acsl/internals/e_acsl_rtl_string.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_rtl_string.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_shexec.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_shexec.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_trace.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/internals/e_acsl_trace.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/libc_replacements/e_acsl_stdio.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/libc_replacements/e_acsl_stdio.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/libc_replacements/e_acsl_string.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/libc_replacements/e_acsl_string.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/numerical_model/e_acsl_floating_point.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/numerical_model/e_acsl_floating_point.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/numerical_model/e_acsl_gmp_api.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/bittree_model/e_acsl_bittree.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/bittree_model/e_acsl_bittree.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/bittree_model/e_acsl_bittree_observation_model.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/bittree_model/e_acsl_bittree_omodel_debug.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/bittree_model/e_acsl_bittree_timestamp_retrieval.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_heap_tracking.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_heap_tracking.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_omodel_debug.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_patricia_trie.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_patricia_trie.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_safe_locations.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_safe_locations.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/internals/e_acsl_timestamp_retrieval.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_segment_observation_model.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_segment_omodel_debug.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_segment_timestamp_retrieval.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/e_acsl_heap.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/e_acsl_heap.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/e_acsl_observation_model.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/observation_model/e_acsl_observation_model.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/e_acsl.h: CEA_LGPL_OR_PROPRIETARY.E_ACSL -share/e-acsl/e_acsl_rtl.c: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/analyses_datatype.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/analyses_datatype.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/analyses.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/analyses.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/analyses_types.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/bound_variables.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/bound_variables.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/e_acsl_visitor.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/e_acsl_visitor.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/exit_points.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/exit_points.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/interval.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/interval.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/labels.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/labels.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/literal_strings.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/literal_strings.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/logic_normalizer.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/logic_normalizer.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/lscope.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/lscope.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/memory_tracking.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/memory_tracking.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/rte.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/rte.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/typing.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/analyses/typing.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/assert.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/assert.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/assigns.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/assigns.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/contract.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/contract.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/contract_types.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/env.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/env.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/global_observer.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/global_observer.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/gmp.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/gmp.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/injector.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/injector.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/libc.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/libc.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/literal_observer.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/literal_observer.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/logic_array.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/logic_array.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/logic_functions.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/logic_functions.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/loops.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/loops.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/memory_observer.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/memory_observer.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/memory_translate.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/memory_translate.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/quantif.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/quantif.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/rational.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/rational.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/smart_exp.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/smart_exp.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/smart_stmt.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/smart_stmt.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/temporal.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/temporal.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_annots.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_annots.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_ats.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_ats.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_predicates.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_predicates.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_rtes.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_rtes.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_terms.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_terms.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_utils.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translate_utils.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translation_error.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/translation_error.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/typed_number.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/code_generator/typed_number.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/builtins.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/builtins.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/error.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/error.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/functions.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/functions.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/gmp_types.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/gmp_types.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/logic_aggr.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/logic_aggr.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/misc.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/misc.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/varname.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/libraries/varname.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/local_config.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/main.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/main.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/options.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/options.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/project_initializer/rtl.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/project_initializer/rtl.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/project_initializer/prepare_ast.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -src/project_initializer/prepare_ast.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL -tests/E_ACSL_test.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL -tests/wrapper.sh: CEA_LGPL_OR_PROPRIETARY.E_ACSL -tests/test_config: .ignore -tests/test_config_dev: .ignore -tests/builtin/test_config: .ignore -tests/builtin/test_config_dev: .ignore -tests/concurrency/test_config: .ignore -tests/concurrency/test_config_dev: .ignore -tests/format/test_config: .ignore -tests/format/test_config_dev: .ignore -tests/full-mtracking/test_config: .ignore -tests/full-mtracking/test_config_dev: .ignore -tests/gmp-only/test_config: .ignore -tests/gmp-only/test_config_dev: .ignore -tests/temporal/test_config: .ignore -tests/temporal/test_config_dev: .ignore diff --git a/src/plugins/e-acsl/scripts/e-acsl-gcc.sh b/src/plugins/e-acsl/scripts/e-acsl-gcc.sh index 57b92420541ec6f345e668b2c1d37297142208e6..df70042b1cc5f57926e0532e88e4584ea8dfd1fc 100755 --- a/src/plugins/e-acsl/scripts/e-acsl-gcc.sh +++ b/src/plugins/e-acsl/scripts/e-acsl-gcc.sh @@ -63,11 +63,6 @@ warning () { BASEDIR="$(realpath `dirname $0`)" error "unable to find base dir of script" $? -# True if the script is launched from the E-ACSL sources, false otherwise -is_development_version() { - test -f "$BASEDIR/../E_ACSL.mli" -} - # Check if a given executable name can be found by in the PATH has_tool() { command -v "$@" >/dev/null 2>&1 && return 0 || return 1 @@ -89,8 +84,6 @@ retrieve_framac_path() { echo "$1" elif [ -e "$BASEDIR/$1" ]; then echo "$BASEDIR/$1" - elif is_development_version && [ -e "$BASEDIR/../../../../bin/$1" ]; then - echo "$BASEDIR/../../../../bin/$1" else echo "No executable '$1' or '$BASEDIR/$1' found" return 1 @@ -865,32 +858,11 @@ FRAMAC="$OPTION_FRAMAC" : ${FRAMAC_SHARE:="`$FRAMAC -no-autoload-plugins -print-share-path`"} : ${FRAMAC_PLUGIN:="`$FRAMAC -no-autoload-plugins -print-plugin-path`"} -# Check if this is a development or an installed version -if is_development_version; then - # Development version - DEVELOPMENT="$(realpath "$BASEDIR/..")" - error "unable to find parent dir of base dir" $? - # Check if the project has been built, as if this is a non-installed - # version that has not been built Frama-C will fallback to an installed one - # for instrumentation but still use local RTL - error "Plugin in $DEVELOPMENT not compiled" \ - `test -f "$DEVELOPMENT/META.frama-c-e_acsl" -o \ - -f "$FRAMAC_PLUGIN/META.frama-c-e_acsl"; echo $?` - EACSL_SHARE="$DEVELOPMENT/share/e-acsl" - EACSL_LIB="$DEVELOPMENT/lib" - EACSL_CONTRIB="$DEVELOPMENT/contrib" - # Add the project directory to FRAMAC_PLUGINS, - # otherwise Frama-C uses an installed version - if test -f "$DEVELOPMENT/META.frama-c-e_acsl"; then - FRAMAC_FLAGS="-add-path=$DEVELOPMENT/top -add-path=$DEVELOPMENT $FRAMAC_FLAGS"; - fi -else - # Installed version. FRAMAC_SHARE should not be used here as Frama-C - # and E-ACSL may not be installed to the same location - EACSL_SHARE="$BASEDIR/../share/frama-c/e-acsl" - EACSL_LIB="$BASEDIR/../lib/frama-c/e-acsl" - EACSL_CONTRIB="$BASEDIR/../share/frama-c/e-acsl/contrib" -fi +# Installed version. FRAMAC_SHARE should not be used here as Frama-C +# and E-ACSL may not be installed to the same location +EACSL_SHARE="$BASEDIR/../share/frama-c/share/e-acsl" +EACSL_LIB="$BASEDIR/../lib/frama-c-e-acsl" +EACSL_CONTRIB="$BASEDIR/../share/frama-c-e-acsl/contrib" # Architecture-dependent flags. Since by default Frama-C uses 32-bit # architecture we need to make sure that same architecture is used for diff --git a/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c b/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c index 2bf9f0f91ec839b315f2dc47b30fc45f14e41519..9e5dd8f5f57cc7ae8befa78281fae1ec6a13849a 100644 --- a/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c +++ b/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c @@ -167,7 +167,7 @@ void validate_shadow_layout() { # endif /* Each segment has 3 partitions: - - application memory + - application memory - primary/secondary shadows */ int num_partitions = sizeof(mem_partitions) / sizeof(memory_partition *); int num_seg_in_part = 3; diff --git a/src/plugins/e-acsl/src/analyses/analyses_types.mli b/src/plugins/e-acsl/src/analyses/analyses_types.ml similarity index 100% rename from src/plugins/e-acsl/src/analyses/analyses_types.mli rename to src/plugins/e-acsl/src/analyses/analyses_types.ml diff --git a/src/plugins/e-acsl/src/code_generator/contract_types.mli b/src/plugins/e-acsl/src/code_generator/contract_types.ml similarity index 100% rename from src/plugins/e-acsl/src/code_generator/contract_types.mli rename to src/plugins/e-acsl/src/code_generator/contract_types.ml diff --git a/src/plugins/e-acsl/src/dune b/src/plugins/e-acsl/src/dune new file mode 100644 index 0000000000000000000000000000000000000000..bd9049b7cd9366699ccfdc3478c66815907decd2 --- /dev/null +++ b/src/plugins/e-acsl/src/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of the Frama-C's E-ACSL plug-in. ;; +;; ;; +;; Copyright (C) 2012-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "E-ACSL:" %{lib-available:frama-c-e-acsl.core} "\n") + ) + ) +) + +(library + (name E_ACSL) + (optional) + (public_name frama-c-e-acsl.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel)) + +(plugin (optional) (name e-acsl) (libraries frama-c-e-acsl.core) (site (frama-c plugins))) + +(include_subdirs unqualified) diff --git a/src/plugins/e-acsl/src/local_config.ml b/src/plugins/e-acsl/src/local_config.ml new file mode 100644 index 0000000000000000000000000000000000000000..2122d0dbcabb3e7c5d3393f2b53c5f9ba1cf34e2 --- /dev/null +++ b/src/plugins/e-acsl/src/local_config.ml @@ -0,0 +1,23 @@ +(**************************************************************************) +(* *) +(* This file is part of the Frama-C's E-ACSL plug-in. *) +(* *) +(* Copyright (C) 2012-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +let version = "todo" diff --git a/src/plugins/e-acsl/tests/builtin/dune b/src/plugins/e-acsl/tests/builtin/dune new file mode 100644 index 0000000000000000000000000000000000000000..9dbf4e24533a7de7d1e1946bcef58497e1507f23 --- /dev/null +++ b/src/plugins/e-acsl/tests/builtin/dune @@ -0,0 +1,7 @@ +(subdir + result/utils + (copy_files ../../utils/*)) + +(subdir + result_dev/utils + (copy_files ../../utils/*)) diff --git a/src/plugins/e-acsl/tests/builtin/strcat.c b/src/plugins/e-acsl/tests/builtin/strcat.c index ae47c89f2928c950ef25095e7f4bc2dd8fc3710b..4f5097eee1c4430a6cfb44d66163f75bdc0be32d 100644 --- a/src/plugins/e-acsl/tests/builtin/strcat.c +++ b/src/plugins/e-acsl/tests/builtin/strcat.c @@ -2,10 +2,10 @@ COMMENT: Test `strcat` and `strncat` E-ACSL built-ins DEPS: @PTEST_DEPS@ utils/signalled.h STDOPT: +"-eva-precision=1" - COMMENT: This part is blank on purpose (test stability + Dune) - - - +*/ +/* run.config_dev + MACRO: INCLUDED_HEADERS utils/signalled.h + COMMENT: This part is blank on purpose (test stability + Dune) */ diff --git a/src/plugins/e-acsl/tests/builtin/strcmp.c b/src/plugins/e-acsl/tests/builtin/strcmp.c index 10c86c02e0aa57f3d845574008a91f39bb4eec26..37f43a402148b2f222d2e30d726b418c6c83e13c 100644 --- a/src/plugins/e-acsl/tests/builtin/strcmp.c +++ b/src/plugins/e-acsl/tests/builtin/strcmp.c @@ -2,10 +2,10 @@ COMMENT: Test `strcmp` and `strncmp` E-ACSL built-ins DEPS: @PTEST_DEPS@ utils/signalled.h STDOPT: - COMMENT: This part is blank on purpose (test stability + Dune) - - - +*/ +/* run.config_dev + MACRO: INCLUDED_HEADERS utils/signalled.h + COMMENT: This part is blank on purpose (test stability + Dune) */ diff --git a/src/plugins/e-acsl/tests/builtin/strcpy.c b/src/plugins/e-acsl/tests/builtin/strcpy.c index 51987a4299dbfbe0d75279a0e566dea7ec4274d5..fcf30f6cd2560230f568405e69b3590eff6a7beb 100644 --- a/src/plugins/e-acsl/tests/builtin/strcpy.c +++ b/src/plugins/e-acsl/tests/builtin/strcpy.c @@ -2,10 +2,10 @@ COMMENT: Test `strcpy` and `strncpy` E-ACSL built-ins DEPS: @PTEST_DEPS@ utils/signalled.h STDOPT: - COMMENT: This part is blank on purpose (test stability + Dune) - - - +*/ +/* run.config_dev + MACRO: INCLUDED_HEADERS utils/signalled.h + COMMENT: This part is blank on purpose (test stability + Dune) */ diff --git a/src/plugins/e-acsl/tests/builtin/strlen.c b/src/plugins/e-acsl/tests/builtin/strlen.c index b570dfe679ef08540fc73c48292d915df29d460a..5ec3ad2191479f2bcca75821388e9fb3e54f646a 100644 --- a/src/plugins/e-acsl/tests/builtin/strlen.c +++ b/src/plugins/e-acsl/tests/builtin/strlen.c @@ -2,10 +2,10 @@ COMMENT: Test `strlen` E-ACSL built-ins DEPS: @PTEST_DEPS@ utils/signalled.h STDOPT: - COMMENT: This part is blank on purpose (test stability + Dune) - - - +*/ +/* run.config_dev + MACRO: INCLUDED_HEADERS utils/signalled.h + COMMENT: This part is blank on purpose (test stability + Dune) */ diff --git a/src/plugins/e-acsl/tests/concurrency/threads_debug.c b/src/plugins/e-acsl/tests/concurrency/threads_debug.c index 75bf51d6121358b31fa55b3114b3d2b2ac5a6b12..31d748444a6be8d371c348153e7033886894b409 100644 --- a/src/plugins/e-acsl/tests/concurrency/threads_debug.c +++ b/src/plugins/e-acsl/tests/concurrency/threads_debug.c @@ -1,10 +1,10 @@ -/* run.config, run.config_dev +/* run.config_dev COMMENT: This test is identical to `parallel_thread.c` but with RTL debug code COMMENT: activated. MACRO: ROOT_EACSL_GCC_OPTS_EXT --rt-debug --rt-verbose --concurrency - COMMENT: Filter the addresses of the output so that the test is deterministic. MACRO: ROOT_EACSL_EXEC_FILTER sed -e s_0x[0-9a-f-]*_0x0000-0000-0000_g | sed -e s_Offset:\s[0-9-]*_Offset:xxxxx_g | sed -e s/[0-9]*\skB/xxxkB/g | sed -e s/[0-9]*\sMB/xxxMB/g | sed -e s/Leaked.*bytes/Leakedxxxbytes/g + DONTRUN: */ // Include existing test diff --git a/src/plugins/e-acsl/tests/dune b/src/plugins/e-acsl/tests/dune new file mode 100644 index 0000000000000000000000000000000000000000..5a43bd223a0bae216544fe3eb2c7dfb50657484e --- /dev/null +++ b/src/plugins/e-acsl/tests/dune @@ -0,0 +1,6 @@ +(library + (name E_ACSL_test) + (modules E_ACSL_test) + (libraries frama-c.init.cmdline frama-c.boot frama-c.kernel frama-c-e-acsl.core) + (flags -open Frama_c_kernel) +) diff --git a/src/plugins/e-acsl/tests/format/dune b/src/plugins/e-acsl/tests/format/dune new file mode 100644 index 0000000000000000000000000000000000000000..9dbf4e24533a7de7d1e1946bcef58497e1507f23 --- /dev/null +++ b/src/plugins/e-acsl/tests/format/dune @@ -0,0 +1,7 @@ +(subdir + result/utils + (copy_files ../../utils/*)) + +(subdir + result_dev/utils + (copy_files ../../utils/*)) diff --git a/src/plugins/e-acsl/tests/format/fprintf.c b/src/plugins/e-acsl/tests/format/fprintf.c index d882296dc46353433056f0b1c97a646606364f58..71cbd78f9a6e17ef1b7d4b436a5a5ac7bb47db42 100644 --- a/src/plugins/e-acsl/tests/format/fprintf.c +++ b/src/plugins/e-acsl/tests/format/fprintf.c @@ -2,11 +2,11 @@ COMMENT: Check behaviours of format functions DEPS: @PTEST_DEPS@ utils/signalled.h STDOPT: +"-eva-precision=1" +*/ +/* run.config_dev + MACRO: INCLUDED_HEADERS utils/signalled.h COMMENT: This part is blank on purpose (test stability + Dune) - - - */ #include "utils/signalled.h" diff --git a/src/plugins/e-acsl/tests/format/printf.c b/src/plugins/e-acsl/tests/format/printf.c index a70af11be0159a5a338a4f1990f37d513d48481e..321fca54b3083aa5f40eb69d5fd878728cd4df16 100644 --- a/src/plugins/e-acsl/tests/format/printf.c +++ b/src/plugins/e-acsl/tests/format/printf.c @@ -5,11 +5,11 @@ */ /* run.config_dev MACRO: ROOT_EACSL_GCC_OPTS_EXT @ROOT_EACSL_GCC_OPTS_EXT@ -e "-Wno-maybe-uninitialized" + MACRO: INCLUDED_HEADERS utils/signalled.h COMMENT: This part is blank on purpose (test stability + Dune) - */ #include "utils/signalled.h" diff --git a/src/plugins/e-acsl/tests/memory/vdso.c b/src/plugins/e-acsl/tests/memory/vdso.c index d71a88db11369c7445fd003b33abea36722ffd99..38cebaf2b4d428ba7294762a882c402a5fd20665 100644 --- a/src/plugins/e-acsl/tests/memory/vdso.c +++ b/src/plugins/e-acsl/tests/memory/vdso.c @@ -2,7 +2,7 @@ STDOPT: #"-e-acsl-full-mtracking" */ /* run.config_dev - MACRO: ROOT_EACSL_GCC_OPTS_EXT --full-mtracking --rt-debug + DONTRUN: MACRO: ROOT_EACSL_GCC_OPTS_EXT --full-mtracking --rt-debug */ #include <time.h> diff --git a/src/plugins/e-acsl/tests/ptests_config b/src/plugins/e-acsl/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..0c0f44a5c36506af7ae9a955ce3701188d87fff2 --- /dev/null +++ b/src/plugins/e-acsl/tests/ptests_config @@ -0,0 +1,2 @@ +DEFAULT_SUITES = arith bts builtin concurrency constructs examples format full-mtracking gmp-only memory special temporal +dev_SUITES = arith bts builtin concurrency constructs examples format full-mtracking gmp-only memory special temporal diff --git a/src/plugins/e-acsl/tests/test_config b/src/plugins/e-acsl/tests/test_config index 32bdb4f86a1625cc53ce62d68ca8ce0b3b159cda..a729d3877fc2389a3b8497ade9c3f68750616abd 100644 --- a/src/plugins/e-acsl/tests/test_config +++ b/src/plugins/e-acsl/tests/test_config @@ -2,12 +2,13 @@ MACRO: DEST @PTEST_RESULT@/gen_@PTEST_NAME@ MACRO: MACHDEP -machdep gcc_x86_64 MACRO: GLOBAL @MACHDEP@ -remove-unused-specified-functions -verbose 0 -no-unicode -MACRO: EACSL -e-acsl -e-acsl-share @PTEST_SHARE_DIR@/e-acsl -e-acsl-verbose 1 +COMMENT: no more share to set with Dune +MACRO: EACSL -e-acsl -e-acsl-verbose 1 MACRO: EVA -eva -eva-no-alloc-returns-null -eva-no-results -eva-no-print -eva-warn-key libc:unsupported-spec=inactive -eva-warn-key loop-unroll:auto=inactive MACRO: EVENTUALLY -print -ocode @DEST@.c -PLUGIN: E_ACSL eva,scope,variadic rtegen +PLUGIN: e-acsl eva,scope,inout,variadic rtegen LIBS: @PTEST_SUITE_DIR@/../E_ACSL_test LOG: gen_@PTEST_NAME@.c diff --git a/src/plugins/e-acsl/tests/test_config_dev b/src/plugins/e-acsl/tests/test_config_dev index f2563a6a21328fa04b3b2d0ef5260f2a637d142a..e98e5eb62f93de601cb5e0f75f480a7b5df64a4f 100644 --- a/src/plugins/e-acsl/tests/test_config_dev +++ b/src/plugins/e-acsl/tests/test_config_dev @@ -7,12 +7,12 @@ MACRO: ROOT_EACSL_GCC_MISC_OPTS -q -X --no-assert-print-data COMMENT: Default options for the frama-c invocation MACRO: ROOT_EACSL_GCC_FC_EXTRA -verbose 0 -PLUGIN: E_ACSL eva,scope,variadic rtegen +PLUGIN: e-acsl eva,scope,variadic rtegen COMMENT: The dependency to the plugin share directory has not to be explicited -DEPS: @PTEST_SUITE_DIR@/../wrapper.sh +DEPS: @PTEST_SUITE_DIR@/../wrapper.sh @INCLUDED_HEADERS@ -EXEC: LOG @EACSL_ERR@ @PTEST_SUITE_DIR@/../wrapper.sh "@frama-c-exe@" "@PTEST_RESULT@" "@PTEST_NAME@" "@PTEST_FILE@" "@EACSL_ERR@" "@ROOT_EACSL_GCC_MISC_OPTS@ @ROOT_EACSL_GCC_OPTS_EXT@" "@PTEST_DEFAULT_OPTIONS@ @PTEST_LOAD_OPTIONS@ @ROOT_EACSL_GCC_FC_EXTRA@ @ROOT_EACSL_GCC_FC_EXTRA_EXT@" "@ROOT_EACSL_EXEC_FILTER@" +EXECNOW: LOG @EACSL_ERR@ @PTEST_SUITE_DIR@/../wrapper.sh "@frama-c-exe@" "@PTEST_RESULT@" "@PTEST_NAME@" "@PTEST_FILE@" "@EACSL_ERR@" "@ROOT_EACSL_GCC_MISC_OPTS@ @ROOT_EACSL_GCC_OPTS_EXT@" "@PTEST_DEFAULT_OPTIONS@ @PTEST_LOAD_OPTIONS@ @ROOT_EACSL_GCC_FC_EXTRA@ @ROOT_EACSL_GCC_FC_EXTRA_EXT@" "@ROOT_EACSL_EXEC_FILTER@" COMMENT: These next macros can be redefined in a test file @@ -26,3 +26,5 @@ COMMENT: Define the following macro in a test to filter the output of the test e COMMENT: You can chain several filters by separating commands with |. However sed cannot COMMENT: use | as a delimiter, please use / or another character instead. MACRO: ROOT_EACSL_EXEC_FILTER cat + +MACRO: INCLUDED_HEADERS diff --git a/src/plugins/e-acsl/tests/wrapper.sh b/src/plugins/e-acsl/tests/wrapper.sh index b97a83379bed140ffcc87f140f6c9bdf8de74d1e..3f2c4edf3d8aa8a306c9a2f3fe8eaa0db2c391a7 100755 --- a/src/plugins/e-acsl/tests/wrapper.sh +++ b/src/plugins/e-acsl/tests/wrapper.sh @@ -65,7 +65,7 @@ exec_err_log=$result_dir/$test_name.exec_err.log output_log=$result_dir/$output_name # Compile the test file -$BASEDIR/../scripts/e-acsl-gcc.sh -I $framac_exe \ +e-acsl-gcc.sh -I $framac_exe \ -c $opts \ --frama-c-extra="$fc_opts" \ -o $result_dir/$test_name.gcc.c \ diff --git a/src/plugins/from/dune b/src/plugins/from/dune new file mode 100644 index 0000000000000000000000000000000000000000..a281709efa26bd457c9b98e9a1c677279510d4f6 --- /dev/null +++ b/src/plugins/from/dune @@ -0,0 +1,43 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "From:" %{lib-available:frama-c-from.core} "\n") + (echo " - Callgraph:" %{lib-available:frama-c-callgraph.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - Postdominators:" %{lib-available:frama-c-postdominators.core} "\n") + ) + ) +) + +( library + (name from) + (optional) + (public_name frama-c-from.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-callgraph.core frama-c-eva.core frama-c-postdominators.core) +) + +(plugin (optional) (name from) (libraries frama-c-from.core) (site (frama-c plugins))) diff --git a/src/plugins/from/dune-project b/src/plugins/from/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..4f636dba24bab4bb183a1195ea99fc23cc6f4490 --- /dev/null +++ b/src/plugins/from/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-from) +(using dune_site 0.1) diff --git a/src/plugins/from/frama-c-from.opam b/src/plugins/from/frama-c-from.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/from/from_parameters.mli b/src/plugins/from/from_parameters.mli index 6f6a9fc88e4ececd134511fa3d6334fcd8187cd4..3264710b5c2fc5c982a282f767e695652991a568 100644 --- a/src/plugins/from/from_parameters.mli +++ b/src/plugins/from/from_parameters.mli @@ -26,7 +26,7 @@ include Plugin.S module ForceDeps: Parameter_sig.With_output (** Option -calldeps. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) module ForceCallDeps: Parameter_sig.With_output (** Option -show-indirect-deps *) diff --git a/src/plugins/from/gui/dune b/src/plugins/from/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..5ab41e7e98ec07bda63db1f38f5dccc763d81e0f --- /dev/null +++ b/src/plugins/from/gui/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +( library + (name from_gui) + (public_name frama-c-from.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-from.core) +) + +(plugin (optional) (name from-gui) (libraries frama-c-from.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/from/from_register_gui.ml b/src/plugins/from/gui/from_register_gui.ml similarity index 100% rename from src/plugins/from/from_register_gui.ml rename to src/plugins/from/gui/from_register_gui.ml diff --git a/src/plugins/from/from_register_gui.mli b/src/plugins/from/gui/from_register_gui.mli similarity index 100% rename from src/plugins/from/from_register_gui.mli rename to src/plugins/from/gui/from_register_gui.mli diff --git a/src/plugins/gui/GSourceView2.ml.in b/src/plugins/gui/GSourceView.2.ml similarity index 91% rename from src/plugins/gui/GSourceView2.ml.in rename to src/plugins/gui/GSourceView.2.ml index 826327fd35ee073626ce0c10ab8be85ea6e16b75..afd8c379727d7cb076948992e83d842095c8373b 100644 --- a/src/plugins/gui/GSourceView2.ml.in +++ b/src/plugins/gui/GSourceView.2.ml @@ -24,13 +24,13 @@ include GSourceView2 let make_marker_attributes - ~(source:source_view) - ~(category:string) - ~(priority: int) - ?(background: Gdk.color option) - ?(pixbuf:GdkPixbuf.pixbuf option) - ?(icon_name:string option) - () = + ~(source:source_view) + ~(category:string) + ~(priority: int) + ?(background: Gdk.color option) + ?(pixbuf:GdkPixbuf.pixbuf option) + ?(icon_name:string option) + () = ignore icon_name; (* not in lablgtk2. *) source#set_mark_category_priority ~category priority; source#set_mark_category_pixbuf ~category pixbuf; diff --git a/src/plugins/gui/GSourceView2.mli.in b/src/plugins/gui/GSourceView.2.mli similarity index 100% rename from src/plugins/gui/GSourceView2.mli.in rename to src/plugins/gui/GSourceView.2.mli diff --git a/src/plugins/gui/GSourceView3.ml.in b/src/plugins/gui/GSourceView.3.ml similarity index 91% rename from src/plugins/gui/GSourceView3.ml.in rename to src/plugins/gui/GSourceView.3.ml index 189b5c15bcc971e453c99d07a45b0e98d7235ade..19ae25c428594c779ab4adbb594c27bdf1e9f96b 100644 --- a/src/plugins/gui/GSourceView3.ml.in +++ b/src/plugins/gui/GSourceView.3.ml @@ -24,13 +24,13 @@ include GSourceView3 let make_marker_attributes - ~(source:source_view) - ~(category:string) - ~(priority: int) - ?(background: Gdk.rgba option) - ?(pixbuf:GdkPixbuf.pixbuf option) - ?(icon_name:string option) - () = + ~(source:source_view) + ~(category:string) + ~(priority: int) + ?(background: Gdk.rgba option) + ?(pixbuf:GdkPixbuf.pixbuf option) + ?(icon_name:string option) + () = let my_attributes = GSourceView3.source_mark_attributes () in Option.iter my_attributes#set_background background; Option.iter my_attributes#set_pixbuf pixbuf; diff --git a/src/plugins/gui/GSourceView3.mli.in b/src/plugins/gui/GSourceView.3.mli similarity index 100% rename from src/plugins/gui/GSourceView3.mli.in rename to src/plugins/gui/GSourceView.3.mli diff --git a/src/plugins/gui/debug_manager.ko.ml b/src/plugins/gui/debug_manager.ko.ml new file mode 100644 index 0000000000000000000000000000000000000000..192106d34ea67bf3d919a40345a219f6d9c85f15 --- /dev/null +++ b/src/plugins/gui/debug_manager.ko.ml @@ -0,0 +1,23 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(* empty file *) diff --git a/src/plugins/gui/debug_manager.yes.ml b/src/plugins/gui/debug_manager.ok.ml similarity index 100% rename from src/plugins/gui/debug_manager.yes.ml rename to src/plugins/gui/debug_manager.ok.ml diff --git a/src/plugins/gui/design.mli b/src/plugins/gui/design.mli index f920b516f972b307c8ec3a04529c79c0d8dceb6a..5e18605413afa48366ddb8326f9c8d32d36cc87d 100644 --- a/src/plugins/gui/design.mli +++ b/src/plugins/gui/design.mli @@ -21,7 +21,7 @@ (**************************************************************************) (** The extensible GUI. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) open Cil_types @@ -82,7 +82,7 @@ class protected_menu_factory: Gtk_helper.host -> GMenu.menu -> [ GMenu.menu ] GMenu.factory (** This is the type of extension points for the GUI. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) class type main_window_extension_points = object inherit view_code @@ -158,7 +158,7 @@ class type main_window_extension_points = object localizable. If the button 3 is released, the first argument is popped as a contextual menu. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) method register_source_highlighter : (reactive_buffer -> Pretty_source.localizable -> @@ -243,7 +243,7 @@ class main_window : unit -> main_window_extension_points val register_extension : (main_window_extension_points -> unit) -> unit (** Register an extension to the main GUI. It will be invoked at initialization time. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val register_reset_extension : (main_window_extension_points -> unit) -> unit (** Register a function to be called whenever the main GUI reset method is diff --git a/src/plugins/gui/dgraph_helper.mli b/src/plugins/gui/dgraph_helper.mli index 0dac7a9dc8a9e9f0b59e0e004c7f63a22957d4ed..64628a35b5e988083e02d5e6f5246ae06ccb9752 100644 --- a/src/plugins/gui/dgraph_helper.mli +++ b/src/plugins/gui/dgraph_helper.mli @@ -26,7 +26,7 @@ *) (** Create a new window displaying a graph. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val graph_window: parent: GWindow.window -> title:string -> diff --git a/src/plugins/gui/dune b/src/plugins/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..b236414fc979c75878b1813a68996983bb6e7828 --- /dev/null +++ b/src/plugins/gui/dune @@ -0,0 +1,83 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "GUI:" %{lib-available:frama-c.gui} "\n") + (echo " - lablgtk2:" %{lib-available:lablgtk2} "\n") + (echo " - lablgtk2.gnomecanvas:" %{lib-available:lablgtk2.gnomecanvas} "\n") + (echo " - lablgtk2.sourceview2:" %{lib-available:lablgtk2.sourceview2} "\n") + (echo " - lablgtk3:" %{lib-available:lablgtk3} "\n") + (echo " - lablgtk3-sourceview3:" %{lib-available:lablgtk3-sourceview3} "\n") + ) + ) +) + +(include_subdirs no) + +( library + (name frama_c_gui) + (public_name frama-c.gui) + (optional) + (modules + wutil wutil_once widget wbox wfile wpane wpalette wtext wtable + gui_parameters + gtk_helper gtk_form + source_viewer pretty_source source_manager book_manager + warning_manager + filetree + launcher + menu_manager + history + gui_printers + design + analyses_manager file_manager project_manager + help_manager + property_navigator GSourceView gtk_compat + dgraph_helper +) + (flags -open Frama_c_kernel -linkall :standard -w -9) + (libraries frama-c.init.gui frama-c.kernel + (select gtk_compat.ml from + (lablgtk2 lablgtk2.gnomecanvas lablgtk2.sourceview2 -> gtk_compat.2.ml) + (lablgtk3 lablgtk3-sourceview3 -> gtk_compat.3.ml) + ) + (select GSourceView.ml from + (lablgtk2 lablgtk2.gnomecanvas lablgtk2.sourceview2 -> GSourceView.2.ml) + (lablgtk3 lablgtk3-sourceview3 -> GSourceView.3.ml) + ) + (select GSourceView.mli from + (lablgtk2 lablgtk2.gnomecanvas lablgtk2.sourceview2 -> GSourceView.2.mli) + (lablgtk3 lablgtk3-sourceview3 -> GSourceView.3.mli) + ) + (select dgraph_helper.ml from + (ocamlgraph.dgraph -> dgraph_helper.yes.ml) + ( -> dgraph_helper.no.ml) + ) + (select debug_manager.ml from + (ocamlgraph.dgraph -> debug_manager.ok.ml) + ( -> debug_manager.ko.ml) + ) +) +) diff --git a/src/plugins/impact/compute_impact.ml b/src/plugins/impact/compute_impact.ml index 1744f0a3e7da3f56490a759d998ecd28957c7be2..9f1379f3ec9104f0e9c23927c726ed55e9f30ce6 100644 --- a/src/plugins/impact/compute_impact.ml +++ b/src/plugins/impact/compute_impact.ml @@ -22,7 +22,10 @@ open Cil_types open Cil_datatype + +open Pdg_types open PdgIndex + open Reason_graph (** Computation of the PDG nodes that are impacted by the "execution" @@ -166,7 +169,7 @@ let add_to_result wl n kf init = (** return [true] if the location in [n] is contained in [skip], in which case the node should be skipped entirely *) let node_to_skip skip n = - match !Db.Pdg.node_key n with + match Pdg.Api.node_key n with | Key.SigKey (Signature.In (Signature.InImpl z)) | Key.SigKey (Signature.Out (Signature.OutLoc z)) | Key.SigCallKey (_, Signature.In (Signature.InImpl z)) @@ -179,7 +182,7 @@ let node_to_skip skip n = the results *) let filter wl (n, z) = not (Locations.Zone.is_bottom z) && - match !Db.Pdg.node_key n with + match Pdg.Api.node_key n with | Key.SigKey (Signature.In Signature.InCtrl) -> false (* do not consider node [InCtrl]. YYY: find when this may happen *) | Key.VarDecl _ -> false @@ -320,7 +323,7 @@ let add_downward_call wl (caller_kf, pdg) (called_kf, called_pdg) stmt = callee are directly in the worklist, and the call is registered in the field [downward_calls]. *) let downward_one_call_node wl (pnode, _ as node) caller_kf pdg = - match !Db.Pdg.node_key pnode with + match Pdg.Api.node_key pnode with | Key.SigKey (Signature.In Signature.InCtrl) (* never in the worklist *) | Key.VarDecl _ (* never in the worklist *) | Key.CallStmt _ (* pdg returns a SigCallKey instead *) @@ -335,31 +338,31 @@ let downward_one_call_node wl (pnode, _ as node) caller_kf pdg = let called_kfs = Eva.Results.callee stmt in List.iter (fun called_kf -> - let called_pdg = !Db.Pdg.get called_kf in + let called_pdg = Pdg.Api.get called_kf in let nodes_callee, pdg_ok = Options.debug ~level:3 "%a: considering call to %a" Pdg_aux.pretty_node node Kernel_function.pretty called_kf; try (match key with | Signature.In (Signature.InNum n) -> - (try [!Db.Pdg.find_input_node called_pdg n, + (try [Pdg.Api.find_input_node called_pdg n, Locations.Zone.top] with Not_found -> []) | Signature.In Signature.InCtrl -> - (try [!Db.Pdg.find_entry_point_node called_pdg, + (try [Pdg.Api.find_entry_point_node called_pdg, Locations.Zone.top] with Not_found -> []) | Signature.In (Signature.InImpl _) -> assert false | Signature.Out _ -> [] ), true with - | Db.Pdg.Top -> + | Pdg.Api.Top -> Options.warning "no precise pdg for function %s. \n\ Ignoring this function in the analysis (potentially incorrect results)." (Kernel_function.get_name called_kf); [], false - | Db.Pdg.Bottom -> + | Pdg.Api.Bottom -> (*Function that fails or never returns immediately *) [], false | Not_found -> assert false @@ -398,7 +401,7 @@ let downward_one_call_inputs wl kf_caller kf_callee (node, deps) = (fun nsrc -> add_to_reason wl ~nsrc ~ndst:node' InterproceduralDownward) inter; - add_to_do wl kf_callee (!Db.Pdg.get kf_callee) node'; + add_to_do wl kf_callee (Pdg.Api.get kf_callee) node'; ;; (** Propagate impact for all calls registered in [downward_calls]. For each @@ -447,10 +450,10 @@ let all_upward_callers wl kfs = let todo = if not (KFS.mem kf wl.callers) then ( Options.debug "Found caller %a" Kernel_function.pretty kf; - let pdg_kf = !Db.Pdg.get kf in + let pdg_kf = Pdg.Api.get kf in List.fold_left (fun todo (caller, callsites) -> - let pdg_caller = !Db.Pdg.get caller in + let pdg_caller = Pdg.Api.get caller in List.iter (aux_call (caller, pdg_caller) (kf, pdg_kf)) callsites; KFS.add caller todo ) todo (Eva.Results.callsites kf); @@ -486,9 +489,9 @@ let upward_in_callers wl = add_to_reason wl ~nsrc ~ndst:n InterproceduralUpward ) inter; if init then - add_to_do_part_of_initial wl caller (!Db.Pdg.get caller) n + add_to_do_part_of_initial wl caller (Pdg.Api.get caller) n else - add_to_do wl caller (!Db.Pdg.get caller) n + add_to_do wl caller (Pdg.Api.get caller) n ) (Lazy.force l) in KfKfCall.Map.iter aux wl.upward_calls; @@ -522,7 +525,7 @@ let initial_worklist ?(skip=Locations.Zone.bottom) ?(reason=false) nodes kf = } in (* Fill the [todo] field *) - initial_to_do_list wl kf (!Db.Pdg.get kf) nodes; + initial_to_do_list wl kf (Pdg.Api.get kf) nodes; let initial_callers = if Options.Upward.get () then KFS.singleton kf else KFS.empty in @@ -536,10 +539,10 @@ let initial_worklist ?(skip=Locations.Zone.bottom) ?(reason=false) nodes kf = callees of the call. *) let initial_nodes ~skip kf stmt = Options.debug ~level:3 "computing initial nodes for %d" stmt.sid; - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in if Eva.Results.is_reachable stmt then try - let all = !Db.Pdg.find_simple_stmt_nodes pdg stmt in + let all = Pdg.Api.find_simple_stmt_nodes pdg stmt in let filter n = match PdgTypes.Node.elem_key n with | Key.SigCallKey (_, Signature.In _) -> false | _ -> not (node_to_skip skip n) @@ -669,7 +672,7 @@ let result_to_nodes (res: result) : nodes = (** Transform a set of PDG nodes into a set of statements *) let nodes_to_stmts ns = - let get_stmt node = Key.stmt (!Db.Pdg.node_key node) in + let get_stmt node = Key.stmt (Pdg.Api.node_key node) in let set = (* Do not generate a list immediately, some nodes would be duplicated *) NS.fold diff --git a/src/plugins/impact/compute_impact.mli b/src/plugins/impact/compute_impact.mli index 64307dc66281a1879dd0e7332ef9748ce058813c..74831f03df77459e0b84f0b5a17f7c2154dd3c43 100644 --- a/src/plugins/impact/compute_impact.mli +++ b/src/plugins/impact/compute_impact.mli @@ -22,6 +22,8 @@ open Cil_types +open Pdg_types + type nodes = Pdg_aux.NS.t type result = nodes Kernel_function.Map.t diff --git a/src/plugins/impact/dune b/src/plugins/impact/dune new file mode 100644 index 0000000000000000000000000000000000000000..6bcede10dbbcfd1333725c7a55c804e15abbe9ae --- /dev/null +++ b/src/plugins/impact/dune @@ -0,0 +1,45 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Impact:" %{lib-available:frama-c-impact.core} "\n") + (echo " - Callgraph:" %{lib-available:frama-c-callgraph.core} "\n") + (echo " - Slicing:" %{lib-available:frama-c-slicing.core} "\n") + (echo " - Inout:" %{lib-available:frama-c-inout.core} "\n") + (echo " - Pdg:" %{lib-available:frama-c-pdg.core} "\n") + ) + ) +) + + +( library + (name impact) + (optional) + (public_name frama-c-impact.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-pdg.core frama-c-slicing.core frama-c-callgraph.core frama-c-inout.core) +) + +(plugin (optional) (name impact) (libraries frama-c-impact.core) (site (frama-c plugins))) diff --git a/src/plugins/impact/dune-project b/src/plugins/impact/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..3c590eff01801f722fdea3b386882e5c8b2924e0 --- /dev/null +++ b/src/plugins/impact/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-impact) +(using dune_site 0.1) diff --git a/src/plugins/impact/frama-c-impact.opam b/src/plugins/impact/frama-c-impact.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/impact/gui/dune b/src/plugins/impact/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..e00946f69448800bdd05a5e35f6bbf859a7e19ec --- /dev/null +++ b/src/plugins/impact/gui/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +( library + (name impact_gui) + (public_name frama-c-impact.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Impact :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-pdg.core frama-c-impact.core frama-c-slicing.core frama-c-callgraph.core) +) + +(plugin (optional) (name impact-gui) (libraries frama-c-impact.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/impact/register_gui.ml b/src/plugins/impact/gui/register_gui.ml similarity index 99% rename from src/plugins/impact/register_gui.ml rename to src/plugins/impact/gui/register_gui.ml index 5146cb4a509f753a2e4ef66c8eac70c68377cf11..1bd988cb199607a31a287fa4df715fb8916fa52b 100644 --- a/src/plugins/impact/register_gui.ml +++ b/src/plugins/impact/gui/register_gui.ml @@ -22,8 +22,8 @@ open Pretty_source open Gtk_helper -open Db open Cil_types +open Pdg_types module SelectedStmt = struct include State_builder.Option_ref @@ -43,7 +43,7 @@ let () = (fun () -> State_dependency_graph.add_codependencies ~onto:SelectedStmt.self - [ !Db.Pdg.self ]) + [ Pdg.Api.self ]) module Highlighted_stmt : sig val add: Kernel_function.t -> stmt -> unit @@ -232,7 +232,7 @@ let pp_impact_on_inputs (main_ui:Design.main_window_extension_points) kf = let call, formals, zones = Pdg_aux.NS.fold (fun (node, z) (call, formals, zones as acc) -> - match !Pdg.node_key node with + match Pdg.Api.node_key node with | SigCallKey _ | CallStmt _ | Stmt _ | Label _ -> acc (* Related to one stmt: skip *) | VarDecl _ -> acc (* skip *) @@ -268,7 +268,7 @@ let pp_impacted_call_outputs let ret, zones = Pdg_aux.NS.fold (fun (node, z) (ret, zones as acc) -> - match !Pdg.node_key node with + match Pdg.Api.node_key node with | SigCallKey (stmt', key) when Cil_datatype.Stmt.equal call_stmt stmt' -> (match key with diff --git a/src/plugins/impact/register_gui.mli b/src/plugins/impact/gui/register_gui.mli similarity index 100% rename from src/plugins/impact/register_gui.mli rename to src/plugins/impact/gui/register_gui.mli diff --git a/src/plugins/impact/pdg_aux.ml b/src/plugins/impact/pdg_aux.ml index 8513bcf24116c76db8f094446ad837068f527f2e..0a3b4acb21ed47d3e6ab5e15869955fd91164b06 100644 --- a/src/plugins/impact/pdg_aux.ml +++ b/src/plugins/impact/pdg_aux.ml @@ -20,12 +20,12 @@ (* *) (**************************************************************************) +open Pdg_types open PdgIndex open Locations type node = PdgTypes.Node.t * Zone.t - module NS = struct include Hptmap.Make (PdgTypes.Node) @@ -159,7 +159,7 @@ let find_call_input_nodes pdg_caller call_stmt ?(z=Locations.Zone.top) in_key = (* skip undef zone: any result different from None is due to calldeps or some imprecision. *) let nodes, _undef = - !Db.Pdg.find_location_nodes_at_stmt + Pdg.Api.find_location_nodes_at_stmt pdg_caller call_stmt ~before:true zone' in nodes @@ -201,7 +201,7 @@ let all_call_out_nodes ~callee ~caller call_stmt = in let test_out acc (out_key, call_out_node) = (* skip undef: any zone found undef is due to an imprecision or a bug*) - let out_nodes, _ = !Db.Pdg.find_output_nodes callee out_key in + let out_nodes, _ = Pdg.Api.find_output_nodes callee out_key in let out_nodes = node_list_to_set out_nodes in (call_out_node, out_nodes) :: acc in diff --git a/src/plugins/impact/pdg_aux.mli b/src/plugins/impact/pdg_aux.mli index 32e7f34d68c3decd9bc4b30df0046734c05d5012..f07aca633a1ca26345642e911cf4567fa5d6a3fb 100644 --- a/src/plugins/impact/pdg_aux.mli +++ b/src/plugins/impact/pdg_aux.mli @@ -21,16 +21,17 @@ (**************************************************************************) open Cil_types -open PdgTypes open Locations +open Pdg_types + (** Useful functions that are not directly accessible through the other Pdg modules. *) (** Refinement of a PDG node: we add an indication of which zone is really impacted *) -type node = Node.t * Zone.t +type node = PdgTypes.Node.t * Zone.t val pretty_node: node Pretty_utils.formatter @@ -53,9 +54,9 @@ module NS: sig val inter: t -> t -> t val diff: t -> t -> t - val remove: Node.t -> t -> t + val remove: PdgTypes.Node.t -> t -> t - val mem: Node.t -> t -> bool + val mem: PdgTypes.Node.t -> t -> bool val mem': node -> t -> bool val intersects: t -> t -> bool val for_all': (node -> bool) -> t -> bool @@ -76,7 +77,7 @@ type call_interface = (PdgTypes.Node.t * NS.t) list of [callee]. Each input node in [callee] is returned with the set of nodes that define it in [caller]. *) val all_call_input_nodes: - caller:Db.Pdg.t -> callee:kernel_function * Db.Pdg.t -> stmt -> + caller:Pdg.Api.t -> callee:kernel_function * Pdg.Api.t -> stmt -> call_interface (** [all_call_out_nodes ~callee ~caller stmt] find all the nodes of [callee] @@ -84,4 +85,4 @@ val all_call_input_nodes: that occurs at [stmt]. Each such out node is returned, with the set of nodes that define it in [callee] *) val all_call_out_nodes : - callee:Db.Pdg.t -> caller:Db.Pdg.t -> stmt -> call_interface + callee:Pdg.Api.t -> caller:Pdg.Api.t -> stmt -> call_interface diff --git a/src/plugins/impact/reason_graph.ml b/src/plugins/impact/reason_graph.ml index eceba7800cf411e23e0689b306edd741f1ef07cb..eb8452ccdd367b01b77d582fb0b6571ea7bbb209 100644 --- a/src/plugins/impact/reason_graph.ml +++ b/src/plugins/impact/reason_graph.ml @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open Pdg_types + module NodeSet = PdgTypes.NodeSet @@ -216,7 +218,7 @@ let print_dot_graph reason = (* Very basic textual debugging function *) let _print_reason reason = - let pp_node = !Db.Pdg.pretty_node false in + let pp_node = Pdg.Api.pretty_node false in let pp fmt (nsrc, ndst, reason) = Format.fprintf fmt "@[<v 2>%a -> %a (%s)@]" pp_node nsrc pp_node ndst diff --git a/src/plugins/impact/reason_graph.mli b/src/plugins/impact/reason_graph.mli index d0f03c55694e1a5d10439b237934cd69bce29d10..ccdbd733b2207e905a3d7054b204fcea8a674433 100644 --- a/src/plugins/impact/reason_graph.mli +++ b/src/plugins/impact/reason_graph.mli @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open Pdg_types + (** Why is a node impacted. The reasons will be given as [n is impacted by the effect of [n'], and the impact is of type reason]. *) type reason_type = diff --git a/src/plugins/impact/register.ml b/src/plugins/impact/register.ml index 6dfc46429bd86b280c90ba5418fb0e552a2314bb..e9b09ca1784c2b9f1d8e547f27209b48f3284003 100644 --- a/src/plugins/impact/register.ml +++ b/src/plugins/impact/register.ml @@ -23,6 +23,8 @@ open Cil_types open Cil_datatype +open Pdg_types + let rec pp_stmt fmt s = match s.skind with | Instr _ | Return _ | Goto _ | Break _ | Continue _ | TryFinally _ | TryExcept _ | Throw _ | TryCatch _ -> diff --git a/src/plugins/impact/register.mli b/src/plugins/impact/register.mli index a426a0bb2b23bc8422b0ec2a2b818d0834729721..7cdc3c047533c1b1c7e33408488ce820ba5bff83 100644 --- a/src/plugins/impact/register.mli +++ b/src/plugins/impact/register.mli @@ -22,6 +22,8 @@ open Cil_types +open Pdg_types + val compute_pragmas: (unit -> stmt list) (** Compute the impact analysis from the impact pragma in the program. Print and slice the results according to the parameters -impact-print diff --git a/src/plugins/inout/Inout.mli b/src/plugins/inout/Inout.mli deleted file mode 100644 index 3d0eae33a80d9eb424f37fb0582598518bcb98af..0000000000000000000000000000000000000000 --- a/src/plugins/inout/Inout.mli +++ /dev/null @@ -1,31 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(* $Id: Inout.mli,v 1.5 2008-04-01 09:25:20 uid568 Exp $ *) - -(** Inputs-outputs computations. *) - -(** No function is directly exported: they are registered in: - - {!Db.Inputs} for computations of non functional inputs; - - {!Db.Outputs} for computations of outputs; - - {!Db.Operational_inputs} for computation of inout context; and - - {!Db.Derefs}. *) diff --git a/src/plugins/inout/context.mli b/src/plugins/inout/context.ml similarity index 89% rename from src/plugins/inout/context.mli rename to src/plugins/inout/context.ml index 93b7732985f3ef17da9bd7877b0c9d7c4107cacc..464205caae746d5240d6727127b6374e0c7c3924 100644 --- a/src/plugins/inout/context.mli +++ b/src/plugins/inout/context.ml @@ -20,8 +20,10 @@ (* *) (**************************************************************************) -val pretty_internal: Format.formatter -> Cil_types.kernel_function -> unit -val pretty_external_with_formals: Format.formatter -> Cil_types.kernel_function -> unit +module type S = sig + val pretty_internal: Format.formatter -> Cil_types.kernel_function -> unit + val pretty_external_with_formals: Format.formatter -> Cil_types.kernel_function -> unit +end (* Local Variables: diff --git a/src/plugins/inout/dune b/src/plugins/inout/dune new file mode 100644 index 0000000000000000000000000000000000000000..d4148f8d0329905ae137ff491ac8ba9370f18e73 --- /dev/null +++ b/src/plugins/inout/dune @@ -0,0 +1,43 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Inout:" %{lib-available:frama-c-inout.core} "\n") + (echo " - Callgraph:" %{lib-available:frama-c-callgraph.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - From:" %{lib-available:frama-c-from.core} "\n") + ) + ) +) + +( library + (name inout) + (optional) + (public_name frama-c-inout.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-callgraph.core frama-c-eva.core frama-c-from.core) +) + +(plugin (optional) (name inout) (libraries frama-c-inout.core) (site (frama-c plugins))) diff --git a/src/plugins/inout/dune-project b/src/plugins/inout/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..f1e420b2977367d9680cb65fb4c61753b0ac4049 --- /dev/null +++ b/src/plugins/inout/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-inout) +(using dune_site 0.1) diff --git a/src/plugins/inout/frama-c-inout.opam b/src/plugins/inout/frama-c-inout.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/inout/operational_inputs.ml b/src/plugins/inout/operational_inputs.ml index adddc088f623ecfedc193549263e561afeb335df..632d4a4bd1a12115325af5944788a0bf50df5447 100644 --- a/src/plugins/inout/operational_inputs.ml +++ b/src/plugins/inout/operational_inputs.ml @@ -378,7 +378,7 @@ module Computer(Fenv:Dataflows.FUNCTION_ENV)(X:sig let pre = X.kf_pre_state and here = X.stmt_state stmt in let deps = - Eva.Eval_terms.annot_predicate_deps ~pre ~here p.tp_statement + Eva.Private.Eval_terms.annot_predicate_deps ~pre ~here p.tp_statement in match deps with | None -> diff --git a/src/plugins/instantiate/.gitignore b/src/plugins/instantiate/.gitignore index 0114e3d0f08985bcf97727dcde8f314ddb4410ae..cf191ced79913e05a88f7328899d77f503fc77f4 100644 --- a/src/plugins/instantiate/.gitignore +++ b/src/plugins/instantiate/.gitignore @@ -1,4 +1,4 @@ /configure /Makefile -/tests/ptests_config +/tests/*/oracle/dune /tests/*/result diff --git a/src/plugins/instantiate/Instantiate.mli b/src/plugins/instantiate/Instantiate.ml similarity index 98% rename from src/plugins/instantiate/Instantiate.mli rename to src/plugins/instantiate/Instantiate.ml index 59bdc9cc00961948c9a6a4f82e90fd50ed26c23f..177aee4c0ad928b2c26fb7e44867288d82722fab 100644 --- a/src/plugins/instantiate/Instantiate.mli +++ b/src/plugins/instantiate/Instantiate.ml @@ -91,7 +91,7 @@ module Instantiator_builder: sig *) val generate_spec: override_key -> location -> fundec -> funspec end -end +end = Instantiator_builder module Transform: sig (** Registers a new [Instantiator] to the visitor from the [Generator_sig] module @@ -99,7 +99,7 @@ module Transform: sig globally. *) val register: (module Instantiator_builder.Generator_sig) -> unit -end +end = Transform module Global_context:sig (** [get_variable name f] searches for an existing variable [name]. If this @@ -109,4 +109,4 @@ module Global_context:sig perform the registration, it will be done by the transformation. *) val get_variable: string -> (unit -> varinfo) -> varinfo -end +end = Global_context diff --git a/src/plugins/instantiate/Makefile.in b/src/plugins/instantiate/Makefile.in deleted file mode 100644 index 1243f1bb6bedf316c9d36d046e21dee5c5c7a2df..0000000000000000000000000000000000000000 --- a/src/plugins/instantiate/Makefile.in +++ /dev/null @@ -1,96 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -SRC_STRING:= \ - mem_utils \ - memcmp \ - memcpy \ - memmove \ - memset -SRC_STRING:=$(addprefix string/, $(SRC_STRING)) - -SRC_STDLIB:= \ - basic_alloc \ - calloc \ - free \ - malloc -SRC_STDLIB:=$(addprefix stdlib/, $(SRC_STDLIB)) - -################### -# Plug-in Setting # -################### - -PLUGIN_DIR ?= . -PLUGIN_ENABLE := @ENABLE_INSTANTIATE@ -PLUGIN_NAME := Instantiate -PLUGIN_EXTRA_DIRS:=\ - string\ - stdlib -PLUGIN_CMI := -PLUGIN_CMO := \ - options basic_blocks \ - global_context instantiator_builder \ - transform register \ - $(SRC_STRING) \ - $(SRC_STDLIB) - -PLUGIN_DISTRIBUTED := $(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -#PLUGIN_NO_DEFAULT_TEST := no -PLUGIN_TESTS_DIRS := string stdlib options api plugin -PLUGIN_DISTRIB_TESTS := \ - $(foreach dir, $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/oracle/* \ - $(filter-out result oracle,$(dir)/*)) \ - ) \ - $(filter-out result oracle,tests/*)) \ - $(foreach dir, tests $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/test_config) - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(Instantiate_DIR)/Makefile: $(Instantiate_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/instantiate/dune b/src/plugins/instantiate/dune new file mode 100644 index 0000000000000000000000000000000000000000..3212f4baf9fd96dd0fbdf7c80cfc16f38c08a37f --- /dev/null +++ b/src/plugins/instantiate/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Instantiate:" %{lib-available:frama-c-instantiate.core} "\n") + ) + ) +) + +( library + (name instantiate) + (optional) + (public_name frama-c-instantiate.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel) +) + +(plugin (optional) (name instantiate) (libraries frama-c-instantiate.core) (site (frama-c plugins))) + +(include_subdirs unqualified) diff --git a/src/plugins/instantiate/dune-project b/src/plugins/instantiate/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..21067e40127356e7414f2e693db558fa645cb0c8 --- /dev/null +++ b/src/plugins/instantiate/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-instantiate) +(using dune_site 0.1) diff --git a/src/plugins/instantiate/frama-c-instantiate.opam b/src/plugins/instantiate/frama-c-instantiate.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/instantiate/tests/dune b/src/plugins/instantiate/tests/dune new file mode 100644 index 0000000000000000000000000000000000000000..ff757cb8ca298349f7475c85a739f5eab4250b24 --- /dev/null +++ b/src/plugins/instantiate/tests/dune @@ -0,0 +1 @@ +(include_subdirs no) diff --git a/src/plugins/instantiate/tests/ptests_config b/src/plugins/instantiate/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..7128b0328816da84540657ec5baa0004332dc344 --- /dev/null +++ b/src/plugins/instantiate/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= api options plugin stdlib string diff --git a/src/plugins/loop_analysis/.gitignore b/src/plugins/loop_analysis/.gitignore index 0114e3d0f08985bcf97727dcde8f314ddb4410ae..3a98458e917cbf63ae42a311989dbe7be4a5d56c 100644 --- a/src/plugins/loop_analysis/.gitignore +++ b/src/plugins/loop_analysis/.gitignore @@ -1,4 +1,4 @@ /configure /Makefile -/tests/ptests_config /tests/*/result +/tests/**/dune diff --git a/src/plugins/loop_analysis/LoopAnalysis.ml b/src/plugins/loop_analysis/LoopAnalysis.ml new file mode 100644 index 0000000000000000000000000000000000000000..58d2bd968ae05ce6dfc6240d85b196fb307d348a --- /dev/null +++ b/src/plugins/loop_analysis/LoopAnalysis.ml @@ -0,0 +1,23 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module Loop_analysis = Loop_analysis diff --git a/src/plugins/loop_analysis/Makefile.in b/src/plugins/loop_analysis/Makefile.in deleted file mode 100644 index c0f1bcdcb41a35af74e2f88b87f9e0230457a27f..0000000000000000000000000000000000000000 --- a/src/plugins/loop_analysis/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -PLUGIN_ENABLE:=@ENABLE_LOOP_ANALYSIS@ -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) - -PLUGIN_NAME:= LoopAnalysis -PLUGIN_CMO:= options region_analysis region_analysis_stmt loop_analysis register -PLUGIN_CMI:= region_analysis_sig -PLUGIN_DEPENDENCIES:= Eva -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure test.c test.oracle README.org -PLUGIN_TESTS_DIRS:=loop_analysis - -include $(FRAMAC_SHARE)/Makefile.dynamic - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(LoopAnalysis_DIR)/Makefile: $(LoopAnalysis_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/loop_analysis/dune b/src/plugins/loop_analysis/dune new file mode 100644 index 0000000000000000000000000000000000000000..06cf37ed84a864c833bac4775e16614c996c26dc --- /dev/null +++ b/src/plugins/loop_analysis/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Loop-Analysis:" %{lib-available:frama-c-loop-analysis.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name LoopAnalysis) + (optional) + (public_name frama-c-loop-analysis.core) + (private_modules region_analysis_sig region_analysis region_analysis_stmt loop_analysis register) + (flags -open Frama_c_kernel :standard) + (libraries frama-c.kernel frama-c-eva.core) +) + +(plugin (optional) (name loop-analysis) (libraries frama-c-loop-analysis.core) (site (frama-c plugins))) diff --git a/src/plugins/loop_analysis/dune-project b/src/plugins/loop_analysis/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..c7d0e2e99d61b1b5adfbf9a9d2dd5f741343e5f8 --- /dev/null +++ b/src/plugins/loop_analysis/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-loop_analysis) +(using dune_site 0.1) diff --git a/src/plugins/loop_analysis/frama-c-loop-analysis.opam b/src/plugins/loop_analysis/frama-c-loop-analysis.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/loop_analysis/region_analysis_sig.mli b/src/plugins/loop_analysis/region_analysis_sig.ml similarity index 100% rename from src/plugins/loop_analysis/region_analysis_sig.mli rename to src/plugins/loop_analysis/region_analysis_sig.ml diff --git a/src/plugins/loop_analysis/tests/ptests_config b/src/plugins/loop_analysis/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..c778e02b18ead56a0307c7a1d1c5bf5d7be53b43 --- /dev/null +++ b/src/plugins/loop_analysis/tests/ptests_config @@ -0,0 +1,2 @@ +# todo: to fixe package name +DEFAULT_SUITES= loop_analysis diff --git a/src/plugins/loop_analysis/tests/test_config b/src/plugins/loop_analysis/tests/test_config index f5a7fe2c3073d7012157044a16ee50637344ba4e..38f5a9cf0d342a8db00e3909b0f2c227e8a808e7 100644 --- a/src/plugins/loop_analysis/tests/test_config +++ b/src/plugins/loop_analysis/tests/test_config @@ -1,2 +1,2 @@ -PLUGIN: loopanalysis +PLUGIN: loop-analysis OPT: -loop diff --git a/src/plugins/markdown-report/.gitignore b/src/plugins/markdown-report/.gitignore index 08329726023435c95a4fdd89252eb0c3a5b27651..9f63f866593fb8546d1562b3b1bef39e4b7f6bfc 100644 --- a/src/plugins/markdown-report/.gitignore +++ b/src/plugins/markdown-report/.gitignore @@ -7,7 +7,6 @@ top/ .merlin *~ /Makefile -/Markdown_report.mli -/tests/ptests_config +/tests/**/dune /tests/*/result /tests/*/result_* diff --git a/src/plugins/markdown-report/Makefile.in b/src/plugins/markdown-report/Makefile.in deleted file mode 100644 index 1319104e18fc93bb3628eb66df1c26e52f7754ac..0000000000000000000000000000000000000000 --- a/src/plugins/markdown-report/Makefile.in +++ /dev/null @@ -1,106 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -PLUGIN_DIR ?=. -PLUGIN_ENABLE:=@ENABLE_MDR@ -PLUGIN_NAME:=Markdown_report -PLUGIN_HAS_META:=yes -PLUGIN_GENERATED:=$(PLUGIN_DIR)/Markdown_report.mli -PLUGIN_CMO:=\ - sarif mdr_params parse_remarks md_gen sarif_gen mdr_register -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_REQUIRES:=ppx_deriving ppx_deriving_yojson yojson -PLUGIN_DISTRIB_EXTERNAL:=\ - Makefile.in configure.ac configure share/acsl.xml META.in \ - eva_info.ml eva_info.mli -PLUGIN_DEPFLAGS:= $(PLUGIN_DIR)/eva_info.mli $(PLUGIN_DIR)/eva_info.ml -PLUGIN_TESTS_DIRS:= md sarif -PLUGIN_DISTRIB_TESTS := \ - $(foreach dir, $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/oracle/* \ - $(filter-out result oracle,$(dir)/*)) \ - ) \ - $(filter-out result oracle,tests/*)) \ - $(foreach dir, tests $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/test_config) - -include $(FRAMAC_SHARE)/Makefile.dynamic - -ifneq (@ENABLE_MDR@,no) -ifneq ($(ENABLE_EVA), no) -byte:: $(PLUGIN_LIB_DIR)/top/eva_info.cmo $(PLUGIN_LIB_DIR)/top/eva_info.cmi -opt:: $(PLUGIN_LIB_DIR)/top/eva_info.cmxs $(PLUGIN_LIB_DIR)/top/eva_info.cmi -install:: - $(MKDIR) $(PLUGIN_INSTALL_DIR)/top - $(CP) $(PLUGIN_LIB_DIR)/top/eva_info.cm* $(PLUGIN_INSTALL_DIR)/top - -$(PLUGIN_LIB_DIR)/top/eva_info.cm%: $(Markdown_report_DIR)/eva_info.cm% - $(MKDIR) $(dir $@) - $(CP) $< $@ - -$(Markdown_report_DIR)/eva_info.cmo: BFLAGS+=-I $(Markdown_report_DIR) -$(Markdown_report_DIR)/eva_info.cmx: OFLAGS+=-I $(Markdown_report_DIR) - -endif -endif - -$(Markdown_report_DIR)/Markdown_report.mli: \ - $(Markdown_report_DIR)/mdr_params.mli \ - $(Markdown_report_DIR)/md_gen.mli \ - $(Markdown_report_DIR)/Makefile - echo "module Mdr_params: sig" > $@ - cat $(Markdown_report_DIR)/mdr_params.mli >> $@ - echo "end" >> $@ - echo "module Md_gen: sig" >> $@ - cat $(Markdown_report_DIR)/md_gen.mli >> $@ - echo "end" >> $@ - -VERSION:=$(shell $(CAT) $(FRAMAC_SRC)/VERSION) - -$(Markdown_report_DIR)/META: $(Markdown_report_DIR)/META.in $(FRAMAC_SRC)/VERSION - $(PRINT_MAKING) $@ - $(RM) $@ - $(SED) -e 's|@VERSION@|$(VERSION)|' $< > $@ - $(CHMOD_RO) $@ - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -ifeq ("@ENABLE_MDR@","yes") -install:: - $(PRINT_CP) $(FRAMAC_DATADIR)/Markdown_report - $(MKDIR) $(FRAMAC_DATADIR)/Markdown_report - $(CP) $(Markdown_report_DIR)/share/acsl.xml \ - $(FRAMAC_DATADIR)/Markdown_report -endif diff --git a/src/plugins/markdown-report/Mardown_report.ml b/src/plugins/markdown-report/Mardown_report.ml new file mode 100644 index 0000000000000000000000000000000000000000..74ce78834e2b9ed1668be744f03589358ab36d5c --- /dev/null +++ b/src/plugins/markdown-report/Mardown_report.ml @@ -0,0 +1,24 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module Mdr_params = Mdr_params +module Md_gen = Md_gen diff --git a/src/plugins/markdown-report/dune b/src/plugins/markdown-report/dune new file mode 100644 index 0000000000000000000000000000000000000000..aece380807bcd8a0a05a11559f01b45284a4c237 --- /dev/null +++ b/src/plugins/markdown-report/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Markdown-report:" %{lib-available:frama-c-markdown-report.core} "\n") + (echo " - ppx_deriving_yojson:" %{lib-available:ppx_deriving_yojson} "\n") + ) + ) +) + +( library + (name markdown_report) + (public_name frama-c-markdown-report.core) + (optional) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel) + (preprocess (pps ppx_deriving_yojson)) +) + +(plugin (optional) (name markdown-report) (libraries frama-c-markdown-report.core) (site (frama-c plugins))) diff --git a/src/plugins/markdown-report/dune-project b/src/plugins/markdown-report/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..2f95b35d7a3fffbca58549b1a31d884f3e10bcba --- /dev/null +++ b/src/plugins/markdown-report/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-markdown-report) +(using dune_site 0.1) diff --git a/src/plugins/markdown-report/eva-info/dune b/src/plugins/markdown-report/eva-info/dune new file mode 100644 index 0000000000000000000000000000000000000000..9961d03f3674eebdf94ce7e8c0eae7742da00d5f --- /dev/null +++ b/src/plugins/markdown-report/eva-info/dune @@ -0,0 +1,43 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Markdown-report.eva-info:" %{lib-available:frama-c-markdown-report.eva-info.core} "\n") + (echo " - markdown-report:" %{lib-available:frama-c-markdown-report.core} "\n") + (echo " - eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name markdown_report_eva_info) + (public_name frama-c-markdown-report.eva-info.core) + (optional) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core frama-c-markdown-report.core) + (preprocess (pps ppx_deriving_yojson)) +) + +(plugin (optional) (name markdown-report.eva-info) (libraries frama-c-markdown-report.eva-info.core) (site (frama-c plugins))) diff --git a/src/plugins/markdown-report/eva_info.ml b/src/plugins/markdown-report/eva-info/eva_info.ml similarity index 100% rename from src/plugins/markdown-report/eva_info.ml rename to src/plugins/markdown-report/eva-info/eva_info.ml diff --git a/src/plugins/markdown-report/eva_info.mli b/src/plugins/markdown-report/eva-info/eva_info.mli similarity index 100% rename from src/plugins/markdown-report/eva_info.mli rename to src/plugins/markdown-report/eva-info/eva_info.mli diff --git a/src/plugins/markdown-report/frama-c-markdown-report.opam b/src/plugins/markdown-report/frama-c-markdown-report.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/markdown-report/mdr_register.ml b/src/plugins/markdown-report/mdr_register.ml index b470ddbd3f8ee46cfa685257e4dfc4223d1e3c66..ded117f03983ab06c65c0df0a1d622675e206927 100644 --- a/src/plugins/markdown-report/mdr_register.ml +++ b/src/plugins/markdown-report/mdr_register.ml @@ -20,15 +20,6 @@ (* *) (**************************************************************************) -let load_eva_info () = - if not !Md_gen.Eva_info.loaded && Dynamic.is_loaded "frama-c-eva" - then begin - let eva_info = "frama-c-markdown_report.eva_info" in - Dynamic.load_packages [eva_info]; - end - -(* end *) - let main () = match Mdr_params.Generate.get () with | "none" -> () @@ -40,5 +31,4 @@ let main () = Mdr_params.Generate.option_name s let () = - Cmdline.run_after_extended_stage load_eva_info; Db.Main.extend main diff --git a/src/plugins/markdown-report/tests/md/cwe126.c b/src/plugins/markdown-report/tests/md/cwe126.c index b96948df6e500f229770267e52b4199900066e57..0750b43d6cb6673fcae0d4c0a95ed3a5d67867fd 100644 --- a/src/plugins/markdown-report/tests/md/cwe126.c +++ b/src/plugins/markdown-report/tests/md/cwe126.c @@ -1,5 +1,5 @@ /* run.config - COMMENT: to uncomment with dune -> PLUGIN: @PTEST_PLUGIN@ markdown-report.eva-info + PLUGIN: @PTEST_PLUGIN@ markdown-report.eva-info OPT: -mdr-remarks %{dep:@PTEST_DIR@/@PTEST_NAME@.remarks.md} */ diff --git a/src/plugins/markdown-report/tests/md/test_config b/src/plugins/markdown-report/tests/md/test_config index 39520192dd0d0c81fbff3a6294c2f39c4fb80b54..43f2d664e4579878e03a5783c2b82f41d879e809 100644 --- a/src/plugins/markdown-report/tests/md/test_config +++ b/src/plugins/markdown-report/tests/md/test_config @@ -1,3 +1,3 @@ -PLUGIN: eva,inout,scope markdown_report -CMD: @frama-c@ -eva @PTEST_FILE@ -mdr-gen md -mdr-date="now" -mdr-out @PTEST_RESULT@/@PTEST_NAME@.@PTEST_NUMBER@.md +PLUGIN: inout,scope,eva markdown-report LOG: @PTEST_NAME@.@PTEST_NUMBER@.md +CMD: @frama-c@ -eva @PTEST_FILE@ -mdr-gen md -mdr-date="now" -mdr-out @PTEST_RESULT@/@PTEST_NAME@.@PTEST_NUMBER@.md diff --git a/src/plugins/markdown-report/tests/ptests_config b/src/plugins/markdown-report/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..0cc5fff411d1d611e74084db92cafafa7654ed7f --- /dev/null +++ b/src/plugins/markdown-report/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= md sarif diff --git a/src/plugins/markdown-report/tests/sarif/cwe125.c b/src/plugins/markdown-report/tests/sarif/cwe125.c index f36a215aa2ed410ccddbf058b0d11a8874744e57..b983da0cb79e2581734c83d071dde69dd7e3fdff 100644 --- a/src/plugins/markdown-report/tests/sarif/cwe125.c +++ b/src/plugins/markdown-report/tests/sarif/cwe125.c @@ -2,9 +2,9 @@ NOFRAMAC: use execnow for proper sequencing of executions EXECNOW: BIN @PTEST_NAME@_parse.sav LOG @PTEST_NAME@.parse.log LOG @PTEST_NAME@.parse.err @frama-c@ @PTEST_FILE@ -save @PTEST_RESULT@/@PTEST_NAME@_parse.sav > @PTEST_RESULT@/@PTEST_NAME@.parse.log 2> @PTEST_RESULT@/@PTEST_NAME@.parse.err EXECNOW: BIN @PTEST_NAME@_eva.sav LOG @PTEST_NAME@.eva.log LOG @PTEST_NAME@.eva.err @frama-c@ -load %{dep:@PTEST_RESULT@/@PTEST_NAME@_parse.sav} -eva -save @PTEST_RESULT@/@PTEST_NAME@_eva.sav > @PTEST_RESULT@/@PTEST_NAME@.eva.log 2> @PTEST_RESULT@/@PTEST_NAME@.eva.err -EXECNOW: LOG @PTEST_NAME@.sarif LOG @PTEST_NAME@.sarif.log LOG @PTEST_NAME@.sarif.err @frama-c@ -load %{dep:@PTEST_RESULT@/@PTEST_NAME@_eva.sav} -then -mdr-out @PTEST_RESULT@/@PTEST_NAME@.sarif -mdr-gen sarif -mdr-no-print-libc -mdr-sarif-deterministic > @PTEST_RESULT@/@PTEST_NAME@.sarif.log 2> @PTEST_RESULT@/@PTEST_NAME@.sarif.err +EXECNOW: BIN @PTEST_NAME@.sarif.unfiltered LOG @PTEST_NAME@.sarif.log LOG @PTEST_NAME@.sarif.err @frama-c@ -load %{dep:@PTEST_RESULT@/@PTEST_NAME@_eva.sav} -then -mdr-out @PTEST_RESULT@/@PTEST_NAME@.sarif.unfiltered -mdr-gen sarif -mdr-no-print-libc -mdr-sarif-deterministic > @PTEST_RESULT@/@PTEST_NAME@.sarif.log 2> @PTEST_RESULT@/@PTEST_NAME@.sarif.err +EXECNOW: LOG @PTEST_NAME@.sarif sed -e "s:@PTEST_SESSION@:PTEST_SESSION:" %{dep:@PTEST_NAME@.sarif.unfiltered} > @PTEST_NAME@.sarif 2> @NULL */ - #include "__fc_builtin.h" #define LENGTH 10 diff --git a/src/plugins/markdown-report/tests/sarif/libc.c b/src/plugins/markdown-report/tests/sarif/libc.c index ccceac073671f0b697d0128e95f057940d0b119d..97ac292b33584782e2c3aefcb182f54fba992132 100644 --- a/src/plugins/markdown-report/tests/sarif/libc.c +++ b/src/plugins/markdown-report/tests/sarif/libc.c @@ -1,13 +1,13 @@ /* run.config - CMD: @frama-c@ -eva -eva-no-results -mdr-gen sarif -mdr-sarif-deterministic - LOG: with-libc.sarif - OPT: -mdr-out @PTEST_RESULT@/with-libc.sarif - LOG: without-libc.sarif - OPT: -mdr-no-print-libc -mdr-out @PTEST_RESULT@/without-libc.sarif + CMD: @frama-c@ -eva -eva-no-results -mdr-gen sarif -mdr-sarif-deterministic + BIN: with-libc.sarif.unfiltered + OPT: -mdr-out @PTEST_RESULT@/with-libc.sarif.unfiltered + EXECNOW: LOG with-libc.sarif sed -e "s:@PTEST_SESSION@:PTEST_SESSION:" %{dep:with-libc.sarif.unfiltered} > with-libc.sarif 2> @NULL + BIN: without-libc.sarif.unfiltered + OPT: -mdr-no-print-libc -mdr-out @PTEST_RESULT@/without-libc.sarif.unfiltered + EXECNOW: LOG without-libc.sarif sed -e "s:@PTEST_SESSION@:PTEST_SESSION:" %{dep:without-libc.sarif.unfiltered} > without-libc.sarif 2> @NULL */ - #include <string.h> - int main() { char *s = "hello world"; int n = strlen(s); diff --git a/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif b/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif index 2492553138546f46918a6768c6ba357925416d2d..bae3ec58849f73f5b4e457c8dc4c44d4a7da501a 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif +++ b/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif @@ -16,10 +16,11 @@ "invocations": [ { "commandLine": - "frama-c -check -no-autoload-plugins -add-symbolic-path :. -load-module=eva,from,scope,markdown_report cwe125.c -save ./cwe125_parse.sav", + "frama-c -check -no-autoload-plugins -add-symbolic-path=PTEST_SESSION:. -load-plugin=eva,from,scope,inout,markdown-report cwe125.c -save ./cwe125_parse.sav", "arguments": [ - "-check", "-no-autoload-plugins", "-add-symbolic-path", ":.", - "-load-module=eva,from,scope,markdown_report", "cwe125.c", + "-check", "-no-autoload-plugins", + "-add-symbolic-path=PTEST_SESSION:.", + "-load-plugin=eva,from,scope,inout,markdown-report", "cwe125.c", "-save", "./cwe125_parse.sav" ], "exitCode": 0, @@ -27,10 +28,11 @@ }, { "commandLine": - "frama-c -check -no-autoload-plugins -add-symbolic-path :. -load-module=eva,from,scope,markdown_report -load ./cwe125_parse.sav -eva -save ./cwe125_eva.sav", + "frama-c -check -no-autoload-plugins -add-symbolic-path=PTEST_SESSION:. -load-plugin=eva,from,scope,inout,markdown-report -load ./cwe125_parse.sav -eva -save ./cwe125_eva.sav", "arguments": [ - "-check", "-no-autoload-plugins", "-add-symbolic-path", ":.", - "-load-module=eva,from,scope,markdown_report", "-load", + "-check", "-no-autoload-plugins", + "-add-symbolic-path=PTEST_SESSION:.", + "-load-plugin=eva,from,scope,inout,markdown-report", "-load", "./cwe125_parse.sav", "-eva", "-save", "./cwe125_eva.sav" ], "exitCode": 0, @@ -38,13 +40,14 @@ }, { "commandLine": - "frama-c -check -no-autoload-plugins -add-symbolic-path :. -load-module=eva,from,scope,markdown_report -load ./cwe125_eva.sav -then -mdr-out ./cwe125.sarif -mdr-gen sarif -mdr-no-print-libc -mdr-sarif-deterministic", + "frama-c -check -no-autoload-plugins -add-symbolic-path=PTEST_SESSION:. -load-plugin=eva,from,scope,inout,markdown-report -load ./cwe125_eva.sav -then -mdr-out ./cwe125.sarif.unfiltered -mdr-gen sarif -mdr-no-print-libc -mdr-sarif-deterministic", "arguments": [ - "-check", "-no-autoload-plugins", "-add-symbolic-path", ":.", - "-load-module=eva,from,scope,markdown_report", "-load", - "./cwe125_eva.sav", "-then", "-mdr-out", "./cwe125.sarif", - "-mdr-gen", "sarif", "-mdr-no-print-libc", - "-mdr-sarif-deterministic" + "-check", "-no-autoload-plugins", + "-add-symbolic-path=PTEST_SESSION:.", + "-load-plugin=eva,from,scope,inout,markdown-report", "-load", + "./cwe125_eva.sav", "-then", "-mdr-out", + "./cwe125.sarif.unfiltered", "-mdr-gen", "sarif", + "-mdr-no-print-libc", "-mdr-sarif-deterministic" ], "exitCode": 0, "executionSuccessful": true diff --git a/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif.log b/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif.log index 6cd26d996cee95fbe14913350e674657cead372b..b2d798515191b7d2684cb970770e5a80436d40f5 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif.log +++ b/src/plugins/markdown-report/tests/sarif/oracle/cwe125.sarif.log @@ -1 +1 @@ -[mdr] Report cwe125.sarif generated +[mdr] Report cwe125.sarif.unfiltered generated diff --git a/src/plugins/markdown-report/tests/sarif/oracle/libc.0.res.oracle b/src/plugins/markdown-report/tests/sarif/oracle/libc.0.res.oracle index 34bcdb93fb43f0ff5c25fc32050eaa471f301668..5b92529acb630c7e68f8f3f946d2c06b066f8515 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/libc.0.res.oracle +++ b/src/plugins/markdown-report/tests/sarif/oracle/libc.0.res.oracle @@ -20,4 +20,4 @@ Preconditions 1 valid 0 unknown 0 invalid 1 total 100% of the logical properties reached have been proven. ---------------------------------------------------------------------------- -[mdr] Report with-libc.sarif generated +[mdr] Report with-libc.sarif.unfiltered generated diff --git a/src/plugins/markdown-report/tests/sarif/oracle/libc.1.res.oracle b/src/plugins/markdown-report/tests/sarif/oracle/libc.1.res.oracle index 8888de2a968f4b8ba4d22bf1fab25200f606800c..528152ef4885091962e4a066de650c1acba62956 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/libc.1.res.oracle +++ b/src/plugins/markdown-report/tests/sarif/oracle/libc.1.res.oracle @@ -20,4 +20,4 @@ Preconditions 1 valid 0 unknown 0 invalid 1 total 100% of the logical properties reached have been proven. ---------------------------------------------------------------------------- -[mdr] Report without-libc.sarif generated +[mdr] Report without-libc.sarif.unfiltered generated diff --git a/src/plugins/markdown-report/tests/sarif/oracle/std_string.res.oracle b/src/plugins/markdown-report/tests/sarif/oracle/std_string.res.oracle index a3b1c0eeacb9ccc543e78667ef269e254a11603f..02ebc03a71e3e4b5bfb27a950a13fac9f2151ef1 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/std_string.res.oracle +++ b/src/plugins/markdown-report/tests/sarif/oracle/std_string.res.oracle @@ -19,4 +19,4 @@ ---------------------------------------------------------------------------- No logical properties have been reached by the analysis. ---------------------------------------------------------------------------- -[mdr] Report std_string.sarif generated +[mdr] Report std_string.sarif.unfiltered generated diff --git a/src/plugins/markdown-report/tests/sarif/oracle/std_string.sarif b/src/plugins/markdown-report/tests/sarif/oracle/std_string.sarif index f5cfcd6dea5dc27f0acfa63b9387f2f4b924a661..c29b3db8d73bf9099204e617f2593294fb004cb2 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/std_string.sarif +++ b/src/plugins/markdown-report/tests/sarif/oracle/std_string.sarif @@ -16,12 +16,13 @@ "invocations": [ { "commandLine": - "frama-c -check -no-autoload-plugins -add-symbolic-path :. -load-module=eva,from,scope,markdown_report std_string.c -eva -then -mdr-sarif-deterministic -mdr-gen sarif -mdr-out ./std_string.sarif", + "frama-c -check -no-autoload-plugins -add-symbolic-path=PTEST_SESSION:. -load-plugin=eva,from,scope,inout,markdown-report std_string.c -eva -then -mdr-sarif-deterministic -mdr-gen sarif -mdr-out ./std_string.sarif.unfiltered", "arguments": [ - "-check", "-no-autoload-plugins", "-add-symbolic-path", ":.", - "-load-module=eva,from,scope,markdown_report", "std_string.c", - "-eva", "-then", "-mdr-sarif-deterministic", "-mdr-gen", "sarif", - "-mdr-out", "./std_string.sarif" + "-check", "-no-autoload-plugins", + "-add-symbolic-path=PTEST_SESSION:.", + "-load-plugin=eva,from,scope,inout,markdown-report", + "std_string.c", "-eva", "-then", "-mdr-sarif-deterministic", + "-mdr-gen", "sarif", "-mdr-out", "./std_string.sarif.unfiltered" ], "exitCode": 0, "executionSuccessful": true diff --git a/src/plugins/markdown-report/tests/sarif/oracle/with-libc.sarif b/src/plugins/markdown-report/tests/sarif/oracle/with-libc.sarif index 42708bf75372a88ed5ac6e0dd75257c9dd2f3dd1..a09df2debac18b5015f52f9bddfc1ccec772ae20 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/with-libc.sarif +++ b/src/plugins/markdown-report/tests/sarif/oracle/with-libc.sarif @@ -16,13 +16,14 @@ "invocations": [ { "commandLine": - "frama-c -check -no-autoload-plugins -add-symbolic-path :. -load-module=eva,from,scope,markdown_report -eva -eva-no-results -mdr-gen sarif -mdr-sarif-deterministic libc.c -mdr-out ./with-libc.sarif", + "frama-c -check -no-autoload-plugins -add-symbolic-path=PTEST_SESSION:. -load-plugin=eva,from,scope,inout,markdown-report -eva -eva-no-results -mdr-gen sarif -mdr-sarif-deterministic libc.c -mdr-out ./with-libc.sarif.unfiltered", "arguments": [ - "-check", "-no-autoload-plugins", "-add-symbolic-path", ":.", - "-load-module=eva,from,scope,markdown_report", "-eva", + "-check", "-no-autoload-plugins", + "-add-symbolic-path=PTEST_SESSION:.", + "-load-plugin=eva,from,scope,inout,markdown-report", "-eva", "-eva-no-results", "-mdr-gen", "sarif", "-mdr-sarif-deterministic", "libc.c", "-mdr-out", - "./with-libc.sarif" + "./with-libc.sarif.unfiltered" ], "exitCode": 0, "executionSuccessful": true diff --git a/src/plugins/markdown-report/tests/sarif/oracle/without-libc.sarif b/src/plugins/markdown-report/tests/sarif/oracle/without-libc.sarif index 00f3d299424eb204322729e64d0831c86c96458c..a5dd4fbc506da45f44ac1826f94f8f72c4b3f073 100644 --- a/src/plugins/markdown-report/tests/sarif/oracle/without-libc.sarif +++ b/src/plugins/markdown-report/tests/sarif/oracle/without-libc.sarif @@ -16,13 +16,14 @@ "invocations": [ { "commandLine": - "frama-c -check -no-autoload-plugins -add-symbolic-path :. -load-module=eva,from,scope,markdown_report -eva -eva-no-results -mdr-gen sarif -mdr-sarif-deterministic libc.c -mdr-no-print-libc -mdr-out ./without-libc.sarif", + "frama-c -check -no-autoload-plugins -add-symbolic-path=PTEST_SESSION:. -load-plugin=eva,from,scope,inout,markdown-report -eva -eva-no-results -mdr-gen sarif -mdr-sarif-deterministic libc.c -mdr-no-print-libc -mdr-out ./without-libc.sarif.unfiltered", "arguments": [ - "-check", "-no-autoload-plugins", "-add-symbolic-path", ":.", - "-load-module=eva,from,scope,markdown_report", "-eva", + "-check", "-no-autoload-plugins", + "-add-symbolic-path=PTEST_SESSION:.", + "-load-plugin=eva,from,scope,inout,markdown-report", "-eva", "-eva-no-results", "-mdr-gen", "sarif", "-mdr-sarif-deterministic", "libc.c", "-mdr-no-print-libc", - "-mdr-out", "./without-libc.sarif" + "-mdr-out", "./without-libc.sarif.unfiltered" ], "exitCode": 0, "executionSuccessful": true diff --git a/src/plugins/markdown-report/tests/sarif/std_string.c b/src/plugins/markdown-report/tests/sarif/std_string.c index f59bb9d1106d8645ea0700bbe533ec6eba4dee68..723cc5eda08137cfa4d7326b47a425b61c67cd7f 100644 --- a/src/plugins/markdown-report/tests/sarif/std_string.c +++ b/src/plugins/markdown-report/tests/sarif/std_string.c @@ -1,8 +1,8 @@ /* run.config* -LOG: @PTEST_NAME@.sarif -OPT: -eva -then -mdr-sarif-deterministic -mdr-gen sarif -mdr-out @PTEST_RESULT@/@PTEST_NAME@.sarif +BIN: @PTEST_NAME@.sarif.unfiltered +OPT: -eva -then -mdr-sarif-deterministic -mdr-gen sarif -mdr-out @PTEST_RESULT@/@PTEST_NAME@.sarif.unfiltered +EXECNOW: LOG @PTEST_NAME@.sarif sed -e "s:@PTEST_SESSION@:PTEST_SESSION:" %{dep:@PTEST_NAME@.sarif.unfiltered} > @PTEST_NAME@.sarif 2> @NULL */ - #include "string.c" int main() { } diff --git a/src/plugins/markdown-report/tests/test_config b/src/plugins/markdown-report/tests/test_config index d8bce8de28a2aa935d226e8561a3097808500d60..e867ba041db820d96474926f646609fec4c1af64 100644 --- a/src/plugins/markdown-report/tests/test_config +++ b/src/plugins/markdown-report/tests/test_config @@ -1 +1 @@ -PLUGIN: eva,from,scope markdown_report +PLUGIN: eva,from,scope,inout markdown-report diff --git a/src/plugins/metrics/dune b/src/plugins/metrics/dune new file mode 100644 index 0000000000000000000000000000000000000000..30c04d80fc0064beb198fd24310eb1f7c66185d5 --- /dev/null +++ b/src/plugins/metrics/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Metrics:" %{lib-available:frama-c-metrics.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - Server:" %{lib-available:frama-c-server.core} "\n") + ) + ) +) + +( library + (name metrics) + (optional) + (public_name frama-c-metrics.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core frama-c-server.core) +) + +(plugin (optional) (name metrics) (libraries frama-c-metrics.core) (site (frama-c plugins))) diff --git a/src/plugins/metrics/dune-project b/src/plugins/metrics/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..507ccd298ba0e12e7906bc998ef38d344c7c88ba --- /dev/null +++ b/src/plugins/metrics/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-metrics) +(using dune_site 0.1) diff --git a/src/plugins/metrics/frama-c-metrics.opam b/src/plugins/metrics/frama-c-metrics.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/metrics/gui/dune b/src/plugins/metrics/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..2a7064260b7f9840c7aa14f200c2035ee5c4f373 --- /dev/null +++ b/src/plugins/metrics/gui/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +( library + (name metrics_gui) + (public_name frama-c-metrics.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Metrics :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-metrics.core) +) + +(plugin (optional) (name metrics-gui) (libraries frama-c-metrics.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/metrics/metrics_gui.ml b/src/plugins/metrics/gui/metrics_gui_panels.ml similarity index 100% rename from src/plugins/metrics/metrics_gui.ml rename to src/plugins/metrics/gui/metrics_gui_panels.ml diff --git a/src/plugins/metrics/metrics_gui.mli b/src/plugins/metrics/gui/metrics_gui_panels.mli similarity index 100% rename from src/plugins/metrics/metrics_gui.mli rename to src/plugins/metrics/gui/metrics_gui_panels.mli diff --git a/src/plugins/metrics/register_gui.ml b/src/plugins/metrics/gui/register_gui.ml similarity index 86% rename from src/plugins/metrics/register_gui.ml rename to src/plugins/metrics/gui/register_gui.ml index 2d428cdc8377170a70f03385332b6ec1620cfe40..fa86fffe2d31c364810190c5a17e2ecde48a6e10 100644 --- a/src/plugins/metrics/register_gui.ml +++ b/src/plugins/metrics/gui/register_gui.ml @@ -35,20 +35,19 @@ module HalsteadMetricsGUI = struct ignore(GMisc.label ~markup:(Printf.sprintf "<b>%s</b>" name) ~justify:`LEFT ~packing:box#pack ()); ignore(GMisc.separator `HORIZONTAL ~packing:box#pack ()); - let metrics = Metrics_cabs.Halstead.get_metrics () in - let table_contents = Metrics_cabs.Halstead.to_list metrics in - Metrics_gui.display_as_table table_contents box + let metrics = Metrics__Metrics_cabs.Halstead.get_metrics () in + let table_contents = Metrics__Metrics_cabs.Halstead.to_list metrics in + Metrics_gui_panels.display_as_table table_contents box with | Ast.NoUntypedAst -> main_ui#error "Cannot compute Halstead metrics: untyped AST not present.\n\ It has been removed either by user request or \ by some AST transformation." - let register main_ui = Metrics_gui.register_metrics name (display_result main_ui) + let register main_ui = Metrics_gui_panels.register_metrics name (display_result main_ui) end module CyclomaticMetricsGUI = struct - open Metrics_base open Pretty_source open Visitor @@ -60,7 +59,7 @@ module CyclomaticMetricsGUI = struct val mutable checked_fun = Kernel_function.dummy () method get_data = - let checker = (new Metrics_cilast.slocVisitor ~libc) in + let checker = (new Metrics__Metrics_cilast.slocVisitor ~libc) in ignore (visitFramacGlobal (checker :> frama_c_visitor) (Kernel_function.get_global checked_fun)); checker#get_global_metrics @@ -97,7 +96,7 @@ module CyclomaticMetricsGUI = struct ["stmts analyzed";(string_of_int valeur)]; ["percentage of stmts covered"; (string_of_float percent)] ] in - Metrics_gui.display_as_table metrics_data vbox; + Metrics_gui_panels.display_as_table metrics_data vbox; let close_button = GButton.button ~stock:`OK ~packing:vbox#pack () in close_button#set_border_width 10; ignore (close_button#connect#clicked ~callback:dialog#misc#hide); @@ -127,8 +126,8 @@ module CyclomaticMetricsGUI = struct ignore(GMisc.label ~markup:(Printf.sprintf "<b>%s</b>" fname) ~justify:`LEFT ~packing:vbox#pack ()); ignore(GMisc.separator `HORIZONTAL ~packing:vbox#pack ()); - let metrics_data = BasicMetrics.to_list self#get_data in - Metrics_gui.display_as_table metrics_data vbox; + let metrics_data = Metrics__Metrics_base.BasicMetrics.to_list self#get_data in + Metrics_gui_panels.display_as_table metrics_data vbox; let close_button = GButton.button ~stock:`OK ~packing:vbox#pack () in close_button#set_border_width 10; ignore (close_button#connect#clicked ~callback:dialog#misc#hide); @@ -150,16 +149,16 @@ module CyclomaticMetricsGUI = struct match localizable with | PVDecl (Some kf, _,_) -> let callback1 () = - Metrics_parameters.debug "cyclo_selector - callback"; + Metrics__Metrics_parameters.debug "cyclo_selector - callback"; self#display_localizable localizable () in let callback2 () = (* function selected is kf *) - Metrics_coverage.compute_coverage_by_fun (); + Metrics__Metrics_coverage.compute_coverage_by_fun (); (* Got a list of (kf,value,total,percent). Now let's scan this list *) try - let valeur,total,percent = Metrics_coverage.get_coverage kf in + let valeur,total,percent = Metrics__Metrics_coverage.get_coverage kf in self#do_value main_ui localizable valeur total percent with Not_found -> () in @@ -183,19 +182,18 @@ module CyclomaticMetricsGUI = struct ignore(GMisc.label ~markup:(Printf.sprintf "<b>%s</b>" name) ~justify:`LEFT ~packing:box#pack ()); ignore(GMisc.separator `HORIZONTAL ~packing:box#pack ()); - let metrics = Metrics_cilast.get_global_metrics ~libc in - let table_contents = BasicMetrics.to_list metrics in - Metrics_gui.display_as_table table_contents box + let metrics = Metrics__Metrics_cilast.get_global_metrics ~libc in + let table_contents = Metrics__Metrics_base.BasicMetrics.to_list metrics in + Metrics_gui_panels.display_as_table table_contents box let register ~libc main_ui = ignore (new cyclo_class ~libc main_ui); - Metrics_gui.register_metrics name (display_result ~libc) + Metrics_gui_panels.register_metrics name (display_result ~libc) end (** GUI hooks value coverage *) module ValueCoverageGUI = struct open Cil_datatype - open Metrics_coverage open Gtk_helper let name = "Eva coverage" @@ -207,7 +205,7 @@ module ValueCoverageGUI = struct let filetree_enabled = ref true let filetree_visible () = - !filetree_enabled && Metrics_coverage.is_computed_by_fun () + !filetree_enabled && Metrics__Metrics_coverage.is_computed_by_fun () (* TODO : Metrics data structure must be projectified ? *) let compute ~libc = @@ -215,10 +213,10 @@ module ValueCoverageGUI = struct match !result with | None -> Eva.Analysis.compute (); - result := Some (Metrics_coverage.compute ~libc) + result := Some (Metrics__Metrics_coverage.compute ~libc) | Some _ -> () end; - Metrics_coverage.compute_coverage_by_fun (); + Metrics__Metrics_coverage.compute_coverage_by_fun (); !update_filetree `Contents; Option.get !result @@ -228,7 +226,7 @@ module ValueCoverageGUI = struct begin try let kf = Globals.Functions.get v in - get (Metrics_coverage.get_coverage kf) + get (Metrics__Metrics_coverage.get_coverage kf) with Not_found -> -1 end | _ -> -1 @@ -274,7 +272,7 @@ module ValueCoverageGUI = struct let () = Eva.Analysis.register_computation_hook (fun _ -> - Metrics_coverage.clear_coverage_by_fun (); + Metrics__Metrics_coverage.clear_coverage_by_fun (); !update_filetree `Visibility) (* Functions are highlighted using different colors according to the @@ -323,12 +321,12 @@ module ValueCoverageGUI = struct ~justify:`LEFT ~packing:box#pack ()); ignore(GMisc.separator `HORIZONTAL ~packing:box#pack ()); let metrics = compute ~libc in - let pcent = Metrics_coverage.percent_coverage ~libc metrics in + let pcent = Metrics__Metrics_coverage.percent_coverage ~libc metrics in let progress_bar = GRange.progress_bar ~packing:box#pack () in progress_bar#set_fraction (pcent /. 100.0); ignore(GMisc.label ~markup:(Format.sprintf "%s%% functions reached" - (Metrics_base.float_to_string pcent)) + (Metrics__Metrics_base.float_to_string pcent)) ~justify:`LEFT ~packing:box#pack ()); let _ignore = Gtk_helper.on_bool box "Highlight results" (fun () -> !highlight) @@ -344,17 +342,17 @@ module ValueCoverageGUI = struct let register ~libc main_ui = Design.register_reset_extension (fun _ -> result := None); main_ui#register_source_highlighter highlighter; - let apply = Metrics_parameters.ValueCoverage.get () in - Metrics_gui.register_metrics ~apply name (display_result ~libc main_ui); + let apply = Metrics__Metrics_parameters.ValueCoverage.get () in + Metrics_gui_panels.register_metrics ~apply name (display_result ~libc main_ui); end -let register_final ?(libc=Metrics_parameters.Libc.get ()) main_ui = - let box = Metrics_gui.init_panel main_ui in - Design.register_reset_extension Metrics_gui.reset_panel; +let register_final ?(libc=Metrics__Metrics_parameters.Libc.get ()) main_ui = + let box = Metrics_gui_panels.init_panel main_ui in + Design.register_reset_extension Metrics_gui_panels.reset_panel; HalsteadMetricsGUI.register main_ui; CyclomaticMetricsGUI.register ~libc main_ui; ValueCoverageGUI.register ~libc main_ui; - Metrics_gui.coerce_panel_to_ui box main_ui + Metrics_gui_panels.coerce_panel_to_ui box main_ui let gui (main_ui:Design.main_window_extension_points) = main_ui#register_panel register_final diff --git a/src/plugins/metrics/register_gui.mli b/src/plugins/metrics/gui/register_gui.mli similarity index 100% rename from src/plugins/metrics/register_gui.mli rename to src/plugins/metrics/gui/register_gui.mli diff --git a/src/plugins/security_slicing/Security_slicing.mli b/src/plugins/metrics/metrics.ml similarity index 93% rename from src/plugins/security_slicing/Security_slicing.mli rename to src/plugins/metrics/metrics.ml index f2a7ec9e4cdbbf7c17255ba48cd6c9234804c63c..5b8bbeecacf92966ced1384882eff9b37f47c016 100644 --- a/src/plugins/security_slicing/Security_slicing.mli +++ b/src/plugins/metrics/metrics.ml @@ -20,9 +20,9 @@ (* *) (**************************************************************************) -(** Security slicing. *) - -(** No function is directly exported: they are dynamically registered. *) +module Metrics_coverage = Metrics_coverage +module Metrics_base = Metrics_base +module Metrics_cilast = Metrics_cilast (* Local Variables: diff --git a/src/plugins/metrics/Metrics.mli b/src/plugins/metrics/metrics.mli similarity index 100% rename from src/plugins/metrics/Metrics.mli rename to src/plugins/metrics/metrics.mli diff --git a/src/plugins/nonterm/.gitignore b/src/plugins/nonterm/.gitignore index 0114e3d0f08985bcf97727dcde8f314ddb4410ae..b18adc61b4fbcc6e775225047b0a86a8a8a8659d 100644 --- a/src/plugins/nonterm/.gitignore +++ b/src/plugins/nonterm/.gitignore @@ -1,4 +1,4 @@ /configure /Makefile -/tests/ptests_config +/tests/**/dune /tests/*/result diff --git a/src/plugins/nonterm/Makefile.in b/src/plugins/nonterm/Makefile.in deleted file mode 100644 index a45d5b990a5a9f948f6ebd1db46811a427c8c344..0000000000000000000000000000000000000000 --- a/src/plugins/nonterm/Makefile.in +++ /dev/null @@ -1,72 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -################### -# Plug-in Setting # -################### - -PLUGIN_DIR ?=. -PLUGIN_ENABLE:=@ENABLE_NONTERM@ -PLUGIN_NAME:=Nonterm -PLUGIN_CMO:= nonterm_run -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -PLUGIN_DEPENDENCIES:=Eva -#PLUGIN_NO_DEFAULT_TEST:=no -PLUGIN_TESTS_DIRS:=nonterm -PLUGIN_DISTRIB_TESTS := \ - $(foreach dir, $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/oracle/* \ - $(filter-out result oracle,$(dir)/*)) \ - ) \ - $(filter-out result oracle,tests/*)) \ - $(foreach dir, tests $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/test_config) - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(Nonterm_DIR)/Makefile: $(Nonterm_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/nonterm/Nonterm.mli b/src/plugins/nonterm/Nonterm.ml similarity index 100% rename from src/plugins/nonterm/Nonterm.mli rename to src/plugins/nonterm/Nonterm.ml diff --git a/src/plugins/nonterm/dune b/src/plugins/nonterm/dune new file mode 100644 index 0000000000000000000000000000000000000000..644ec0500d9e80493685cd86e31f2ece9bf3eab9 --- /dev/null +++ b/src/plugins/nonterm/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "NonTerm:" %{lib-available:frama-c-nonterm.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name nonterm) + (optional) + (public_name frama-c-nonterm.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core) +) + +(plugin (optional) (name nonterm) (libraries frama-c-nonterm.core) (site (frama-c plugins))) diff --git a/src/plugins/nonterm/dune-project b/src/plugins/nonterm/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..a91cdce8beaa366f997c06157a79ccc10e464b9c --- /dev/null +++ b/src/plugins/nonterm/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-nonterm) +(using dune_site 0.1) diff --git a/src/plugins/nonterm/frama-c-nonterm.opam b/src/plugins/nonterm/frama-c-nonterm.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/nonterm/tests/ptests_config b/src/plugins/nonterm/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..6dc5f3ae39e5b140aef91b2b89bec6ccc8366afc --- /dev/null +++ b/src/plugins/nonterm/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= nonterm diff --git a/src/plugins/obfuscator/Obfuscator.mli b/src/plugins/obfuscator/Obfuscator.ml similarity index 100% rename from src/plugins/obfuscator/Obfuscator.mli rename to src/plugins/obfuscator/Obfuscator.ml diff --git a/src/plugins/obfuscator/dune b/src/plugins/obfuscator/dune new file mode 100644 index 0000000000000000000000000000000000000000..12e3732b53fc3a8c73198f38a236d565b5d1ed9f --- /dev/null +++ b/src/plugins/obfuscator/dune @@ -0,0 +1,40 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Obfuscator:" %{lib-available:frama-c-obfuscator.core} "\n") + ) + ) +) + +( library + (name obfuscator) + (optional) + (public_name frama-c-obfuscator.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel) +) + +(plugin (optional) (name obfuscator) (libraries frama-c-obfuscator.core) (site (frama-c plugins))) diff --git a/src/plugins/obfuscator/dune-project b/src/plugins/obfuscator/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..c74dfe1f855719718015f2986c9b183ebe09c4d5 --- /dev/null +++ b/src/plugins/obfuscator/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-obfuscator) +(using dune_site 0.1) diff --git a/src/plugins/obfuscator/frama-c-obfuscator.opam b/src/plugins/obfuscator/frama-c-obfuscator.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/occurrence/Occurrence.mli b/src/plugins/occurrence/Occurrence.ml similarity index 93% rename from src/plugins/occurrence/Occurrence.mli rename to src/plugins/occurrence/Occurrence.ml index 2f606eebc35504cb7d04704e8afa7525279c7a0c..d7961a9f07fe6ce58ced320bd71862a8d8609fd7 100644 --- a/src/plugins/occurrence/Occurrence.mli +++ b/src/plugins/occurrence/Occurrence.ml @@ -36,7 +36,13 @@ module Register: sig val print_all: (unit -> unit) (** Print all the occurrence of each variable declarations. *) -end + + (* {2 Internal Use Only}*) + + type access_type = Read | Write | Both + + val classify_accesses: kernel_function option * kinstr *lval -> access_type +end = Register (* Local Variables: diff --git a/src/plugins/occurrence/dune b/src/plugins/occurrence/dune new file mode 100644 index 0000000000000000000000000000000000000000..eb86f031617ef68e9b6c58132fe3c27fe15ed5b3 --- /dev/null +++ b/src/plugins/occurrence/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Occurrence:" %{lib-available:frama-c-occurrence.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name occurrence) + (optional) + (public_name frama-c-occurrence.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core) +) + +(plugin (optional) (name occurrence) (libraries frama-c-occurrence.core) (site (frama-c plugins))) diff --git a/src/plugins/occurrence/dune-project b/src/plugins/occurrence/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..c4d46ce003e6e51858792b9f473077381506b0ac --- /dev/null +++ b/src/plugins/occurrence/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-occurrence) +(using dune_site 0.1) diff --git a/src/plugins/occurrence/frama-c-occurrence.opam b/src/plugins/occurrence/frama-c-occurrence.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/occurrence/gui/dune b/src/plugins/occurrence/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..0617333ebb5dcb6360c90c62d3d5e1218db472ae --- /dev/null +++ b/src/plugins/occurrence/gui/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Occurrence GUI:" %{lib-available:frama-c-occurrence.gui} "\n") + (echo " - Frama-C GUI:" %{lib-available:frama-c.gui} "\n") + (echo " - Occurrence:" %{lib-available:frama-c-occurrence.core} "\n") + ) + ) +) + +( library + (name occurrence_gui) + (public_name frama-c-occurrence.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Occurrence :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-occurrence.core) +) + +(plugin (optional) (name occurrence) (libraries frama-c-occurrence.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/occurrence/register_gui.ml b/src/plugins/occurrence/gui/register_gui.ml similarity index 100% rename from src/plugins/occurrence/register_gui.ml rename to src/plugins/occurrence/gui/register_gui.ml diff --git a/src/plugins/occurrence/register_gui.mli b/src/plugins/occurrence/gui/register_gui.mli similarity index 100% rename from src/plugins/occurrence/register_gui.mli rename to src/plugins/occurrence/gui/register_gui.mli diff --git a/src/plugins/postdominators/Postdominators.mli b/src/plugins/pdg/Pdg.ml similarity index 89% rename from src/plugins/postdominators/Postdominators.mli rename to src/plugins/pdg/Pdg.ml index 9f4252e6b4a8647acd8738fed5a9729c9245affb..2472224ae4c3981e0e6720ab359d8b6f8ea034a6 100644 --- a/src/plugins/postdominators/Postdominators.mli +++ b/src/plugins/pdg/Pdg.ml @@ -20,9 +20,8 @@ (* *) (**************************************************************************) -(* $Id: Postdominators.mli,v 1.5 2008-04-01 09:25:21 uid568 Exp $ *) +(** Program Dependences Graph. *) -(** Postdominators analysis. *) +module Api = Api -(** No function is directly exported: they are registered in - {!Db.Postdominators}. *) +module Marks = Marks diff --git a/src/plugins/pdg/Pdg.mli b/src/plugins/pdg/Pdg.mli index 2fcfa88853137ba80dbddf902f353d2bbc5ac1fb..aaaefb329d90b35ec8a6078cf2d3cd5d767ca2d1 100644 --- a/src/plugins/pdg/Pdg.mli +++ b/src/plugins/pdg/Pdg.mli @@ -22,7 +22,6 @@ (** Program Dependences Graph. *) -(** Functions for this plugin are registered through the [Db] module, - the dynamic API, and the module Below. *) +module Api : module type of Api -module Register : module type of Marks +module Marks : module type of Marks diff --git a/src/plugins/pdg/annot.ml b/src/plugins/pdg/annot.ml index d76dc95c38da8546bce3569b83ddcadbb3fbfa54..09c37fa94373490d0eb7133f4c09be10d36bccec 100644 --- a/src/plugins/pdg/annot.ml +++ b/src/plugins/pdg/annot.ml @@ -22,6 +22,8 @@ open Cil_types open Cil_datatype + +open Pdg_types open PdgIndex type data_info = ((PdgTypes.Node.t * Locations.Zone.t option) list @@ -117,13 +119,13 @@ let find_code_annot_nodes pdg stmt annot = let labels = decl_label_info.Db.Properties.Interp.To_zone.lbl in let stmt_key = Key.stmt_key stmt in let stmt_node = match stmt_key with - | Key.Stmt _ -> !Db.Pdg.find_stmt_node pdg stmt - | Key.CallStmt _ -> !Db.Pdg.find_call_ctrl_node pdg stmt + | Key.Stmt _ -> Sets.find_stmt_node pdg stmt + | Key.CallStmt _ -> Sets.find_call_ctrl_node pdg stmt | _ -> assert false in - let ctrl_dpds = !Db.Pdg.direct_ctrl_dpds pdg stmt_node in + let ctrl_dpds = Sets.direct_ctrl_dpds pdg stmt_node in let add_stmt_nodes s acc = - try !Db.Pdg.find_stmt_and_blocks_nodes pdg s @ acc + try Sets.find_stmt_and_blocks_nodes pdg s @ acc with Not_found -> acc in (* can safely ignore pragmas.ctrl diff --git a/src/plugins/pdg/annot.mli b/src/plugins/pdg/annot.mli index 8aa296375843ddb909c61cba30f6b76014ea6c3e..c46dd70667d8e4df934d0843732858f3694fa267 100644 --- a/src/plugins/pdg/annot.mli +++ b/src/plugins/pdg/annot.mli @@ -24,6 +24,8 @@ @raise Kernel_function.No_Definition on annotations for function declarations. *) +open Pdg_types + (** [data_info] is composed of [(node,z_part) list, undef_loc)] * and correspond to data dependencies nodes. * Can be None if we don't know how to compute them. diff --git a/src/plugins/pdg/api.ml b/src/plugins/pdg/api.ml new file mode 100644 index 0000000000000000000000000000000000000000..0024018d796890a4136e964dcbc48c9d1ee97ec7 --- /dev/null +++ b/src/plugins/pdg/api.ml @@ -0,0 +1,113 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +[@@@ warning "-32" ] + +open Pdg_types + +type t = PdgTypes.Pdg.t + +type t_nodes_and_undef = + ((PdgTypes.Node.t * Locations.Zone.t option) list * Locations.Zone.t option) + +exception Top = PdgTypes.Pdg.Top +exception Bottom = PdgTypes.Pdg.Bottom + +(**************************************************************************) + +let self = Pdg_tbl.self +let get = Pdg_tbl.get + +let node_key = PdgTypes.Node.elem_key + +let from_same_fun pdg1 pdg2 = + let kf1 = PdgTypes.Pdg.get_kf pdg1 in + let kf2 = PdgTypes.Pdg.get_kf pdg2 in + Kernel_function.equal kf1 kf2 + +(**************************************************************************) +let find_decl_var_node = Sets.find_decl_var_node +let find_entry_point_node = Sets.find_entry_point_node +let find_top_input_node = Sets.find_top_input_node +let find_simple_stmt_nodes = Sets.find_simple_stmt_nodes +let find_stmt_and_blocks_nodes = Sets.find_stmt_and_blocks_nodes +let find_stmt_node = Sets.find_stmt_node +let find_label_node = Sets.find_label_node +let find_location_nodes_at_stmt = Sets.find_location_nodes_at_stmt +let find_location_nodes_at_begin = Sets.find_location_nodes_at_begin +let find_location_nodes_at_end = Sets.find_location_nodes_at_end +let find_call_ctrl_node = Sets.find_call_ctrl_node +let find_call_input_node = Sets.find_call_num_input_node +let find_call_output_node = Sets.find_call_output_node +let find_input_node = Sets.find_input_node +let find_ret_output_node = Sets.find_output_node +let find_output_nodes = Sets.find_output_nodes +let find_all_inputs_nodes = Sets.find_all_input_nodes + +let find_call_stmts = Sets.find_call_stmts + +let find_code_annot_nodes = Annot.find_code_annot_nodes +let find_fun_precond_nodes = Annot.find_fun_precond_nodes +let find_fun_postcond_nodes = Annot.find_fun_postcond_nodes +let find_fun_variant_nodes = Annot.find_fun_variant_nodes + +let find_call_out_nodes_to_select = Sets.find_call_out_nodes_to_select +let find_in_nodes_to_select_for_this_call = + Sets.find_in_nodes_to_select_for_this_call + +(**************************************************************************) + +let direct_dpds = Sets.direct_dpds +let direct_ctrl_dpds = Sets.direct_ctrl_dpds +let direct_data_dpds = Sets.direct_data_dpds +let direct_addr_dpds = Sets.direct_addr_dpds + +let all_dpds = Sets.find_nodes_all_dpds +let all_ctrl_dpds = Sets.find_nodes_all_ctrl_dpds +let all_data_dpds = Sets.find_nodes_all_data_dpds +let all_addr_dpds = Sets.find_nodes_all_addr_dpds + +let direct_uses = Sets.direct_uses +let direct_ctrl_uses = Sets.direct_ctrl_uses +let direct_data_uses = Sets.direct_data_uses +let direct_addr_uses = Sets.direct_addr_uses + +let all_uses = Sets.all_uses + +let custom_related_nodes = Sets.custom_related_nodes + +let iter_nodes = PdgTypes.Pdg.iter_nodes + +(**************************************************************************) + + +let extract = Pdg_tbl.print_dot + +let pretty_node = Pdg_tbl.pretty_node +let pretty_key = Pdg_tbl.pretty_key +let pretty = Pdg_tbl.pretty + +(**************************************************************************) + +module Marks = Marks + +(**************************************************************************) diff --git a/src/plugins/pdg/api.mli b/src/plugins/pdg/api.mli new file mode 100644 index 0000000000000000000000000000000000000000..6094779cec4e5920a5575b27b90613eae0deaf66 --- /dev/null +++ b/src/plugins/pdg/api.mli @@ -0,0 +1,352 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Pdg_types + +type t = PdgTypes.Pdg.t +(** Program Dependence Graph type *) + +type t_nodes_and_undef = + ((PdgTypes.Node.t * Locations.Zone.t option) list * Locations.Zone.t option) +(** type for the return value of many [find_xxx] functions when the + answer can be a list of [(node, z_part)] and an [undef zone]. + For each node, [z_part] can specify which part of the node + is used in terms of zone ([None] means all). *) + +(**************************************************************************) + +exception Bottom +(** Raised by most function when the PDG is Bottom because we can hardly do + nothing with it. It happens when the function is unreachable because we + have no information about it. *) + +exception Top +(** Raised by most function when the PDG is Top because we can hardly do + nothing with it. It happens when we didn't manage to compute it, for + instance for a variadic function. *) + +(**************************************************************************) + +val self : State.t +(** PDG depedency state *) + +(**************************************************************************) + +(** {3 Getters} *) + +val get : Cil_types.kernel_function -> t +(** Get the PDG of a function. Build it if it doesn't exist yet. *) + +val node_key : PdgTypes.Node.t -> PdgIndex.Key.t + +val from_same_fun : t -> t -> bool + +(**************************************************************************) + +(** {Finding PDG nodes} *) + +val find_decl_var_node : t -> Cil_types.varinfo -> PdgTypes.Node.t +(** Get the node corresponding the declaration of a local variable or a + formal parameter. + @raise Not_found if the variable is not declared in this function. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_ret_output_node : t -> PdgTypes.Node.t +(** Get the node corresponding return stmt. + @raise Not_found if the output state in unreachable + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_output_nodes : t -> PdgIndex.Signature.out_key -> t_nodes_and_undef +(** Get the nodes corresponding to a call output key in the called pdg. + @raise Not_found if the output state in unreachable + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_input_node : t -> int -> PdgTypes.Node.t +(** Get the node corresponding to a given input (parameter). + @raise Not_found if the number is not an input number. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_all_inputs_nodes : t -> PdgTypes.Node.t list +(** Get the nodes corresponding to all inputs. + {!node_key} can be used to know their numbers. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_stmt_node : t -> Cil_types.stmt -> PdgTypes.Node.t +(** Get the node corresponding to the statement. + It shouldn't be a call statement. + See also {!find_simple_stmt_nodes} or {!find_call_stmts}. + @raise Not_found if the given statement is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. + @raise PdgIndex.CallStatement if the given stmt is a function + call. *) + + +val find_simple_stmt_nodes : t -> Cil_types.stmt -> PdgTypes.Node.t list +(** Get the nodes corresponding to the statement. + It is usually composed of only one node (see {!find_stmt_node}), + except for call statement. + Be careful that for block statements, it only returns a node + corresponding to the elementary stmt + (see {!find_stmt_and_blocks_nodes} for more) + @raise Not_found if the given statement is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_label_node : t -> Cil_types.stmt -> Cil_types.label -> PdgTypes.Node.t +(** Get the node corresponding to the label. + @raise Not_found if the given label is not in the PDG. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_stmt_and_blocks_nodes : t -> Cil_types.stmt -> PdgTypes.Node.t list +(** Get the nodes corresponding to the statement like + {!find_simple_stmt_nodes} but also add the nodes of the enclosed + statements if [stmt] contains blocks. + @raise Not_found if the given statement is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_top_input_node : t -> PdgTypes.Node.t +(** @raise Not_found if there is no top input in the PDG. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_entry_point_node : t -> PdgTypes.Node.t +(** Find the node that represent the entry point of the function, i.e. the + higher level block. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_location_nodes_at_stmt : t -> Cil_types.stmt -> before:bool -> + Locations.Zone.t -> t_nodes_and_undef +(** Find the nodes that define the value of the location at the given + program point. Also return a zone that might be undefined at that point. + @raise Not_found if the given statement is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_location_nodes_at_end : t -> Locations.Zone.t -> t_nodes_and_undef +(** Same than {!find_location_nodes_at_stmt} for the program point located + at the end of the function. + @raise Not_found if the output state is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_location_nodes_at_begin : t -> Locations.Zone.t -> t_nodes_and_undef +(** Same than {!find_location_nodes_at_stmt} for the program point located + at the beginning of the function. + Notice that it can only find formal argument nodes. + The remaining zone (implicit input) is returned as undef. + @raise Not_found if the output state is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_call_stmts : Cil_types.kernel_function -> + caller:Cil_types.kernel_function -> Cil_types.stmt list +(** Find the call statements to the function (can maybe be somewhere + else). + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_call_ctrl_node : t -> Cil_types.stmt -> PdgTypes.Node.t +(** @raise Not_found if the call is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_call_input_node : t -> Cil_types.stmt -> int -> PdgTypes.Node.t +(** @raise Not_found if the call is unreachable or has no such input. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_call_output_node : t -> Cil_types.stmt -> PdgTypes.Node.t +(** @raise Not_found if the call is unreachable or has no output node. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_code_annot_nodes : t -> Cil_types.stmt -> + Cil_types.code_annotation -> + PdgTypes.Node.t list * PdgTypes.Node.t list * (t_nodes_and_undef option) +(** The result is composed of three parts : + - the first part of the result are the control dependencies nodes + of the annotation, + - the second part is the list of declaration nodes of the variables + used in the annotation; + - the third part is similar to [find_location_nodes_at_stmt] result + but for all the locations needed by the annotation. + When the third part is globally [None], + it means that we were not able to compute this information. + @raise Not_found if the statement is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val find_fun_precond_nodes : t -> Cil_types.predicate -> + PdgTypes.Node.t list * (t_nodes_and_undef option) +(** Similar to [find_code_annot_nodes] (no control dependencies nodes) *) + +val find_fun_postcond_nodes : t -> Cil_types.predicate -> + PdgTypes.Node.t list * (t_nodes_and_undef option) +(** Similar to [find_fun_precond_nodes] *) + +val find_fun_variant_nodes : t -> Cil_types.term -> + PdgTypes.Node.t list * (t_nodes_and_undef option) +(** Similar to [find_fun_precond_nodes] *) + +(**************************************************************************) + +(** {3 Propagation} + See also [Pdg.mli] for more function that cannot be here because + they use polymorphic types. **) + +val find_call_out_nodes_to_select : + t -> PdgTypes.NodeSet.t -> t -> Cil_types.stmt -> PdgTypes.Node.t list +(** [find_call_out_nodes_to_select pdg_called called_selected_nodes + pdg_caller call_stmt] + @return the call outputs nodes [out] such that + [find_output_nodes pdg_called out_key] + intersects [called_selected_nodes]. *) + +val find_in_nodes_to_select_for_this_call : + t -> PdgTypes.NodeSet.t -> Cil_types.stmt -> t -> PdgTypes.Node.t list +(** [find_in_nodes_to_select_for_this_call + pdg_caller caller_selected_nodes call_stmt pdg_called] + @return the called input nodes such that the corresponding nodes + in the caller intersect [caller_selected_nodes] + @raise Not_found if the statement is unreachable. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +(**************************************************************************) + +(** {3 Dependencies} *) + +val direct_dpds : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** Get the nodes to which the given node directly depend on. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val direct_ctrl_dpds : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** Similar to {!direct_dpds}, but for control dependencies only. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val direct_data_dpds : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** Similar to {!direct_dpds}, but for data dependencies only. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val direct_addr_dpds : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** Similar to {!direct_dpds}, but for address dependencies only. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val all_dpds : t -> PdgTypes.Node.t list -> PdgTypes.Node.t list +(** Transitive closure of {!direct_dpds} for all the given nodes. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val all_data_dpds : t -> PdgTypes.Node.t list -> PdgTypes.Node.t list +(** Gives the data dependencies of the given nodes, and recursively, all + the dependencies of those nodes (regardless to their kind). + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val all_ctrl_dpds : t -> PdgTypes.Node.t list -> PdgTypes.Node.t list +(** Similar to {!all_data_dpds} for control dependencies. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val all_addr_dpds : t -> PdgTypes.Node.t list -> PdgTypes.Node.t list +(** Similar to {!all_data_dpds} for address dependencies. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val direct_uses : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** build a list of all the nodes that have direct dependencies on the + given node. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val direct_ctrl_uses : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** Similar to {!direct_uses}, but for control dependencies only. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val direct_data_uses : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** Similar to {!direct_uses}, but for data dependencies only. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val direct_addr_uses : t -> PdgTypes.Node.t -> PdgTypes.Node.t list +(** Similar to {!direct_uses}, but for address dependencies only. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val all_uses : t -> PdgTypes.Node.t list -> PdgTypes.Node.t list +(** build a list of all the nodes that have dependencies (even indirect) on + the given nodes. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val custom_related_nodes : (PdgTypes.Node.t -> PdgTypes.Node.t list) -> + PdgTypes.Node.t list -> PdgTypes.Node.t list +(** [custom_related_nodes get_dpds node_list] build a list, starting from + the node in [node_list], and recursively add the nodes given by the + function [get_dpds]. For this function to work well, it is important + that [get_dpds n] returns a subset of the nodes directly related to + [n], ie a subset of [direct_uses] U [direct_dpds]. + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +val iter_nodes : (PdgTypes.Node.t -> unit) -> t -> unit +(** apply a given function to all the PDG nodes + @raise Bottom if given PDG is bottom. + @raise Top if the given pdg is top. *) + +(**************************************************************************) + +(** {3 Printers} *) + +val extract : t -> string -> unit +(** Pretty print pdg into a dot file. *) + +val pretty_node : bool -> Format.formatter -> PdgTypes.Node.t -> unit +(** Pretty print information on a node : with [short=true], only the id + of the node is printed.. *) + +val pretty_key : Format.formatter -> PdgIndex.Key.t -> unit +(** Pretty print information on a node key *) + +val pretty : ?bw:bool -> Format.formatter -> t -> unit +(** For debugging... Pretty print pdg information. + Print codependencies rather than dependencies if [bw=true]. *) + +(**************************************************************************) + +module Marks : module type of Marks + +(**************************************************************************) diff --git a/src/plugins/pdg/build.ml b/src/plugins/pdg/build.ml index 256f3d9f9980db347853fa0fcef8ed3ab51deb27..34dfb781a9acc918cf7bbffb2cd0f28718053bbd 100644 --- a/src/plugins/pdg/build.ml +++ b/src/plugins/pdg/build.ml @@ -31,6 +31,8 @@ {!module: Build.Computer} below). *) +open Pdg_types + let dkey = Pdg_parameters.register_category "build" let debug fmt = Pdg_parameters.debug ~dkey fmt let debug2 fmt = Pdg_parameters.debug ~dkey fmt ~level:2 diff --git a/src/plugins/pdg/build.mli b/src/plugins/pdg/build.mli index 583fdbc47301200ea659df06ad1ba628c46044f9..6e134517409b423d3a2dab2e50cfa49f4f2a20a1 100644 --- a/src/plugins/pdg/build.mli +++ b/src/plugins/pdg/build.mli @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open Pdg_types + val compute_pdg : Cil_types.kernel_function -> PdgTypes.Pdg.t (* diff --git a/src/plugins/pdg/dune b/src/plugins/pdg/dune new file mode 100644 index 0000000000000000000000000000000000000000..8e02c55d171fe9f97229f4b502f4820a1885bc63 --- /dev/null +++ b/src/plugins/pdg/dune @@ -0,0 +1,44 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "PDG:" %{lib-available:frama-c-pdg.core} "\n") + (echo " - Pdg-Types:" %{lib-available:frama-c-pdg.types.core} "\n") + (echo " - Callgraph:" %{lib-available:frama-c-callgraph.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - From:" %{lib-available:frama-c-from.core} "\n") + ) + ) +) + +( library + (name pdg) + (optional) + (public_name frama-c-pdg.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-pdg.types.core frama-c-callgraph.core frama-c-from.core frama-c-eva.core) +) + +(plugin (optional) (name pdg) (libraries frama-c-pdg.core) (site (frama-c plugins))) diff --git a/src/plugins/pdg/dune-project b/src/plugins/pdg/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..12ff9bf17de9a6ee74274b32b49f5fc6f4a1b7d2 --- /dev/null +++ b/src/plugins/pdg/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-pdg) +(using dune_site 0.1) diff --git a/src/plugins/pdg/frama-c-pdg.opam b/src/plugins/pdg/frama-c-pdg.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/pdg/marks.ml b/src/plugins/pdg/marks.ml index 272b5b1ad9fe0928b90ed766e1c06a0345f5afcc..6330ce5fb40bb8dfbe87e315f1ed4c2639b905d1 100644 --- a/src/plugins/pdg/marks.ml +++ b/src/plugins/pdg/marks.ml @@ -20,9 +20,11 @@ (* *) (**************************************************************************) -open PdgIndex open Cil_datatype +open Pdg_types +open PdgIndex + (** compute the marks to propagate in the caller nodes from the marks of * a function inputs [in_marks]. *) @@ -36,12 +38,12 @@ let in_marks_to_caller pdg call m2m ?(rqs=[]) in_marks = let build rqs (in_key, m) = match in_key with | Signature.InCtrl -> - add_n_m rqs (!Db.Pdg.find_call_ctrl_node pdg call) None m + add_n_m rqs (Sets.find_call_ctrl_node pdg call) None m | Signature.InNum in_num -> - add_n_m rqs (!Db.Pdg.find_call_input_node pdg call in_num) None m + add_n_m rqs (Sets.find_call_num_input_node pdg call in_num) None m | Signature.InImpl zone -> let nodes, undef = - !Db.Pdg.find_location_nodes_at_stmt pdg call ~before:true zone + Sets.find_location_nodes_at_stmt pdg call ~before:true zone in let rqs = List.fold_left (fun acc (n,z) -> add_n_m acc n z m) rqs nodes in @@ -64,10 +66,10 @@ let translate_in_marks pdg_called in_new_marks in_marks_to_caller pdg call (m2m (Some call) pdg) ~rqs in_new_marks in let build rqs caller = - let pdg_caller = !Db.Pdg.get caller in + let pdg_caller = Pdg_tbl.get caller in let caller_rqs = try - let call_stmts = !Db.Pdg.find_call_stmts ~caller kf_called in + let call_stmts = Sets.find_call_stmts ~caller kf_called in (* TODO : more intelligent merge ? *) let rqs = List.fold_left (translate pdg_caller) [] call_stmts in PdgMarks.SelList rqs @@ -98,7 +100,7 @@ let call_out_marks_to_called called_pdg m2m ?(rqs=[]) out_marks = let translate_out_mark _pdg m2m other_rqs (call, l) = let add_list l_out_m rqs called_kf = - let called_pdg = !Db.Pdg.get called_kf in + let called_pdg = Pdg_tbl.get called_kf in let m2m = m2m (Some call) called_pdg in try let node_marks = @@ -165,7 +167,7 @@ module F_Proj (C : PdgMarks.Config) : let fct_var = Kernel_function.get_vi kf in try Varinfo.Hashtbl.find proj fct_var with Not_found -> - let pdg = !Db.Pdg.get kf in + let pdg = Pdg_tbl.get kf in let info = F.create pdg in Varinfo.Hashtbl.add proj fct_var info; info diff --git a/src/plugins/pdg/marks.mli b/src/plugins/pdg/marks.mli index 55a303293f931a46d482ff89bc32e84d1ad9666d..846aeae6adace9a638d1fbda719eff249dec6731 100644 --- a/src/plugins/pdg/marks.mli +++ b/src/plugins/pdg/marks.mli @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open Pdg_types + open PdgMarks (** [in_marks_to_caller] translate the input information part returned by diff --git a/src/plugins/pdg/pdg_state.ml b/src/plugins/pdg/pdg_state.ml index 276f231efbe10bc51e0dd8891540a12b56feb943..b5c081a3438d810f876fa6b30fe4f949be98804e 100644 --- a/src/plugins/pdg/pdg_state.ml +++ b/src/plugins/pdg/pdg_state.ml @@ -29,6 +29,8 @@ let dkey = Pdg_parameters.register_category "state" module P = Pdg_parameters + +open Pdg_types open PdgTypes exception Cannot_fold diff --git a/src/plugins/pdg/pdg_state.mli b/src/plugins/pdg/pdg_state.mli index a108bd99666eca31c374ce242e6a9c50e1a7134b..72f8297b41a2e8f42130aca2aed6dbe160cb99ce 100644 --- a/src/plugins/pdg/pdg_state.mli +++ b/src/plugins/pdg/pdg_state.mli @@ -22,6 +22,8 @@ exception Cannot_fold +open Pdg_types + open PdgTypes (** Types data_state and Node.t come froms this module *) diff --git a/src/plugins/pdg/pdg_tbl.ml b/src/plugins/pdg/pdg_tbl.ml new file mode 100644 index 0000000000000000000000000000000000000000..5603732213786a2cc7020bd13272323edd35081c --- /dev/null +++ b/src/plugins/pdg/pdg_tbl.ml @@ -0,0 +1,61 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Pdg_types + +type t = PdgTypes.Pdg.t + +(**************************************************************************) + +let compute = Build.compute_pdg + +module Tbl = + Kernel_function.Make_Table + (PdgTypes.Pdg) + (struct + let name = "Pdg.State" + let dependencies = [] (* postponed because !Db.From.self may + not exist yet *) + let size = 17 + end) + +let self = Tbl.self +let get = Tbl.memo compute + +(**************************************************************************) + +let pretty ?(bw=false) fmt pdg = + let kf = PdgTypes.Pdg.get_kf pdg in + Format.fprintf fmt "@[RESULT for %s:@]@\n@[ %a@]" + (Kernel_function.get_name kf) (PdgTypes.Pdg.pretty_bw ~bw) pdg + +let pretty_node short = + if short then PdgTypes.Node.pretty + else PdgTypes.Node.pretty_node + +let print_dot pdg filename = + PdgTypes.Pdg.build_dot filename pdg; + Pdg_parameters.feedback "dot file generated in %s" filename + +let pretty_key = PdgIndex.Key.pretty + +(**************************************************************************) diff --git a/src/plugins/pdg/pdg_tbl.mli b/src/plugins/pdg/pdg_tbl.mli new file mode 100644 index 0000000000000000000000000000000000000000..541731a591138e8f100578e57827682b488da976 --- /dev/null +++ b/src/plugins/pdg/pdg_tbl.mli @@ -0,0 +1,46 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Pdg_types + +type t = PdgTypes.Pdg.t + +val self : State.t + +val get : Cil_types.kernel_function -> t +(** Get the PDG of a function. Build it if it doesn't exist yet. *) + +(** {3 Pretty printing} *) + +val pretty_node : bool -> Format.formatter -> PdgTypes.Node.t -> unit +(** Pretty print information on a node : with [short=true], only the id + of the node is printed.. *) + +val pretty_key : Format.formatter -> PdgIndex.Key.t -> unit +(** Pretty print information on a node key *) + +val pretty : ?bw:bool -> Format.formatter -> t -> unit +(** For debugging... Pretty print pdg information. + Print codependencies rather than dependencies if [bw=true]. *) + +val print_dot : t -> string -> unit +(** Pretty print pdg into a dot file. *) diff --git a/src/plugins/pdg/pdg_types/Pdg_types.ml b/src/plugins/pdg/pdg_types/Pdg_types.ml new file mode 100644 index 0000000000000000000000000000000000000000..a27209b47941a8551ffbe793be5f98d714307ea5 --- /dev/null +++ b/src/plugins/pdg/pdg_types/Pdg_types.ml @@ -0,0 +1,25 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module PdgIndex = PdgIndex +module PdgMarks = PdgMarks +module PdgTypes = PdgTypes diff --git a/src/plugins/pdg/pdg_types/Pdg_types.mli b/src/plugins/pdg/pdg_types/Pdg_types.mli new file mode 100644 index 0000000000000000000000000000000000000000..edc3a0fd49034f42631a26719c9338ac75e292ce --- /dev/null +++ b/src/plugins/pdg/pdg_types/Pdg_types.mli @@ -0,0 +1,27 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module PdgIndex: module type of PdgIndex +module PdgMarks: module type of PdgMarks +module PdgTypes: module type of PdgTypes + +(**************************************************************************) diff --git a/src/plugins/pdg/pdg_types/dune b/src/plugins/pdg/pdg_types/dune new file mode 100644 index 0000000000000000000000000000000000000000..722fae390011c23904d8646cfcfbd7e30f6c06e4 --- /dev/null +++ b/src/plugins/pdg/pdg_types/dune @@ -0,0 +1,40 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Pdg-Types:" %{lib-available:frama-c-pdg.types.core} "\n") + ) + ) +) + +( library + (name Pdg_types) + (optional) + (public_name frama-c-pdg.types.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel) +) + +(plugin (optional) (name pdg-types) (libraries frama-c-pdg.types.core) (site (frama-c plugins))) diff --git a/src/plugins/pdg/pdg_types/frama-c-pdg-types.opam b/src/plugins/pdg/pdg_types/frama-c-pdg-types.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/pdg_types/pdgIndex.ml b/src/plugins/pdg/pdg_types/pdgIndex.ml similarity index 100% rename from src/plugins/pdg_types/pdgIndex.ml rename to src/plugins/pdg/pdg_types/pdgIndex.ml diff --git a/src/plugins/pdg_types/pdgIndex.mli b/src/plugins/pdg/pdg_types/pdgIndex.mli similarity index 100% rename from src/plugins/pdg_types/pdgIndex.mli rename to src/plugins/pdg/pdg_types/pdgIndex.mli diff --git a/src/plugins/pdg_types/pdgMarks.ml b/src/plugins/pdg/pdg_types/pdgMarks.ml similarity index 100% rename from src/plugins/pdg_types/pdgMarks.ml rename to src/plugins/pdg/pdg_types/pdgMarks.ml diff --git a/src/plugins/pdg_types/pdgMarks.mli b/src/plugins/pdg/pdg_types/pdgMarks.mli similarity index 100% rename from src/plugins/pdg_types/pdgMarks.mli rename to src/plugins/pdg/pdg_types/pdgMarks.mli diff --git a/src/plugins/pdg_types/pdgTypes.ml b/src/plugins/pdg/pdg_types/pdgTypes.ml similarity index 100% rename from src/plugins/pdg_types/pdgTypes.ml rename to src/plugins/pdg/pdg_types/pdgTypes.ml diff --git a/src/plugins/pdg_types/pdgTypes.mli b/src/plugins/pdg/pdg_types/pdgTypes.mli similarity index 100% rename from src/plugins/pdg_types/pdgTypes.mli rename to src/plugins/pdg/pdg_types/pdgTypes.mli diff --git a/src/plugins/pdg/register.ml b/src/plugins/pdg/register.ml index 4f707e7ffeb43572c405893f74411acb98b2b560..8217fb8ccc0794e95ec2b72c7178730c50fa990c 100644 --- a/src/plugins/pdg/register.ml +++ b/src/plugins/pdg/register.ml @@ -20,104 +20,18 @@ (* *) (**************************************************************************) -let compute = Build.compute_pdg -let pretty ?(bw=false) fmt pdg = - let kf = PdgTypes.Pdg.get_kf pdg in - Format.fprintf fmt "@[RESULT for %s:@]@\n@[ %a@]" - (Kernel_function.get_name kf) (PdgTypes.Pdg.pretty_bw ~bw) pdg +open Pdg_types -let pretty_node short = - if short then PdgTypes.Node.pretty - else PdgTypes.Node.pretty_node - -let print_dot pdg filename = - PdgTypes.Pdg.build_dot filename pdg; - Pdg_parameters.feedback "dot file generated in %s" filename - -module Tbl = - Kernel_function.Make_Table - (PdgTypes.Pdg) - (struct - let name = "Pdg.State" - let dependencies = [] (* postponed because !Db.From.self may - not exist yet *) - let size = 17 - end) let () = Cmdline.run_after_extended_stage (fun () -> State_dependency_graph.add_codependencies - ~onto:Tbl.self + ~onto:Pdg_tbl.self [ !Db.From.self ]) -(** Register external functions into Db. *) -let () = - Db.Pdg.self := Tbl.self; - Db.Pdg.get := Tbl.memo compute; - Db.Pdg.node_key := PdgTypes.Node.elem_key; - - Db.Pdg.find_decl_var_node := Sets.find_decl_var_node; - Db.Pdg.find_entry_point_node := Sets.find_entry_point_node; - Db.Pdg.find_top_input_node := Sets.find_top_input_node; - Db.Pdg.find_simple_stmt_nodes := Sets.find_simple_stmt_nodes; - Db.Pdg.find_stmt_and_blocks_nodes := Sets.find_stmt_and_blocks_nodes; - Db.Pdg.find_stmt_node := Sets.find_stmt_node; - Db.Pdg.find_label_node := Sets.find_label_node; - Db.Pdg.find_location_nodes_at_stmt := Sets.find_location_nodes_at_stmt; - Db.Pdg.find_location_nodes_at_begin := Sets.find_location_nodes_at_begin; - Db.Pdg.find_location_nodes_at_end := Sets.find_location_nodes_at_end; - Db.Pdg.find_call_ctrl_node := Sets.find_call_ctrl_node; - Db.Pdg.find_call_input_node := Sets.find_call_num_input_node; - Db.Pdg.find_call_output_node := Sets.find_call_output_node; - Db.Pdg.find_input_node := Sets.find_input_node; - Db.Pdg.find_ret_output_node := Sets.find_output_node; - Db.Pdg.find_output_nodes := Sets.find_output_nodes; - Db.Pdg.find_all_inputs_nodes := Sets.find_all_input_nodes; - - Db.Pdg.find_call_stmts := Sets.find_call_stmts; - - Db.Pdg.find_code_annot_nodes := Annot.find_code_annot_nodes; - Db.Pdg.find_fun_precond_nodes := Annot.find_fun_precond_nodes; - Db.Pdg.find_fun_postcond_nodes := Annot.find_fun_postcond_nodes; - - Db.Pdg.find_call_out_nodes_to_select := Sets.find_call_out_nodes_to_select; - Db.Pdg.find_in_nodes_to_select_for_this_call := - Sets.find_in_nodes_to_select_for_this_call; - - Db.Pdg.direct_dpds := Sets.direct_dpds; - Db.Pdg.direct_ctrl_dpds := Sets.direct_ctrl_dpds; - Db.Pdg.direct_data_dpds := Sets.direct_data_dpds; - Db.Pdg.direct_addr_dpds := Sets.direct_addr_dpds; - - Db.Pdg.all_dpds := Sets.find_nodes_all_dpds; - Db.Pdg.all_ctrl_dpds := Sets.find_nodes_all_ctrl_dpds; - Db.Pdg.all_data_dpds := Sets.find_nodes_all_data_dpds; - Db.Pdg.all_addr_dpds := Sets.find_nodes_all_addr_dpds; - - Db.Pdg.direct_uses := Sets.direct_uses; - Db.Pdg.direct_ctrl_uses := Sets.direct_ctrl_uses; - Db.Pdg.direct_data_uses := Sets.direct_data_uses; - Db.Pdg.direct_addr_uses := Sets.direct_addr_uses; - - Db.Pdg.all_uses := Sets.all_uses; - - Db.Pdg.custom_related_nodes := Sets.custom_related_nodes; - - Db.Pdg.iter_nodes := PdgTypes.Pdg.iter_nodes; - - Db.Pdg.pretty := pretty ; - Db.Pdg.pretty_node := pretty_node ; - Db.Pdg.pretty_key := PdgIndex.Key.pretty; - Db.Pdg.extract := print_dot - -(* This module contains polymorphic functions : cannot be registered in Db. - Can be used through Pdg.Register instead (see Pdg.mli) *) -include Marks - - let deps = - [!Db.Pdg.self; Pdg_parameters.BuildAll.self; Pdg_parameters.BuildFct.self] + [Pdg_tbl.self; Pdg_parameters.BuildAll.self; Pdg_parameters.BuildFct.self] let () = Pdg_parameters.BuildAll.set_output_dependencies deps @@ -130,11 +44,11 @@ let compute () = Eva.Analysis.compute (); let do_kf_pdg kf = if compute_for_kf kf then - let pdg = !Db.Pdg.get kf in + let pdg = Pdg_tbl.get kf in let dot_basename = Pdg_parameters.DotBasename.get () in if dot_basename <> "" then let fname = Kernel_function.get_name kf in - !Db.Pdg.extract pdg (dot_basename ^ "." ^ fname ^ ".dot") + Pdg_tbl.print_dot pdg (dot_basename ^ "." ^ fname ^ ".dot") in Callgraph.Uses.iter_in_rev_order do_kf_pdg; let pp_sep fmt () = Format.pp_print_string fmt "," in @@ -151,7 +65,7 @@ let output () = let bw = Pdg_parameters.PrintBw.get () in let do_kf_pdg kf = if compute_for_kf kf then - let pdg = !Db.Pdg.get kf in + let pdg = Pdg_tbl.get kf in let header fmt = Format.fprintf fmt "PDG for %a" Kernel_function.pretty kf in diff --git a/src/plugins/pdg/register.mli b/src/plugins/pdg/register.mli index a99bfbabb26f9923ead07b600345bf705b0b6757..a7f49285d2960e715b6059dcd0fbfc316c2c6360 100644 --- a/src/plugins/pdg/register.mli +++ b/src/plugins/pdg/register.mli @@ -20,4 +20,4 @@ (* *) (**************************************************************************) -include module type of Marks +(* empty *) diff --git a/src/plugins/pdg/sets.ml b/src/plugins/pdg/sets.ml index 275477477b083ab80dca3d0e8df4ae8a95a30e96..846b30c2540db37082090965d0a76a07d422b553 100644 --- a/src/plugins/pdg/sets.ml +++ b/src/plugins/pdg/sets.ml @@ -23,6 +23,8 @@ (** Provides function to extract information from the PDG. *) open Cil_types + +open Pdg_types open PdgIndex type nodes_and_undef = diff --git a/src/plugins/pdg/sets.mli b/src/plugins/pdg/sets.mli index a416d993e6975611bf9612afb1c25d71a28ee41d..27c12193321a174aad89fcd0e57f19643b355c6d 100644 --- a/src/plugins/pdg/sets.mli +++ b/src/plugins/pdg/sets.mli @@ -23,6 +23,7 @@ (** PDG (program dependence graph) access functions. *) open Cil_types +open Pdg_types type nodes_and_undef = (PdgTypes.Node.t * Locations.Zone.t option) list * Locations.Zone.t option diff --git a/src/plugins/postdominators/dune b/src/plugins/postdominators/dune new file mode 100644 index 0000000000000000000000000000000000000000..da173221feddee9605ea27c2754b1cc1f1329343 --- /dev/null +++ b/src/plugins/postdominators/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Postdominators:" %{lib-available:frama-c-postdominators.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name postdominators) + (optional) + (public_name frama-c-postdominators.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core) +) + +(plugin (optional) (name postdominators) (libraries frama-c-postdominators.core) (site (frama-c plugins))) diff --git a/src/plugins/postdominators/dune-project b/src/plugins/postdominators/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..db21480e1f5cffa508aabcf63e6c2c28be05ba01 --- /dev/null +++ b/src/plugins/postdominators/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-postdominators) +(using dune_site 0.1) diff --git a/src/plugins/postdominators/frama-c-postdominators.opam b/src/plugins/postdominators/frama-c-postdominators.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/postdominators/print.ml b/src/plugins/postdominators/print.ml index 6ff5e94dd085ea9bafddbe2bd0a0f78f66928221..56e3d81e8ee858dcef7e14a2888dd4a7a516cf80 100644 --- a/src/plugins/postdominators/print.ml +++ b/src/plugins/postdominators/print.ml @@ -23,8 +23,7 @@ open Cil_types open Cil_datatype -let pretty_stmt fmt s = - let key = PdgIndex.Key.stmt_key s in !Db.Pdg.pretty_key fmt key +let pretty_stmt fmt s = Cil_printer.pp_stmt fmt s module Printer = struct diff --git a/src/plugins/print_api/Print_api.mli b/src/plugins/print_api/Print_api.ml similarity index 100% rename from src/plugins/print_api/Print_api.mli rename to src/plugins/print_api/Print_api.ml diff --git a/src/plugins/print_api/dune b/src/plugins/print_api/dune new file mode 100644 index 0000000000000000000000000000000000000000..04a23dd1088e089950e21b340f68b784bb8913e8 --- /dev/null +++ b/src/plugins/print_api/dune @@ -0,0 +1,30 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; ( library +; (name print_api) +; (public_name frama-c-print_api.core) +; (flags -open Frama_c_kernel) +; (libraries frama-c.kernel frama-c-callgraph.core frama-c-eva.core frama-c-postdominators.core) +; ) + +; (plugin (optional) (name print_api) (libraries frama-c-print_api.core) (site (frama-c plugins))) diff --git a/src/plugins/print_api/dune-project b/src/plugins/print_api/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..f4887f33a78bd82e30ce3ed1c67d36a0ad3584e6 --- /dev/null +++ b/src/plugins/print_api/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-print_api) +(using dune_site 0.1) diff --git a/src/plugins/print_api/frama-c-print_api.opam b/src/plugins/print_api/frama-c-print_api.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/qed/.gitignore b/src/plugins/qed/.gitignore index 549dd6d17c4e5f0fd31348346118b778e4faeda7..41e8d77bed9a54d1afbd1310294b3af5831cc199 100644 --- a/src/plugins/qed/.gitignore +++ b/src/plugins/qed/.gitignore @@ -1,2 +1 @@ /.depend -/Qed.mli diff --git a/src/plugins/qed/dune b/src/plugins/qed/dune new file mode 100644 index 0000000000000000000000000000000000000000..1bf194811298679ce83f424e02a6317a17357fb9 --- /dev/null +++ b/src/plugins/qed/dune @@ -0,0 +1,39 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Qed:" %{lib-available:qed} "\n") + (echo " - Zarith:" %{lib-available:zarith} "\n") + ) + ) +) + +(library + (name qed) + (optional) + (public_name qed) + (flags (-open Frama_c_kernel :standard -w -9)) + (libraries frama-c.kernel zarith) +) diff --git a/src/plugins/qed/dune-project b/src/plugins/qed/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..cc71f1946f8869a92c1a460d797f88b6d4e0c4e1 --- /dev/null +++ b/src/plugins/qed/dune-project @@ -0,0 +1,24 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name qed) diff --git a/src/plugins/qed/engine.mli b/src/plugins/qed/engine.ml similarity index 100% rename from src/plugins/qed/engine.mli rename to src/plugins/qed/engine.ml diff --git a/src/plugins/qed/logic.mli b/src/plugins/qed/logic.ml similarity index 100% rename from src/plugins/qed/logic.mli rename to src/plugins/qed/logic.ml diff --git a/src/plugins/qed/qed.opam b/src/plugins/qed/qed.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/qed/term.mli b/src/plugins/qed/term.mli index afec11e96dc53957536c283cae535be482b640ce..bf5c8585fb35af82000f1eb3960061f4a3718de3 100644 --- a/src/plugins/qed/term.mli +++ b/src/plugins/qed/term.mli @@ -39,8 +39,9 @@ module Make (** {2 Global State} One given [term] has valid meaning only for one particular state. *) - (** Hash-consing, cache, rewriting rules, etc. *) type state + (** Hash-consing, cache, rewriting rules, etc. *) + val create : unit -> state (** Create a new fresh state. Local state is not modified. *) diff --git a/src/plugins/reduc/Reduc.mli b/src/plugins/reduc/Reduc.ml similarity index 100% rename from src/plugins/reduc/Reduc.mli rename to src/plugins/reduc/Reduc.ml diff --git a/src/plugins/reduc/dune b/src/plugins/reduc/dune new file mode 100644 index 0000000000000000000000000000000000000000..4ce47bef495dbbd55efe820108e5593d0e00c9f7 --- /dev/null +++ b/src/plugins/reduc/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Reduc:" %{lib-available:frama-c-reduc.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - Inout:" %{lib-available:frama-c-inout.core} "\n") + ) + ) +) + +(library + (name reduc) + (optional) + (public_name frama-c-reduc.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-inout.core frama-c-eva.core) +) + +(plugin (optional) (name reduc) (libraries frama-c-reduc.core) (site (frama-c plugins))) diff --git a/src/plugins/reduc/dune-project b/src/plugins/reduc/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..e9d7fc8b47138992aaad83218578bd65c7dc223c --- /dev/null +++ b/src/plugins/reduc/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-reduc) +(using dune_site 0.1) diff --git a/src/plugins/reduc/frama-c-reduc.opam b/src/plugins/reduc/frama-c-reduc.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/report/.gitignore b/src/plugins/report/.gitignore index 0114e3d0f08985bcf97727dcde8f314ddb4410ae..3a98458e917cbf63ae42a311989dbe7be4a5d56c 100644 --- a/src/plugins/report/.gitignore +++ b/src/plugins/report/.gitignore @@ -1,4 +1,4 @@ /configure /Makefile -/tests/ptests_config /tests/*/result +/tests/**/dune diff --git a/src/plugins/report/Makefile.in b/src/plugins/report/Makefile.in deleted file mode 100644 index 079eeda0df829b83f5fc48d24ec177b08ab74a48..0000000000000000000000000000000000000000 --- a/src/plugins/report/Makefile.in +++ /dev/null @@ -1,69 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -################### -# Plug-in Setting # -################### - -PLUGIN_DIR ?=. -PLUGIN_ENABLE:=@ENABLE_REPORT@ -PLUGIN_NAME:=Report -PLUGIN_CMO:= report_parameters scan dump csv classify register -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -#PLUGIN_NO_DEFAULT_TEST:=no -PLUGIN_TESTS_DIRS:=report - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -ifeq ($(FRAMAC_INTERNAL),yes) -# To allow testing with WP -Report_DEFAULT_TESTS: create_share_link - -endif - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(Report_DIR)/Makefile: $(Report_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/report/Report.ml b/src/plugins/report/Report.ml new file mode 100644 index 0000000000000000000000000000000000000000..fa50e18c562cc92ef735b9f6fb1d4eda6e171f96 --- /dev/null +++ b/src/plugins/report/Report.ml @@ -0,0 +1,30 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + + +module Register = Register + +(* +Local Variables: +compile-command: "make -C ../../../.." +End: +*) diff --git a/src/plugins/report/classify.ml b/src/plugins/report/classify.ml index 8f5c62b139b2d78dec3e088ecc00eb9652c054b3..7b9f0a85cb20ea2e652c6e42e0dcfc7f1391fc61 100644 --- a/src/plugins/report/classify.ml +++ b/src/plugins/report/classify.ml @@ -546,7 +546,7 @@ let classify () = report_number "Unclassified: " !nb_unclassified R.OutputUnclassified.get ; if !nb_errors > 0 && R.Exit.get () then R.abort "Classified errors found" ; - if not !Fc_config.is_gui then clear_events () ; + if not Fc_config.is_gui then clear_events () ; end (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/report/dune b/src/plugins/report/dune new file mode 100644 index 0000000000000000000000000000000000000000..c8e0c97fcef6f9a30770bf541c6704dedda8c9ec --- /dev/null +++ b/src/plugins/report/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Report:" %{lib-available:frama-c-report.core} "\n") + ) + ) +) + +( library + (name report) + (optional) + (public_name frama-c-report.core) + (private_modules report_parameters scan dump csv register classify) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel) +) + +(plugin (optional) (name report) (libraries frama-c-report.core) (site (frama-c plugins))) diff --git a/src/plugins/report/dune-project b/src/plugins/report/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..e58864153062c3c28c43d89445771e5481e80f77 --- /dev/null +++ b/src/plugins/report/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-report) +(using dune_site 0.1) diff --git a/src/plugins/report/frama-c-report.opam b/src/plugins/report/frama-c-report.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/report/tests/ptests_config b/src/plugins/report/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..2af08cc747973c537e3aff87ee963b13852a0d95 --- /dev/null +++ b/src/plugins/report/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= report diff --git a/src/plugins/rte/RteGen.ml b/src/plugins/rte/RteGen.ml new file mode 100644 index 0000000000000000000000000000000000000000..938489dcdd015a6b646fc62f9cd9d9ccd19e7448 --- /dev/null +++ b/src/plugins/rte/RteGen.ml @@ -0,0 +1,30 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Flags for filtering Alarms *) +module Flags = Flags + +(** RTE Generator Status & Emitters *) +module Generator = Generator + +(** Visitors to iterate over Alarms and/or generate Code-Annotations *) +module Visit = Visit diff --git a/src/plugins/rte/dune b/src/plugins/rte/dune new file mode 100644 index 0000000000000000000000000000000000000000..cadaf87df3807fd54fc34235fdc696a5a4f801f3 --- /dev/null +++ b/src/plugins/rte/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Rtegen:" %{lib-available:frama-c-rtegen.core} "\n") + ) + ) +) + +(library + (name RteGen) + (optional) + (public_name frama-c-rtegen.core) + (private_modules options generator rte visit register) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel) +) + +(plugin (optional) (name rtegen) (libraries frama-c-rtegen.core) (site (frama-c plugins))) diff --git a/src/plugins/rte/dune-project b/src/plugins/rte/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..8faf68e3c1d0a623682081a1d83c1c1a85879abb --- /dev/null +++ b/src/plugins/rte/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-rte) +(using dune_site 0.1) diff --git a/src/plugins/rte/frama-c-rtegen.opam b/src/plugins/rte/frama-c-rtegen.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/scope/defs.ml b/src/plugins/scope/defs.ml index 2e7fbdbdf8694c5424314143013f4681865576b5..b7783e9f5e508440367136109324a5fb629805e9 100644 --- a/src/plugins/scope/defs.ml +++ b/src/plugins/scope/defs.ml @@ -27,6 +27,8 @@ open Cil_datatype open Cil_types +open Pdg_types + let debug1 fmt = Datascope.R.debug ~level:1 fmt module Interproc = @@ -60,19 +62,19 @@ let _pp_set prefix fmt = let rec add_callee_nodes z acc nodes = let new_nodes, acc = NSet.fold (fun node acc2 -> - match !Db.Pdg.node_key node with + match Pdg.Api.node_key node with | PdgIndex.Key.SigCallKey (cid, PdgIndex.Signature.Out out_key) -> let callees = Eva.Results.callee (PdgIndex.Key.call_from_id cid) in List.fold_left (fun (new_nodes, acc) kf -> - let callee_pdg = !Db.Pdg.get kf in + let callee_pdg = Pdg.Api.get kf in let outputs = match out_key with | PdgIndex.Signature.OutLoc out -> (* [out] might be an over-approximation of the location we are searching for. We refine the search if needed. *) let z = Locations.Zone.narrow out z in - fst (!Db.Pdg.find_location_nodes_at_end callee_pdg z) + fst (Pdg.Api.find_location_nodes_at_end callee_pdg z) | PdgIndex.Signature.OutRet -> (* probably never occurs *) - fst (!Db.Pdg.find_output_nodes callee_pdg out_key) + fst (Pdg.Api.find_output_nodes callee_pdg out_key) in let outputs = List.map fst outputs in add_list_to_set outputs new_nodes, add_list_to_set outputs acc) @@ -99,25 +101,25 @@ let rec add_caller_nodes z kf acc (undef, nodes) = | None -> acc_undef, acc | Some undef -> let nodes_for_undef, undef' = - !Db.Pdg.find_location_nodes_at_stmt pdg stmt ~before:true undef + Pdg.Api.find_location_nodes_at_stmt pdg stmt ~before:true undef in let acc_undef = join_undef acc_undef undef' in let acc = add_list_to_set (List.map fst nodes_for_undef) acc in acc_undef, acc in let add_call_input_nodes node (acc_undef, acc) = - match !Db.Pdg.node_key node with + match Pdg.Api.node_key node with | PdgIndex.Key.SigKey (PdgIndex.Signature.In in_key) -> begin match in_key with | PdgIndex.Signature.InCtrl -> (* We only look for the values *) acc_undef, acc | PdgIndex.Signature.InNum n_param -> - let n = !Db.Pdg.find_call_input_node pdg stmt n_param in + let n = Pdg.Api.find_call_input_node pdg stmt n_param in acc_undef, NSet.add n acc | PdgIndex.Signature.InImpl z' -> let z = Locations.Zone.narrow z z' in - let nodes, undef'= !Db.Pdg.find_location_nodes_at_stmt + let nodes, undef'= Pdg.Api.find_location_nodes_at_stmt pdg stmt ~before:true z in let acc_undef = join_undef acc_undef undef' in @@ -128,7 +130,7 @@ let rec add_caller_nodes z kf acc (undef, nodes) = NSet.fold add_call_input_nodes nodes (acc_undef, acc) in let add_one_caller_nodes acc (kf, stmts) = - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let acc_undef, caller_nodes = List.fold_left (add_one_call_nodes pdg) (None, NSet.empty) stmts in add_caller_nodes z kf (NSet.union caller_nodes acc) (acc_undef, caller_nodes) @@ -138,9 +140,9 @@ let compute_aux kf stmt zone = debug1 "[Defs.compute] for %a at sid:%d in '%a'@." Locations.Zone.pretty zone stmt.sid Kernel_function.pretty kf; try - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let nodes, undef = - !Db.Pdg.find_location_nodes_at_stmt pdg stmt ~before:true zone + Pdg.Api.find_location_nodes_at_stmt pdg stmt ~before:true zone in let nodes = add_list_to_set (List.map fst nodes) NSet.empty in let nodes = @@ -152,13 +154,13 @@ let compute_aux kf stmt zone = else nodes in Some (nodes, undef) - with Db.Pdg.Bottom | Db.Pdg.Top | Not_found -> + with Pdg.Api.Bottom | Pdg.Api.Top | Not_found -> None let compute kf stmt lval = let extract (nodes, undef) = let add_node node defs = - match PdgIndex.Key.stmt (!Db.Pdg.node_key node) with + match PdgIndex.Key.stmt (Pdg.Api.node_key node) with | None -> defs | Some s -> Stmt.Hptset.add s defs in @@ -185,7 +187,7 @@ let compute_with_def_type_zone kf stmt zone = let after = (direct || prev_d, indirect || pred_i) in Stmt.Map.add stmt after acc in - match !Db.Pdg.node_key node with + match Pdg.Api.node_key node with | PdgIndex.Key.Stmt s -> change s (true, false) | PdgIndex.Key.CallStmt _ -> assert false | PdgIndex.Key.SigCallKey (s, sign) -> diff --git a/src/plugins/scope/dune b/src/plugins/scope/dune new file mode 100644 index 0000000000000000000000000000000000000000..82e4e62e6002f60ee6ee6b9267438cf6dd4e304e --- /dev/null +++ b/src/plugins/scope/dune @@ -0,0 +1,43 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Scope:" %{lib-available:frama-c-scope.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - Inout:" %{lib-available:frama-c-inout.core} "\n") + (echo " - Pdg:" %{lib-available:frama-c-pdg.core} "\n") + ) + ) +) + +(library + (name scope) + (optional) + (public_name frama-c-scope.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core frama-c-inout.core frama-c-pdg.core) +) + +(plugin (optional) (name scope) (libraries frama-c-scope.core) (site (frama-c plugins))) diff --git a/src/plugins/scope/dune-project b/src/plugins/scope/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..b2f3282105ebdb366cdec8b2901b7fc23c76e7ae --- /dev/null +++ b/src/plugins/scope/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-scope) +(using dune_site 0.1) diff --git a/src/plugins/scope/frama-c-scope.opam b/src/plugins/scope/frama-c-scope.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/scope/dpds_gui.ml b/src/plugins/scope/gui/dpds_gui.ml similarity index 100% rename from src/plugins/scope/dpds_gui.ml rename to src/plugins/scope/gui/dpds_gui.ml diff --git a/src/plugins/scope/dpds_gui.mli b/src/plugins/scope/gui/dpds_gui.mli similarity index 100% rename from src/plugins/scope/dpds_gui.mli rename to src/plugins/scope/gui/dpds_gui.mli diff --git a/src/plugins/scope/gui/dune b/src/plugins/scope/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..3e9fdbf823cd937e0cb5ffd8727ac7e7ec1865de --- /dev/null +++ b/src/plugins/scope/gui/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Scope GUI:" %{lib-available:frama-c-scope.gui} "\n") + (echo " - Frama-C GUI:" %{lib-available:frama-c.gui} "\n") + (echo " - Scope:" %{lib-available:frama-c-scope.core} "\n") + ) + ) +) + +(library + (name scope_gui) + (public_name frama-c-scope.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Scope :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-scope.core) +) + +(plugin (optional) (name scope) (libraries frama-c-scope.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/scope/scope.ml b/src/plugins/scope/scope.ml new file mode 100644 index 0000000000000000000000000000000000000000..053a3b16f0d5a95db3b0107806dc84a68a49a6e7 --- /dev/null +++ b/src/plugins/scope/scope.ml @@ -0,0 +1,25 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module Defs = Defs +module Datascope = Datascope +module Zones = Zones diff --git a/src/plugins/scope/Scope.mli b/src/plugins/scope/scope.mli similarity index 83% rename from src/plugins/scope/Scope.mli rename to src/plugins/scope/scope.mli index 758bba54fe0e9455558e5ab8c343315740d918e4..eb59481580ed12af3c008e171516b8066b8a087c 100644 --- a/src/plugins/scope/Scope.mli +++ b/src/plugins/scope/scope.mli @@ -38,14 +38,19 @@ module Defs : sig val get_defs_with_type : Kernel_function.t -> stmt -> lval -> ((bool * bool) Stmt.Map.t * Locations.Zone.t option) option - (** @return a map from the statements that define [lval] before [stmt] in - [kf]. The first boolean indicates the possibility of a direct - modification at this statement, ie. [lval = ...] or [lval = f()]. - The second boolean indicates a possible indirect modification through - a call. - Also returns the zone that is possibly not defined. - Can return [None] when the information is not available (Pdg missing). - *) + (** @return a map from the statements that define [lval] before [stmt] in + [kf]. The first boolean indicates the possibility of a direct + modification at this statement, ie. [lval = ...] or [lval = f()]. + The second boolean indicates a possible indirect modification through + a call. + Also returns the zone that is possibly not defined. + Can return [None] when the information is not available (Pdg missing). + *) + + val compute_with_def_type_zone: + Cil_types.kernel_function -> Cil_types.stmt -> Locations.Zone.t -> + ((bool * bool) Cil_datatype.Stmt.Map.t * Locations.Zone.t option) option + (** internal use *) end module Datascope : sig @@ -72,6 +77,9 @@ module Datascope : sig val rm_asserts : unit -> unit (** Same analysis than [check_asserts] but mark the assertions as proven. *) + + (** for internal use *) + module R: Plugin.General_services end (** {3 Zones} *) diff --git a/src/plugins/scope/zones.ml b/src/plugins/scope/zones.ml index aa02df158d8b3d246e59e501748f8fdf5dd3ae08..ba308e499fa2110d4aef18bbe2f29c18c890d9e8 100644 --- a/src/plugins/scope/zones.ml +++ b/src/plugins/scope/zones.ml @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open Pdg_types + module R = Datascope.R let debug1 fmt = R.debug ~level:1 fmt let debug2 fmt = R.debug ~level:2 fmt @@ -262,7 +264,7 @@ let compute_ctrl_info pdg ctrl_part used_stmts = let module CtrlCompute = Dataflow2.Backwards(CtrlComputer) in let seen = Stmt.Hashtbl.create 50 in let rec add_node_ctrl_nodes new_stmts node = - let ctrl_nodes = !Db.Pdg.direct_ctrl_dpds pdg node in + let ctrl_nodes = Pdg.Api.direct_ctrl_dpds pdg node in List.fold_left add_ctrl_node new_stmts ctrl_nodes and add_ctrl_node new_stmts ctrl_node = debug2 "[zones] add ctrl node %a@." PdgTypes.Node.pretty ctrl_node; @@ -287,7 +289,7 @@ let compute_ctrl_info pdg ctrl_part used_stmts = if Stmt.Hashtbl.mem seen stmt then new_stmts else begin Stmt.Hashtbl.add seen stmt (); - match !Db.Pdg.find_simple_stmt_nodes pdg stmt with + match Pdg.Api.find_simple_stmt_nodes pdg stmt with | [] -> [] | n::_ -> add_node_ctrl_nodes new_stmts n end @@ -323,7 +325,7 @@ let compute kf stmt lval = let used_stmts = DataComputer.get_and_reset_used_stmts () in let all_used_stmts = if used_stmts = [] then [] - else compute_ctrl_info (!Db.Pdg.get kf) ctrl_part used_stmts + else compute_ctrl_info (Pdg.Api.get kf) ctrl_part used_stmts in let all_used_stmts = List.fold_left diff --git a/src/plugins/security_slicing/Makefile.in b/src/plugins/security_slicing/Makefile.in deleted file mode 100644 index 3eeab8cce57a6931a63613e3ba9309f530408741..0000000000000000000000000000000000000000 --- a/src/plugins/security_slicing/Makefile.in +++ /dev/null @@ -1,53 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -PLUGIN_DIR ?=. -PLUGIN_ENABLE:=@ENABLE_SECURITY_SLICING@ -PLUGIN_NAME:=Security_slicing -PLUGIN_CMO:= security_slicing_parameters components -PLUGIN_GUI_CMO:= register_gui -PLUGIN_UNDOC:= analysis -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -PLUGIN_NO_TEST:=yes -include $(FRAMAC_SHARE)/Makefile.dynamic - -# Regenerating the Makefile on need - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(Security_slicing_DIR)/Makefile: $(Security_slicing_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/security_slicing/Security_slicing.ml b/src/plugins/security_slicing/Security_slicing.ml new file mode 100644 index 0000000000000000000000000000000000000000..5de90590943e0b8c0bdb1ba58e32ad67b9583066 --- /dev/null +++ b/src/plugins/security_slicing/Security_slicing.ml @@ -0,0 +1,36 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Security slicing. *) + +(** No function is directly exported: they are dynamically registered. *) + +(** {2 Internal use only} *) + +module Components = Components +module Security_slicing_parameters = Security_slicing_parameters + +(* +Local Variables: +compile-command: "make -C ../../.." +End: +*) diff --git a/src/plugins/security_slicing/components.ml b/src/plugins/security_slicing/components.ml index 629fa05f3835588deac0848a4d24514a7f93b89f..e28a649eb889d5ade1e2af1bf5e0072e8607ad8b 100644 --- a/src/plugins/security_slicing/components.ml +++ b/src/plugins/security_slicing/components.ml @@ -23,6 +23,8 @@ open Cil_types open Cil_datatype +open Pdg_types + (* ************************************************************************* *) (** {2 Searching security annotations} *) (* ************************************************************************* *) @@ -98,7 +100,7 @@ let search_security_requirements () = open PdgIndex -let get_node_stmt node = Key.stmt (!Db.Pdg.node_key node) +let get_node_stmt node = Key.stmt (Pdg.Api.node_key node) module NodeKf = Datatype.Pair(PdgTypes.Node)(Kernel_function) @@ -246,26 +248,26 @@ module Todolist : sig type todo = private { node: PdgTypes.Node.t; kf: kernel_function; - pdg: Db.Pdg.t; + pdg: Pdg.Api.t; callstack_length: int; from_deep: bool } type t = todo list - val mk_init: kernel_function -> Db.Pdg.t -> PdgTypes.Node.t list -> todo list + val mk_init: kernel_function -> Pdg.Api.t -> PdgTypes.Node.t list -> todo list val add: - PdgTypes.Node.t -> kernel_function -> Db.Pdg.t -> int -> bool -> t -> t + PdgTypes.Node.t -> kernel_function -> Pdg.Api.t -> int -> bool -> t -> t end = struct type todo = { node: PdgTypes.Node.t; kf: kernel_function; - pdg: Db.Pdg.t; + pdg: Pdg.Api.t; callstack_length: int; from_deep: bool } type t = todo list let add n kf pdg len fd list = - match !Db.Pdg.node_key n with + match Pdg.Api.node_key n with | Key.SigKey (Signature.In Signature.InCtrl) -> (* do not consider node [InCtrl] *) list @@ -276,7 +278,7 @@ end = struct list | _ -> Security_slicing_parameters.debug ~level:2 "adding node %a (in %s)" - (!Db.Pdg.pretty_node false) n + (Pdg.Api.pretty_node false) n (Kernel_function.get_name kf); { node = n; kf = kf; pdg = pdg; callstack_length = len; from_deep = fd } @@ -301,7 +303,7 @@ module Component = struct | Forward of fwd_kind type value = - { pdg: Db.Pdg.t; + { pdg: Pdg.Api.t; mutable callstack_length: int; mutable direct: bool; mutable indirect_backward: bool; @@ -356,15 +358,15 @@ module Component = struct (* do not consider address dependencies now (except for impact analysis): just consider them during the last slicing pass (for semantic preservation of pointers) *) - let direct node = !Db.Pdg.direct_data_dpds pdg node in + let direct node = Pdg.Api.direct_data_dpds pdg node in match kind with | Direct -> direct node - | Indirect_Backward -> direct node @ !Db.Pdg.direct_ctrl_dpds pdg node + | Indirect_Backward -> direct node @ Pdg.Api.direct_ctrl_dpds pdg node | Forward Security -> - !Db.Pdg.direct_data_uses pdg node @ !Db.Pdg.direct_ctrl_uses pdg node + Pdg.Api.direct_data_uses pdg node @ Pdg.Api.direct_ctrl_uses pdg node | Forward Impact -> - !Db.Pdg.direct_data_uses pdg node @ !Db.Pdg.direct_ctrl_uses pdg node - @ !Db.Pdg.direct_addr_uses pdg node + Pdg.Api.direct_data_uses pdg node @ Pdg.Api.direct_ctrl_uses pdg node + @ Pdg.Api.direct_addr_uses pdg node let search_input kind kf lazy_l = try @@ -378,18 +380,18 @@ module Component = struct [] let add_from_deep caller todo n = - Todolist.add n caller (!Db.Pdg.get caller) 0 true todo + Todolist.add n caller (Pdg.Api.get caller) 0 true todo let forward_caller kf node todolist = - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in List.fold_left (fun todolist (caller, callsites) -> (* foreach caller *) List.fold_left (fun todolist callsite -> let nodes = - !Db.Pdg.find_call_out_nodes_to_select - pdg (PdgTypes.NodeSet.singleton node) (!Db.Pdg.get caller) callsite + Pdg.Api.find_call_out_nodes_to_select + pdg (PdgTypes.NodeSet.singleton node) (Pdg.Api.get caller) callsite in List.fold_left (add_from_deep caller) @@ -420,7 +422,7 @@ module Component = struct end else begin Security_slicing_parameters.debug ~level:2 "considering node %a (in %s)" - (!Db.Pdg.pretty_node false) node + (Pdg.Api.pretty_node false) node (Kernel_function.get_name kf); (* intraprocedural related_nodes *) let related_nodes = one_step_related_nodes kind pdg node in @@ -448,7 +450,7 @@ module Component = struct for zone %a@." (Kernel_function.get_name kf) (Kernel_function.get_name caller) Locations.Zone.pretty zone;*) - let pdg_caller = !Db.Pdg.get caller in + let pdg_caller = Pdg.Api.get caller in let do_call todolist callsite = match kind with | Direct | Indirect_Backward -> @@ -465,13 +467,13 @@ module Component = struct todolist in let todolist = - match !Db.Pdg.node_key node with + match Pdg.Api.node_key node with | Key.SigKey (Signature.In Signature.InCtrl) -> assert false | Key.SigKey (Signature.In (Signature.InImpl zone)) -> let compute_nodes pdg_caller callsite = let nodes, _undef_zone = - !Db.Pdg.find_location_nodes_at_stmt + Pdg.Api.find_location_nodes_at_stmt pdg_caller callsite ~before:true zone (* TODO : use undef_zone (see FS#201)? *) in @@ -484,9 +486,9 @@ module Component = struct let compute_nodes pdg_caller callsite = [ match key with | Signature.In (Signature.InNum n) -> - !Db.Pdg.find_call_input_node pdg_caller callsite n + Pdg.Api.find_call_input_node pdg_caller callsite n | Signature.Out Signature.OutRet -> - !Db.Pdg.find_call_output_node pdg_caller callsite + Pdg.Api.find_call_output_node pdg_caller callsite | Signature.In (Signature.InCtrl | Signature.InImpl _) | Signature.Out _ -> @@ -511,14 +513,14 @@ module Component = struct "[security] search inside %s (from %s)@." (Kernel_function.get_name called_kf) (Kernel_function.get_name kf);*) - let called_pdg = !Db.Pdg.get called_kf in + let called_pdg = Pdg.Api.get called_kf in let nodes = try match kind, key with | (Direct | Indirect_Backward), Signature.Out out_key -> let nodes, _undef_zone = - !Db.Pdg.find_output_nodes called_pdg out_key + Pdg.Api.find_output_nodes called_pdg out_key (* TODO: use undef_zone (see FS#201) *) in let nodes = @@ -527,28 +529,28 @@ module Component = struct nodes | _, Signature.In (Signature.InNum n) -> search_input kind called_kf - (lazy [!Db.Pdg.find_input_node called_pdg n]) + (lazy [Pdg.Api.find_input_node called_pdg n]) | _, Signature.In Signature.InCtrl -> search_input kind called_kf (lazy - [!Db.Pdg.find_entry_point_node called_pdg]) + [Pdg.Api.find_entry_point_node called_pdg]) | _, Signature.In (Signature.InImpl _) -> assert false | Forward _, Signature.Out _ -> [] with - | Db.Pdg.Top -> + | Pdg.Api.Top -> Security_slicing_parameters.warning "no precise pdg for function %s. \n\ Ignoring this function in the analysis (potentially incorrect results)." (Kernel_function.get_name called_kf); [] - | Db.Pdg.Bottom | Not_found -> assert false + | Pdg.Api.Bottom | Not_found -> assert false in List.fold_left (fun todo n -> (*Format.printf "node %a inside %s@." - (!Db.Pdg.pretty_node false) n + (Pdg.Api.pretty_node false) n (Kernel_function.get_name called_kf);*) Todolist.add n called_kf called_pdg @@ -584,16 +586,16 @@ module Component = struct let from_stmt = List.fold_left (fun s n -> PdgTypes.NodeSet.add n s) PdgTypes.NodeSet.empty from_stmt in - let called_pdg = !Db.Pdg.get called_kf in + let called_pdg = Pdg.Api.get called_kf in let nodes = try - !Db.Pdg.find_in_nodes_to_select_for_this_call + Pdg.Api.find_in_nodes_to_select_for_this_call pdg from_stmt stmt called_pdg with - | Db.Pdg.Top -> + | Pdg.Api.Top -> (* warning already emitted in the previous fold *) [] - | Db.Pdg.Bottom | Not_found -> assert false + | Pdg.Api.Bottom | Not_found -> assert false in List.fold_left (fun todo n -> @@ -623,10 +625,10 @@ module Component = struct let initial_nodes kf stmt = Security_slicing_parameters.debug ~level:3 "computing initial nodes for %d" stmt.sid; - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let nodes = if Eva.Results.is_reachable stmt then - try !Db.Pdg.find_simple_stmt_nodes pdg stmt + try Pdg.Api.find_simple_stmt_nodes pdg stmt with Not_found -> assert false else begin Security_slicing_parameters.debug @@ -654,7 +656,7 @@ module Component = struct nodes in res - with Db.Pdg.Top | Db.Pdg.Bottom -> + with Pdg.Api.Top | Pdg.Api.Bottom -> Security_slicing_parameters.warning "PDG is not manageable. skipping."; M.empty @@ -665,7 +667,7 @@ module Component = struct Security_slicing_parameters.debug "computing backward indirect component for %d" stmt.sid; related_nodes_of_nodes Indirect_Backward res nodes - with Db.Pdg.Top | Db.Pdg.Bottom -> + with Pdg.Api.Top | Pdg.Api.Bottom -> Security_slicing_parameters.warning "PDG is not manageable. skipping."; M.empty @@ -855,7 +857,7 @@ let slice ctrl = let slicing = !Slicing.Project.mk_project name in let select (n, kf) sel = Security_slicing_parameters.debug ~level:2 "selecting %a (of %s)" - (!Db.Pdg.pretty_node false) n + (Pdg.Api.pretty_node false) n (Kernel_function.get_name kf); !Slicing.Select.select_pdg_nodes sel diff --git a/src/plugins/security_slicing/dune b/src/plugins/security_slicing/dune new file mode 100644 index 0000000000000000000000000000000000000000..4e24b20cfd4e2c6103fd71897dc204be5fe01bcb --- /dev/null +++ b/src/plugins/security_slicing/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Security Slicing:" %{lib-available:frama-c-security_slicing.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - Pdg:" %{lib-available:frama-c-pdg.core} "\n") + ) + ) +) + +( library + (name security_slicing) + (optional) + (public_name frama-c-security_slicing.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-eva.core frama-c-pdg.core) +) + +(plugin (optional) (name security_slicing) (libraries frama-c-security_slicing.core) (site (frama-c plugins))) diff --git a/src/plugins/security_slicing/dune-project b/src/plugins/security_slicing/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..153f462fbfbca972919cb52b318ad1e5027bbbf2 --- /dev/null +++ b/src/plugins/security_slicing/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-security_slicing) +(using dune_site 0.1) diff --git a/src/plugins/security_slicing/frama-c-security_slicing.opam b/src/plugins/security_slicing/frama-c-security_slicing.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/security_slicing/gui/dune b/src/plugins/security_slicing/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..f9695a3f9721799ce82c72d8e883590c35ad10b9 --- /dev/null +++ b/src/plugins/security_slicing/gui/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +( library + (name security_slicing_gui) + (public_name frama-c-security_slicing.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Security_slicing :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-security_slicing.core) +) + +(plugin (optional) (name security_slicing) (libraries frama-c-security_slicing.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/security_slicing/register_gui.ml b/src/plugins/security_slicing/gui/register_gui.ml similarity index 100% rename from src/plugins/security_slicing/register_gui.ml rename to src/plugins/security_slicing/gui/register_gui.ml diff --git a/src/plugins/security_slicing/register_gui.mli b/src/plugins/security_slicing/gui/register_gui.mli similarity index 100% rename from src/plugins/security_slicing/register_gui.mli rename to src/plugins/security_slicing/gui/register_gui.mli diff --git a/src/plugins/server/.gitignore b/src/plugins/server/.gitignore index 4b99079bde042aa1b40f702356f91672c633b52d..2da34c702bc6458d352da4d681c3928c90cca5ee 100644 --- a/src/plugins/server/.gitignore +++ b/src/plugins/server/.gitignore @@ -1,2 +1,3 @@ /Makefile -/Server.mli +/tests/*/result +/tests/**/dune diff --git a/src/plugins/server/Makefile.in b/src/plugins/server/Makefile.in deleted file mode 100644 index 943f93e2fe1ddb98ce547a23397196bcbab2a5e4..0000000000000000000000000000000000000000 --- a/src/plugins/server/Makefile.in +++ /dev/null @@ -1,130 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -################### -# Plug-in Setting # -################### - -PLUGIN_DIR ?=. -PLUGIN_ENABLE:=@ENABLE_SERVER@ -PLUGIN_NAME:=Server -PLUGIN_CMO:= \ - server_parameters \ - jbuffer \ - package \ - data main request states \ - server_doc \ - server_batch \ - server_socket \ - kernel_ast \ - kernel_main \ - kernel_project \ - kernel_properties - -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -PLUGIN_TESTS_DIRS := batch - -PLUGIN_REQUIRES:= yojson - -PLUGIN_UNDOC:= server_batch.ml server_zmq.ml server_socket.ml - -PLUGIN_GENERATED:= $(PLUGIN_DIR)/Server.mli - -################## -# ZeroMQ Support # -################## - -ifeq (@SERVER_ZMQ@,yes) -PLUGIN_REQUIRES+= zmq -PLUGIN_CMO+= server_zmq -else -PLUGIN_DISTRIB_EXTERNAL+= server_zmq.ml -endif - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -############## -# Server API # -############## - -SERVER_API= \ - package.mli \ - jbuffer.mli \ - data.mli \ - request.mli \ - states.mli \ - main.mli \ - kernel_main.mli \ - kernel_ast.mli \ - kernel_properties.mli - -define Capitalize -$(shell printf "%s%s" \ - $$($(ECHO) $(1) | cut -c 1 | tr '[:lower:]' '[:upper:]') - $$($(ECHO) $(1) | cut -c 2-)) -endef - -define ExportModule -$(ECHO) "module $(call Capitalize, $(basename $(notdir $(1)))) : sig" >> $(2); -$(ECHO) '# 1 "$(1)"' >> $(2); -$(CAT) $(1) >> $(2); -$(ECHO) "end" >> $(2); -endef - -SERVER_MLI=$(addprefix $(Server_DIR)/, $(SERVER_API)) - -$(Server_DIR)/Server.mli: $(Server_DIR)/Makefile $(SERVER_MLI) - $(PRINT_MAKING) $@ "from" $(SERVER_MLI) - $(RM) $@ $@.tmp - $(ECHO) "(* This file is generated. Do not edit. *)" >> $@.tmp - $(ECHO) "(** {b Server Public API} *)" >> $@.tmp - $(foreach file,$(SERVER_MLI),$(call ExportModule,$(file),$@.tmp)) - $(CHMOD_RO) $@.tmp - $(MV) $@.tmp $@ - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(Server_DIR)/Makefile: $(Server_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/server/dune b/src/plugins/server/dune new file mode 100644 index 0000000000000000000000000000000000000000..682610a0cfc7d3466b57fd85de414dfe8958aa6a --- /dev/null +++ b/src/plugins/server/dune @@ -0,0 +1,45 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Server:" %{lib-available:frama-c-server.core} "\n") + (echo " - (optional) Zmq:" %{lib-available:zmq} "\n") + ) + ) +) + +( library + (name server) + (optional) + (public_name frama-c-server.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel + (select server_zmq.ml from + (zmq -> server_zmq.ok.ml) + ( -> server_zmq.ko.ml) + )) +) + +(plugin (optional) (name server) (libraries frama-c-server.core) (site (frama-c plugins))) diff --git a/src/plugins/server/dune-project b/src/plugins/server/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..f9fc8ba242d6e1999f496ef5570b92e9bb62ba18 --- /dev/null +++ b/src/plugins/server/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-server) +(using dune_site 0.1) diff --git a/src/plugins/server/frama-c-server.opam b/src/plugins/server/frama-c-server.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/server/kernel_main.ml b/src/plugins/server/kernel_main.ml index 83d3459dae9fdaed722119786355c774896ef9b1..b3c16a3f1182f63f13b7fe4be43be13953c54085 100644 --- a/src/plugins/server/kernel_main.ml +++ b/src/plugins/server/kernel_main.ml @@ -40,25 +40,20 @@ let () = let signature = Request.signature ~input:(module Junit) () in let result name descr = Request.result signature ~name ~descr:(Md.plain descr) (module Jstring) in + let result_list name descr = + Request.result signature ~name ~descr:(Md.plain descr) (module Jlist (Jstring)) in let set_version = result "version" "Frama-C version" in - let set_datadir = result "datadir" "Shared directory (FRAMAC_SHARE)" in - let set_libdir = result "libdir" "Lib directory (FRAMAC_LIB)" in - let set_pluginpath = Request.result signature - ~name:"pluginpath" - ~descr:(Md.plain "Plugin directories (FRAMAC_PLUGIN)") - (module Jlist(Jstring)) in + let set_datadir = result_list "datadir" "Shared directory (FRAMAC_SHARE)" in + let set_pluginpath = result_list "pluginpath" "Plugin directories (FRAMAC_PLUGIN)" in Request.register_sig ~package ~kind:`GET ~name:"getConfig" ~descr:(Md.plain "Frama-C Kernel configuration") signature begin fun rq () -> set_version rq Fc_config.version ; - set_datadir rq (Fc_config.datadir :> string) ; - set_libdir rq (Fc_config.libdir :> string) ; - let pluginpath = - Filepath.Normalized.to_string_list Fc_config.plugin_dir - in - set_pluginpath rq pluginpath ; + set_datadir rq (Filepath.Normalized.to_string_list Fc_config.datadirs); + set_pluginpath rq + (Filepath.Normalized.to_string_list Fc_config.plugin_dir) ; end (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/server/server_zmq.ko.ml b/src/plugins/server/server_zmq.ko.ml new file mode 100644 index 0000000000000000000000000000000000000000..192106d34ea67bf3d919a40345a219f6d9c85f15 --- /dev/null +++ b/src/plugins/server/server_zmq.ko.ml @@ -0,0 +1,23 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(* empty file *) diff --git a/src/plugins/server/server_zmq.ml b/src/plugins/server/server_zmq.ok.ml similarity index 100% rename from src/plugins/server/server_zmq.ml rename to src/plugins/server/server_zmq.ok.ml diff --git a/src/plugins/server/tests/.gitignore b/src/plugins/server/tests/.gitignore deleted file mode 100644 index a002f646b79ae980fea08ebe8b30f1f8dd5fa48c..0000000000000000000000000000000000000000 --- a/src/plugins/server/tests/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/ptests_config -result diff --git a/src/plugins/server/tests/ptests_config b/src/plugins/server/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..588227adac2e57043d0d7d8c738977298023db9a --- /dev/null +++ b/src/plugins/server/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= batch diff --git a/src/plugins/slicing/Slicing.mli b/src/plugins/slicing/Slicing.mli deleted file mode 100644 index 1751112ca3dacd3a63e01d2f1598308c41fdc705..0000000000000000000000000000000000000000 --- a/src/plugins/slicing/Slicing.mli +++ /dev/null @@ -1,583 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2022 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It 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 Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Cil_datatype - -(** Slicing API. *) -module Api:sig - - val self: State.t - (** Internal state of the slicing tool from project viewpoints. *) - - val set_modes : ?calls:int -> ?callers:bool -> ?sliceUndef:bool -> - ?keepAnnotations:bool -> unit -> unit - (** Sets slicing parameters related to command line options - [-slicing-level], [-slice-callers], [-slice-undef-functions], - [-slicing-keep-annotations]. - *) - - (* ---------------------------------------------------------------------- *) - - (** Slicing project management. *) - module Project : sig - - val reset_slicing : unit -> unit - (** Function that can be used for: - - initializing the slicing tool before starting a slicing project; - - removing all computed slices and all internal pending requests - of the current slicing project. *) - - (** {3 Kernel function} *) - - val is_called : kernel_function -> bool - (** Return [true] iff the source function is called (even indirectly via - transitivity) from a [Slice.t]. *) - - val has_persistent_selection : kernel_function -> bool - (** Return [true] iff the source function has persistent selection *) - - val change_slicing_level : kernel_function -> int -> unit - (** Change the slicing level of this function (see the [-slicing-level] - option documentation to know the meaning of the number). - @raise SlicingTypes.ExternalFunction if [kf] has no definition. - @raise SlicingTypes.WrongSlicingLevel if [n] is not valid. *) - - (** {3 Extraction} *) - - val default_slice_names : kernel_function -> bool -> int -> string - (** Default function used for the optional [?f_slice_names] argument of - [extract] function. *) - - val extract : ?f_slice_names:(kernel_function -> bool -> int -> string) -> - string -> Project.t - (** Build a new [Db.Project.t] from all [Slice.t] of a project. - The string argument is used for naming the new project. - Can optionally specify how to name the sliced functions - by defining [f_slice_names]. - [f_slice_names kf src_visi num_slice] has to return the name - of the exported functions based on the source function [kf]. - - [src_visi] tells if the source function name is used - (if not, it can be used for a slice) - - [num_slice] gives the number of the slice to name. - The entry point function is only exported once : - it is VERY recommended to give to it its original name, - even if it is sliced. - *) - - (** {3 Not for casual users} *) - - val is_directly_called_internal : kernel_function -> bool - (** Return [true] if the source function is directly (even via pointer - function) called from a [Slice.t]. *) - - val print_dot : filename:string -> title:string -> unit - (** May be used to for debugging... - Pretty print a representation of the slicing project (call graph) - in a dot file which name is the given string. *) - - val pretty : Format.formatter -> unit - (** May be used for debugging... Pretty print project information. *) - - end - - (* ---------------------------------------------------------------------- *) - - (** Access to slicing results. *) - module Mark : sig - - (** Abstract data type for mark value. *) - type t - - val dyn_t : t Type.t - (** For dynamic type checking. *) - - val make : data:bool -> addr:bool -> ctrl:bool -> t - (** To construct a mark such as - [(is_ctrl result, is_data result, isaddr result) = - (~ctrl, ~data, ~addr)], - [(is_bottom result) = false] and - [(is_spare result) = not (~ctrl || ~data || ~addr)]. *) - - val compare : t -> t -> int - (** A total ordering function similar to the generic structural - comparison function [compare]. - Can be used to build a map from [t] marks to, for example, colors for - the GUI. *) - - val is_bottom : t -> bool - (** [true] iff the mark is empty: it is the only case where the - associated element is invisible. *) - - val is_spare : t -> bool - (** Smallest visible mark. Usually used to mark element that need to be - visible for compilation purpose, not really for the selected - computations. *) - - val is_data : t -> bool - (** The element is used to compute selected data. - Notice that a mark can be [is_data] and/or [is_ctrl] and/or [is_addr] - at the same time. *) - - val is_ctrl : t -> bool - (** The element is used to control the program point of a selected - data. *) - - val is_addr : t -> bool - (** The element is used to compute the address of a selected data. *) - - val get_from_src_func : kernel_function -> t - (** The mark [m] related to all statements of a source function [kf]. - Property : [is_bottom (get_from_func proj kf) = not (Project.is_called proj kf) ] *) - - (** {3 Not for casual users} *) - - val pretty : Format.formatter -> t -> unit - (** May be used for debugging... Pretty mark information. *) - - end - - (* ---------------------------------------------------------------------- *) - - (** Slicing selections. *) - module Select : sig - - type t - (** Internal selection. *) - - val dyn_t : t Type.t - (** For dynamic type checking. *) - - type set - (** Set of colored selections. *) - - val dyn_set : set Type.t - (** For dynamic type checking. *) - - (** {3 Journalized selectors} *) - - val empty_selects : set - (** Empty selection. *) - - val select_stmt : set -> spare:bool -> stmt -> kernel_function -> set - (** To select a statement. *) - - val select_stmt_ctrl : set -> spare:bool -> stmt -> kernel_function -> set - (** To select a statement reachability. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_lval_rw : - (set -> - Mark.t -> - rd:Datatype.String.Set.t -> - wr:Datatype.String.Set.t -> - stmt -> - eval:stmt -> - kernel_function -> set) - (** To select rw accesses to lvalues (given as a string) related to a - statement. - Variable names used in the sets of strings [~rd] and [~wr] are relative - to the function scope. - The interpretation of the address of the lvalues is - done just before the execution of the statement [~eval]. - The selection preserves the [~rd] and ~[wr] accesses contained into - the statement [ki]. - Note: add also a transparent selection on the whole statement. - *) - - val select_stmt_lval : - (set -> Mark.t -> Datatype.String.Set.t -> before:bool -> stmt -> - eval:stmt -> kernel_function -> set) - (** To select lvalues (given as string) related to a statement. - Variable names used in the sets of strings [~rd] and [~wr] are relative - to the function scope. - The interpretation of the address of the lvalue is - done just before the execution of the statement [~eval]. - The selection preserve the value of these lvalues before or - after (c.f. boolean [~before]) the statement [ki]. - Note: add also a transparent selection on the whole statement. - *) - - val select_stmt_annots : - (set -> Mark.t -> spare:bool -> threat:bool -> user_assert:bool -> - slicing_pragma:bool -> loop_inv:bool -> loop_var:bool -> - stmt -> kernel_function -> set) - (** To select the annotations related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_func_lval_rw : - (set -> Mark.t -> rd:Datatype.String.Set.t -> wr:Datatype.String.Set.t -> - eval:stmt -> kernel_function -> set) - (** To select rw accesses to lvalues (given as a string) related to a - function. - Variable names used in the sets of strings [~rd] and [~wr] are relative - to the function scope. - The interpretation of the address of the lvalues is - done just before the execution of the statement [~eval]. - The selection preserve the value of these lvalues into the whole - project. - *) - - val select_func_lval : - (set -> Mark.t -> Datatype.String.Set.t -> kernel_function -> set) - (** To select lvalues (given as a string) related to a function. - Variable names used in the sets of strings [lval_str] string are - relative to the scope of the first statement of [kf]. - The interpretation of the address of the lvalues is - done just before the execution of the first statement [kf]. - The selection preserve the value of these lvalues before - execution of the return statement. *) - - val select_func_return : set -> spare:bool -> kernel_function -> set - (** To select the function result (returned value). *) - - val select_func_calls_to : set -> spare:bool -> kernel_function -> set - (** To select every calls to the given function, i.e. the call keeps - its semantics in the slice. *) - - val select_func_calls_into : set -> spare:bool -> kernel_function -> set - (** To select every calls to the given function without the selection of - its inputs/outputs. *) - - val select_func_annots : - (set -> Mark.t -> spare:bool -> threat:bool -> user_assert:bool -> - slicing_pragma:bool -> loop_inv:bool -> loop_var:bool -> - kernel_function -> set) - (** To select the annotations related to a function. *) - - val select_func_zone : - (set -> Mark.t -> Locations.Zone.t -> kernel_function -> set) - (** To select an output zone related to a function. *) - - val select_stmt_zone : - (set -> Mark.t -> Locations.Zone.t -> before:bool -> stmt -> - kernel_function -> set) - (** To select a zone value related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_term : - (set -> Mark.t -> term -> stmt -> - kernel_function -> set) - (** To select a predicate value related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_pred : - (set -> Mark.t -> predicate -> stmt -> - kernel_function -> set) - (** To select a predicate value related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_annot : - (set -> Mark.t -> spare:bool -> code_annotation -> stmt -> - kernel_function -> set) - (** To select the annotations related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_pdg_nodes : - (set -> Mark.t -> PdgTypes.Node.t list -> kernel_function -> set) - (** To select nodes of the PDG - - if [is_ctrl_mark m], - propagate ctrl_mark on ctrl dependencies - - if [is_addr_mark m], - propagate addr_mark on addr dependencies - - if [is_data_mark m], - propagate data_mark on data dependencies - - mark the node with a spare_mark and propagate so that - the dependencies that were not selected yet will be marked spare. *) - - (** {3 Not for casual users} *) - - val get_function : t -> kernel_function - (** May be used to get the function related to an internal selection. *) - - val merge_internal : t -> t -> t - val add_to_selects_internal : t -> set -> set - val iter_selects_internal : (t -> unit) -> set -> unit - val fold_selects_internal : ('a -> t -> 'a) -> 'a -> set -> 'a - - val select_stmt_internal : (kernel_function -> ?select:t -> - stmt -> Mark.t -> t) - (** May be used to select a statement : - - if [is_ctrl_mark m], - propagates ctrl_mark on ctrl dependencies of the statement - - if [is_addr_mark m], - propagates addr_mark on addr dependencies of the statement - - if [is_data_mark m], - propagates data_mark on data dependencies of the statement - - otherwise, marks the node with a spare_mark and propagate so that - the dependencies that were not selected yet will be marked spare. - When the statement is a call, its functional inputs/outputs are - also selected (The call is still selected even it has no output). - When the statement is a composed one (block, if, etc...), - all the sub-statements are selected. - @raise SlicingTypes.NoPdg when there is no PDG for the - [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) - - val select_label_internal : (kernel_function -> ?select:t -> - Logic_label.t -> Mark.t -> t) - (** May be used to select a label. *) - - val select_min_call_internal : - (kernel_function -> ?select:t -> stmt -> Mark.t -> t) - (** May be used to select a statement call without its - inputs/outputs so that it doesn't select the statements computing the - inputs of the called function as [select_stmt_internal] would do. - @raise Invalid_argument when the [stmt] isn't a call. - @raise SlicingTypes.NoPdg when there is no PDG for the - [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) - - val select_stmt_zone_internal : - (kernel_function -> ?select:t -> - stmt -> before:bool -> Locations.Zone.t -> Mark.t -> t) - (** May be used to select a zone value at a program point. - @raise SlicingTypes.NoPdg when there is no PDG for the - [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) - - val select_zone_at_entry_point_internal : - (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) - (** May be used to select a zone value at the beginning of a function. - For a defined function, it is similar to [select_stmt_zone_internal] - with the initial statement, but it can also be used for undefined - functions. - @raise SlicingTypes.NoPdg when there is no PDG for the - [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) - - val select_zone_at_end_internal : - (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) - (** May be used to select a zone value at the end of a function. - For a defined function, it is similar to [select_stmt_zone_internal] - with the return statement, but it can also be used for undefined - functions. - @raise SlicingTypes.NoPdg when there is no PDG for the - [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) - - val select_modified_output_zone_internal : - (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) - (** May be used to select the statements that modify the - given zone considered as in output. - Be careful that it is NOT the same as selecting the zone at the end! - (the 'undef' zone is not propagated...). *) - - val select_stmt_ctrl_internal : kernel_function -> ?select:t -> stmt -> t - (** May be used to select a statement reachability : - Only propagate a ctrl_mark on the statement control dependencies. - @raise SlicingTypes.NoPdg when there is no PDG for the - [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) - - val select_entry_point_internal : - (kernel_function -> ?select:t -> Mark.t -> t) - val select_return_internal : - (kernel_function -> ?select:t -> Mark.t -> t) - val select_decl_var_internal : - (kernel_function -> ?select:t -> Cil_types.varinfo -> Mark.t -> t) - - val select_pdg_nodes_internal : - (kernel_function -> ?select:t -> PdgTypes.Node.t list -> Mark.t -> t) - (** May be used to select PDG nodes. *) - - val pretty : Format.formatter -> t -> unit - (** May be used for debugging... Pretty mark information. *) - - end - - (* ---------------------------------------------------------------------- *) - - (** Function slice. *) - module Slice : sig - - type t - (** Abstract data type for function slice. *) - - val dyn_t : t Type.t - (** For dynamic type checking. *) - - val create : kernel_function -> t - (** Used to get an empty slice (nothing selected) related to a - function. *) - - val remove : t -> unit - (** Remove the slice from the project. The slice shouldn't be called. *) - - val remove_uncalled : unit -> unit - (** Remove the uncalled slice from the project. *) - - (** {3 Getters} *) - - val get_all: kernel_function -> t list - (** Get all slices related to a function. *) - - val get_function : t -> kernel_function - (** To get the function related to a slice *) - - val get_callers : t -> t list - (** Get the slices having direct calls to a slice. *) - - val get_called_slice : t -> stmt -> t option - (** To get the slice directly called by the statement of a slice. - Returns None when the statement mark is bottom, - or else the statement isn't a call - or else the statement is a call to one or several (via pointer) - source functions. *) - - val get_called_funcs : t -> stmt -> kernel_function list - (** To get the source functions called by the statement of a slice. - Returns an empty list when the statement mark is bottom, - or else the statement isn't a call - or else the statement is a call to a function slice. *) - - val get_mark_from_stmt : t -> stmt -> Mark.t - (** Get the mark value of a statement. *) - - val get_mark_from_label : t -> stmt -> Cil_types.label -> Mark.t - (** Get the mark value of a label. *) - - val get_mark_from_local_var : t -> varinfo -> Mark.t - (** Get the mark value of local variable. *) - - val get_mark_from_formal : t -> varinfo -> Mark.t - (** Get the mark from the formal of a function. *) - - val get_user_mark_from_inputs : t -> Mark.t - (** Get a mark that is the merged user inputs marks of the slice *) - - (** {3 Not for casual users} *) - - val get_num_id : t -> int - - val from_num_id : kernel_function -> int -> t - - val pretty : Format.formatter -> t -> unit - (** May be used for debugging... Pretty print slice information. *) - - end - - (* ---------------------------------------------------------------------- *) - - (** Requests for slicing jobs. - Slicing requests are part of a slicing project. - So, user requests affect slicing project. *) - module Request : sig - - (** {3 Applying the added requests} *) - - val apply_all: propagate_to_callers:bool -> unit - (** Apply all slicing requests. *) - - (** {3 Adding slicing requests} *) - - val add_selection: Select.set -> unit - (** Add a selection request to all (existing) slices - of a function to the project requests. *) - - val add_persistent_selection: Select.set -> unit - (** Add a persistent selection request to all slices (already existing or - created later) of a function to the project requests. *) - - val add_persistent_cmdline : unit -> unit - (** Add persistent selection from the command line. *) - - (** {3 Not for casual users} *) - - val add_slice_selection_internal:Slice.t -> Select.t -> unit - (** May be used to add a selection request for a function slice - to the project requests. *) - - val add_selection_internal: Select.t -> unit - (** May be used to add a selection request to the project requests. - This selection will be applied to every slicies of the function - (already existing or created later). *) - - val add_call_slice:caller:Slice.t -> to_call:Slice.t -> unit - (** May be used to change every call to any [to_call] source or specialisation in order - to call [to_call] in [caller]. *) - - val add_call_fun: caller:Slice.t -> to_call:kernel_function -> unit - (** May be used to change every call to any [to_call] source or specialisation - in order to call the source function [to_call] in [caller]. *) - - val add_call_min_fun: caller:Slice.t -> to_call:kernel_function -> unit - (** May be used to change each call to [to_call] in [caller] such that, at least, it - will be visible at the end, ie. call either the source function or - one of [to_call] slice (depending on the [slicing_level]). *) - - val is_request_empty_internal: unit -> bool - (** May be used to know if internal requests are pending. *) - - (* REMOVED: val is_already_selected_internal: Slice.t -> Select.t -> bool *) - (** Return true when the requested selection is already selected into the - slice. *) - - val apply_all_internal: unit -> unit - (** May be used to apply all slicing requests. *) - - val apply_next_internal: unit -> unit - (** May be used to apply the first slicing request of the project list - and remove it from the list. - That may modify the contents of the remaining list. - For example, new requests may be added to the list. *) - - val merge_slices: Slice.t -> Slice.t -> replace:bool -> Slice.t - (** May be used to build a new slice which marks is a merge of the two given slices. - [choose_call] requests are added to the project in order to choose - the called functions for this new slice. - If [replace] is true, more requests are added to call this new - slice instead of the two original slices. When these requests will - be applied, the user will be able to remove those two slices using - [Db.Slicing.Slice.remove]. *) - - val copy_slice: Slice.t -> Slice.t - (** May be used to copy the input slice. The new slice is not called, so it is the user - responsibility to change the calls if he wants to. *) - - val split_slice: Slice.t -> Slice.t list - (** May be used to copy the input slice to have one slice for each call of the original - slice and generate requests in order to call them. - @return the newly created slices. *) - - val propagate_user_marks : unit -> unit - (** May be used to apply pending request then propagate user marks to callers - recursively then apply pending requests *) - - val pretty : Format.formatter -> unit - (** May be used for debugging... Pretty print the request list. *) - - end - -end - -(* ---------------------------------------------------------------------- *) -(** For debugging purpose only. - - API used by the tests of slicing (see tests/slicing/libSelect.ml). *) - -module PrintSlice: sig - val print_fct_stmts: - Format.formatter -> - kernel_function -> - unit -end - -(* -Local Variables: -compile-command: "make -C ../.." -End: -*) diff --git a/src/plugins/slicing/api.mli b/src/plugins/slicing/api.mli index 2a0af61952fbb5e2b4ef8ed5550aed059a351773..c1b4b19a0d97e6391031f0fb39fb5ac64367937a 100644 --- a/src/plugins/slicing/api.mli +++ b/src/plugins/slicing/api.mli @@ -306,6 +306,8 @@ module Select : sig (** {3 Pdg selectors.} *) + open Pdg_types + val select_pdg_nodes : set -> Mark.t -> PdgTypes.Node.t list -> Cil_types.kernel_function -> set diff --git a/src/plugins/slicing/dune b/src/plugins/slicing/dune new file mode 100644 index 0000000000000000000000000000000000000000..6552f49dd8296a0d44a17ce6735a7e46bbe426fe --- /dev/null +++ b/src/plugins/slicing/dune @@ -0,0 +1,42 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Slicing:" %{lib-available:frama-c-slicing.core} "\n") + (echo " - Pdg:" %{lib-available:frama-c-pdg.core} "\n") + (echo " - Sparecode:" %{lib-available:frama-c-sparecode.core} "\n") + ) + ) +) + +( library + (name slicing) + (optional) + (public_name frama-c-slicing.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-pdg.core frama-c-sparecode.core) +) + +(plugin (optional) (name slicing) (libraries frama-c-slicing.core) (site (frama-c plugins))) diff --git a/src/plugins/slicing/dune-project b/src/plugins/slicing/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..8f75251e779d289edc199385618c0eba0689d3e7 --- /dev/null +++ b/src/plugins/slicing/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-slicing) +(using dune_site 0.1) diff --git a/src/plugins/slicing/fct_slice.ml b/src/plugins/slicing/fct_slice.ml index b470412386a2539a15b5fd3c3b3fb857fa5de024..43be72e63ec8990bfab89552dde3857cebd463e6 100644 --- a/src/plugins/slicing/fct_slice.ml +++ b/src/plugins/slicing/fct_slice.ml @@ -41,6 +41,7 @@ (**/**) open Cil_types +open Pdg_types (**/**) (* Look at (only once) the callers of [kf] ([kf] included). *) @@ -356,7 +357,7 @@ end = struct let merge ff1 ff2 = let pdg1, fm1 = ff1.SlicingInternals.ff_marks in let pdg2, fm2 = ff2.SlicingInternals.ff_marks in - assert (Db.Pdg.from_same_fun pdg1 pdg2) ; + assert (Pdg.Api.from_same_fun pdg1 pdg2) ; let merge_marks m1 m2 = SlicingMarks.merge_marks [m1; m2] in let merge_call_info _c1 _c2 = None in let fm = PdgIndex.FctIndex.merge fm1 fm2 merge_marks merge_call_info in @@ -418,7 +419,7 @@ end = struct let m2m s m = let key = match s with | PdgMarks.SelIn loc -> PdgIndex.Key.implicit_in_key loc - | PdgMarks.SelNode (n,_z) -> !Db.Pdg.node_key n + | PdgMarks.SelNode (n,_z) -> Pdg.Api.node_key n in let old_m = get_mark old_marks key in let add_mark = @@ -436,7 +437,7 @@ end = struct SlicingParameters.debug ~level:2 "[Fct_Slice.FctMarks.marks_for_caller_inputs] for %a : \ old=%a new=%a -> %a" - !Db.Pdg.pretty_key key SlicingMarks.pretty_mark old_m + Pdg.Api.pretty_key key SlicingMarks.pretty_mark old_m SlicingMarks.pretty_mark m SlicingMarks.pretty_mark (match new_m with None -> SlicingMarks.bottom_mark | Some m -> m); @@ -452,7 +453,7 @@ end = struct None in let new_input_marks = - Pdg.Register.in_marks_to_caller pdg_caller call m2m in_info in + Pdg.Marks.in_marks_to_caller pdg_caller call m2m in_info in new_input_marks, !new_input let marks_for_call_outputs (_, out_info) = out_info @@ -467,7 +468,7 @@ end = struct let pdg = SlicingMacros.get_ff_pdg ff_call in let spare = SlicingMarks.mk_gen_spare in let rec add2 marks n = - match !Db.Pdg.node_key n with + match Pdg.Api.node_key n with | PdgIndex.Key.SigCallKey (_, (PdgIndex.Signature.In _)) -> marks | PdgIndex.Key.SigCallKey (_, (PdgIndex.Signature.Out key)) -> @@ -497,7 +498,7 @@ end = struct * it has already been taken into account in the "from". *) None | PdgMarks.SelNode (n, _z_opt) -> - let nkey = !Db.Pdg.node_key n in + let nkey = Pdg.Api.node_key n in (* let nkey = match z_opt with None -> nkey | Some z -> match nkey with @@ -516,7 +517,7 @@ end = struct | _ -> (); false in SlicingParameters.debug ~level:2 "[Fct_Slice.FctMarks.check_called_marks] for %a : old=%a new=%a -> %a %s" - !Db.Pdg.pretty_key nkey + Pdg.Api.pretty_key nkey SlicingMarks.pretty_mark old_m SlicingMarks.pretty_mark m SlicingMarks.pretty_mark @@ -524,7 +525,7 @@ end = struct (if new_out then "(new out)" else ""); m_opt in let new_called_marks = - Pdg.Register.call_out_marks_to_called ff_pdg m2m new_call_marks + Pdg.Marks.call_out_marks_to_called ff_pdg m2m new_call_marks in new_called_marks, !new_output let persistent_in_marks_to_prop fi to_prop = @@ -532,12 +533,12 @@ end = struct SlicingParameters.debug ~level:2 "[Fct_Slice.FctMarks.persistent_in_marks_to_prop] from %s" (SlicingMacros.fi_name fi); let m2m _call _pdg_caller _n m = (* SlicingParameters.debug ~level:2 " in_m2m %a in %s ?@." - PdgIndex.Key.pretty (!Db.Pdg.node_key n) (SlicingMacros.pdg_name pdg_caller); *) + PdgIndex.Key.pretty (Pdg.Api.node_key n) (SlicingMacros.pdg_name pdg_caller); *) SlicingMarks.missing_input_mark ~call:SlicingMarks.bottom_mark ~called:m in let pdg = SlicingMacros.get_fi_pdg fi in let pdg_node_marks = - Pdg.Register.translate_in_marks pdg ~m2m in_info [] in + Pdg.Marks.translate_in_marks pdg ~m2m in_info [] in pdg_node_marks let get_new_marks ff nodes_marks = @@ -546,13 +547,13 @@ end = struct let nkey = match n with | PdgMarks.SelNode (n, _z_opt) -> (* TODO : something to do for z_opt ? *) - !Db.Pdg.node_key n + Pdg.Api.node_key n | PdgMarks.SelIn l -> PdgIndex.Key.implicit_in_key l in let oldm = get_mark fm nkey in let newm = SlicingMarks.minus_marks m oldm in (* Format.printf "get_new_marks for %a : old=%a new=%a -> %a@." - !Db.Pdg.pretty_key nkey SlicingMarks.pretty_mark oldm + Pdg.Api.pretty_key nkey SlicingMarks.pretty_mark oldm SlicingMarks.pretty_mark m SlicingMarks.pretty_mark newm; *) if not (SlicingMarks.is_bottom_mark newm) then (n, newm)::acc else acc in List.fold_left add_if_new [] nodes_marks @@ -571,7 +572,7 @@ end = struct let mark_spare_call_nodes ff call = let pdg = SlicingMacros.get_ff_pdg ff in - let nodes = !Db.Pdg.find_simple_stmt_nodes pdg call in + let nodes = Pdg.Api.find_simple_stmt_nodes pdg call in mark_spare_nodes ff nodes (** TODO : @@ -587,8 +588,8 @@ end = struct let rec check_in_params n params = match params with | [] -> [] | _ :: params -> - let node = !Db.Pdg.find_input_node pdg n in - let dpds = !Db.Pdg.direct_dpds pdg node in + let node = Pdg.Api.find_input_node pdg n in + let dpds = Pdg.Api.direct_dpds pdg node in let get_n_mark n = get_mark ff_marks (PdgTypes.Node.elem_key n) in let dpds_marks = List.map get_n_mark dpds in let m = SlicingMarks.inter_marks dpds_marks in @@ -596,7 +597,7 @@ end = struct if not (SlicingMarks.is_bottom_mark m) then begin SlicingKernel.debug ~level:2 "[Fct_Slice.FctMarks.mark_visible_inputs] %a -> %a" - (!Db.Pdg.pretty_node true) node SlicingMarks.pretty_mark m; + (Pdg.Api.pretty_node true) node SlicingMarks.pretty_mark m; PdgMarks.add_node_to_select marks (node, None) m end else marks @@ -609,15 +610,15 @@ end = struct let mark_visible_output ff_marks = let pdg, _ = ff_marks in try - let out_node = !Db.Pdg.find_ret_output_node pdg in - let dpds = !Db.Pdg.direct_dpds pdg out_node in + let out_node = Pdg.Api.find_ret_output_node pdg in + let dpds = Pdg.Api.direct_dpds pdg out_node in let get_n_mark n = get_mark ff_marks (PdgTypes.Node.elem_key n) in let dpds_marks = List.map get_n_mark dpds in let m = SlicingMarks.inter_marks dpds_marks in if not (SlicingMarks.is_bottom_mark m) then begin SlicingParameters.debug ~level:2 "[Fct_Slice.FctMarks.mark_visible_outputs] %a -> %a" - (!Db.Pdg.pretty_node true) out_node SlicingMarks.pretty_mark m; + (Pdg.Api.pretty_node true) out_node SlicingMarks.pretty_mark m; let select = PdgMarks.add_node_to_select [] (out_node, None) m in let to_prop = mark_and_propagate ff_marks select in assert (to_prop = PropMark.empty_to_prop); () @@ -634,10 +635,10 @@ end = struct with PdgIndex.CallStatement -> assert false with Not_found -> SlicingMarks.bottom_mark in - Format.fprintf fmt "%a : %a" (!Db.Pdg.pretty_node true) node + Format.fprintf fmt "%a : %a" (Pdg.Api.pretty_node true) node SlicingMarks.pretty_mark m in - !Db.Pdg.iter_nodes print_node pdg + Pdg.Api.iter_nodes print_node pdg let debug_marked_ff fmt ff = Format.fprintf fmt "@[<hv>Print slice =@ %s@]" (SlicingMacros.ff_name ff); @@ -663,7 +664,7 @@ let get_called_slice ff call = let _pretty_node_marks fmt marks = let print fmt (n, m) = - (!Db.Pdg.pretty_node true) fmt n; SlicingMarks.pretty_mark fmt m + (Pdg.Api.pretty_node true) fmt n; SlicingMarks.pretty_mark fmt m in Format.fprintf fmt "%a" (fun fmt x -> List.iter (print fmt) x) marks @@ -1000,7 +1001,7 @@ let get_call_in_nodes called_kf call_info called_in_zone = let _, nodes, in_zone = List.fold_left check_param (1, [], called_in_zone) param_list in - let impl_in_nodes, undef = !Db.Pdg.find_location_nodes_at_stmt + let impl_in_nodes, undef = Pdg.Api.find_location_nodes_at_stmt pdg_caller call_stmt ~before:true in_zone in (nodes @ impl_in_nodes), undef @@ -1232,7 +1233,7 @@ let apply_missing_inputs ff call missing_inputs = assert (not (SlicingMarks.is_bottom_mark m)); match sel with | PdgMarks.SelNode (n, _) - when (!Db.Pdg.node_key n = PdgIndex.Key.top_input) -> true + when (Pdg.Api.node_key n = PdgIndex.Key.top_input) -> true | _ -> visible_top tl in let is_top_visible = visible_top input_marks in *) diff --git a/src/plugins/slicing/fct_slice.mli b/src/plugins/slicing/fct_slice.mli index 6ea3a114edbdc847d41731dc0d04e4ec1dd20157..a6dd86470f6aa83f972912dad981089fbfeb2468 100644 --- a/src/plugins/slicing/fct_slice.mli +++ b/src/plugins/slicing/fct_slice.mli @@ -23,6 +23,8 @@ open SlicingInternals open Cil_types +open Pdg_types + (** Return [true] if the source function is called * (even indirectly via transitivity) from a [Slice.t]. *) val is_src_fun_called : diff --git a/src/plugins/slicing/frama-c-slicing.opam b/src/plugins/slicing/frama-c-slicing.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/slicing/gui/dune b/src/plugins/slicing/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..ddc359106faec271bf503a990b59e01e7e6177ea --- /dev/null +++ b/src/plugins/slicing/gui/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +( library + (name slicing_gui) + (public_name frama-c-slicing.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Slicing :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-slicing.core) +) + +(plugin (optional) (name slicing-gui) (libraries frama-c-slicing.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/slicing/register_gui.ml b/src/plugins/slicing/gui/register_gui.ml similarity index 100% rename from src/plugins/slicing/register_gui.ml rename to src/plugins/slicing/gui/register_gui.ml diff --git a/src/plugins/slicing/register_gui.mli b/src/plugins/slicing/gui/register_gui.mli similarity index 100% rename from src/plugins/slicing/register_gui.mli rename to src/plugins/slicing/gui/register_gui.mli diff --git a/src/plugins/slicing/printSlice.ml b/src/plugins/slicing/printSlice.ml index faa275ee37bf95e7489066f89220042821c4e219..535e841b34be8791091c1f102f0074fafb09fa86 100644 --- a/src/plugins/slicing/printSlice.ml +++ b/src/plugins/slicing/printSlice.ml @@ -26,6 +26,8 @@ open Cil_types +open Pdg_types + (**/**) let find_sub_stmts st = match st.skind with @@ -334,7 +336,7 @@ let build_dot_project filename title = let print_fct_stmts fmt kf = try - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in print_fct_from_pdg fmt pdg; Format.pp_print_flush fmt () with Not_found -> () diff --git a/src/plugins/slicing/printSlice.mli b/src/plugins/slicing/printSlice.mli index dbf55bac1d788e64a6a64727a937478b5402a153..f3ad3570b12b39cc771b39339d2277b03384d5ba 100644 --- a/src/plugins/slicing/printSlice.mli +++ b/src/plugins/slicing/printSlice.mli @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open Pdg_types + val print_fct_from_pdg : Format.formatter -> ?ff:SlicingInternals.fct_slice -> PdgTypes.Pdg.t -> unit diff --git a/src/plugins/slicing/slicingActions.ml b/src/plugins/slicing/slicingActions.ml index 3529e42201527f028e136480bc7018d6c08d738a..0f8410e0446c633e8f855b3425c5993cfa613999 100644 --- a/src/plugins/slicing/slicingActions.ml +++ b/src/plugins/slicing/slicingActions.ml @@ -27,6 +27,8 @@ (**/**) +open Pdg_types + type select = SlicingTypes.sl_mark PdgMarks.select type n_or_d_marks = (SlicingInternals.node_or_dpds * SlicingInternals.pdg_mark) list @@ -156,10 +158,10 @@ let mk_appli_select_calls fi = SlicingInternals.CrAppli (SlicingInternals.CaCall let mk_crit_mark_calls fi_caller to_call mark = let select = try let caller = SlicingMacros.get_fi_kf fi_caller in - let pdg_caller = !Db.Pdg.get caller in - let call_stmts = !Db.Pdg.find_call_stmts ~caller to_call in + let pdg_caller = Pdg.Api.get caller in + let call_stmts = Pdg.Api.find_call_stmts ~caller to_call in let stmt_mark stmt = - let stmt_ctrl_node = !Db.Pdg.find_call_ctrl_node pdg_caller stmt in + let stmt_ctrl_node = Pdg.Api.find_call_ctrl_node pdg_caller stmt in (PdgMarks.mk_select_node stmt_ctrl_node, mark) in let select = List.map stmt_mark call_stmts in @@ -182,7 +184,7 @@ let mk_crit_add_output_marks ff select = (* let mk_crit_add_all_outputs_mark ff mark = let pdg = SlicingMacros.get_ff_pdg ff in - let nodes = !Db.Pdg.find_all_outputs_nodes pdg in + let nodes = Pdg.Api.find_all_outputs_nodes pdg in let nd_m = build_simple_node_selection mark in let select = mk_mark_nodes nodes nd_m in mk_ff_user_crit ff select @@ -206,7 +208,7 @@ let rec print_nd_and_mark_list fmt ndm_list = print_nd_and_mark fmt x; print_nd_and_mark_list fmt ndm_list let print_nodes fmt nodes = - let print n = Format.fprintf fmt "%a " (!Db.Pdg.pretty_node true) n in + let print n = Format.fprintf fmt "%a " (Pdg.Api.pretty_node true) n in List.iter print nodes let print_node_mark fmt n z m = diff --git a/src/plugins/slicing/slicingActions.mli b/src/plugins/slicing/slicingActions.mli index 975252aaa930ef6d2fe39aa93fe626a20a5c655a..081e5bbb6822e1adb85919bfc86037cb7b9a62f6 100644 --- a/src/plugins/slicing/slicingActions.mli +++ b/src/plugins/slicing/slicingActions.mli @@ -22,6 +22,9 @@ open SlicingTypes open Cil_types + +open Pdg_types + open SlicingInternals type select = sl_mark PdgMarks.select @@ -43,7 +46,7 @@ val build_node_and_dpds_selection : ?nd_marks:n_or_d_marks -> sl_mark -> n_or_d_marks val translate_crit_to_select : - Db.Pdg.t -> ?to_select:select -> + Pdg.Api.t -> ?to_select:select -> ((PdgTypes.Node.t * Locations.Zone.t option) list * n_or_d_marks) list -> select diff --git a/src/plugins/slicing/slicingCmds.mli b/src/plugins/slicing/slicingCmds.mli index a54c67ba31adc7806433769f1d1ca5cb56d70666..693aa337f1c05aa23fbf27b9680e3a132ab2c66b 100644 --- a/src/plugins/slicing/slicingCmds.mli +++ b/src/plugins/slicing/slicingCmds.mli @@ -22,6 +22,8 @@ open Cil_types +open Pdg_types + (* TODO: This .mli exists mainly to avoid problems with 'make -j'. This API is too vast and must be simplified. For example, functions should not receive variables as names (ie. strings) but directly as zones, possibly diff --git a/src/plugins/slicing/slicingInternals.ml b/src/plugins/slicing/slicingInternals.ml index 4169f6937d3d208c157d24e958faf9d96b4aea93..df18b5d589c2cbff6be1b02017156f92ce4478fa 100644 --- a/src/plugins/slicing/slicingInternals.ml +++ b/src/plugins/slicing/slicingInternals.ml @@ -27,6 +27,8 @@ open Cil_datatype +open Pdg_types + (** {3 About options} *) (** associate a level to each function in order to control how it will be diff --git a/src/plugins/slicing/slicingInternals.mli b/src/plugins/slicing/slicingInternals.mli index 0e6dc51a49ccfd353bbe3d0e3c6729e68a48eb96..2c7de6f72a77653826a563428b842f379e2d204c 100644 --- a/src/plugins/slicing/slicingInternals.mli +++ b/src/plugins/slicing/slicingInternals.mli @@ -27,6 +27,8 @@ open Cil_datatype +open Pdg_types + (** {3 About options} *) (** associate a level to each function in order to control how it will be diff --git a/src/plugins/slicing/slicingMacros.ml b/src/plugins/slicing/slicingMacros.ml index d221c7299c34279593def3da2e49322dd59c3e88..56dc2b438bd9b2024a9d642932e6aef85e96230b 100644 --- a/src/plugins/slicing/slicingMacros.ml +++ b/src/plugins/slicing/slicingMacros.ml @@ -28,6 +28,8 @@ open Cil_types +open Pdg_types + (**/**) (** {2 Options} *) @@ -127,7 +129,7 @@ let get_pdg_kf pdg = PdgTypes.Pdg.get_kf pdg (** {4 getting PDG} *) -let get_fi_pdg fi = let kf = get_fi_kf fi in !Db.Pdg.get kf +let get_fi_pdg fi = let kf = get_fi_kf fi in Pdg.Api.get kf let get_ff_pdg ff = get_fi_pdg ff.SlicingInternals.ff_fct diff --git a/src/plugins/slicing/slicingMacros.mli b/src/plugins/slicing/slicingMacros.mli index 04e20ee753e5287e06af6884d83120043d6c562b..427b60450b8ccffe98994cb4c62dac41866746a0 100644 --- a/src/plugins/slicing/slicingMacros.mli +++ b/src/plugins/slicing/slicingMacros.mli @@ -24,6 +24,8 @@ functions below should be inlined, as there is no good reason to treat those types as semi-private *) +open Pdg_types + open SlicingInternals val str_level_option : level_option -> string @@ -40,8 +42,8 @@ val ff_src_name : fct_slice -> string val get_fi_kf : fct_info -> Cil_types.kernel_function val get_ff_kf : fct_slice -> Cil_types.kernel_function val get_pdg_kf : PdgTypes.Pdg.t -> Kernel_function.t -val get_fi_pdg : fct_info -> Db.Pdg.t -val get_ff_pdg : fct_slice -> Db.Pdg.t +val get_fi_pdg : fct_info -> Pdg.Api.t +val get_ff_pdg : fct_slice -> Pdg.Api.t val ff_slicing_level : fct_slice -> level_option val change_fi_slicing_level : fct_info -> level_option -> unit val change_slicing_level : Kernel_function.t -> int -> unit diff --git a/src/plugins/slicing/slicingMarks.ml b/src/plugins/slicing/slicingMarks.ml index d32603122c23f6479a4139c1d7f4194016ba25ca..77e2c60002dc6e95b15e94a4df90e970610dc68b 100644 --- a/src/plugins/slicing/slicingMarks.ml +++ b/src/plugins/slicing/slicingMarks.ml @@ -22,6 +22,8 @@ (** Everything related with the marks. Mainly quite low level function. *) +open Pdg_types + (**/**) let debug = false diff --git a/src/plugins/slicing/slicingMarks.mli b/src/plugins/slicing/slicingMarks.mli index d398c3967fdaec9c47b1e2aa9a4cbd5fc79a47af..fd4505c96de75d7990f83b99007cd56f8c7f1894 100644 --- a/src/plugins/slicing/slicingMarks.mli +++ b/src/plugins/slicing/slicingMarks.mli @@ -22,6 +22,8 @@ open SlicingTypes +open Pdg_types + val bottom_mark : sl_mark val mk_user_mark : data:bool -> addr:bool -> ctrl:bool -> sl_mark diff --git a/src/plugins/slicing/slicingProject.ml b/src/plugins/slicing/slicingProject.ml index 27cca02339737ad74f510c4dfec8679ccc6b8a34..70ee325043535f43c8ae87624cf22f940addbc75 100644 --- a/src/plugins/slicing/slicingProject.ml +++ b/src/plugins/slicing/slicingProject.ml @@ -24,6 +24,8 @@ (**/**) +open Pdg_types + module T = SlicingInternals module M = SlicingMacros diff --git a/src/plugins/slicing/slicingSelect.ml b/src/plugins/slicing/slicingSelect.ml index 25b922ab7f417778765b40c4bc8eeb43efc48ae6..cf279d65247463b02cf17fc8c0155f90ea46b625 100644 --- a/src/plugins/slicing/slicingSelect.ml +++ b/src/plugins/slicing/slicingSelect.ml @@ -23,6 +23,8 @@ open Cil_types open Cil_datatype +open Pdg_types + (* ---------------------------------------------------------------------- *) (** {1 For internal use} *) @@ -72,7 +74,7 @@ let basic_add_select kf select nodes ?(undef) nd_marks = match sel with | SlicingInternals.CuTop _ -> select | SlicingInternals.CuSelect sel -> - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let nodes = List.map (fun n -> (n, None) (*TODO: add z_part ? *)) nodes in (* let nd_marks = SlicingActions.build_node_and_dpds_selection mark in *) @@ -89,7 +91,7 @@ let select_pdg_nodes kf ?(select=empty_db_select kf) nodes mark = SlicingParameters.debug ~level:1 "[Register.select_pdg_nodes]" ; let nd_marks = SlicingActions.build_node_and_dpds_selection mark in try basic_add_select kf select nodes nd_marks - with Db.Pdg.Top | Db.Pdg.Bottom -> + with Pdg.Api.Top | Pdg.Api.Bottom -> assert false (* if we have node, we must have a pdg somewhere ! *) let mk_select pdg sel nodes undef mark = @@ -120,9 +122,9 @@ let select_stmt_zone kf ?(select=empty_db_select kf) stmt ~before loc mark = | SlicingInternals.CuTop _ -> select | SlicingInternals.CuSelect sel -> try - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let nodes, undef = - !Db.Pdg.find_location_nodes_at_stmt pdg stmt ~before loc in + Pdg.Api.find_location_nodes_at_stmt pdg stmt ~before loc in let sel = mk_select pdg sel nodes undef mark in (fvar, sel) with @@ -138,8 +140,8 @@ let select_stmt_zone kf ?(select=empty_db_select kf) stmt ~before loc mark = (if before then "before" else "after") stmt.sid Kernel_function.pretty kf; select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select + | Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; select (** this one is similar to [select_stmt_zone] with the return statement @@ -154,10 +156,10 @@ let select_in_out_zone ~at_end ~use_undef kf select loc mark = | SlicingInternals.CuTop _ -> select | SlicingInternals.CuSelect sel -> try - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let find = - if at_end then !Db.Pdg.find_location_nodes_at_end - else !Db.Pdg.find_location_nodes_at_begin in + if at_end then Pdg.Api.find_location_nodes_at_end + else Pdg.Api.find_location_nodes_at_begin in let nodes, undef = find pdg loc in let undef = if use_undef then undef else None in let sel = mk_select pdg sel nodes undef mark in @@ -169,8 +171,8 @@ let select_in_out_zone ~at_end ~use_undef kf select loc mark = Locations.Zone.pretty loc SlicingMarks.pretty_mark mark (if at_end then "end" else "begin") Kernel_function.pretty kf; select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select + | Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; select let select_zone_at_end kf ?(select=empty_db_select kf) loc mark = select_in_out_zone ~at_end:true ~use_undef:true kf select loc mark @@ -183,9 +185,9 @@ let select_zone_at_entry kf ?(select=empty_db_select kf) loc mark = let stmt_nodes_to_select pdg stmt = try - let stmt_nodes = !Db.Pdg.find_stmt_and_blocks_nodes pdg stmt in + let stmt_nodes = Pdg.Api.find_stmt_and_blocks_nodes pdg stmt in SlicingParameters.debug ~level:2 "[Register.stmt_nodes_to_select] results on stmt %d (%a)" stmt.sid - (fun fmt l -> List.iter (!Db.Pdg.pretty_node true fmt) l) + (fun fmt l -> List.iter (Pdg.Api.pretty_node true fmt) l) stmt_nodes; stmt_nodes with Not_found -> @@ -203,23 +205,23 @@ let select_stmt_computation kf ?(select=empty_db_select kf) stmt mark = end else try - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let stmt_nodes = stmt_nodes_to_select pdg stmt in let nd_marks = SlicingActions.build_node_and_dpds_selection mark in basic_add_select kf select stmt_nodes nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select + with Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; select let select_label kf ?(select=empty_db_select kf) label mark = SlicingParameters.debug ~level:1 "[Register.select_label] on label " (* Logic_label.pretty label *); try - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let nodes = let add_label_nodes l acc = match l with | StmtLabel stmt -> let add acc l = - try !Db.Pdg.find_label_node pdg !stmt l :: acc + try Pdg.Api.find_label_node pdg !stmt l :: acc with Not_found -> acc in List.fold_left add acc (!stmt).labels @@ -230,8 +232,8 @@ let select_label kf ?(select=empty_db_select kf) label mark = in let nd_marks = SlicingActions.build_node_and_dpds_selection mark in basic_add_select kf select nodes nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select + with Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; select (** marking a call node means that a [choose_call] will have to decide that to * call according to the slicing-level, but anyway, the call will be visible. @@ -239,42 +241,42 @@ let select_label kf ?(select=empty_db_select kf) label mark = let select_minimal_call kf ?(select=empty_db_select kf) stmt m = SlicingParameters.debug ~level:1 "[Register.select_minimal_call]"; try - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in let call = check_call stmt true in - let call_node = !Db.Pdg.find_call_ctrl_node pdg call in + let call_node = Pdg.Api.find_call_ctrl_node pdg call in let nd_marks = SlicingActions.build_simple_node_selection m in basic_add_select kf select [call_node] nd_marks - with Db.Pdg.Top -> top_db_select kf m - | Db.Pdg.Bottom -> bottom_msg kf; select + with Pdg.Api.Top -> top_db_select kf m + | Pdg.Api.Bottom -> bottom_msg kf; select let select_stmt_ctrl kf ?(select=empty_db_select kf) stmt = SlicingParameters.debug ~level:1 "[Register.select_stmt_ctrl] of sid:%d" stmt.sid; let mark = SlicingMarks.mk_user_mark ~ctrl:true ~data:false ~addr:false in try - let pdg = !Db.Pdg.get kf in - let stmt_nodes = !Db.Pdg.find_simple_stmt_nodes pdg stmt in + let pdg = Pdg.Api.get kf in + let stmt_nodes = Pdg.Api.find_simple_stmt_nodes pdg stmt in let nd_marks = SlicingActions.build_ctrl_dpds_selection mark in basic_add_select kf select stmt_nodes nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + with Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; empty_db_select kf let select_entry_point kf ?(select=empty_db_select kf) mark = SlicingParameters.debug ~level:1 "[Register.select_entry_point] of %a" Kernel_function.pretty kf; try - let pdg = !Db.Pdg.get kf in - let node = !Db.Pdg.find_entry_point_node pdg in + let pdg = Pdg.Api.get kf in + let node = Pdg.Api.find_entry_point_node pdg in let nd_marks = SlicingActions.build_simple_node_selection mark in basic_add_select kf select [node] nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + with Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; empty_db_select kf let select_return kf ?(select=empty_db_select kf) mark = SlicingParameters.debug ~level:1 "[Register.select_return] of %a" Kernel_function.pretty kf; try - let pdg = !Db.Pdg.get kf in - let node = !Db.Pdg.find_ret_output_node pdg in + let pdg = Pdg.Api.get kf in + let node = Pdg.Api.find_ret_output_node pdg in let nd_marks = SlicingActions.build_simple_node_selection mark in basic_add_select kf select [node] nd_marks with @@ -283,8 +285,8 @@ let select_return kf ?(select=empty_db_select kf) mark = "@[Nothing to select for return stmt of %a@]" Kernel_function.pretty kf; select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + | Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; empty_db_select kf let select_decl_var kf ?(select=empty_db_select kf) vi mark = SlicingParameters.debug ~level:1 "[Register.select_decl_var] of %s in %a@." @@ -292,8 +294,8 @@ let select_decl_var kf ?(select=empty_db_select kf) vi mark = if vi.Cil_types.vglob (* no slicing request on globals *) then select else try - let pdg = !Db.Pdg.get kf in - let node = !Db.Pdg.find_decl_var_node pdg vi in + let pdg = Pdg.Api.get kf in + let node = Pdg.Api.find_decl_var_node pdg vi in let nd_marks = SlicingActions.build_simple_node_selection mark in basic_add_select kf select [node] nd_marks with @@ -302,8 +304,8 @@ let select_decl_var kf ?(select=empty_db_select kf) vi mark = "@[Nothing to select for %s declarationin %a@]" vi.Cil_types.vname Kernel_function.pretty kf; select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + | Pdg.Api.Top -> top_db_select kf mark + | Pdg.Api.Bottom -> bottom_msg kf; empty_db_select kf let merge_select select1 select2 = @@ -351,7 +353,7 @@ let add_crit_ff_change_call ff_caller call f_to_call = let call_ff_in_caller ~caller ~to_call = let kf_caller = SlicingMacros.get_ff_kf caller in let kf_to_call = SlicingMacros.get_ff_kf to_call in - let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller kf_to_call in + let call_stmts = Pdg.Api.find_call_stmts ~caller:kf_caller kf_to_call in let ff_to_call = SlicingInternals.CallSlice to_call in let add_change_call stmt = add_crit_ff_change_call caller stmt ff_to_call ; @@ -367,7 +369,7 @@ let call_fsrc_in_caller ~caller ~to_call = let kf_caller = SlicingMacros.get_ff_kf caller in let fi_to_call = SlicingMacros.get_kf_fi to_call in let kf_to_call = SlicingMacros.get_fi_kf fi_to_call in - let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller kf_to_call in + let call_stmts = Pdg.Api.find_call_stmts ~caller:kf_caller kf_to_call in let add_change_call stmt = add_crit_ff_change_call caller stmt (SlicingInternals.CallSrc (Some fi_to_call)) in List.iter add_change_call call_stmts @@ -375,9 +377,9 @@ let call_fsrc_in_caller ~caller ~to_call = let call_min_f_in_caller ~caller ~to_call = let kf_caller = SlicingMacros.get_ff_kf caller in let pdg = SlicingMacros.get_ff_pdg caller in - let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller to_call in + let call_stmts = Pdg.Api.find_call_stmts ~caller:kf_caller to_call in let call_nodes = - List.map (fun call -> (!Db.Pdg.find_call_ctrl_node pdg call),None) + List.map (fun call -> (Pdg.Api.find_call_ctrl_node pdg call),None) call_stmts in let m = SlicingMarks.mk_user_spare in let nd_marks = SlicingActions.build_simple_node_selection m in @@ -389,7 +391,7 @@ let is_already_selected ff db_select = match select with | SlicingInternals.CuTop _ -> assert false | SlicingInternals.CuSelect to_select -> - (* let pdg = !Db.Pdg.get (Globals.Functions.get fvar) in *) + (* let pdg = Pdg.Api.get (Globals.Functions.get fvar) in *) let new_marks = Fct_slice.filter_already_in ff to_select in let ok = if new_marks = [] then true else false in if ok then diff --git a/src/plugins/slicing/slicingSelect.mli b/src/plugins/slicing/slicingSelect.mli index c139085e9da9b6f5dd0b7925a88397f5e229405c..f68618af4ab69e2871793680ace383a3a673be89 100644 --- a/src/plugins/slicing/slicingSelect.mli +++ b/src/plugins/slicing/slicingSelect.mli @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open Pdg_types + val check_call : Cil_types.stmt -> bool -> Cil_types.stmt val print_select : @@ -69,7 +71,7 @@ val select_pdg_nodes : SlicingTypes.sl_select val mk_select : - Db.Pdg.t -> + Pdg.Api.t -> SlicingActions.select -> (PdgTypes.Node.t * Locations.Zone.t option) list -> Locations.Zone.t option -> @@ -117,7 +119,7 @@ val select_zone_at_entry : SlicingTypes.sl_select val stmt_nodes_to_select : - Db.Pdg.t -> Cil_types.stmt -> PdgTypes.Node.t list + Pdg.Api.t -> Cil_types.stmt -> PdgTypes.Node.t list val select_stmt_computation : Kernel_function.t -> diff --git a/src/plugins/slicing/slicingState.ml b/src/plugins/slicing/slicingState.ml index b51f528fe8b7d7427b7fa06fd95ecb42f94040ca..28991d806423a6408dc7202d49476160cb0c7373 100644 --- a/src/plugins/slicing/slicingState.ml +++ b/src/plugins/slicing/slicingState.ml @@ -34,7 +34,7 @@ let () = (fun () -> State_dependency_graph.add_codependencies ~onto:self - [ !Db.Pdg.self; !Db.Inputs.self_external; !Db.Outputs.self_external ]) + [ Pdg.Api.self; !Db.Inputs.self_external; !Db.Outputs.self_external ]) let get () = try P.get () diff --git a/src/plugins/slicing/slicingTransform.ml b/src/plugins/slicing/slicingTransform.ml index 5d7b4d1c5282e14d1fcfe0777d92e5d020051606..2915223eec08c36ed39b517038169b951525e899 100644 --- a/src/plugins/slicing/slicingTransform.ml +++ b/src/plugins/slicing/slicingTransform.ml @@ -26,6 +26,8 @@ open Cil_types open Cil +open Pdg_types + (**/**) module Visibility (SliceName : sig @@ -138,7 +140,7 @@ module Visibility (SliceName : sig begin SlicingParameters.debug ~level:3 "[SlicingTransform.Visibility.all_nodes_visible] node %a invisible" - (!Db.Pdg.pretty_node true) n; + (Pdg.Api.pretty_node true) n; false end else visi @@ -173,7 +175,7 @@ module Visibility (SliceName : sig SlicingParameters.debug ~level:2 "[SlicingTransform.Visibility.data_nodes_visible]@\n\ node %a invisible" - (!Db.Pdg.pretty_node true) n; + (Pdg.Api.pretty_node true) n; false end else visi @@ -242,10 +244,10 @@ module Visibility (SliceName : sig | Iproto -> false | Iff {slice = ff} -> let kf = SlicingMacros.get_ff_kf ff in - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in try let ctrl_nodes, decl_nodes, data_info = - !Db.Pdg.find_code_annot_nodes pdg stmt annot + Pdg.Api.find_code_annot_nodes pdg stmt annot in let data_visible = data_nodes_visible ff (decl_nodes, data_info) in let visible = ((all_nodes_visible ff ctrl_nodes) && data_visible) in @@ -276,9 +278,9 @@ module Visibility (SliceName : sig | Iproto -> true | Iff {slice = ff} -> let kf = SlicingMacros.get_ff_kf ff in - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in try - let nodes = !Db.Pdg.find_fun_precond_nodes pdg p in + let nodes = Pdg.Api.find_fun_precond_nodes pdg p in data_nodes_visible ff nodes with NoDataInfo -> all_logic_var_visible ff p @@ -296,9 +298,9 @@ module Visibility (SliceName : sig | Iproto -> true | Iff {slice = ff} -> let kf = SlicingMacros.get_ff_kf ff in - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in try - let nodes = !Db.Pdg.find_fun_postcond_nodes pdg p in + let nodes = Pdg.Api.find_fun_postcond_nodes pdg p in data_nodes_visible ff nodes with NoDataInfo -> all_logic_var_visible ff p @@ -316,9 +318,9 @@ module Visibility (SliceName : sig | Iproto -> true | Iff {slice = ff} -> let kf = SlicingMacros.get_ff_kf ff in - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in try - let nodes = !Db.Pdg.find_fun_variant_nodes pdg v in + let nodes = Pdg.Api.find_fun_variant_nodes pdg v in data_nodes_visible ff nodes with NoDataInfo -> all_logic_var_visible_term ff v in SlicingParameters.debug ~level:2 "[SlicingTransform.Visibility.fun_variant_visible] -> %s" diff --git a/src/plugins/slicing/slicingTypes.ml b/src/plugins/slicing/slicingTypes.ml index 343d08a8f13a70053957f7cbb3de2133a0394a8c..e370df2269d2401259075c7ed22268b86ea5f6a2 100644 --- a/src/plugins/slicing/slicingTypes.ml +++ b/src/plugins/slicing/slicingTypes.ml @@ -22,6 +22,8 @@ (** Slicing module types. *) +open Pdg_types + exception Slicing_Internal_Error of string exception ChangeCallErr of string exception PtrCallExpr diff --git a/src/plugins/sparecode/Sparecode.ml b/src/plugins/sparecode/Sparecode.ml new file mode 100644 index 0000000000000000000000000000000000000000..660ca4774b72e267a55957ea8de1a97da2748062 --- /dev/null +++ b/src/plugins/sparecode/Sparecode.ml @@ -0,0 +1,23 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module Register = Register diff --git a/src/plugins/sparecode/dune b/src/plugins/sparecode/dune new file mode 100644 index 0000000000000000000000000000000000000000..e507fff605efef3548c1a0e13b597448fe958ab6 --- /dev/null +++ b/src/plugins/sparecode/dune @@ -0,0 +1,45 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Sparecode:" %{lib-available:frama-c-sparecode.core} "\n") + (echo " - Users:" %{lib-available:frama-c-users.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + (echo " - Inout:" %{lib-available:frama-c-inout.core} "\n") + (echo " - Pdg:" %{lib-available:frama-c-pdg.core} "\n") + ) + ) +) + +(library + (name Sparecode) + (optional) + (public_name frama-c-sparecode.core) + (private_modules sparecode_params globs spare_marks transform register) + (flags :standard -open Frama_c_kernel) + (libraries frama-c.kernel frama-c-users.core frama-c-eva.core frama-c-pdg.core frama-c-inout.core) +) + +(plugin (optional) (name sparecode) (libraries frama-c-sparecode.core) (site (frama-c plugins))) diff --git a/src/plugins/sparecode/dune-project b/src/plugins/sparecode/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..99f06f41fd6cf50c41b7afc9534a29c862e6da01 --- /dev/null +++ b/src/plugins/sparecode/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-sparecode) +(using dune_site 0.1) diff --git a/src/plugins/sparecode/frama-c-sparecode.opam b/src/plugins/sparecode/frama-c-sparecode.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/sparecode/globs.ml b/src/plugins/sparecode/globs.ml index 860f24fa634864535634f4222a038748df3e161c..7db1fca385b380e152d9e8889c5e2af06be6a8e9 100644 --- a/src/plugins/sparecode/globs.ml +++ b/src/plugins/sparecode/globs.ml @@ -160,7 +160,7 @@ let () = (fun () -> State_dependency_graph.add_codependencies ~onto:Result.self - [ !Db.Pdg.self; !Db.Outputs.self_external ]) + [ Pdg.Api.self; !Db.Outputs.self_external ]) let rm_unused_decl = Result.memo diff --git a/src/plugins/sparecode/register.ml b/src/plugins/sparecode/register.ml index b684d758b6bc1fcc216d63385568821a4f334c92..3ac3e1d4ccbea47722282482cdfd82e826cba46f 100644 --- a/src/plugins/sparecode/register.ml +++ b/src/plugins/sparecode/register.ml @@ -43,7 +43,7 @@ let () = (fun () -> State_dependency_graph.add_codependencies ~onto:Result.self - [ !Db.Pdg.self; !Db.Outputs.self_external ]) + [ Pdg.Api.self; !Db.Outputs.self_external ]) module P = Sparecode_params diff --git a/src/plugins/sparecode/spare_marks.ml b/src/plugins/sparecode/spare_marks.ml index 2f0c83674a97d3f143b99a5c84ed36342cbb6ae6..bc433062ccc8929f0be579864f7878a07a6f8cee 100644 --- a/src/plugins/sparecode/spare_marks.ml +++ b/src/plugins/sparecode/spare_marks.ml @@ -20,12 +20,14 @@ (* *) (**************************************************************************) +open Pdg_types + let debug n format = Sparecode_params.debug ~level:n format let fatal fmt = Sparecode_params.fatal fmt (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (** The project is composed of [FctIndex] marked with [BoolMark] - * to be used by [Pdg.Register.F_Proj], and another table to store if a function + * to be used by [Pdg.Api.Marks.F_Proj], and another table to store if a function * is visible (useful for Top PDG). *) (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) @@ -122,7 +124,7 @@ module Config = struct end -module ProjBoolMarks = Pdg.Register.F_Proj (Config) +module ProjBoolMarks = Pdg.Api.Marks.F_Proj (Config) type proj = ProjBoolMarks.t * unit KfTopVisi.t type fct = ProjBoolMarks.fct @@ -172,7 +174,7 @@ let rec add_pdg_selection to_select pdg sel_mark = match to_select with | [] -> let l = match sel_mark with None -> [] | Some m -> [m] in [(pdg, l)] | (p, ln) :: tl -> - if Db.Pdg.from_same_fun p pdg + if Pdg.Api.from_same_fun p pdg then let ln = match sel_mark with None -> ln | Some sel_mark -> sel_mark::ln @@ -273,7 +275,7 @@ let rec process_call_inputs proj = (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) let select_entry_point proj _kf pdg = - let ctrl = !Db.Pdg.find_entry_point_node pdg in + let ctrl = Pdg.Api.find_entry_point_node pdg in let to_select = add_node_to_select true [] None ctrl in select_pdg_elements proj pdg to_select @@ -281,9 +283,9 @@ let select_all_outputs proj kf pdg = let outputs = !Db.Outputs.get_external kf in debug 1 "@[selecting output zones %a@]" Locations.Zone.pretty outputs; try - let nodes, undef = !Db.Pdg.find_location_nodes_at_end pdg outputs in + let nodes, undef = Pdg.Api.find_location_nodes_at_end pdg outputs in let nodes = - try ((!Db.Pdg.find_ret_output_node pdg),None) :: nodes + try ((Pdg.Api.find_ret_output_node pdg),None) :: nodes with Not_found -> nodes in let nodes_and_co = ([], [], Some (nodes, undef)) in @@ -308,7 +310,7 @@ class annot_visitor ~filter pdg = object (self) let stmt = Option.get self#current_stmt in debug 1 "selecting annotation : %a @." Printer.pp_code_annotation annot; - let info = !Db.Pdg.find_code_annot_nodes pdg stmt annot in + let info = Pdg.Api.find_code_annot_nodes pdg stmt annot in to_select <- add_nodes_and_undef_to_select true info to_select with Not_found -> () (* unreachable *) @@ -322,7 +324,7 @@ end let select_annotations ~select_annot ~select_slice_pragma proj = let visit_fun kf = debug 1 "look for annotations in function %a@." Kernel_function.pretty kf; - let pdg = !Db.Pdg.get kf in + let pdg = Pdg.Api.get kf in if PdgTypes.Pdg.is_top pdg then debug 1 "pdg top: skip annotations" else if PdgTypes.Pdg.is_bottom pdg then debug 1 "pdg bottom: skip annotations" @@ -357,7 +359,7 @@ let select_useful_things ~select_annot ~select_slice_pragma kf_entry = assert (!call_in_to_check = []); debug 1 "selecting function %a outputs and entry point@." Kernel_function.pretty kf_entry; - let pdg = !Db.Pdg.get kf_entry in + let pdg = Pdg.Api.get kf_entry in if PdgTypes.Pdg.is_top pdg then KfTopVisi.set proj kf_entry else if PdgTypes.Pdg.is_bottom pdg diff --git a/src/plugins/sparecode/spare_marks.mli b/src/plugins/sparecode/spare_marks.mli index 92a003570b041fa3cf7509dbaa3efff0b6dae067..d6e60878d7c11c498afe8e03592bf2a2331fb8ff 100644 --- a/src/plugins/sparecode/spare_marks.mli +++ b/src/plugins/sparecode/spare_marks.mli @@ -21,6 +21,7 @@ (**************************************************************************) open Cil_types +open Pdg_types type proj type fct diff --git a/src/plugins/sparecode/transform.ml b/src/plugins/sparecode/transform.ml index e2280ec81b2c4ad240ddcd1902c29356572e55d9..0e3ae5a6f1b496506585981e777937a9a7ef387a 100644 --- a/src/plugins/sparecode/transform.ml +++ b/src/plugins/sparecode/transform.ml @@ -23,6 +23,8 @@ open Cil_types open Cil +open Pdg_types + module BoolInfo = struct type proj = Spare_marks.proj type fct = Spare_marks.fct option * Kernel_function.t @@ -41,7 +43,7 @@ module BoolInfo = struct | Some fm -> Spare_marks.key_visible fm key in Sparecode_params.debug ~level:3 "%s : %a -> %b" - txt !Db.Pdg.pretty_key key visible; + txt Pdg.Api.pretty_key key visible; visible let param_visible (fm,_) n = diff --git a/src/plugins/studia/Makefile.in b/src/plugins/studia/Makefile.in deleted file mode 100644 index 49711fab8c04a5244d667aa4ed039293ee26ab36..0000000000000000000000000000000000000000 --- a/src/plugins/studia/Makefile.in +++ /dev/null @@ -1,64 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -################### -# Plug-in Setting # -################### - -PLUGIN_DIR ?=. -PLUGIN_ENABLE:=@ENABLE_STUDIA@ -PLUGIN_NAME:=Studia -PLUGIN_CMO:= options writes reads studia_request -PLUGIN_GUI_CMO:= studia_gui -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -PLUGIN_DEPENDENCIES:=Eva -PLUGIN_NO_TEST:=no - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(Studia_DIR)/Makefile: $(Studia_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/studia/Studia.mli b/src/plugins/studia/Studia.ml similarity index 55% rename from src/plugins/studia/Studia.mli rename to src/plugins/studia/Studia.ml index a7f52544d470a5ea45e313c4adbfe8abc5582115..b6ab1c545caf0a3bf41dd5f1175cb1cb2f890780 100644 --- a/src/plugins/studia/Studia.mli +++ b/src/plugins/studia/Studia.ml @@ -21,30 +21,41 @@ (**************************************************************************) (** Computations of the statements that write a given memory zone. *) -module Writes: sig +include + (struct + module Writes = Writes + module Reads = Reads + end : + sig + module Writes: sig - (** Given an effect [e], something is directly modified by [e] (through an - affectation, or through a call to a leaf function) if [direct] holds, and - indirectly (through the effects of a call) otherwise. *) - type effects = { - direct: bool (** Direct affectation [lv = ...], or modification through - a call to a leaf function. *); - indirect: bool (** Modification inside the body of called function - [f(...)]*); - } + (** Given an effect [e], something is directly modified by [e] (through an + affectation, or through a call to a leaf function) if [direct] holds, and + indirectly (through the effects of a call) otherwise. *) + type effects = { + direct: bool (** Direct affectation [lv = ...], or modification through + a call to a leaf function. *); + indirect: bool (** Modification inside the body of called function + [f(...)]*); + } - val compute: Locations.Zone.t -> (Cil_types.stmt * effects) list - (** [compute z] finds all the statements that modifies [z], and for each - statement, indicates whether the modification is direct or indirect. *) + val compute: Locations.Zone.t -> (Cil_types.stmt * effects) list + (** [compute z] finds all the statements that modifies [z], and for each + statement, indicates whether the modification is direct or indirect. *) -end + end -(** Computations of the statements that read a given memory zone. *) -module Reads: sig + (** Computations of the statements that read a given memory zone. *) + module Reads: sig - val compute: Locations.Zone.t -> (Cil_types.stmt * Writes.effects) list - (** [compute z] finds all the statements that read [z]. The [effects] - information indicates whether the read occur on the given statement, - or through an inner call for [Call] instructions. *) + val compute: Locations.Zone.t -> (Cil_types.stmt * Writes.effects) list + (** [compute z] finds all the statements that read [z]. The [effects] + information indicates whether the read occur on the given statement, + or through an inner call for [Call] instructions. *) -end + end + end) + +(** {2 Internal use only} *) + +module Options = Options diff --git a/src/plugins/studia/dune b/src/plugins/studia/dune new file mode 100644 index 0000000000000000000000000000000000000000..ec9f50f8d7d965647b316e4cf09b9751f731b305 --- /dev/null +++ b/src/plugins/studia/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Studia:" %{lib-available:frama-c-studia.core} "\n") + (echo " - Eva:" %{lib-available:frama-c-eva.core} "\n") + ) + ) +) + +( library + (name studia) + (optional) + (public_name frama-c-studia.core) + (flags -open Frama_c_kernel :standard) + (libraries frama-c.kernel frama-c-eva.core) +) + +(plugin (optional) (name studia) (libraries frama-c-studia.core) (site (frama-c plugins))) diff --git a/src/plugins/studia/dune-project b/src/plugins/studia/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..2eedff1444093bc8ff4f7c1571a531842fa3ecdb --- /dev/null +++ b/src/plugins/studia/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-studia) +(using dune_site 0.1) diff --git a/src/plugins/studia/frama-c-studia.opam b/src/plugins/studia/frama-c-studia.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/studia/gui/dune b/src/plugins/studia/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..986fe2219cc2b83626e96219a65e6a9d0ed9e52d --- /dev/null +++ b/src/plugins/studia/gui/dune @@ -0,0 +1,44 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Studia GUI:" %{lib-available:frama-c-studia.gui} "\n") + (echo " - Frama-C GUI:" %{lib-available:frama-c.gui} "\n") + (echo " - Eva GUI:" %{lib-available:frama-c-eva.gui} "\n") + (echo " - Studia:" %{lib-available:frama-c-studia.core} "\n") + + ) + ) +) + +( library + (name studia_gui) + (public_name frama-c-studia.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Studia :standard -w -9) + (libraries frama-c.kernel frama-c.gui frama-c-eva.gui frama-c-studia.core) +) + +(plugin (optional) (name studia-gui) (libraries frama-c-studia.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/studia/studia_gui.ml b/src/plugins/studia/gui/studia_gui.ml similarity index 100% rename from src/plugins/studia/studia_gui.ml rename to src/plugins/studia/gui/studia_gui.ml diff --git a/src/plugins/studia/studia_gui.mli b/src/plugins/studia/gui/studia_gui.mli similarity index 100% rename from src/plugins/studia/studia_gui.mli rename to src/plugins/studia/gui/studia_gui.mli diff --git a/src/plugins/users/Users.ml b/src/plugins/users/Users.ml new file mode 100644 index 0000000000000000000000000000000000000000..6e7e18e6f3db23883dc2c59ad81bbffc7cdd12dd --- /dev/null +++ b/src/plugins/users/Users.ml @@ -0,0 +1,26 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(* $Id: Users.mli,v 1.5 2008-04-01 09:25:22 uid568 Exp $ *) +(** Functions used by another function. + @see <../users/index.html> internal documentation. *) +module Users_register = Users_register diff --git a/src/plugins/users/dune b/src/plugins/users/dune new file mode 100644 index 0000000000000000000000000000000000000000..99791a84c9048189c599b8b1dc5693f58aca746d --- /dev/null +++ b/src/plugins/users/dune @@ -0,0 +1,41 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Users:" %{lib-available:frama-c-users.core} "\n") + (echo " - Callgraph:" %{lib-available:frama-c-callgraph.core} "\n") + ) + ) +) + +(library + (name Users) + (optional) + (public_name frama-c-users.core) + (flags -open Frama_c_kernel :standard) + (libraries frama-c.kernel frama-c-callgraph.core) +) + +(plugin (optional) (name users) (libraries frama-c-users.core) (site (frama-c plugins))) diff --git a/src/plugins/users/dune-project b/src/plugins/users/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..757332f51263519c8544aea6b3ebbb0325f0c329 --- /dev/null +++ b/src/plugins/users/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-users) +(using dune_site 0.1) diff --git a/src/plugins/users/frama-c-users.opam b/src/plugins/users/frama-c-users.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/value/.merlin b/src/plugins/value/.merlin deleted file mode 100644 index 4a78234301d143f5fd80e27a0a5e2fcc90106c19..0000000000000000000000000000000000000000 --- a/src/plugins/value/.merlin +++ /dev/null @@ -1,5 +0,0 @@ -B ./** -S ./** -B ../value_types/** -S ../value_types/** -REC diff --git a/src/plugins/impact/Impact.mli b/src/plugins/value/Eva.ml.in similarity index 64% rename from src/plugins/impact/Impact.mli rename to src/plugins/value/Eva.ml.in index 83f3ffda6440089966ef8fd8a071754ed8a60dd7..9931040bf9c5e1673271d57bac9d1f99a26c09d9 100644 --- a/src/plugins/impact/Impact.mli +++ b/src/plugins/value/Eva.ml.in @@ -20,26 +20,28 @@ (* *) (**************************************************************************) -(* $Id: Impact.mli,v 1.1 2008-04-08 14:59:02 uid568 Exp $ *) - -open Cil_types - -(** Impact analysis. - @see <../impact/index.html> internal documentation. *) -module Register : sig - val compute_pragmas: (unit -> stmt list) - (** Compute the impact analysis from the impact pragma in the program. - Print and slice the results according to the parameters -impact-print - and -impact-slice. - @return the impacted statements *) - - val from_stmt: (stmt -> stmt list) - (** Compute the impact analysis of the given statement. - @return the impacted statements *) - - val from_nodes: - (kernel_function -> PdgTypes.Node.t list -> PdgTypes.NodeSet.t) - (** Compute the impact analysis of the given set of PDG nodes, - that come from the given function. - @return the impacted nodes *) +module Private = struct + module Abstractions = Eva__Abstractions + module Analysis = Eva__Analysis + module Alarmset = Eva__Alarmset + module Parameters = Parameters + module Main_values = Eva__Main_values + module Eval = Eva__Eval + module Eval_terms = Eva__Eval_terms + module Eva_utils = Eva_utils + module Eva_results = Eva_results + module Self = Self + module Red_statuses = Eva__Red_statuses + module Abstract_value = Eva__Abstract_value + module Abstract_domain = Eva__Abstract_domain + module Active_behaviors = Active_behaviors + module Function_calls = Function_calls + module Simple_memory = Eva__Simple_memory + module Structure = Eva__Structure + module Eval_typ = Eva__Eval_typ + module Eval_op = Eva__Eval_op + module Domain_builder = Eva__Domain_builder + module Main_locations = Eva__Main_locations + module Eval_annots = Eva__Eval_annots + module Eva_dynamic = Eva_dynamic end diff --git a/src/plugins/value/Eva.mli.in b/src/plugins/value/Eva.mli.in new file mode 100644 index 0000000000000000000000000000000000000000..ee97ccf3957db006495ed5f04f863e94bfd56989 --- /dev/null +++ b/src/plugins/value/Eva.mli.in @@ -0,0 +1,54 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** ../.. *) + +(** For internal use *) +(* Private first so that we do not override internal modules with public ones *) + +module Private: sig + module Abstractions = Abstractions + module Analysis = Analysis + module Alarmset = Alarmset + module Parameters = Parameters + module Main_values = Main_values + module Eval = Eval + module Eva_utils = Eva_utils + module Eva_results = Eva_results + module Self = Self + module Eval_terms = Eval_terms + module Red_statuses = Red_statuses + module Abstract_value = Abstract_value + module Abstract_domain = Abstract_domain + module Active_behaviors = Active_behaviors + module Function_calls = Function_calls + module Simple_memory = Simple_memory + module Structure = Structure + module Eval_typ = Eval_typ + module Eval_op = Eval_op + module Domain_builder = Domain_builder + module Main_locations = Main_locations + module Eval_annots = Eval_annots + module Eva_dynamic = Eva_dynamic +end + +(** ../.. *) diff --git a/src/plugins/value/domains/abstract_domain.mli b/src/plugins/value/domains/abstract_domain.ml similarity index 100% rename from src/plugins/value/domains/abstract_domain.mli rename to src/plugins/value/domains/abstract_domain.ml diff --git a/src/plugins/value/domains/cvalue/builtins.mli b/src/plugins/value/domains/cvalue/builtins.mli index 3b53316a23cae6666507edafc9fa73385839c680..3f014634977b758a69b701fc97b04d6ef5949a93 100644 --- a/src/plugins/value/domains/cvalue/builtins.mli +++ b/src/plugins/value/domains/cvalue/builtins.mli @@ -97,7 +97,7 @@ val is_builtin_overridden: kernel_function -> bool val clobbered_set_from_ret: Cvalue.Model.t -> Cvalue.V.t -> Base.SetLattice.t type call = (Precise_locs.precise_location, Cvalue.V.t) Eval.call -type result = Cvalue_domain.State.t +type result = Cvalue.Model.t * Locals_scoping.clobbered_set (** Returns the cvalue builtin for a function, if any. Also returns the name of the builtin and the specification of the function; the preconditions must be diff --git a/src/plugins/value/domains/simpler_domains.mli b/src/plugins/value/domains/simpler_domains.ml similarity index 100% rename from src/plugins/value/domains/simpler_domains.mli rename to src/plugins/value/domains/simpler_domains.ml diff --git a/src/plugins/value/dune b/src/plugins/value/dune new file mode 100644 index 0000000000000000000000000000000000000000..d0285778cc47660df0c498af1f40fde13967ba14 --- /dev/null +++ b/src/plugins/value/dune @@ -0,0 +1,208 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "EVA:" %{lib-available:frama-c-eva.core} "\n") + (echo "Numerors:" %{lib-available:frama-c-eva.numerors.core} "\n") + (echo " - MLMPFR:" %{lib-available:mlmpfr} "\n") + (echo "Apron domains:" %{lib-available:frama-c-eva.apron} "\n") + (echo " - apron.octMPQ:" %{lib-available:apron.octMPQ} "\n") + (echo " - apron.boxMPQ:" %{lib-available:apron.boxMPQ} "\n") + (echo " - apron.polkaMPQ:" %{lib-available:apron.polkaMPQ} "\n") + (echo " - apron.apron:" %{lib-available:apron.apron} "\n") + ) + ) +) + +( library + (name eva) + (optional) + (public_name frama-c-eva.core) + (modules + abstract + abstract_domain + abstract_location + abstract_memory + abstract_offset + abstract_structure + abstract_value + abstractions + active_behaviors + alarmset + analysis + auto_loop_unroll + backward_formals + builtins + builtins_float + builtins_malloc + builtins_memory + builtins_misc + builtins_print_c + builtins_split + builtins_string + builtins_watchpoint + compute_functions + cvalue_backward + cvalue_callbacks + cvalue_domain + cvalue_forward + cvalue_init + cvalue_offsetmap + cvalue_specification + cvalue_transfer + domain_builder + domain_lift + domain_mode + domain_product + domain_store + equality + equality_domain + eva + eva_annotations + eva_audit + eva_dynamic + eva_perf + eva_results + eva_utils + eval + eval_annots + eval_op + eval_terms + eval_typ + evaluation + function_args + function_calls + gauges_domain + general_requests + hcexprs + initialization + inout_domain + iterator + library_functions + locals_scoping + location_lift + main_locations + main_values + mem_exec + multidim + multidim_domain + octagons + offsm_domain + offsm_value + parameters + partition + partitioning_index + partitioning_parameters + per_stmt_slevel + powerset + printer_domain + pretty_memory + recursion + red_statuses + register + results + segmentation + self + sign_domain + sign_value + simple_memory + simpler_domains + split_return + split_strategy + structure + subdivided_evaluation + summary + symbolic_locs + taint_domain + trace_partitioning + traces_domain + transfer_logic + transfer_specification + transfer_stmt + typed_memory + unit_domain + unit_tests + value_product + values_request + warn + widen + widen_hints_ext +) + +; (public_interfaces (Eva)) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel frama-c-server.core + ; frama-c-callgraph.core frama-c-rtegen.core frama-c-loop-analysis.core + ; frama-c-scope.core + ) +) + +(plugin (optional) (name eva) (libraries frama-c-eva.core) (site (frama-c plugins))) + +(rule + (targets Eva.ml Eva.mli) + (deps + gen-api.sh Eva.ml.in Eva.mli.in + engine/analysis.mli utils/results.mli parameters.mli utils/eva_annotations.mli eval.mli + domains/cvalue/builtins.mli utils/cvalue_callbacks.mli legacy/eval_terms.mli utils/eva_results.mli utils/unit_tests.mli + ) + (action (run %{deps})) +) + +( library + (name numerors) + (public_name frama-c-eva.numerors.core) + (flags -open Frama_c_kernel -open Eva.Private :standard) + (modules numerors_domain numerors_utils numerors_float numerors_interval numerors_arithmetics numerors_value) + (libraries frama-c.kernel frama-c-eva.core mlmpfr) + (optional) +) + +(plugin (optional) (name eva.numerors) (libraries frama-c-eva.numerors.core) (site (frama-c plugins))) + +( library + (name apron_domain) + (public_name frama-c-eva.apron) + (flags -open Frama_c_kernel -open Eva.Private :standard -w -9) + (modules apron_domain) + (libraries frama-c.kernel frama-c-eva.core apron.octMPQ apron.boxMPQ apron.polkaMPQ apron.apron) + (optional) +) + +;(plugin (optional) (name eva-apron) (libraries frama-c-eva.apron) (site (frama-c plugins))) + +( library + (name eva_gui) + (public_name frama-c-eva.gui) + (optional) + (modules gui_callstacks_filters gui_callstacks_manager gui_eval gui_types register_gui gui_red) +; (public_interfaces ()) + (flags -open Frama_c_kernel -open Frama_c_gui -open Eva -open Eva.Private :standard -w -9) + (libraries eva frama-c.kernel frama-c.gui) +) + +(plugin (optional) (name eva-gui) (libraries frama-c-eva.gui) (site (frama-c plugins_gui))) + +(include_subdirs unqualified) diff --git a/src/plugins/value/dune-project b/src/plugins/value/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..11c27712d8fea2942b649cb15f48c6a5991a913e --- /dev/null +++ b/src/plugins/value/dune-project @@ -0,0 +1,24 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(using dune_site 0.1) diff --git a/src/plugins/value/engine/analysis.mli b/src/plugins/value/engine/analysis.mli index 99fa1e27592fd03fa534e3473545852e7f6a656b..cd472bcd27b2e9f8b29a4c1c8e763b1fcf10710b 100644 --- a/src/plugins/value/engine/analysis.mli +++ b/src/plugins/value/engine/analysis.mli @@ -85,7 +85,7 @@ val compute : unit -> unit @raise Db.Value.Incorrect_number_of_arguments if some arguments are specified for the entry point using {!Db.Value.fun_set_args}, and an incorrect number of them is given. - @plugin development guide *) + @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *) val is_computed : unit -> bool (** Return [true] iff the Eva analysis has been done. diff --git a/src/plugins/value/frama-c-eva.opam b/src/plugins/value/frama-c-eva.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/value/gen-api.sh b/src/plugins/value/gen-api.sh index e626fff905e7d6920d563b961cacea3ad7a5166f..dea87c497c5aa1b3f4abde3ced38687892beedb8 100755 --- a/src/plugins/value/gen-api.sh +++ b/src/plugins/value/gen-api.sh @@ -23,7 +23,13 @@ set -eu -printf '(** Eva public API. +dir=$(dirname $0) + +# Generate MLI + +cat $dir/Eva.mli.in >> Eva.mli + +printf '\n(** Eva public API. The main modules are: - Analysis: run the analysis. @@ -36,15 +42,32 @@ printf '(** Eva public API. - Builtins: register ocaml builtins to be used by the cvalue domain instead of analysing the body of some C functions. - Other modules are for internal use only. *)\n' + Other modules are for internal use only. *)\n' >> Eva.mli + +printf '\n(* This file is generated. Do not edit. *)\n' >> Eva.mli + +for i in "$@" +do + if [[ ! "$i" =~ [.]in$ ]]; then + file=$(basename $i) + module=${file%.*} + Module="$(echo "${module:0:1}" | tr '[:lower:]' '[:upper:]')${module:1}" + printf '\nmodule %s: sig\n' $Module >> Eva.mli + awk '/\[@@@ api_start\]/{flag=1;next} /\[@@@ api_end\]/{flag=0} flag{ print (NF ? " ":"") $0 }' $i >> Eva.mli + printf 'end\n' >> Eva.mli + fi +done + +# Generate ML -printf '\n(* This file is generated. Do not edit. *)\n' +cat $dir/Eva.ml.in >> Eva.ml for i in "$@" do - file=$(basename $i) - module=${file%.*} - printf '\nmodule %s: sig\n' ${module^} - awk '/\[@@@ api_start\]/{flag=1;next} /\[@@@ api_end\]/{flag=0} flag{ print (NF ? " ":"") $0 }' $i - printf 'end\n' + if [[ ! "$i" =~ [.]in$ ]]; then + file=$(basename $i) + module=${file%.*} + Module="$(echo "${module:0:1}" | tr '[:lower:]' '[:upper:]')${module:1}" + printf '\nmodule %s = %s\n' $Module $Module >> Eva.ml + fi done diff --git a/src/plugins/value/values/abstract_location.mli b/src/plugins/value/values/abstract_location.ml similarity index 100% rename from src/plugins/value/values/abstract_location.mli rename to src/plugins/value/values/abstract_location.ml diff --git a/src/plugins/value/values/abstract_value.mli b/src/plugins/value/values/abstract_value.ml similarity index 100% rename from src/plugins/value/values/abstract_value.mli rename to src/plugins/value/values/abstract_value.ml diff --git a/src/plugins/variadic/.gitattributes b/src/plugins/variadic/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..f1eb44b5fe0f3b867fe537c77ac7d10c73ca97db --- /dev/null +++ b/src/plugins/variadic/.gitattributes @@ -0,0 +1,5 @@ +######################## +# HEADER_SPEC: .ignore # +######################## + +/todo.txt header_spec=.ignore diff --git a/src/plugins/variadic/.gitignore b/src/plugins/variadic/.gitignore index 0114e3d0f08985bcf97727dcde8f314ddb4410ae..b18adc61b4fbcc6e775225047b0a86a8a8a8659d 100644 --- a/src/plugins/variadic/.gitignore +++ b/src/plugins/variadic/.gitignore @@ -1,4 +1,4 @@ /configure /Makefile -/tests/ptests_config +/tests/**/dune /tests/*/result diff --git a/src/plugins/variadic/Makefile.in b/src/plugins/variadic/Makefile.in deleted file mode 100644 index d1eb8663af0792793af4ca6100f175156d607270..0000000000000000000000000000000000000000 --- a/src/plugins/variadic/Makefile.in +++ /dev/null @@ -1,75 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif - -################### -# Plug-in Setting # -################### - -PLUGIN_DIR ?= . -PLUGIN_ENABLE := @ENABLE_VARIADIC@ -PLUGIN_NAME := Variadic -PLUGIN_CMI := format_types va_types -PLUGIN_CMO := options extends environment replacements \ - format_string format_pprint format_typer format_parser \ - generic standard classify translate \ - register -PLUGIN_DISTRIBUTED := $(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure -#PLUGIN_NO_DEFAULT_TEST := no -PLUGIN_TESTS_DIRS := declared defined known erroneous -PLUGIN_DISTRIB_TESTS := \ - $(foreach dir, $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/oracle/* \ - $(filter-out result oracle,$(dir)/*)) \ - ) \ - $(filter-out result oracle,tests/*)) \ - $(foreach dir, tests $(addprefix tests/,$(PLUGIN_TESTS_DIRS)), \ - $(dir)/test_config) - -################ -# Generic part # -################ - -include $(FRAMAC_SHARE)/Makefile.dynamic - -##################################### -# Regenerating the Makefile on need # -##################################### - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -$(Variadic_DIR)/Makefile: $(Variadic_DIR)/Makefile.in \ - $(CONFIG_STATUS_DIR)/config.status - cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ diff --git a/src/plugins/variadic/Variadic.mli b/src/plugins/variadic/Variadic.ml similarity index 99% rename from src/plugins/variadic/Variadic.mli rename to src/plugins/variadic/Variadic.ml index 53abf7a4f86ac7ae44e75cdbd09d697b49d46996..33a9092f885fdf51420c62647991f8ba6fb15d1f 100644 --- a/src/plugins/variadic/Variadic.mli +++ b/src/plugins/variadic/Variadic.ml @@ -30,4 +30,4 @@ module Options: sig (** In strict mode, non-portable casts between integral types are forbidden in calls to LibC's variadic functions. *) module Strict : Parameter_sig.Bool -end +end = Options diff --git a/src/plugins/variadic/dune b/src/plugins/variadic/dune new file mode 100644 index 0000000000000000000000000000000000000000..c70b49ef315c6f0a9f626c27f337f6701fddb353 --- /dev/null +++ b/src/plugins/variadic/dune @@ -0,0 +1,40 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "Variadic:" %{lib-available:frama-c-variadic.core} "\n") + ) + ) +) + +( library + (name variadic) + (optional) + (public_name frama-c-variadic.core) + (flags -open Frama_c_kernel :standard -w -9) + (libraries frama-c.kernel) +) + +(plugin (optional) (name variadic) (libraries frama-c-variadic.core) (site (frama-c plugins))) diff --git a/src/plugins/variadic/dune-project b/src/plugins/variadic/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..9b6a2b3bd3ab4519ad3857454a0cf5640526bef7 --- /dev/null +++ b/src/plugins/variadic/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-variadic) +(using dune_site 0.1) diff --git a/src/plugins/variadic/format_types.mli b/src/plugins/variadic/format_types.ml similarity index 100% rename from src/plugins/variadic/format_types.mli rename to src/plugins/variadic/format_types.ml diff --git a/src/plugins/variadic/frama-c-variadic.opam b/src/plugins/variadic/frama-c-variadic.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/variadic/tests/declared/called_in_ghost.ml b/src/plugins/variadic/tests/declared/called_in_ghost.ml old mode 100755 new mode 100644 diff --git a/src/plugins/variadic/tests/ptests_config b/src/plugins/variadic/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..acf9c7482b63da65d54abdc99014e868ee24cb16 --- /dev/null +++ b/src/plugins/variadic/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= declared defined known erroneous diff --git a/src/plugins/variadic/va_types.mli b/src/plugins/variadic/va_types.ml similarity index 100% rename from src/plugins/variadic/va_types.mli rename to src/plugins/variadic/va_types.ml diff --git a/src/plugins/wp/.gitignore b/src/plugins/wp/.gitignore index 89eb4113c92de3c38219bd677af51210753eb5b6..7910a839f2d78300306bf93762c248d1bcc1581c 100644 --- a/src/plugins/wp/.gitignore +++ b/src/plugins/wp/.gitignore @@ -1,17 +1,15 @@ /Makefile /.make-wp-coq /.make-wp-why3 - -/Wp.mli -/gui/Wp.mli /.WP_API_GENERATED -/driver.ml -/rformat.ml -/script.ml -/why3_xml.ml -/ProverDetect.ml -/tests/ptests_config + + + + + +/tests/*/oracle/dune +/tests/*/oracle_*/dune /tests/*/result /tests/*/result_* @@ -19,4 +17,4 @@ /doc/*/.make-icons /doc/*/.make-images -/why3_api.ml + diff --git a/src/plugins/wp/.merlin b/src/plugins/wp/.merlin deleted file mode 100644 index d4209155cd3e7debb97a64fc44ef4bcf0bc60184..0000000000000000000000000000000000000000 --- a/src/plugins/wp/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -PKG why3 diff --git a/src/plugins/wp/Cache.ml b/src/plugins/wp/Cache.ml index a59b83f54d9902b81e749f1573cedf53c529970e..9ecfc2f038f7df0573495f82b076f41a067a8b13 100644 --- a/src/plugins/wp/Cache.ml +++ b/src/plugins/wp/Cache.ml @@ -37,7 +37,7 @@ let get_miss () = !miss let get_removed () = !removed let mark_cache ~mode hash = - if mode = Cleanup || !Fc_config.is_gui then Hashtbl.replace cleanup hash () + if mode = Cleanup || Fc_config.is_gui then Hashtbl.replace cleanup hash () module CACHEDIR = WpContext.StaticGenerator(Datatype.Unit) (struct diff --git a/src/plugins/wp/Makefile.in b/src/plugins/wp/Makefile.in deleted file mode 100644 index 6ce0a0bad6b5f612e8bb22abd87fe93f8eafe4a4..0000000000000000000000000000000000000000 --- a/src/plugins/wp/Makefile.in +++ /dev/null @@ -1,346 +0,0 @@ -########################################################################## -# # -# This file is part of WP plug-in of Frama-C. # -# # -# Copyright (C) 2007-2022 # -# CEA (Commissariat a l'energie atomique et aux energies # -# alternatives) # -# # -# you can redistribute it and/or modify it under the terms of the GNU # -# Lesser General Public License as published by the Free Software # -# Foundation, version 2.1. # -# # -# It 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 Lesser General Public License for more details. # -# # -# See the GNU Lesser General Public License version 2.1 # -# for more details (enclosed in the file licenses/LGPLv2.1). # -# # -########################################################################## - -# Do not use ?= to initialize both below variables -# (fixed efficiency issue, see GNU Make manual, Section 8.11) -ifndef FRAMAC_SHARE -FRAMAC_SHARE :=$(shell frama-c-config -print-share-path) -endif -ifndef FRAMAC_LIBDIR -FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) -endif -PLUGIN_DIR ?=. - -ifneq ("$(FRAMAC_INTERNAL)","yes") -include $(FRAMAC_SHARE)/Makefile.config -endif - -# Resources Installation -include $(PLUGIN_DIR)/share/Makefile.resources - -# Extension of the GUI for wp is compilable -# only if gnomecanvas is available -#ifeq ($(HAS_GNOMECANVAS),yes) -PLUGIN_GUI_CMO:= \ - GuiConfig \ - GuiList \ - GuiSequent \ - GuiProver \ - GuiTactic \ - GuiProof \ - GuiComposer \ - GuiGoal \ - GuiSource \ - GuiPanel \ - GuiNavigator -#endif - -PLUGIN_REQUIRES:= why3 - -PLUGIN_ENABLE:=@ENABLE_WP@ -PLUGIN_NAME:=Wp -PLUGIN_CMO:= \ - rformat wprop \ - wp_parameters wp_error \ - Why3Provers \ - Context Warning \ - dyncall ctypes clabels \ - AssignsCompleteness MemoryContext wpContext \ - LogicUsage RefUsage \ - Layout Region \ - RegionAnnot RegionAccess RegionDump RegionAnalysis \ - normAtLabels wpPropId \ - Lang Repr Matrix Passive Splitter \ - LogicBuiltins Definitions \ - Cmath Cint Cfloat Vset Vlist Cstring Cvalues \ - Letify Cleaning \ - Mstate Conditions \ - Filtering \ - Plang Pcfg Pcond \ - CodeSemantics \ - LogicCompiler \ - LogicSemantics LogicAssigns \ - Sigma MemLoader MemDebug \ - MemEmpty MemZeroAlias MemVar \ - MemMemory MemTyped MemRegion MemVal \ - wpReached wpRTE wpTarget \ - CfgCompiler StmtSemantics \ - VCS script wpo wpReport \ - Footprint Tactical Strategy \ - TacClear TacSplit TacChoice TacRange TacInduction \ - TacArray TacCompound TacUnfold \ - TacHavoc TacInstance TacLemma \ - TacFilter TacCut WpTac TacNormalForm \ - TacRewrite TacBitwised TacBitrange TacBittest TacModMask TacShift \ - TacSequence \ - TacCongruence TacOverflow Auto \ - ProofSession ProofScript ProofEngine \ - ProverTask \ - filter_axioms Cache ProverWhy3 \ - driver prover ProverSearch ProverScript \ - Factory \ - cfgInit cfgAnnot cfgInfos cfgCalculus \ - cfgDump cfgWP \ - cfgGenerator \ - Generator register VC - -PLUGIN_CMI:= \ - Sigs mcfg - -PLUGIN_GENERATED:= \ - $(PLUGIN_DIR)/script.ml \ - $(PLUGIN_DIR)/rformat.ml \ - $(PLUGIN_DIR)/driver.ml \ - $(PLUGIN_DIR)/Wp.mli - -PLUGIN_DEPENDENCIES:= rtegen qed -PLUGIN_UNDOC+= -PLUGIN_INTRO:=$(PLUGIN_DIR)/intro_wp.txt -PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) -PLUGIN_DISTRIB_EXTERNAL:= \ - Changelog \ - Makefile.in \ - MakeAPI \ - configure.ac \ - configure \ - $(addprefix share/, $(ALL_CEA_RESOURCES) \ - $(ALL_UNMODIFIED_WHY3_RESOURCES) \ - $(ALL_MODIFIED_WHY3_RESOURCES)) - -CEA_WP_GENEREATED= script.ml rformat.ml driver.ml - -# -------------------------------------------------------------------------- -# --- Tests --- -# -------------------------------------------------------------------------- - -PLUGIN_TESTS_DIRS:= \ - why3 wp wp_plugin wp_acsl wp_bts \ - wp_store wp_hoare wp_typed wp_usage \ - wp_gallery wp_manual wp_tip \ - wp_region - -ifeq ($(FRAMAC_INTERNAL),yes) -Wp_DEFAULT_TESTS: create_share_link -endif - -# -------------------------------------------------------------------------- -# --- Dynamic Plugin --- -# -------------------------------------------------------------------------- - -include $(FRAMAC_SHARE)/Makefile.dynamic - -# Regenerating the Makefile on need - -ifeq ("$(FRAMAC_INTERNAL)","yes") -CONFIG_STATUS_DIR=$(FRAMAC_SRC) -else -CONFIG_STATUS_DIR=. -endif - -WP_CONFIGURE_MAKEFILE= \ - $(Wp_DIR)/Makefile.in \ - $(Wp_DIR)/share/Makefile.resources \ - $(CONFIG_STATUS_DIR)/config.status - -$(Wp_DIR)/Makefile: $(WP_CONFIGURE_MAKEFILE) - @cd $(CONFIG_STATUS_DIR) && ./config.status --file $@ - -# -------------------------------------------------------------------------- -# --- Qualif Tests --- -# -------------------------------------------------------------------------- - -.PHONY: wp-qualif wp-qualif-update wp-qualif-upgrade wp-qualif-push wp-qualif-status - -WP_QUALIF_CACHE?=$(abspath $(Wp_DIR)/../wp-cache) -WP_QUALIF_ENTRIES=git -C $(WP_QUALIF_CACHE) ls-files --others --exclude-standard | wc -l - -WP_CHECKOUT_CACHE=\ - echo "[CACHE] repo: $(WP_QUALIF_CACHE)" && \ - git -C $(WP_QUALIF_CACHE) checkout master - -wp-qualif: ./bin/toplevel.opt ./bin/ptests.opt $(WP_QUALIF_CACHE) - $(WP_CHECKOUT_CACHE) - FRAMAC_WP_CACHE=replay \ - FRAMAC_WP_CACHEDIR=$(WP_QUALIF_CACHE) \ - ./bin/ptests.opt src/plugins/wp/tests -config qualif -error-code - -WP_PULL_CACHE=\ - echo "[CACHE] pull cache" && \ - $(WP_CHECKOUT_CACHE) && \ - git -C $(WP_QUALIF_CACHE) pull --rebase --prune - -wp-qualif-update: ./bin/toplevel.opt ./bin/ptests.opt $(WP_QUALIF_CACHE) - $(WP_PULL_CACHE) - @echo "[TESTS] updating wp-qualif" - FRAMAC_WP_CACHE=update \ - FRAMAC_WP_CACHEDIR=$(WP_QUALIF_CACHE) \ - ./bin/ptests.opt src/plugins/wp/tests -config qualif - @echo "[CACHE] cache status" - git -C $(WP_QUALIF_CACHE) status -s -b -u no - @echo "New entries: `$(WP_QUALIF_ENTRIES)`" - -wp-qualif-upgrade: ./bin/toplevel.opt ./bin/ptests.opt - $(WP_PULL_CACHE) - @echo "[TESTS] upgrading wp-qualif (cache & scripts)" - FRAMAC_WP_CACHE=update \ - FRAMAC_WP_SCRIPT=update \ - FRAMAC_WP_CACHEDIR=$(WP_QUALIF_CACHE) \ - ./bin/ptests.opt src/plugins/wp/tests -config qualif - @echo "[CACHE] cache status" - git -C $(WP_QUALIF_CACHE) status -s -b -u no - @echo "New entries: `$(WP_QUALIF_ENTRIES)`" - -wp-qualif-push: - @echo "[CACHE] pushing updates" - $(WP_CHECKOUT_CACHE) - git -C $(WP_QUALIF_CACHE) add -A - git -C $(WP_QUALIF_CACHE) commit -m "[wp] cache updates" - git -C $(WP_QUALIF_CACHE) push -f - -wp-qualif-status: - @echo "[CACHE] status" - $(WP_CHECKOUT_CACHE) - git -C $(WP_QUALIF_CACHE) status -s -b -u no - @echo "New entries: `$(WP_QUALIF_ENTRIES)`" - -$(WP_QUALIF_CACHE): - @echo "[CACHE] cloning wp global at $(WP_QUALIF_CACHE)..." - @echo "Use env. variable WP_QUALIF_CACHE to change this location." - @git clone "git@git.frama-c.com:frama-c/wp-cache.git" $(WP_QUALIF_CACHE) - -# -------------------------------------------------------------------------- -# --- WP API --- -# -------------------------------------------------------------------------- - -WP_API_BASE= \ - wp_parameters.mli \ - ctypes.mli clabels.mli \ - MemoryContext.mli \ - LogicUsage.mli RefUsage.mli \ - normAtLabels.mli \ - wpPropId.mli mcfg.mli \ - Context.mli Warning.mli AssignsCompleteness.mli wpContext.mli \ - Lang.mli Repr.mli Passive.mli Splitter.mli \ - LogicBuiltins.mli Definitions.mli \ - Cint.mli Cfloat.mli Vset.mli Cstring.mli \ - Sigs.mli Mstate.mli Conditions.mli Filtering.mli \ - Plang.mli Pcfg.mli Pcond.mli \ - CodeSemantics.mli \ - LogicCompiler.mli LogicSemantics.mli \ - Sigma.mli MemVar.mli MemTyped.mli MemVal.mli \ - CfgCompiler.mli StmtSemantics.mli \ - Factory.mli driver.mli VCS.mli Tactical.mli Strategy.mli Auto.mli \ - VC.mli wpo.mli ProverTask.mli prover.mli - -define WP_capitalize -$(shell printf "%s%s" \ - $$($(ECHO) $(1) | cut -c 1 | tr '[:lower:]' '[:upper:]') - $$($(ECHO) $(1) | cut -c 2-)) -endef - -define WP_export -$(ECHO) "module $(call WP_capitalize, $(basename $(notdir $(1)))) : sig" >> $(2); -$(ECHO) '# 1 "$(1)"' >> $(2); -$(CAT) $(1) >> $(2); -$(ECHO) "end" >> $(2); -endef - -WP_MLI=$(addprefix $(Wp_DIR)/, $(WP_API_BASE)) - -$(Wp_DIR)/Wp.mli: $(Wp_DIR)/Makefile $(WP_MLI) - $(PRINT_MAKING) $@ - $(RM) $@ $@.tmp - $(ECHO) "(* This file is generated. Do not edit. *)" > $@.tmp - $(ECHO) "(** {b WP Public API} *)" > $@.tmp - $(foreach file,$(WP_MLI),$(call WP_export,$(file),$@.tmp)) - $(CHMOD_RO) $@.tmp - $(MV) $@.tmp $@ - -.PHONY: wp-doc-api - -wp-doc-api: - $(ECHO) "Generating WP documentation" - @mkdir -p $(Wp_DIR)/doc/html - $(RM) -fr $(Wp_DIR)/doc/html/* - $(CP) $(Wp_DIR)/doc/ocamldoc.css $(Wp_DIR)/doc/html/style.css - $(OCAMLDOC) \ - -package zarith \ - -package why3 \ - -I lib/fc -I lib/plugins -I $(Wp_DIR) -stars \ - -html -d $(Wp_DIR)/doc/html -charset utf-8 \ - -t "Frama-C/WP API Documentation" \ - -intro $(Wp_DIR)/doc/wp-api.odoc \ - -colorize-code -short-functors $(Wp_DIR)/Wp.mli - $(ECHO) "Generating $(Wp_DIR)/doc/html/index.html" - -clean:: - $(RM) $(Wp_DIR)/Wp.mli - $(RM) -fr $(Wp_DIR)/doc/html - -# -------------------------------------------------------------------------- -# --- Installation Resources -# -------------------------------------------------------------------------- - -## All relative to share/ - -ALL_WHY3_SOURCES= $(addprefix why3/frama_c_wp/, $(WHY3_LIBS_CEA)) - -ALL_RESOURCES= \ - wp.driver \ - $(ALL_WHY3_SOURCES) - -INSTALL_OPT?= -INSTALL_SHARE=@$(Wp_DIR)/share/instwp $(INSTALL_OPT) - -byte:: $(Wp_DIR)/share/instwp -opt:: $(Wp_DIR)/share/instwp -clean:: - rm -f $(Wp_DIR)/share/instwp - rm -f $(Wp_DIR)/share/install.cm* - -$(Wp_DIR)/share/instwp: $(Wp_DIR)/share/install.ml - $(OCAMLC) $(WARNINGS) -w -70 -o $@ unix.cma $^ - -# -------------------------------------------------------------------------- -# --- Installation --- -# -------------------------------------------------------------------------- - -install:: clean-install - $(PRINT_INSTALL) WP shared files - $(MKDIR) $(FRAMAC_DATADIR)/wp - $(INSTALL_SHARE) -p \ - -i $(Wp_DIR)/share \ - -d $(FRAMAC_DATADIR)/wp \ - $(ALL_RESOURCES) -f -b - -uninstall:: - $(PRINT_RM) WP shared files - $(RM) -r $(FRAMAC_DATADIR)/wp - -# -------------------------------------------------------------------------- -# --- WP Release Stuff (CEA-LIST Only) -# -------------------------------------------------------------------------- -sinclude MakeDistrib -# -------------------------------------------------------------------------- - -$(Wp_DIR)/.depend: $(Wp_DIR)/driver.mll -$(Wp_DIR)/driver.mll: $(Wp_DIR)/Makefile diff --git a/src/plugins/wp/Sigs.mli b/src/plugins/wp/Sigs.ml similarity index 100% rename from src/plugins/wp/Sigs.mli rename to src/plugins/wp/Sigs.ml diff --git a/src/plugins/wp/dune b/src/plugins/wp/dune new file mode 100644 index 0000000000000000000000000000000000000000..f83bd2fd2bca4090a5b6184a76a3c89daddc654f --- /dev/null +++ b/src/plugins/wp/dune @@ -0,0 +1,68 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule + (alias frama-c-configure) + (deps (universe)) + (action (progn + (echo "WP:" %{lib-available:frama-c-wp.core} "\n") + (echo " - Ocamlgraph:" %{lib-available:ocamlgraph} "\n") + (echo " - Qed:" %{lib-available:qed} "\n") + (echo " - Rtegen:" %{lib-available:frama-c-rtegen.core} "\n") + (echo " - Why3:" %{lib-available:why3} "\n") + (echo " - Zarith:" %{lib-available:zarith} "\n") + ) + ) +) + +(library + (name wp) + (optional) + (public_name frama-c-wp.core) + (flags (-open Frama_c_kernel :standard -w -9)) + (libraries frama-c.kernel frama-c-rtegen.core why3 qed zarith ocamlgraph) +) + +(plugin (optional) (name wp) (libraries frama-c-wp.core) (site (frama-c plugins))) + + +(ocamllex driver rformat script) + +;find share \( -not -name ".gitignore" \) -type f -printf "(%p as wp/%p)\n" >> dune +; wp/share -> wp + +(install + (package frama-c-wp) + (section (site (frama-c share))) + (files +(share/Makefile.resources as wp/Makefile.resources) +(share/install.ml as wp/install.ml) +(share/why3/frama_c_wp/vlist.mlw as wp/why3/frama_c_wp/vlist.mlw) +(share/why3/frama_c_wp/cbits.mlw as wp/why3/frama_c_wp/cbits.mlw) +(share/why3/frama_c_wp/cint.mlw as wp/why3/frama_c_wp/cint.mlw) +(share/why3/frama_c_wp/qed.mlw as wp/why3/frama_c_wp/qed.mlw) +(share/why3/frama_c_wp/vset.mlw as wp/why3/frama_c_wp/vset.mlw) +(share/why3/frama_c_wp/memory.mlw as wp/why3/frama_c_wp/memory.mlw) +(share/why3/frama_c_wp/cmath.mlw as wp/why3/frama_c_wp/cmath.mlw) +(share/why3/frama_c_wp/cfloat.mlw as wp/why3/frama_c_wp/cfloat.mlw) +(share/wp.driver as wp/wp.driver) +)) diff --git a/src/plugins/wp/dune-project b/src/plugins/wp/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..68f619f079bada578f1480cb7495a4f4dfc45706 --- /dev/null +++ b/src/plugins/wp/dune-project @@ -0,0 +1,25 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(name frama-c-wp) +(using dune_site 0.1) diff --git a/src/plugins/wp/frama-c-wp.opam b/src/plugins/wp/frama-c-wp.opam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plugins/wp/GuiComposer.ml b/src/plugins/wp/gui/GuiComposer.ml similarity index 100% rename from src/plugins/wp/GuiComposer.ml rename to src/plugins/wp/gui/GuiComposer.ml diff --git a/src/plugins/wp/GuiComposer.mli b/src/plugins/wp/gui/GuiComposer.mli similarity index 100% rename from src/plugins/wp/GuiComposer.mli rename to src/plugins/wp/gui/GuiComposer.mli diff --git a/src/plugins/wp/GuiConfig.ml b/src/plugins/wp/gui/GuiConfig.ml similarity index 100% rename from src/plugins/wp/GuiConfig.ml rename to src/plugins/wp/gui/GuiConfig.ml diff --git a/src/plugins/wp/GuiConfig.mli b/src/plugins/wp/gui/GuiConfig.mli similarity index 100% rename from src/plugins/wp/GuiConfig.mli rename to src/plugins/wp/gui/GuiConfig.mli diff --git a/src/plugins/wp/GuiGoal.ml b/src/plugins/wp/gui/GuiGoal.ml similarity index 100% rename from src/plugins/wp/GuiGoal.ml rename to src/plugins/wp/gui/GuiGoal.ml diff --git a/src/plugins/wp/GuiGoal.mli b/src/plugins/wp/gui/GuiGoal.mli similarity index 100% rename from src/plugins/wp/GuiGoal.mli rename to src/plugins/wp/gui/GuiGoal.mli diff --git a/src/plugins/wp/GuiList.ml b/src/plugins/wp/gui/GuiList.ml similarity index 100% rename from src/plugins/wp/GuiList.ml rename to src/plugins/wp/gui/GuiList.ml diff --git a/src/plugins/wp/GuiList.mli b/src/plugins/wp/gui/GuiList.mli similarity index 100% rename from src/plugins/wp/GuiList.mli rename to src/plugins/wp/gui/GuiList.mli diff --git a/src/plugins/wp/GuiNavigator.ml b/src/plugins/wp/gui/GuiNavigator.ml similarity index 100% rename from src/plugins/wp/GuiNavigator.ml rename to src/plugins/wp/gui/GuiNavigator.ml diff --git a/src/plugins/wp/GuiNavigator.mli b/src/plugins/wp/gui/GuiNavigator.mli similarity index 100% rename from src/plugins/wp/GuiNavigator.mli rename to src/plugins/wp/gui/GuiNavigator.mli diff --git a/src/plugins/wp/GuiPanel.ml b/src/plugins/wp/gui/GuiPanel.ml similarity index 100% rename from src/plugins/wp/GuiPanel.ml rename to src/plugins/wp/gui/GuiPanel.ml diff --git a/src/plugins/wp/GuiPanel.mli b/src/plugins/wp/gui/GuiPanel.mli similarity index 100% rename from src/plugins/wp/GuiPanel.mli rename to src/plugins/wp/gui/GuiPanel.mli diff --git a/src/plugins/wp/GuiProof.ml b/src/plugins/wp/gui/GuiProof.ml similarity index 100% rename from src/plugins/wp/GuiProof.ml rename to src/plugins/wp/gui/GuiProof.ml diff --git a/src/plugins/wp/GuiProof.mli b/src/plugins/wp/gui/GuiProof.mli similarity index 100% rename from src/plugins/wp/GuiProof.mli rename to src/plugins/wp/gui/GuiProof.mli diff --git a/src/plugins/wp/GuiProver.ml b/src/plugins/wp/gui/GuiProver.ml similarity index 100% rename from src/plugins/wp/GuiProver.ml rename to src/plugins/wp/gui/GuiProver.ml diff --git a/src/plugins/wp/GuiProver.mli b/src/plugins/wp/gui/GuiProver.mli similarity index 100% rename from src/plugins/wp/GuiProver.mli rename to src/plugins/wp/gui/GuiProver.mli diff --git a/src/plugins/wp/GuiSequent.ml b/src/plugins/wp/gui/GuiSequent.ml similarity index 100% rename from src/plugins/wp/GuiSequent.ml rename to src/plugins/wp/gui/GuiSequent.ml diff --git a/src/plugins/wp/GuiSequent.mli b/src/plugins/wp/gui/GuiSequent.mli similarity index 100% rename from src/plugins/wp/GuiSequent.mli rename to src/plugins/wp/gui/GuiSequent.mli diff --git a/src/plugins/wp/GuiSource.ml b/src/plugins/wp/gui/GuiSource.ml similarity index 100% rename from src/plugins/wp/GuiSource.ml rename to src/plugins/wp/gui/GuiSource.ml diff --git a/src/plugins/wp/GuiSource.mli b/src/plugins/wp/gui/GuiSource.mli similarity index 100% rename from src/plugins/wp/GuiSource.mli rename to src/plugins/wp/gui/GuiSource.mli diff --git a/src/plugins/wp/GuiTactic.ml b/src/plugins/wp/gui/GuiTactic.ml similarity index 100% rename from src/plugins/wp/GuiTactic.ml rename to src/plugins/wp/gui/GuiTactic.ml diff --git a/src/plugins/wp/GuiTactic.mli b/src/plugins/wp/gui/GuiTactic.mli similarity index 100% rename from src/plugins/wp/GuiTactic.mli rename to src/plugins/wp/gui/GuiTactic.mli diff --git a/src/plugins/wp/gui/dune b/src/plugins/wp/gui/dune new file mode 100644 index 0000000000000000000000000000000000000000..d6d53e011c0e1498e61363db7808ac19e8bbeb30 --- /dev/null +++ b/src/plugins/wp/gui/dune @@ -0,0 +1,31 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +( library + (name wp_gui) + (public_name frama-c-wp.gui) + (optional) + (flags -open Frama_c_kernel -open Frama_c_gui -open Wp :standard -w -9) + (libraries frama-c-wp.core frama-c.kernel frama-c.gui why3 qed) +) + +(plugin (optional) (name wp-gui) (libraries frama-c-wp.gui) (site (frama-c plugins_gui))) diff --git a/src/plugins/wp/mcfg.mli b/src/plugins/wp/mcfg.ml similarity index 100% rename from src/plugins/wp/mcfg.mli rename to src/plugins/wp/mcfg.ml diff --git a/src/plugins/wp/register.ml b/src/plugins/wp/register.ml index cb51b2fed00dedcafc2b7e62fdb929fed605cf12..8952be0b7507acf53ab0904514702dfcac842558 100644 --- a/src/plugins/wp/register.ml +++ b/src/plugins/wp/register.ml @@ -856,7 +856,7 @@ let () = Cmdline.run_after_setting_files let () = Cmdline.run_after_configuring_stage Why3Provers.configure let do_prover_detect () = - if not !Fc_config.is_gui && Wp_parameters.Detect.get () then + if not Fc_config.is_gui && Wp_parameters.Detect.get () then let provers = Why3Provers.provers () in if provers = [] then Wp_parameters.result "No Why3 provers detected." diff --git a/src/plugins/wp/tests/README.md b/src/plugins/wp/tests/README.md index 572734b69d18822dabe8af45e4cb91e146091f2d..3d90fddfa98c31cc044c5f1bbcd7e4df7775e89a 100644 --- a/src/plugins/wp/tests/README.md +++ b/src/plugins/wp/tests/README.md @@ -1,129 +1,56 @@ -# Running qualif tests - -- Be sure that you have installed the appropriate versions of - alt-ergo and coq _before_ having compiled Frama-C. -- use `make wp-qualif` in the toplevel Frama-C directory - -# Test Suites - -Here is a short description of the WP test suites: - -- `tests/wp` tests dedicated to the VC generation engine and proof strategy -- `tests/wp_tip` tests associated to the script engine -- `tests/wp_acsl` tests of generic C/ACSL concepts -- `tests/wp_typed` tests dedicated to aliasing memory model -- `tests/wp_hoare` tests dedicated to non-aliasing memory model -- `tests/wp_region` tests dedicated to region memory model -- `tests/wp_manual` tests for generating the examples of the reference manual -- `tests/wp_gallery` non-regression tests for representative real size usage of WP -- `tests/wp_plugin` general purpose WP plug-in options -- `tests/wp_bts` non-regression tests associated to GitLab issues; eg. `issue_xxx.i` - -Deprecated test suites that shall be moved around: - -- `tests/wp_usage` mostly movable to `tests/wp_plugin` -- `tests/wp_store` mostly movable to `tests/wp_typed` - -# Test Configurations - -There are two test configurations: -- the default one requires _no_ prover execution; -- the `qualif` configuration uses the `wp-cache` global cache, `Alt-Ergo` and `Coq`. - -The test configurations `tests/test_config` and `tests/test_config_qualif` are -carefully crafted to fit with the constraints of the GitLab -Continuous Integration system. In particular, the `qualif` configuration is -designed for being used with a clone of the global WP cache, see -installation instructions below. - -To re-run tests, use by default the following commands: -- `make Wp_TESTS` for the default test configuration; -- `make wp-qualif` for the `qualif` configuration. - -When using the `wp-qualif` target, it will clone the global wp-cache at `../wp-cache` by default, -if not yet present. To choose another place, consult the « Global WP Cache » -installation instructions below. -The WP makefile provides several targets to automate cache management. It is highly -recommanded to use them most of the time: - -- `make wp-qualif` re-runs qualif tests; no new cache entry is created, though. -- `make wp-qualif-env` prints the environment variables for wp-qualif. -- `make wp-qualif-update` re-runs and creates missing cache entries. -- `make wp-qualif-upgrade` creates missing cache entries _and_ updates test scripts if necessary. -- `make wp-qualif-push` commits and pushes all new cache entries to the GitLab repository. -- `make wp-qualif-status` displays a very short git status of your local wp-cache. - -To execute a given test by hand in `qualif` configuration, use the following -commands in a _local_ shell: - - $ export FRAMAC_WP_CACHE=update - $ export FRAMAC_WP_CACHEDIR=<path-to-wp-cache> - $ ./bin/ptests.opt src/plugins/wp/tests/xxx/yyy.i -config qualif [-show|-update] - -It is _highly_ recommanded to _not_ set the `FRAMAC_WP_xxx` variables globally; -doing so would causing WP to add new cache entries to the global « qualif » cache -from all your projects around. Consult the section « Global WP Cache Setup » -below for details. - -Note that this cache is meant to be global, including for the different merge -requests. Thus, when working on a new merge request for WP, **do not** create a -branch (and MR) on the WP-cache repository: just push the new cache entries into -the global cache using `make wp-qualif-push`. - -# Qualified Test Results - -To be accepted by Frama-CI, tests in « qualif » configuration must be easily -reproducible on any platform. This is checked by running WP with flag -`-wp-msg-key shell` which is set by the default in the qualif test -configuration. Hence, a qualified test result only contains proof status that -are either: -- failed -- valid for qed or script -- cached for alt-ergo in all cases -- valid, unknown or stepout for native Alt-Ergo -- valid or unknown for (native) Coq - -This excludes any timeout with native Alt-Ergo, which must be turned into some -reproducible stepout by setting `-wp-steps` and `-wp-timeout` options -accordingly. Please choose a step limit that makes large enough to ensure the -goal is provable, but small enough to make alt-ergo decide quickly. - -# Global WP Cache Setup (for wp-qualif) - -All prover results for test configuration `qualif` shall be cached in a dedicate -GitLab repo. This considerally speed-up the process of running those tests, -from hours downto minutes. - -To ease the management of cache entries accross merge requests, -_all_ cache entries shall be merged into the _same_ master branch of a global -repository, even if they come from _different_ Frama-C branches. -This strategy prevents merge conflicts related to different cache -entries and simplifies the review of MR, especially those modifying the VC -generation process. The gitLab Frama-CI continuous integration system is aware of -this strategy and always use the global cache. - -By default, the WP makefile will clone a local copy of the wp-cache in `../wp-cache` -but you can choose another place with the following commands: - - $ git clone git@git.frama-c.com:frama-c/wp-cache.git <your-cache> - $ export WP_QUALIF_CACHE=<absolute-path-to-your-cache> - -The WP makefile uses `WP_QUALIF_CACHE` environment variable to know where your -local copy of cache has been installed. You shall put it in your global shell -environment. To run individual tests, you may now use: - - $ export FRAMAC_WP_CACHE=update - $ export FRAMAC_WP_CACHEDIR=$WP_QUALIF_CACHE - $ ./bin/ptests.opt src/plugins/wp/tests/xxx/yyy.i -config qualif [-show|-update] - -An utility script is provided to export the necessary environment variables -(dont forget the `.` to execute the script in the current shell environment): - - $ . bin/wp_qualif.sh - -As mentionned above, it is _not_ recommanded to globally set the -`FRAMAC_WP_XXX` variables in your default shell environment, because WP will -use it by default and would merge any new cache entry there, even those -non-related to the « qualif » test suite. For this reason, -it is _highly_ recommended to use `WP_QUALIF_CACHE` globally -and `FRAMAC_WP_CACHEDIR` locally. +# Audience + +This manual is _only_ intended for Frama-C developpers who need to execute tests +that are using WP with external provers. + +## WP Tests Configurations + +There are two configurations for WP tests: +- the default configuration, which does not use external provers +- the `qualif` configuration, which _does_ use external provers + +It is highly recommended to use the `./bin/test.sh` wrapper for executing WP tests. +See section « WP Tests Recipes » below for details. + +Advanced users might consider managing the cache on their own. +See section « Advanced Cache Management. » + +## WP Tests Recipes + +When using the `./bin/test.sh` test wrapper, you don't need to configure the +environment variables mentionned above: the script automatically manages them for you. + +Before executing WP tests in qualif configuration, you shall initiate the WP-cache. +This is done automatically by: + + $ ./bin/test.sh -p + +The first time it is executed, it will clone the `wp-cache` Git repository in `./.wp-cache`. +Next times, this same command will automatically pull the latest cache entries. + +You check tests are up-to-date with: + + $ ./bin/tests.sh src/plugins/wp/tests + +When a test complains that a test result is missing from wp-cache, simply re-run +the desired tests in « update » mode: + + $ ./bin/tests.sh src/plugins/wp/tests/… -u + +If neceassary, you may `dune promote` the new oracles and, correspondly, +you may `git commit` the new cache entries from `./.wp-cache` directory. + +## Advanced Cache Management + +It is possible to share the wp-cache repository among different plug-ins. +The `./bin/test.sh` uses, in order of proprity: +- `FRAMAC_WP_QUALIF` environment variable, +- `FRAMAC_WP_CACHEDIR` environement variable, +- local `./.wp-cache` directory. + +It is _not_ recommended to use the `FRAMAC_WP_CACHEDIR` variable in your default +shell setup, unless is it a temporary directory (eg. `/tmp/wp-sandbox`) since +_every_ run of `frama-c -wp` might then use it by default. Be carefull if you do so. + +However, it is _highly_ recommended for frama-c developpers to export the +`FRAMAC_WP_QUALIF` variable in their default shell setup. diff --git a/src/plugins/wp/tests/ptests_config b/src/plugins/wp/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..d53499bf328b942033d55884fabd3a78cb101437 --- /dev/null +++ b/src/plugins/wp/tests/ptests_config @@ -0,0 +1,6 @@ +DEFAULT_SUITES= wp wp_acsl wp_plugin wp_bts wp_store wp_hoare +DEFAULT_SUITES= wp_typed wp_usage wp_gallery wp_manual wp_region wp_tip + +qualif_SUITES= wp wp_acsl wp_plugin wp_bts wp_store wp_hoare +qualif_SUITES= wp_typed wp_usage wp_gallery wp_manual wp_region wp_tip +qualif_SUITES= why3 diff --git a/src/plugins/wp/tests/test_config b/src/plugins/wp/tests/test_config index 1c78f06e11e80018180777668c123942cf82c868..9a3cee925ad8ab85cd13ba199f4fee4b49b62b68 100644 --- a/src/plugins/wp/tests/test_config +++ b/src/plugins/wp/tests/test_config @@ -1,5 +1,6 @@ PLUGIN: wp MACRO: WP_SESSION @PTEST_DIR@/@PTEST_NAME@.@PTEST_NUMBER@.session@PTEST_CONFIG@ MACRO: USING_WP_SESSION -wp-session @WP_SESSION@ -CMD: @frama-c@ -wp -wp-prover none -wp-print -wp-share @PTEST_SHARE_DIR@ -wp-msg-key shell -wp-warn-key "pedantic-assigns=inactive" +COMMENT: no need of "-wp-share" in Dune -> Dune finds it automatically +CMD: @frama-c@ -wp -wp-prover none -wp-print -wp-msg-key shell -wp-warn-key "pedantic-assigns=inactive" OPT: diff --git a/src/plugins/wp/tests/test_config_qualif b/src/plugins/wp/tests/test_config_qualif index 895b3f4d8bf4111e4f6df1692cdf3675fce834b5..e32bb2e32fceb91f4d09937bd09ef630b243ae32 100644 --- a/src/plugins/wp/tests/test_config_qualif +++ b/src/plugins/wp/tests/test_config_qualif @@ -1,5 +1,7 @@ PLUGIN: wp MACRO: WP_SESSION @PTEST_DIR@/@PTEST_NAME@.@PTEST_NUMBER@.session@PTEST_CONFIG@ MACRO: USING_WP_SESSION -wp-session @WP_SESSION@ -CMD: @frama-c@ -wp -wp-par 1 -wp-share @PTEST_SHARE_DIR@ -wp-msg-key shell -wp-warn-key pedantic-assigns=inactive -wp-report %{dep:@PTEST_SUITE_DIR@/../qualif.report} -wp-cache-env -wp-cache replay @PTEST_FILE@ +COMMENT: no need of "-wp-share" in Dune -> Dune finds it automatically +CMD: @frama-c@ -wp -wp-par 1 -wp-msg-key shell -wp-warn-key pedantic-assigns=inactive -wp-report %{dep:@PTEST_SUITE_DIR@/../qualif.report} -wp-cache-env @PTEST_FILE@ +DEPS: env_var:FRAMAC_WP_CACHE env_var:FRAMAC_WP_CACHEDIR OPT: diff --git a/src/plugins/wp/tests/why3/test_config_qualif b/src/plugins/wp/tests/why3/test_config_qualif index 40a46bc821a47c59715d800508aabd855a13f2e1..0e60b550835d90fccfd265b17ba60d46e227699c 100644 --- a/src/plugins/wp/tests/why3/test_config_qualif +++ b/src/plugins/wp/tests/why3/test_config_qualif @@ -1,4 +1,5 @@ FILEREG: .*\.why +DEPS: ~/.why3.conf CMD: why3 -L @PTEST_SHARE_DIR@/why3 prove -P alt-ergo OPT: COMMENT: the filter remove the information about time and steps diff --git a/src/plugins/wp/tests/wp_bts/bts_1586.i b/src/plugins/wp/tests/wp_bts/bts_1586.i index dab7fc01fe3489960e604ec1a582048561820a0e..510137770e7c34d8dcec9e29899e910519cbaa7e 100644 --- a/src/plugins/wp/tests/wp_bts/bts_1586.i +++ b/src/plugins/wp/tests/wp_bts/bts_1586.i @@ -1,54 +1,54 @@ - -/*@ behavior Bizarre: - assumes x; - ensures TRANS: x ==> \result==1 ; - */ -int compute_bizarre(int x) -{ - if (x) - return 1; - else - return 2; -} - -/*@ behavior Normal: - assumes x; - ensures TRANS: x <==> \result==1 ; - */ -int compute_normal(int x) -{ - if (x) - return 1; - else - return 2; -} - -int main_bizarre_KO(int x) -{ - int trans = compute_bizarre(x); - - switch(trans) { - case 0: - //@ assert FALSE: \false; - return -1; - break; - default: - return -1; - break; - } -} - -int main_normal_KO(int x) -{ - int trans = compute_normal(x); - - switch(trans) { - case 0: - //@ assert FALSE: \false; - return -1; - break; - default: - return -1; - break; - } -} + +/*@ behavior Bizarre: + assumes x; + ensures TRANS: x ==> \result==1 ; + */ +int compute_bizarre(int x) +{ + if (x) + return 1; + else + return 2; +} + +/*@ behavior Normal: + assumes x; + ensures TRANS: x <==> \result==1 ; + */ +int compute_normal(int x) +{ + if (x) + return 1; + else + return 2; +} + +int main_bizarre_KO(int x) +{ + int trans = compute_bizarre(x); + + switch(trans) { + case 0: + //@ assert FALSE: \false; + return -1; + break; + default: + return -1; + break; + } +} + +int main_normal_KO(int x) +{ + int trans = compute_normal(x); + + switch(trans) { + case 0: + //@ assert FALSE: \false; + return -1; + break; + default: + return -1; + break; + } +} diff --git a/src/plugins/wp/tests/wp_bts/ergo_typecheck.i b/src/plugins/wp/tests/wp_bts/ergo_typecheck.i index 27786043f20fd6d2e90613e767fd3de0deed156c..3a05b9220dd03e2b1b1444e202df0a8a79ab2978 100644 --- a/src/plugins/wp/tests/wp_bts/ergo_typecheck.i +++ b/src/plugins/wp/tests/wp_bts/ergo_typecheck.i @@ -1,44 +1,44 @@ -typedef struct -{ - unsigned int a[2]; - unsigned int b[2]; - unsigned int c; -} my_type; - -my_type var = {0}; - -/*@ - @ ensures var_divded : var == {\old(var) \with - @ .a = {\old(var.a) \with - @ [0] = (unsigned int) 0, - @ [1] = (unsigned int) 1}, - @ .b = {\old(var.b) \with - @ [0] = (unsigned int)(\old(var.b[0]) + 1), - @ [1] = (unsigned int)(\old(var.b[1]) + 2)}, - @ .c = (unsigned int) 5 - @ }; - @ - @ ensures var_inline : var == {\old(var) \with - @ .a[0] = (unsigned int) 0, - @ .a[1] = (unsigned int) 1, - @ .b[0] = (unsigned int)(\old(var.b[0]) + 1), - @ .b[1] = (unsigned int)(\old(var.b[1]) + 2), - @ .c = (unsigned int) 5 - @ }; - @ - @ ensures var_unit0 : var.a[0] == 0; - @ ensures var_unit1 : var.a[1] == 1; - @ ensures var_unit2 : var.b[0] == (unsigned int)(\old(var.b[0]) + 1); - @ ensures var_unit3 : var.b[1] == (unsigned int)(\old(var.b[1]) + 2); - @ ensures var_unit4 : var.c == 5; - @ assigns var; - @ - */ -void f() -{ - var.a[0] = 0u; - var.a[1] = 1u; - var.b[0] ++; - var.b[1] += 2; - var.c = 5u; -} +typedef struct +{ + unsigned int a[2]; + unsigned int b[2]; + unsigned int c; +} my_type; + +my_type var = {0}; + +/*@ + @ ensures var_divded : var == {\old(var) \with + @ .a = {\old(var.a) \with + @ [0] = (unsigned int) 0, + @ [1] = (unsigned int) 1}, + @ .b = {\old(var.b) \with + @ [0] = (unsigned int)(\old(var.b[0]) + 1), + @ [1] = (unsigned int)(\old(var.b[1]) + 2)}, + @ .c = (unsigned int) 5 + @ }; + @ + @ ensures var_inline : var == {\old(var) \with + @ .a[0] = (unsigned int) 0, + @ .a[1] = (unsigned int) 1, + @ .b[0] = (unsigned int)(\old(var.b[0]) + 1), + @ .b[1] = (unsigned int)(\old(var.b[1]) + 2), + @ .c = (unsigned int) 5 + @ }; + @ + @ ensures var_unit0 : var.a[0] == 0; + @ ensures var_unit1 : var.a[1] == 1; + @ ensures var_unit2 : var.b[0] == (unsigned int)(\old(var.b[0]) + 1); + @ ensures var_unit3 : var.b[1] == (unsigned int)(\old(var.b[1]) + 2); + @ ensures var_unit4 : var.c == 5; + @ assigns var; + @ + */ +void f() +{ + var.a[0] = 0u; + var.a[1] = 1u; + var.b[0] ++; + var.b[1] += 2; + var.c = 5u; +} diff --git a/src/plugins/wp/tests/wp_gallery/binary-multiplication.c b/src/plugins/wp/tests/wp_gallery/binary-multiplication.c index c365c6f448277fca904f52231225bc5af90dc7b4..26c0459f04acd1eb51b56e24764c26360ba62f6d 100644 --- a/src/plugins/wp/tests/wp_gallery/binary-multiplication.c +++ b/src/plugins/wp/tests/wp_gallery/binary-multiplication.c @@ -3,7 +3,7 @@ */ /* run.config_qualif - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/BinaryMultiplication_*.json OPT: -wp-rte -wp-prover=alt-ergo,script -wp-prop=-lack @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_gallery/dune b/src/plugins/wp/tests/wp_gallery/dune new file mode 100644 index 0000000000000000000000000000000000000000..4e2c8b817fd365d5ffb809779a7f6bc45886160d --- /dev/null +++ b/src/plugins/wp/tests/wp_gallery/dune @@ -0,0 +1,3 @@ +(subdir + result_qualif/binary-multiplication.0.session_qualif/script + (copy_files ../../../binary-multiplication.0.session_qualif/script/*)) diff --git a/src/plugins/wp/tests/wp_manual/dune b/src/plugins/wp/tests/wp_manual/dune new file mode 100644 index 0000000000000000000000000000000000000000..d97afa2949041e76599faba881c6e97b6c4f3c61 --- /dev/null +++ b/src/plugins/wp/tests/wp_manual/dune @@ -0,0 +1,3 @@ +(subdir + result_qualif/working_dir + (copy_files ../../working_dir/*)) diff --git a/src/plugins/wp/tests/wp_plugin/abs.i b/src/plugins/wp/tests/wp_plugin/abs.i index a602a11d813578ba99b10380fa702855e49c3e30..441f0356840d6ed89db4f26bd23b02bd2fa1a393 100644 --- a/src/plugins/wp/tests/wp_plugin/abs.i +++ b/src/plugins/wp/tests/wp_plugin/abs.i @@ -1,11 +1,11 @@ /* run.config COMMENT: depends from files mentionned into "abs.driver" - DEPS: abs.why + DEPS: @PTEST_DEPS@ abs.why OPT: -wp-driver %{dep:@PTEST_DIR@/abs.driver} */ /* run.config_qualif COMMENT: depends from files mentionned into "abs.driver" - DEPS: abs.why + DEPS: @PTEST_DEPS@ abs.why OPT: -wp -wp-driver %{dep:@PTEST_DIR@/abs.driver} -wp-prover alt-ergo */ /*@ axiomatic Absolute { logic integer ABS(integer x) ; } */ diff --git a/src/plugins/wp/tests/wp_plugin/bitmask0x8000.i b/src/plugins/wp/tests/wp_plugin/bitmask0x8000.i index e2e5cf5fba38b6d8860003cd779ae364c30805a3..889dd60a91da9e01ea85bbfde51f9258537c3940 100644 --- a/src/plugins/wp/tests/wp_plugin/bitmask0x8000.i +++ b/src/plugins/wp/tests/wp_plugin/bitmask0x8000.i @@ -3,7 +3,7 @@ */ /* run.config_qualif - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/lemma_*.json OPT: -wp-prover script,alt-ergo @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_plugin/config.sh b/src/plugins/wp/tests/wp_plugin/config.sh index 64004c51ddea7ee92b065d6e41e86d3a8f10019c..d0f7c134c09979614f7908269d1d33e30e9dc8f1 100755 --- a/src/plugins/wp/tests/wp_plugin/config.sh +++ b/src/plugins/wp/tests/wp_plugin/config.sh @@ -4,8 +4,25 @@ ERGO=`alt-ergo -version` WHY3=`why3 --version` echo "----------------------------------------------------------" -echo "WP Requirements for Qualif Tests (3)" +echo "WP Requirements for Qualif Tests" echo "----------------------------------------------------------" + +#------ Alt-Ergo version echo "1. The Alt-Ergo theorem prover, version ${ERGO}" + +#------ Why3 version echo "2. The ${WHY3}" + +#------ FRAMAC_WP_CACHEDIR +if [ "${FRAMAC_WP_CACHEDIR}" = "" ]; then + echo "3. Error: undefined FRAMAC_WP_CACHEDIR variable" +else + echo "3. The environment variable FRAMAC_WP_CACHEDIR is defined" +fi +#------ FRAMAC_WP_CACHE +if [ "${FRAMAC_WP_CACHE}" = "" ]; then + echo "4. Error: undefined FRAMAC_WP_CACHE variable" +else + echo "4. The environment variable FRAMAC_WP_CACHE is defined" +fi echo "----------------------------------------------------------" diff --git a/src/plugins/wp/tests/wp_plugin/dune b/src/plugins/wp/tests/wp_plugin/dune new file mode 100644 index 0000000000000000000000000000000000000000..7323baff07fc5124c2e55b6e9e808096efbd1bdf --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/dune @@ -0,0 +1,11 @@ +(subdir + result_qualif/bitmask0x8000.0.session_qualif/script + (copy_files ../../../bitmask0x8000.0.session_qualif/script/*)) + +(subdir + result_qualif/unroll.0.session_qualif/script + (copy_files ../../../unroll.0.session_qualif/script/*)) + +(subdir + result_qualif/unsigned.0.session_qualif/script + (copy_files ../../../unsigned.0.session_qualif/script/*)) diff --git a/src/plugins/wp/tests/wp_plugin/no_step_limit.i b/src/plugins/wp/tests/wp_plugin/no_step_limit.i index 9f3b47813e5d5248effb9906fee3e8af9131caa5..874baf0c74f20fa9a2510a1cbc783138caedaf2a 100644 --- a/src/plugins/wp/tests/wp_plugin/no_step_limit.i +++ b/src/plugins/wp/tests/wp_plugin/no_step_limit.i @@ -2,7 +2,7 @@ DONTRUN: */ /* run.config_qualif - DEPS: @PTEST_NAME@.conf + DEPS: @PTEST_DEPS@ @PTEST_NAME@.conf CMD: WHY3CONFIG=@PTEST_DIR@/@PTEST_NAME@.conf @frama-c@ OPT: -wp -wp-prover no-steps -wp-steps 10 -wp-timeout 1 -wp-cache none -wp-no-cache-env -wp-msg-key shell */ diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/config.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/config.res.oracle index bdae904b176d5799a42a2c3f84f8b6190c311e27..746a2a97a2559b60e74e43158516741580b3a1c6 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/config.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/config.res.oracle @@ -1,6 +1,8 @@ ---------------------------------------------------------- -WP Requirements for Qualif Tests (3) +WP Requirements for Qualif Tests ---------------------------------------------------------- 1. The Alt-Ergo theorem prover, version 2.2.0 2. The Why3 platform, version 1.5.0 +3. The environment variable FRAMAC_WP_CACHEDIR is defined +4. The environment variable FRAMAC_WP_CACHE is defined ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/unroll.i b/src/plugins/wp/tests/wp_plugin/unroll.i index 021ceb05d916d53f2b67bce5c86c714481e51d4e..f6feda1b587b987794cc4103c1e4e3ea853c7af4 100644 --- a/src/plugins/wp/tests/wp_plugin/unroll.i +++ b/src/plugins/wp/tests/wp_plugin/unroll.i @@ -3,7 +3,7 @@ */ /* run.config_qualif - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/unrolled_loop_*.json OPT: -ulevel=1 -wp-prop=@ensures -wp-prover script @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_plugin/unsigned.i b/src/plugins/wp/tests/wp_plugin/unsigned.i index a4075988005d6bb74ee68e849bcf67ae8789720f..b810f6a8c35fc77831675da1bd3c84e5b8ff00a4 100644 --- a/src/plugins/wp/tests/wp_plugin/unsigned.i +++ b/src/plugins/wp/tests/wp_plugin/unsigned.i @@ -3,7 +3,7 @@ */ /* run.config_qualif - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/lemma_*.json OPT: -wp-prover script @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_tip/clear.i b/src/plugins/wp/tests/wp_tip/clear.i index c4d1b5f53767129850bb885e4ca5eb6261a9d740..7f256f8738439fc95f4d5c2bcbb84b230aaa9ec8 100644 --- a/src/plugins/wp/tests/wp_tip/clear.i +++ b/src/plugins/wp/tests/wp_tip/clear.i @@ -1,5 +1,5 @@ /* run.config - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/clear_*.json OPT: -wp-par 1 -wp-no-print -wp-prover qed,script -wp-msg-key script @USING_WP_SESSION@ */ /* run.config_qualif diff --git a/src/plugins/wp/tests/wp_tip/dune b/src/plugins/wp/tests/wp_tip/dune new file mode 100644 index 0000000000000000000000000000000000000000..4b359d879b10439f6fc632e911635cc66e0cd7ef --- /dev/null +++ b/src/plugins/wp/tests/wp_tip/dune @@ -0,0 +1,47 @@ +; Non qualif + +(subdir + result/clear.0.session/script + (copy_files ../../../clear.0.session/script/*)) + +(subdir + result/induction_typing.0.session/script + (copy_files ../../../induction_typing.0.session/script/*)) + +(subdir + result/modmask.0.session/script + (copy_files ../../../modmask.0.session/script/*)) + +(subdir + result/modmask.1.session/script + (copy_files ../../../modmask.1.session/script/*)) + +(subdir + result/split.0.session/script + (copy_files ../../../split.0.session/script/*)) + +; Qualif + +(subdir + result_qualif/induction.0.session_qualif/script + (copy_files ../../../induction.0.session_qualif/script/*)) + +(subdir + result_qualif/induction.1.session_qualif/script + (copy_files ../../../induction.1.session_qualif/script/*)) + +(subdir + result_qualif/induction.2.session_qualif/script + (copy_files ../../../induction.2.session_qualif/script/*)) + +(subdir + result_qualif/overflow.0.session_qualif/script + (copy_files ../../../overflow.0.session_qualif/script/*)) + +(subdir + result_qualif/tac_split_quantifiers.0.session_qualif/script + (copy_files ../../../tac_split_quantifiers.0.session_qualif/script/*)) + +(subdir + result_qualif/unroll.0.session_qualif/script + (copy_files ../../../unroll.0.session_qualif/script/*)) diff --git a/src/plugins/wp/tests/wp_tip/induction.i b/src/plugins/wp/tests/wp_tip/induction.i index df4e3fa378d1c13704c8af6e64803040b93b565f..fc876e51ec8686bda8930290c1c0dd625bfe01a9 100644 --- a/src/plugins/wp/tests/wp_tip/induction.i +++ b/src/plugins/wp/tests/wp_tip/induction.i @@ -3,11 +3,11 @@ */ /* run.config_qualif - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/lemma_*.json OPT: -wp-prover script,alt-ergo -wp-timeout 1 @USING_WP_SESSION@ - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/lemma_*.json OPT: -wp-prover script,alt-ergo -wp-timeout 1 @USING_WP_SESSION@ - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/lemma_*.json OPT: -wp-prover script,alt-ergo -wp-timeout 1 @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_tip/induction_typing.i b/src/plugins/wp/tests/wp_tip/induction_typing.i index 4f9b82169e695cd8280fd6b609f1d97f42b4eb7e..499aff1fb178c673b154735709a9de8af5903dd7 100644 --- a/src/plugins/wp/tests/wp_tip/induction_typing.i +++ b/src/plugins/wp/tests/wp_tip/induction_typing.i @@ -1,5 +1,5 @@ /* run.config - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/function_*.json OPT: -wp-par 1 -wp-prop X -wp-no-print -wp-prover qed,script -wp-msg-key script @USING_WP_SESSION@ */ /* run.config_qualif diff --git a/src/plugins/wp/tests/wp_tip/modmask.i b/src/plugins/wp/tests/wp_tip/modmask.i index 4da4f942609c8aa048db60978c10cd676ee7c1a6..5d922c9cd7e61fba2d743760a8a2fcd6ada25717 100644 --- a/src/plugins/wp/tests/wp_tip/modmask.i +++ b/src/plugins/wp/tests/wp_tip/modmask.i @@ -1,7 +1,7 @@ /* run.config - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/check_lemma_*.json OPT: -wp-par 1 -wp-no-print -wp-prover qed,script -wp-msg-key script @USING_WP_SESSION@ - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/check_lemma_*.json OPT: -wp-par 1 -wp-no-print -wp-prover qed,script -wp-msg-key script @USING_WP_SESSION@ */ /* run.config_qualif diff --git a/src/plugins/wp/tests/wp_tip/overflow.i b/src/plugins/wp/tests/wp_tip/overflow.i index 34298d91ee6cd15218eaa30df4b27a7e8ddeae8d..9eaeb2f596507759f4d3d1dbb8736bf679b15ff8 100644 --- a/src/plugins/wp/tests/wp_tip/overflow.i +++ b/src/plugins/wp/tests/wp_tip/overflow.i @@ -3,7 +3,7 @@ */ /* run.config_qualif - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/lemma_*.json OPT: -wp-prover script,alt-ergo -wp-timeout 1 @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_tip/split.i b/src/plugins/wp/tests/wp_tip/split.i index 27c531dbae2c92e8ed17eb4a5bb62f682ad44956..5755a39ee518534b768f43f4ee77b27c706eb6b3 100644 --- a/src/plugins/wp/tests/wp_tip/split.i +++ b/src/plugins/wp/tests/wp_tip/split.i @@ -1,5 +1,5 @@ /* run.config - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/test_*.json OPT: -wp-par 1 -wp-no-print -wp-prover qed,script -wp-msg-key script @USING_WP_SESSION@ */ /* run.config_qualif diff --git a/src/plugins/wp/tests/wp_tip/tac_split_quantifiers.i b/src/plugins/wp/tests/wp_tip/tac_split_quantifiers.i index fd890b44fd309b9274b16f57b3b612078a9682a2..1b30e034e1faaac5ab59dd13a59fd4eb1a66cfce 100644 --- a/src/plugins/wp/tests/wp_tip/tac_split_quantifiers.i +++ b/src/plugins/wp/tests/wp_tip/tac_split_quantifiers.i @@ -4,7 +4,7 @@ /* run.config_qualif SCRIPT: TacNOP - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/split_*.json OPT: -wp -wp-par 1 -wp-prover script @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_tip/unroll.i b/src/plugins/wp/tests/wp_tip/unroll.i index df1151d0372728c581ddaed68ce417a896d07c55..f7d00c3009ab837ca628afb63abb2805118e5126 100644 --- a/src/plugins/wp/tests/wp_tip/unroll.i +++ b/src/plugins/wp/tests/wp_tip/unroll.i @@ -3,7 +3,7 @@ */ /* run.config_qualif - + DEPS: @PTEST_DEPS@ @WP_SESSION@/script/lemma_*.json OPT: -wp-prover script,none @USING_WP_SESSION@ */ diff --git a/src/plugins/wp/tests/wp_typed/unit_bitwise.c b/src/plugins/wp/tests/wp_typed/unit_bitwise.c index acb4398b437fd953eeae6b3d8f23e91a3557fcfb..76102d7b33ff4937ee298883f8648ca44dbc0ec7 100644 --- a/src/plugins/wp/tests/wp_typed/unit_bitwise.c +++ b/src/plugins/wp/tests/wp_typed/unit_bitwise.c @@ -1,9 +1,9 @@ /* run.config - DEPS: unit_bitwise.h + DEPS: @PTEST_DEPS@ unit_bitwise.h OPT: */ /* run.config_qualif - DEPS: unit_bitwise.h + DEPS: @PTEST_DEPS@ unit_bitwise.h OPT: -wp-prop="-ko" OPT: -wp-prop="ko" */ diff --git a/src/plugins/wp/wp.ml b/src/plugins/wp/wp.ml new file mode 100644 index 0000000000000000000000000000000000000000..037fd72723fa408543d6934f7f65151d32ae07e9 --- /dev/null +++ b/src/plugins/wp/wp.ml @@ -0,0 +1,83 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module Wp_parameters = Wp_parameters +module Ctypes = Ctypes +module Clabels = Clabels +module MemoryContext = MemoryContext +module LogicUsage = LogicUsage +module RefUsage = RefUsage +module NormatLabels = NormAtLabels +module WpPropId = WpPropId +module Mcfg = Mcfg +module Context = Context +module Warning = Warning +module Lang = Lang +module Repr = Repr +module Passive = Passive +module Splitter = Splitter +module LogicBuiltins = LogicBuiltins +module Definitions = Definitions +module Cint = Cint +module Cfloat = Cfloat +module Vset = Vset +module Cstring = Cstring +module Sigs = Sigs +module Mstate = Mstate +module Conditions = Conditions +module Filtering = Filtering +module Plang = Plang +module Pcfg = Pcfg +module Pcond = Pcond +module CodeSemantics = CodeSemantics +module LogicCompiler = LogicCompiler +module LogicSemantics = LogicSemantics +module Sigma = Sigma +module MemVar = MemVar +module MemTyped = MemTyped +module CfgCompiler = CfgCompiler +module StmtSemantics = StmtSemantics +module Factory = Factory +module Driver = Driver +module VCS = VCS +module Tactical = Tactical +module Strategy = Strategy +module Auto = Auto +module VC = VC +module Wpo = Wpo +module ProverTask = ProverTask +module Prover = Prover +module AssignsCompleteness = AssignsCompleteness + +(** For gui *) +module ProofEngine = ProofEngine +module ProofScript = ProofScript +module ProofSession = ProofSession +module ProverScript = ProverScript +module ProverSearch = ProverSearch +module WpRTE = WpRTE +module Rformat = Rformat +module WpContext = WpContext +module Why3Provers = Why3Provers +module ProverWhy3 = ProverWhy3 +module Cache = Cache +module WpTarget = WpTarget diff --git a/src/plugins/wp/wp_parameters.ml b/src/plugins/wp/wp_parameters.ml index e3f635e500eb47d3189ee49427487e390d24d12a..2a18489d2931c8fb44a50d749521cb070802932b 100644 --- a/src/plugins/wp/wp_parameters.ml +++ b/src/plugins/wp/wp_parameters.ml @@ -1071,7 +1071,7 @@ module OutputDir = let dkey = register_category "prover" -let has_out () = OutputDir.get () <> "" +let has_out () = OutputDir.get() <> "" let make_output_dir dir = if Sys.file_exists dir then @@ -1126,7 +1126,7 @@ let base_output () = | None -> let output = match OutputDir.get () with | "" -> - if !Fc_config.is_gui + if Fc_config.is_gui then make_gui_dir () else make_tmp_dir () | dir -> diff --git a/tests/constant_propagation/test_config b/tests/constant_propagation/test_config index e4fab5265fc6f8ad2301d089f8776df00b4e6f92..a0809882b6a8268c6431a2d0f1c71fb4d00042c3 100644 --- a/tests/constant_propagation/test_config +++ b/tests/constant_propagation/test_config @@ -1,3 +1,3 @@ -MACRO: CONSTANT_PROPAGATION_PLUGINS constant_propagation @EVA_MAIN_PLUGINS@ +MACRO: CONSTANT_PROPAGATION_PLUGINS constant_propagation @EVA_MAIN_PLUGINS@ from,inout PLUGIN: @CONSTANT_PROPAGATION_PLUGINS@ OPT: @EVA_OPTIONS@ -machdep x86_32 -then -scf diff --git a/tests/crowbar/.merlin b/tests/crowbar/.merlin deleted file mode 100644 index bad48ad47efcb83ced077e1e3644853249c968ab..0000000000000000000000000000000000000000 --- a/tests/crowbar/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG crowbar -REC diff --git a/tests/dynamic/dune b/tests/dynamic/dune new file mode 100644 index 0000000000000000000000000000000000000000..548c2ebb2b4edc91c0948a3a1a363fd5b73839a6 --- /dev/null +++ b/tests/dynamic/dune @@ -0,0 +1,7 @@ +(subdir + result + (copy_files ../file_path)) + +(subdir + result/directory_path + (copy_files ../../directory_path/*)) diff --git a/tests/dynamic/dynamic.i b/tests/dynamic/dynamic.i index b33a41b88c7d881276220ab303231eba7d5e2b70..ca9861b12ca9a9e852286010071abe1e4946ad7b 100644 --- a/tests/dynamic/dynamic.i +++ b/tests/dynamic/dynamic.i @@ -1,5 +1,9 @@ /*run.config - OPT: -add-path @PTEST_DIR@/file_path -add-path @PTEST_DIR@/directory_path -add-path @PTEST_DIR@/none +EXIT: 1 + DEPS: @PTEST_DIR@/directory_path/README + OPT: -add-path %{dep:@PTEST_DIR@/file_path} -add-path @PTEST_DIR@/directory_path -add-path @PTEST_DIR@/none +EXIT: 0 MODULE: empty abstract abstract2 OPT: */ +// Note: the dependency @PTEST_DIR@/directory_path/README is used to create the directory directory_path by the copy_files of the dune file. diff --git a/tests/dynamic/oracle/dynamic.0.res.oracle b/tests/dynamic/oracle/dynamic.0.res.oracle index c68b9c26afe58fbb9b9eb8222bea165621fcb505..d337236378f155063b675e4f6d1b68bc44473fba 100644 --- a/tests/dynamic/oracle/dynamic.0.res.oracle +++ b/tests/dynamic/oracle/dynamic.0.res.oracle @@ -1,3 +1,3 @@ -[kernel] Warning: cannot load './none' (not a directory) -[kernel] Warning: cannot load './file_path' (not a directory) -[kernel] Parsing dynamic.i (no preprocessing) +[kernel] User Error: option `-add-path' is unknown. + use `frama-c -help' for more information. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/fc_script/main.c b/tests/fc_script/main.c index b9a1681883931e7d547bbf022867ce43738c9f59..decfb23991130135e247f622aec8f8d5e5606121 100644 --- a/tests/fc_script/main.c +++ b/tests/fc_script/main.c @@ -3,7 +3,7 @@ COMMENT: the 'build' command cannot be tested because it requires 'glub'. DEPS: main2.c main3.c main.c EXECNOW: LOG list_files.res LOG list_files.err PTESTS_TESTING=1 %{bin:frama-c-script} list-files %{dep:@PTEST_DIR@/list_files.json} > @PTEST_RESULT@/list_files.res 2> @PTEST_RESULT@/list_files.err - DEPS: for-find-fun2.c for-find-fun.c for-list-functions.c main2.c main3.c main.c make-wrapper2.c make-wrapper3.c make-wrapper.c + DEPS: for-find-fun2.c for-find-fun.c for-list-functions.c for-list-functions.h for-list-functions2.h main2.c main3.c main.c make-wrapper2.c make-wrapper3.c make-wrapper.c EXECNOW: LOG find_fun1.res LOG find_fun1.err PTESTS_TESTING=1 %{bin:frama-c-script} find-fun main2 @PTEST_DIR@ > @PTEST_RESULT@/find_fun1.res 2> @PTEST_RESULT@/find_fun1.err EXECNOW: LOG find_fun2.res LOG find_fun2.err PTESTS_TESTING=1 %{bin:frama-c-script} find-fun main3 @PTEST_DIR@ > @PTEST_RESULT@/find_fun2.res 2> @PTEST_RESULT@/find_fun2.err EXECNOW: LOG find_fun3.res LOG find_fun3.err PTESTS_TESTING=1 %{bin:frama-c-script} find-fun false_positive @PTEST_DIR@ > @PTEST_RESULT@/find_fun3.res 2> @PTEST_RESULT@/find_fun3.err diff --git a/tests/fc_script/test_config b/tests/fc_script/test_config new file mode 100644 index 0000000000000000000000000000000000000000..ff1c5e31628a610eb768e563368ecec4c4cfdad3 --- /dev/null +++ b/tests/fc_script/test_config @@ -0,0 +1,6 @@ +/* run.config* +COMMENT: Explicits the dependencies of {bin:frama-c-script} execution: + PLUGIN: variadic,instantiate +COMMENT: The library frama-c.analysis_scripts is part of the package frama-c +COMMENT: and this dependency is implicit as the one to the needed python files. +*/ diff --git a/tests/jcdb/dune b/tests/jcdb/dune new file mode 100644 index 0000000000000000000000000000000000000000..fb081c70ecac3c1577fcf60d102b491479b60bdf --- /dev/null +++ b/tests/jcdb/dune @@ -0,0 +1,11 @@ +(subdir + result/subdir1 + (copy_files ../../subdir1/*)) + +(subdir + result/subdir2 + (copy_files ../../subdir2/*)) + +(subdir + result/logic-pp-include + (copy_files ../../logic-pp-include/*)) diff --git a/tests/make_run_script/make_run_script.mll b/tests/make_run_script/make_run_script.mll deleted file mode 100644 index 9e92922569776948d4a22b6da553e2bf11f966a5..0000000000000000000000000000000000000000 --- a/tests/make_run_script/make_run_script.mll +++ /dev/null @@ -1,215 +0,0 @@ -{ - let debug = true - - let string_if_not_zero nbr = if nbr = 0 then "" else "."^string_of_int nbr - - type state = CMD_STATE | ARG_STATE | SRC_STATE | OPT_STATE | PPC_STATE | GCC_STATE - type token = TOP_TOKEN | CFG_TOKEN | CMD_TOKEN - - let head = - "#!/bin/sh\n" ^ - "if [ $# -lt 5 ] ; then\n" ^ - " echo `basename $0`\": a subshell build by make_run_script.\"\n" ^ - " exit 1\n" ^ - "fi\n" ^ - "#comparaison\n" ^ - "Compare() {\n" ^ - " if [ -e $1$2 ]; then\n" ^ - " File=`basename $1$2 .log`.oracle\n" ^ - " Dir=`dirname $1`\n" ^ - " Dir=`dirname $Dir`\n" ^ - " File=\"$Dir/oracle/$File\"\n" ^ - " if [ -e ${File} ]; then\n" ^ - " if ! diff -b -B --brief $1$2 ${File} >/dev/null\n" ^ - " then\n" ^ - " echo \". KO: diff -b -B $1$2 ${File}\"\n" ^ - " fi\n" ^ - " else\n" ^ - " echo \". NO oracle ${File}\"\n" ^ - " fi\n" ^ - " fi\n" ^ - "}\n" ^ - "# input file\n" ^ - "Src=$1\n" ^ - "shift\n" ^ - "# prefix for the out files\n" ^ - "PreFix=$1\n" ^ - "shift\n" ^ - "# extension for out files issued from stdout\n" ^ - "PostFix1=$1\n" ^ - "shift\n" ^ - "# extension for out files issued from stderr\n" ^ - "PostFix2=$1\n" ^ - "shift\n" ^ - "# command running the test\n" ^ - "Cmd=$1\n" ^ - "shift\n" ^ - "#\n" ^ - "Result=0\n" - - let line_nbr, lex_token, cmd_state, cmd_head, cmd_nbr, cmd_str = - ref 1, ref TOP_TOKEN, ref CMD_STATE, ref false, ref 0, ref "" - - (* GCC: check the compilation of the source file*) - let flush_gcc_line cmd nbr = -(* Printf.printf"# check the compilation of the source file.\n"; - Printf.printf"#\n#echo \"- Test %d: compilation checking...\"\n" nbr; - Printf.printf"echo \"gcc %s -c ${Src} -o ${PreFix}.o\"\n" cmd; - Printf.printf"gcc %s -c ${Src} -o ${PreFix}.o 2> /dev/null\n" cmd; - Printf.printf"Res=$?\n"; - Printf.printf"rm -f ${PreFix}.o\n"; - Printf.printf"if [ \"${Res}\" != 0 ] ; then\n"; - Printf.printf" echo \"# compilation problem with: gcc %s -c ${Src} -o ${PreFix}.o\"\n" cmd; - Printf.printf"fi\n" -*) - () - let flush_redirection nbr_ = - let nbr = string_if_not_zero nbr_ in - Printf.printf" > ${PreFix}%s${PostFix1} 2> ${PreFix}%s${PostFix2}\n" - nbr nbr; - Printf.printf"Res=$?\n"; - Printf.printf"if [ \"${Res}\" != 0 ] ; then\n"; - Printf.printf" Result=${Res}\n"; - Printf.printf" echo \"# abort(${Res}) on test No %d\"\n" nbr_; - Printf.printf"else\n"; - Printf.printf" Compare ${PreFix}%s${PostFix1}\n" nbr; - Printf.printf" Compare ${PreFix}%s${PostFix2}\n" nbr; - Printf.printf"fi\n" - - (* default binary, options and source file are still into the command. *) - (* SRC: <extra-opt>* <extra-src-file>* *) - (* cmd= <default-tool> <default-opt> SRC <default-src-file> *) - (* cmd= <default-tool> <default-opt> <extra-opt>* <extra-src-file>* <default-src-file> *) - let flush_src_line cmd nbr = - Printf.printf"#\n#echo \"- Test %d: running...\"\n" nbr; - Printf.printf"echo \"${Cmd} %s ${Src}\"\n" cmd; - Printf.printf"${Cmd} $* %s ${Src}" cmd; - flush_redirection nbr - - (* default binary and source file are still into the command. *) - (* OPT: <opt>* <extra-src-file>* *) - (* cmd= <default-tool> OPT <default-src-file> *) - (* cmd= <default-tool> <opt>* <extra-src-file>* <default-src-file> *) - let flush_opt_line cmd nbr = - Printf.printf"#\n#echo \"- Test %d: running...\"\n" nbr; - Printf.printf"echo \"${Cmd} %s ${Src}\"\n" cmd; - Printf.printf"${Cmd} %s ${Src}" cmd; - flush_redirection nbr - - (* default binary is still into the command. *) - (* ARG: <opt>* <src-file>* *) - (* cmd= <default-tool> ARG *) - (* cmd= <default-tool> <opt>* <src-file>* *) - let flush_arg_line cmd nbr = - Printf.printf"#\n#echo \"- Test %d: running...\"\n" nbr; - Printf.printf"echo \"${Cmd} %s\"\n" cmd; - Printf.printf"${Cmd} %s" cmd; - flush_redirection nbr - - (* CMD: <command> <opt>* <src-file>* *) - (* cmd= CMD *) - (* cmd= <command> <opt>* <src-file> *) - let flush_cmd_line cmd nbr = - Printf.printf"#\n#echo \"- Test %d: running...\"\n" nbr; - Printf.printf"echo \"%s\"\n" cmd; - Printf.printf"%s" cmd; - flush_redirection nbr - - let flush_cmd state = - - if not !cmd_head - then Printf.printf"%s" head; - (match state with - | PPC_STATE -> flush_gcc_line "" !cmd_nbr; Printf.printf"${Cmd} $* ${Src}" - | GCC_STATE -> flush_gcc_line !cmd_str !cmd_nbr - | OPT_STATE -> - flush_opt_line !cmd_str !cmd_nbr; - incr cmd_nbr - | ARG_STATE -> flush_arg_line !cmd_str !cmd_nbr; - incr cmd_nbr - | SRC_STATE -> flush_src_line !cmd_str !cmd_nbr; - incr cmd_nbr - | CMD_STATE -> flush_cmd_line !cmd_str !cmd_nbr; - incr cmd_nbr); - cmd_head := true; - cmd_str := "" - - let debug_cmd txt = - if debug - then - Printf.printf"#%s\n" txt - else - () - - let state_cmd token info = - lex_token := token; - debug_cmd info - - let start_cmd state token info= - cmd_state := state; - state_cmd token info - - let start_cfg state token info = - if state = !cmd_state - then flush_cmd !cmd_state; - start_cmd state token info - - let build_cmd s = - cmd_str := !cmd_str ^ s - - exception Eof - exception ConfigNotFound -} -rule token_top = parse - '\n' { if (5 > !line_nbr) - then line_nbr := 1 + !line_nbr - else raise ConfigNotFound } - | [^ '\n'] { } - | eof { debug_cmd "end of file"; raise Eof } - | "/*" ([' ' '\t']*) "run.config" ([' ' '\t' '\n']) { line_nbr := 1; start_cmd PPC_STATE CFG_TOKEN "parsing config"; } - -and token_cfg = parse - | '\n' { } - | [^ '*' '\n' ' ' '\t' ]+ { } - | ['*' ' ' '\t'] { } - | eof { debug_cmd "end of file"; raise Eof } - | ('\n' | ['*' ' ' '\t'])* "GCC:" { start_cmd GCC_STATE CMD_TOKEN "* GCC:" } - | ('\n' | ['*' ' ' '\t'])* "CMD:" { start_cmd CMD_STATE CMD_TOKEN "* CMD:"} - | ('\n' | ['*' ' ' '\t'])* "OPT:" { start_cmd OPT_STATE CMD_TOKEN "* OPT:" } - | ('\n' | ['*' ' ' '\t'])* "ARG:" { start_cmd ARG_STATE CMD_TOKEN "* ARG:"} - | ('\n' | ['*' ' ' '\t'])* "SRC:" { start_cmd SRC_STATE CMD_TOKEN "* SRC:"} - | "*/" { start_cfg PPC_STATE TOP_TOKEN "end of config" } - -and token_cmd = parse - '\\' '\n' [' ' '\t']* { } - | '\n' { flush_cmd !cmd_state; state_cmd CFG_TOKEN "* end of line"} - | ('\\' as c) { build_cmd (String.make 1 c) } - | ([^ '\n' '\\']+ as s) { build_cmd s } - | eof { flush_cmd !cmd_state; raise Eof } - | "*/" { flush_cmd !cmd_state; state_cmd TOP_TOKEN "end of parsing"} - -{ - let _ = ( try - let std_channel = - if Array.length Sys.argv = 1 then stdin - else open_in Sys.argv.(1) - in - let lexbuffer = Lexing.from_channel std_channel - in while true do - let lexfun = (match !lex_token with - | TOP_TOKEN -> token_top - | CFG_TOKEN -> token_cfg - | CMD_TOKEN -> token_cmd) - in lexfun lexbuffer - done - with Eof -> debug_cmd "#end of file" - | ConfigNotFound -> () - | Failure(s) -> Printf.printf"#ERROR\n"); - print_newline(); - if not !cmd_head - then exit 1; - Printf.printf"#return last abort value.\n"; - Printf.printf"exit ${Result}\n"; - flush stdout; -} - diff --git a/tests/misc/dune b/tests/misc/dune new file mode 100644 index 0000000000000000000000000000000000000000..350ae7160b3c799e3d13271dd4342fb7e90279c8 --- /dev/null +++ b/tests/misc/dune @@ -0,0 +1,3 @@ +(subdir + result/custom_machdep + (copy_files ../../custom_machdep/*)) diff --git a/tests/misc/global_decl_loc.i b/tests/misc/global_decl_loc.i index 7955b774e26b1c68c70f8451b9dd9b8463989b7d..755b5d1a822b7bb62ddfdb6ccb50a6de0fca2925 100644 --- a/tests/misc/global_decl_loc.i +++ b/tests/misc/global_decl_loc.i @@ -1,6 +1,6 @@ /* run.config COMMENT: with dune, the LIBS directive must be replaced by a MODULE directive (see also ./test_config file) - LIBS: global_decl_loc + MODULE: global_decl_loc OPT: %{dep:@PTEST_DIR@/global_decl_loc2.i} */ diff --git a/tests/misc/global_decl_loc2.i b/tests/misc/global_decl_loc2.i index 77ea1dfabb166e240936c70641fe093b769db756..964f7e09301f4738337d4a33f1a45156d337844a 100644 --- a/tests/misc/global_decl_loc2.i +++ b/tests/misc/global_decl_loc2.i @@ -1,7 +1,7 @@ /* run.config* COMMENT: with dune, the LIBS directive must be replaced by a MODULE directive (see also ./test_config file) - LIBS: global_decl_loc + MODULE: global_decl_loc OPT: %{dep:@PTEST_DIR@/global_decl_loc.i} */ extern int g; diff --git a/tests/misc/oracle/log_selfrec.res.oracle b/tests/misc/oracle/log_selfrec.res.oracle index a6950e931a0ec56f8a87657fbc4d32fd71e54c8d..befe7bc2d0fa5c1653ace7344098c437ca313627 100644 --- a/tests/misc/oracle/log_selfrec.res.oracle +++ b/tests/misc/oracle/log_selfrec.res.oracle @@ -1,5 +1,5 @@ [report] Monitoring events [kernel] User Error: option `-foobar' is unknown. - use `bin/toplevel.opt -help' for more information. + use `frama-c -help' for more information. [report] User Error: Invalid action ("JAZZ") [kernel] Plug-in report aborted: invalid user input. diff --git a/tests/misc/with space/dune b/tests/misc/with space/dune new file mode 100644 index 0000000000000000000000000000000000000000..3f68a03100050f8644cba0921dfcfdb87461b327 --- /dev/null +++ b/tests/misc/with space/dune @@ -0,0 +1,7 @@ +(executable ; MODULE #1 FOR TEST FILES: "with-space.i" + (name "module") + (modules "module") + (modes plugin) + (libraries frama-c.init.cmdline frama-c.boot frama-c.kernel ) + (flags :standard -w -9-32-6-34 -open Frama_c_kernel) +) diff --git a/tests/misc/with-space.i b/tests/misc/with-space.i index 98f36854e12589e89b66c49274a8bd9556998b20..5a1eddc52babddf2ba7f1b428715ffaf3db82b9b 100644 --- a/tests/misc/with-space.i +++ b/tests/misc/with-space.i @@ -1,4 +1,4 @@ /* run.config - SCRIPT: @PTEST_DIR@/with\ space/module + LIBS: ../with\ space/module OPT: */ diff --git a/tests/occurrence/decl_func.i b/tests/occurrence/decl_func.i index 7bdd40c185effbe9fc874bbf8d6b8bc8e6c30d5a..94757ecd52f73090caf85ec22dc35c5fdb126514 100644 --- a/tests/occurrence/decl_func.i +++ b/tests/occurrence/decl_func.i @@ -1,7 +1,7 @@ /* run.config +PLUGIN: @PTEST_PLUGIN@ inout STDOPT: +"-occurrence" */ - int x,y; /*@ predicate foo{L} = x == y; */ diff --git a/tests/occurrence/ptr_assert.i b/tests/occurrence/ptr_assert.i index 2fab8226c3d92fc6fb206aa4bcad0b709752065f..19808c8694a6a867aa8092c7933a843d1369ceff 100644 --- a/tests/occurrence/ptr_assert.i +++ b/tests/occurrence/ptr_assert.i @@ -1,5 +1,5 @@ /* run.config - + PLUGIN: @PTEST_PLUGIN@ inout STDOPT: +"-occurrence" */ diff --git a/tests/pdg/dyn_dpds.ml b/tests/pdg/dyn_dpds.ml index 716e5067f6a276524b036e8efe28dd061dd235ab..4907cf29314c0d98ef989c991d66b70567bc1493 100644 --- a/tests/pdg/dyn_dpds.ml +++ b/tests/pdg/dyn_dpds.ml @@ -21,29 +21,29 @@ let main _ = File.pretty_ast (); Kernel.Debug.set memo_debug ; let kf = Globals.Functions.find_def_by_name "main" in - let pdg = !Db.Pdg.get kf in - Format.printf "%a@." (!Db.Pdg.pretty ~bw:false) pdg; - !Db.Pdg.extract pdg "dyn_dpds_0.dot"; + let pdg = Pdg.Api.get kf in + Format.printf "%a@." (Pdg.Api.pretty ~bw:false) pdg; + Pdg.Api.extract pdg "dyn_dpds_0.dot"; let assert_sid = 5 in (* assert ( *p>G) *) let assert_stmt, kf = Kernel_function.find_from_sid assert_sid in let _assert_node = - match !Db.Pdg.find_simple_stmt_nodes pdg assert_stmt with + match Pdg.Api.find_simple_stmt_nodes pdg assert_stmt with | n::[] -> n | _ -> assert false in let star_p = get_zones "*p" (assert_stmt, kf) in let data_nodes, undef = - !Db.Pdg.find_location_nodes_at_stmt pdg assert_stmt ~before:true star_p + Pdg.Api.find_location_nodes_at_stmt pdg assert_stmt ~before:true star_p in assert (undef = None); let g_zone = get_zones "G" (assert_stmt, kf) in let g_nodes, undef = - !Db.Pdg.find_location_nodes_at_stmt pdg assert_stmt ~before:true g_zone + Pdg.Api.find_location_nodes_at_stmt pdg assert_stmt ~before:true g_zone in let _data_nodes = g_nodes @ data_nodes in let undef = match undef with None -> assert false | Some z -> z in Format.printf "Warning : cannot select %a in this function...@\n" Locations.Zone.pretty undef; - Format.printf "%a@." (!Db.Pdg.pretty ~bw:false) pdg; - !Db.Pdg.extract pdg "dyn_dpds_1.dot" + Format.printf "%a@." (Pdg.Api.pretty ~bw:false) pdg; + Pdg.Api.extract pdg "dyn_dpds_1.dot" let () = Db.Main.extend main diff --git a/tests/pdg/sets.ml b/tests/pdg/sets.ml index f9759901253978aef39e3675d91663df60b7587e..23c627b3a5bb207fb6a40a3d1ec5fcd793dfbe3e 100644 --- a/tests/pdg/sets.ml +++ b/tests/pdg/sets.ml @@ -1,58 +1,57 @@ -open Db;; -open Cil_types;; - -let pp_nodes msg nodes = - Kernel.result "%s" msg ; - List.iter (fun n -> Kernel.result "%a" (!Pdg.pretty_node false) n) nodes;; - -exception Find of varinfo;; - -let main _ = - let f = Globals.Functions.find_by_name "f" in - let pdg = !Pdg.get f in - - (* Uncomment to retrieve sid *) - (*Kernel.Debug.set 1;; - Format.eprintf "@[%a@]@." Printer.pp_global (Kernel_function.get_global f);; - *) - (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) - let stmt_1 = fst (Kernel_function.find_from_sid 1) in (* y = 0 *) - let node = !Pdg.find_stmt_node pdg stmt_1 in - let nodes = !Pdg.all_uses pdg [node] in - pp_nodes "Test [all_uses] stmt1" nodes; - - (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) - let y = - try - Globals.Vars.iter (fun v _ -> if v.vname = "y" then raise (Find v)); - assert false - with Find v -> - v - in - - let y_zone = Locations.(enumerate_valid_bits Read (loc_of_varinfo y)) in - let y_at_11_nodes, undef = (* y=5 *) - !Pdg.find_location_nodes_at_stmt - pdg (fst (Kernel_function.find_from_sid 11)) ~before:false y_zone - in - - assert (undef = None); - let y_at_11_nodes = List.map (fun (n,_z) -> n) y_at_11_nodes in - - let () = pp_nodes "Test [find_location_nodes_at_stmt] y@11" y_at_11_nodes in - (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) - let nodes = !Pdg.all_dpds pdg y_at_11_nodes in - let () = pp_nodes "Test [all_dpds] y@11" nodes in - (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) - let nodes = !Pdg.all_uses pdg y_at_11_nodes in - let () = pp_nodes "Test [all_uses] y@11" nodes in - (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) - let all_related_nodes pdg = - let all n = (!Pdg.direct_uses pdg n) @ (!Pdg.direct_dpds pdg n) in - !Pdg.custom_related_nodes all - in - let nodes = all_related_nodes pdg y_at_11_nodes in - pp_nodes "Test [all_related_nodes] y@11" nodes -(*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) - -let () = Db.Main.extend main +open Cil_types;; + +let pp_nodes msg nodes = + Kernel.result "%s" msg ; + List.iter (fun n -> Kernel.result "%a" (Pdg.Api.pretty_node false) n) nodes;; + +exception Find of varinfo;; + +let main _ = + let f = Globals.Functions.find_by_name "f" in + let pdg = Pdg.Api.get f in + + (* Uncomment to retrieve sid *) + (*Kernel.Debug.set 1;; + Format.eprintf "@[%a@]@." Printer.pp_global (Kernel_function.get_global f);; + *) + (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) + let stmt_1 = fst (Kernel_function.find_from_sid 1) in (* y = 0 *) + let node = Pdg.Api.find_stmt_node pdg stmt_1 in + let nodes = Pdg.Api.all_uses pdg [node] in + pp_nodes "Test [all_uses] stmt1" nodes; + + (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) + let y = + try + Globals.Vars.iter (fun v _ -> if v.vname = "y" then raise (Find v)); + assert false + with Find v -> + v + in + + let y_zone = Locations.(enumerate_valid_bits Read (loc_of_varinfo y)) in + let y_at_11_nodes, undef = (* y=5 *) + Pdg.Api.find_location_nodes_at_stmt + pdg (fst (Kernel_function.find_from_sid 11)) ~before:false y_zone + in + + assert (undef = None); + let y_at_11_nodes = List.map (fun (n,_z) -> n) y_at_11_nodes in + + let () = pp_nodes "Test [find_location_nodes_at_stmt] y@11" y_at_11_nodes in + (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) + let nodes = Pdg.Api.all_dpds pdg y_at_11_nodes in + let () = pp_nodes "Test [all_dpds] y@11" nodes in + (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) + let nodes = Pdg.Api.all_uses pdg y_at_11_nodes in + let () = pp_nodes "Test [all_uses] y@11" nodes in + (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) + let all_related_nodes pdg = + let all n = (Pdg.Api.direct_uses pdg n) @ (Pdg.Api.direct_dpds pdg n) in + Pdg.Api.custom_related_nodes all + in + let nodes = all_related_nodes pdg y_at_11_nodes in + pp_nodes "Test [all_related_nodes] y@11" nodes +(*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) + +let () = Db.Main.extend main diff --git a/tests/ptests_config b/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..7f88d14afd5084b1a1b167317be74a23dda7f814 --- /dev/null +++ b/tests/ptests_config @@ -0,0 +1,29 @@ +# todo: adds bugs? +# todo: adds crowbar? Yes, but these tests do not use ptests +# todo: adds journal? No, the journal suite directory will be removed later to master + +### Tests of kernel + +DEFAULT_SUITES= cil compliance dynamic fc_script jcdb libc misc +DEFAULT_SUITES= pretty_printing saveload spec syntax test + +### Tests of small plugins + +DEFAULT_SUITES= callgraph constant_propagation impact metrics occurrence pdg +DEFAULT_SUITES= rte rte_manual scope slicing sparecode + +### Tests of EVA + +DEFAULT_SUITES= value/numerors value/traces +DEFAULT_SUITES= value builtins float idct + +### Tests of EVA domains +apron_SUITES = +bitwise_SUITES = value builtins float idct +equality_SUITES = value builtins float idct +gauges_SUITES = value builtins float idct +multidim_SUITES = value builtins float idct +octagon_SUITES = value builtins float idct +symblocs_SUITES = value builtins float idct +# todo: +IGNORE= apron_SUITES = builtins float idct value diff --git a/tests/slicing/dune b/tests/slicing/dune new file mode 100644 index 0000000000000000000000000000000000000000..ed45836ab781b2f76d7d981e4dc2ff7cafb1d773 --- /dev/null +++ b/tests/slicing/dune @@ -0,0 +1,14 @@ +(library + (name libSelect) + (modules libSelect) + (libraries frama-c.init.cmdline frama-c.boot frama-c.kernel frama-c-slicing.core) + (flags -open Frama_c_kernel) +) + +(library + (name libAnim) + (modules libAnim) + (libraries frama-c.init.cmdline frama-c.boot frama-c.kernel frama-c-slicing.core) + (flags -open Frama_c_kernel) +) + diff --git a/tests/slicing/libSelect.ml b/tests/slicing/libSelect.ml index fae01cc8b503d8b9ea25207c7d62c2617596d3aa..8fed3fdca1f1de30f97a13a1bb3d6d358a5197d9 100644 --- a/tests/slicing/libSelect.ml +++ b/tests/slicing/libSelect.ml @@ -29,7 +29,7 @@ let print_stmt kf = Slicing.PrintSlice.print_fct_stmts fmt kf (* print PDG (for debugging purposes) *) -let print_pdg kf = !Db.Pdg.pretty fmt (!Db.Pdg.get kf) ;; +let print_pdg kf = Pdg.Api.pretty fmt (Pdg.Api.get kf) ;; let print_ff ff = Slicing.Api.Slice.pretty fmt ff diff --git a/tests/slicing/min_call.ml b/tests/slicing/min_call.ml index ebb0e3e8983bf0c210980e6700575ac75ff6f5ab..80fbe7ad12575a7cf978e0441508b3fec992676d 100644 --- a/tests/slicing/min_call.ml +++ b/tests/slicing/min_call.ml @@ -31,8 +31,8 @@ let main _ = * the call to [send_bis] is visible as wished. *) Slicing.Api.Project.reset_slicing (); - (*let pdg_k = !Db.Pdg.get kf_k;;*) - let calls = !Db.Pdg.find_call_stmts ~caller:kf_k(*pdg_k*) kf_send_bis in + (*let pdg_k = Pdg.Api.get kf_k;;*) + let calls = Pdg.Api.find_call_stmts ~caller:kf_k(*pdg_k*) kf_send_bis in let sb_call = match calls with c::[] -> c | _ -> assert false in let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in let select = Slicing.Api.Select.select_stmt_internal kf_k sb_call mark in @@ -52,8 +52,8 @@ let main _ = * But as [send_bis] is an undefined function, this makes no difference. *) Slicing.Api.Project.reset_slicing (); - (*let pdg_k = !Db.Pdg.get kf_k;;*) - let calls = !Db.Pdg.find_call_stmts (*pdg_k*)~caller:kf_k kf_send_bis in + (*let pdg_k = Pdg.Api.get kf_k;;*) + let calls = Pdg.Api.find_call_stmts (*pdg_k*)~caller:kf_k kf_send_bis in let sb_call = match calls with c::[] -> c | _ -> assert false in let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in let select = Slicing.Api.Select.select_min_call_internal kf_k sb_call mark in diff --git a/tests/slicing/select_by_annot.ml b/tests/slicing/select_by_annot.ml index c3dec000e6239395812460cca35e5dd40299bcda..39e3e6d67a0bbda7190384523b629ca7b7ba20b9 100644 --- a/tests/slicing/select_by_annot.ml +++ b/tests/slicing/select_by_annot.ml @@ -7,7 +7,7 @@ open LibSelect;; let main _ = Slicing.Api.Project.reset_slicing (); - let pretty_pdg fmt kf = !Db.Pdg.pretty fmt (!Db.Pdg.get kf) in + let pretty_pdg fmt kf = Pdg.Api.pretty fmt (Pdg.Api.get kf) in let add_annot kf = let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in let select = Slicing.Api.Select.empty_selects in diff --git a/tests/slicing/simple_intra_slice.ml b/tests/slicing/simple_intra_slice.ml index f9e17c3b87c76683424ec6fc3679609606e3beac..7a7e189a1c90ae91ae2a9165430481ed0d3d05d7 100644 --- a/tests/slicing/simple_intra_slice.ml +++ b/tests/slicing/simple_intra_slice.ml @@ -7,7 +7,7 @@ include LibSelect;; let main _ = Slicing.Api.Project.reset_slicing (); - let pretty_pdg fmt kf = !Db.Pdg.pretty fmt (!Db.Pdg.get kf) in + let pretty_pdg fmt kf = Pdg.Api.pretty fmt (Pdg.Api.get kf) in let apply_all_actions = Slicing.Api.Request.apply_all_internal in let print_slice = Slicing.Api.Slice.pretty in let print_fct_stmts kf = diff --git a/tests/spec/assigns_result.i b/tests/spec/assigns_result.i index 55ebd04043412a8e6d2f9e9480b4c0bb94de85b5..76734ec44f8ad7978c3c915aecab215cc7308bd3 100644 --- a/tests/spec/assigns_result.i +++ b/tests/spec/assigns_result.i @@ -1,5 +1,5 @@ /* run.config -PLUGIN: eva,scope +PLUGIN: eva,scope inout STDOPT: +"-deps @EVA_OPTIONS@" */ int X,Y; diff --git a/tests/spec/const_ptr_bts1729.i b/tests/spec/const_ptr_bts1729.i index e2231335e0454d2586897f1552b3eac698e88e87..cb6ef2c2f0fe442b5bcd69f4714ec14f65cd0c73 100644 --- a/tests/spec/const_ptr_bts1729.i +++ b/tests/spec/const_ptr_bts1729.i @@ -1,4 +1,4 @@ - -static void elem_size(void) { - //@ assert \valid_read((char const * const *)0); -} + +static void elem_size(void) { + //@ assert \valid_read((char const * const *)0); +} diff --git a/tests/spec/logic_def.c b/tests/spec/logic_def.c index c01bfb9e61297a6a281ab144bdd7c3524a753d9a..03ee3fd170597c8913a683e7e33427759cda8cb8 100644 --- a/tests/spec/logic_def.c +++ b/tests/spec/logic_def.c @@ -1,5 +1,5 @@ /* run.config -PLUGIN: eva,scope +PLUGIN: eva,scope inout STDOPT: +"-eva -eva-verbose 2" */ //@ logic integer foo(int x) = x + 2 ; diff --git a/tests/spec/preprocess_dos.c b/tests/spec/preprocess_dos.c new file mode 100644 index 0000000000000000000000000000000000000000..fad1137e4f47452a05fd11c815e5e59b7c673ad9 --- /dev/null +++ b/tests/spec/preprocess_dos.c @@ -0,0 +1,13 @@ +/* run.config* +DEPS: preprocess_dos.sh +ENABLED_IF: %{bin-available:unix2dos} +OPT: -cpp-command="./@PTEST_NAME@.sh unix2dos %i %o" -cpp-frama-c-compliant -print +*/ + +int main() { + int a = 0; + /*@ + assert a == 0; + */ + return a; +} diff --git a/tests/spec/preprocess_dos.c.in b/tests/spec/preprocess_dos.c.in deleted file mode 100644 index abae8ad374b159cd60043731308ac57df1f96498..0000000000000000000000000000000000000000 --- a/tests/spec/preprocess_dos.c.in +++ /dev/null @@ -1,13 +0,0 @@ -/* run.config* -COMMENT: Don't edit directly preprocess_dos.c, but preprocess_dos.c.in -@DONTRUN@ -OPT: -cpp-command="@PTEST_DIR@/@PTEST_NAME@.sh @UNIX2DOS@ %i %o" -cpp-frama-c-compliant -print -*/ - -int main() { - int a = 0; - /*@ - assert a == 0; - */ - return a; -} diff --git a/tests/syntax/ast_diff_1.i b/tests/syntax/ast_diff_1.i index 4f5db3d6867a1bd94ba7e9073d5e5b384cdd4d78..3528959793760f44b2ed89cbc310f0db4d685b10 100644 --- a/tests/syntax/ast_diff_1.i +++ b/tests/syntax/ast_diff_1.i @@ -1,6 +1,6 @@ /* run.config MODULE: @PTEST_NAME@ - OPT: -then -ast-diff ast_diff_2.i + OPT: -then -ast-diff %{dep:ast_diff_2.i} */ int X; int Y=3; diff --git a/tests/syntax/copy_visitor_bts_1073_bis.ml b/tests/syntax/copy_visitor_bts_1073_bis.ml index d26b1010abf5ca0abdc6ed8c1f089c43bc39291c..7f6abc845200d0eceff40365c3c812cd702b3632 100644 --- a/tests/syntax/copy_visitor_bts_1073_bis.ml +++ b/tests/syntax/copy_visitor_bts_1073_bis.ml @@ -1,55 +1,55 @@ -(*============================================================================*) -module P = Plugin.Register - (struct - let name = "Testing plugin" - let shortname = "test" - let help = "Just to test Filter..." - end) -module Opt = P.False - (struct - let option_name = "-test" - let help = "switch the plug-in on" - end) -(*============================================================================*) -module Visi = struct - exception EraseAssigns - exception EraseAllocation +(*============================================================================*) +module P = Plugin.Register + (struct + let name = "Testing plugin" + let shortname = "test" + let help = "Just to test Filter..." + end) +module Opt = P.False + (struct + let option_name = "-test" + let help = "switch the plug-in on" + end) +(*============================================================================*) +module Visi = struct + exception EraseAssigns + exception EraseAllocation - type fct = unit - type proj = unit + type fct = unit + type proj = unit - let fct_name vf _fi = vf.Cil_types.vname - let fct_info () _ = [ () ] - let param_visible _ _ = true - let body_visible _fi = true - let loc_var_visible _ _ = true - let inst_visible _ _ = true - let label_visible _ _ _ = true - let annotation_visible _ _ _ = true - let fun_precond_visible _ _ = true - let fun_postcond_visible _ _ = true - let fun_variant_visible _ _ = true - let fun_frees_visible _ _ = true - let fun_allocates_visible _ _ = true - let fun_assign_visible _ _ = true - let fun_deps_visible _ _ = true - let called_info _ _ = None - let res_call_visible _ _ = true - let result_visible _ _ = true - let cond_edge_visible _ _ = true, true -end -(*============================================================================*) -let main () = - if Opt.get () then - begin - let _ast = Ast.get () in - P.feedback "start compute"; - let new_proj_name = "filtered" in - let module Transform = Filter.F (Visi) in - let new_prj = Transform.build_cil_file new_proj_name () in - Project.on new_prj Opt.clear (); - P.feedback "exported in new project : %s" new_proj_name - end + let fct_name vf _fi = vf.Cil_types.vname + let fct_info () _ = [ () ] + let param_visible _ _ = true + let body_visible _fi = true + let loc_var_visible _ _ = true + let inst_visible _ _ = true + let label_visible _ _ _ = true + let annotation_visible _ _ _ = true + let fun_precond_visible _ _ = true + let fun_postcond_visible _ _ = true + let fun_variant_visible _ _ = true + let fun_frees_visible _ _ = true + let fun_allocates_visible _ _ = true + let fun_assign_visible _ _ = true + let fun_deps_visible _ _ = true + let called_info _ _ = None + let res_call_visible _ _ = true + let result_visible _ _ = true + let cond_edge_visible _ _ = true, true +end +(*============================================================================*) +let main () = + if Opt.get () then + begin + let _ast = Ast.get () in + P.feedback "start compute"; + let new_proj_name = "filtered" in + let module Transform = Filter.F (Visi) in + let new_prj = Transform.build_cil_file new_proj_name () in + Project.on new_prj Opt.clear (); + P.feedback "exported in new project : %s" new_proj_name + end -let () = Db.Main.extend main -(*============================================================================*) +let () = Db.Main.extend main +(*============================================================================*) diff --git a/tests/syntax/duplicated_global_bts1129.i b/tests/syntax/duplicated_global_bts1129.i index b95f7dfed63c40ac468c5af75edf3b4f1d7ef84b..b8ac93ff233a19e3dcd95c1d12e7297ff4c9668e 100644 --- a/tests/syntax/duplicated_global_bts1129.i +++ b/tests/syntax/duplicated_global_bts1129.i @@ -1,7 +1,7 @@ -void f(int* x); - -void f(int* x) { *x++; } - -int X; -//@ ensures X==1; -void f(int* x); +void f(int* x); + +void f(int* x) { *x++; } + +int X; +//@ ensures X==1; +void f(int* x); diff --git a/tests/value/.gitignore b/tests/value/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/value/numerors/numerors.c b/tests/value/numerors/numerors.c index fd0609d1213af2c53e128e9dce2573823dc773df..d62d96d1e7f231a38eee40fe6a1061dfabe7013e 100644 --- a/tests/value/numerors/numerors.c +++ b/tests/value/numerors/numerors.c @@ -1,7 +1,7 @@ /* run.config + PLUGIN: @PTEST_PLUGIN@ eva.numerors OPT: -eva -eva-domains numerors -eva-msg-key=d-numerors */ - /* Tests for the numerors domain, that computes absolute and relative errors of floating-point computations. */ diff --git a/bin/wp-qualif.sh b/tools/hdrck/Makefile similarity index 88% rename from bin/wp-qualif.sh rename to tools/hdrck/Makefile index 418cabf7b371c8ac91a44196bdcf23d68fab7af3..9ac5878d11e189c580ee42dbfc4ae58ac7778de1 100644 --- a/bin/wp-qualif.sh +++ b/tools/hdrck/Makefile @@ -20,5 +20,15 @@ # # ########################################################################## -export FRAMAC_WP_CACHE=update -export FRAMAC_WP_CACHEDIR=$WP_QUALIF_CACHE +.PHONY: all +all: hdrck.exe + +.PHONY: hdrck.exe +ptests.exe: + dune build --root . hdrck.exe + +.PHONY: clean +clean: + dune clean --root . + +########################################################################## diff --git a/tools/hdrck/dune b/tools/hdrck/dune new file mode 100644 index 0000000000000000000000000000000000000000..769d8ae8711541535935fd8e38b2ea856eb18295 --- /dev/null +++ b/tools/hdrck/dune @@ -0,0 +1,28 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(executable + (public_name frama-c-hdrck) + (name hdrck) + (modules hdrck) + (libraries unix str) +) diff --git a/tools/hdrck/dune-project b/tools/hdrck/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..3a50a77564ad624c2ef212b0448c2bc7e92281e3 --- /dev/null +++ b/tools/hdrck/dune-project @@ -0,0 +1,26 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(package + (name frama-c-hdchk) +) diff --git a/headers/hdrck.ml b/tools/hdrck/hdrck.ml old mode 100755 new mode 100644 similarity index 95% rename from headers/hdrck.ml rename to tools/hdrck/hdrck.ml index 14c04d2568bbc7eed18638f0ef670f64e5965b82..e8fd61024ec531b223e662b26ccf70d4aac4ae5d --- a/headers/hdrck.ml +++ b/tools/hdrck/hdrck.ml @@ -56,7 +56,8 @@ and forbidden_headers = ref [] and root_dir = ref (Sys.getcwd ()) and distrib_file = ref None and header_except_file = ref None -and headache_config_file = ref "headers/headache_config.txt" +and headache_config_file = ref [] (* empty -> headache_config_file_default *) +and headache_config_file_default = "headers/headache_config.txt" and exit_on_warning = ref false and exit_on_error = ref true (* only settable to false for debugging purposes *) @@ -389,8 +390,11 @@ let extract_header filename template_hdr = debug "%s: %s does not conform to %s@." filename hdr_filename template_hdr; let create_file filename = let oc = open_out filename in close_out oc in create_file hdr_filename; + let config_file_opts = if !headache_config_file = [] then Format.sprintf "-c %s" headache_config_file_default + else String.concat "-c " !headache_config_file + in let cmd = Format.sprintf "headache -c %s -e %s > %s" - !headache_config_file filename hdr_filename in + config_file_opts filename hdr_filename in let ret = Sys.command cmd in if ret <> 0 then if ret = 255 then @@ -410,11 +414,12 @@ let extract_header filename template_hdr = * @requires all header specifications have a corresponding existing template *) let check_spec_discrepancies + ~config_file_opts (specs: (string, string) Hashtbl.t) (headers: (string, string) Hashtbl.t) : unit = let eq_header orig_file template_hdr = let cmd = Format.sprintf "headache -c %s -e %s | diff --strip-trailing-cr -q - %s > /dev/null" - !headache_config_file orig_file template_hdr + config_file_opts orig_file template_hdr in let ret = Sys.command cmd in if ret = 255 then @@ -541,16 +546,17 @@ let check files_ignored header_specifications distributed_files exceptions = * The headers are simply overwritten. * No warning is emitted if the new license is not the same as the old license. * + * @param ~config_file_opts -> headache options setting the list of config files * @param header_specifications file -> license header name hashtable * @requires: files and licenses appearing in [header_specifications] exists *) -let update_headers header_specifications = +let update_headers ~config_file_opts header_specifications = let headers = get_header_files () in check_declared_headers header_specifications headers; let update filename header = debug "Updating %s with license %s@." filename header; let cmd = Format.sprintf "headache -r -c %s -h %s %s" - !headache_config_file header filename in + config_file_opts header filename in let ret = Sys.command cmd in if ret <> 0 then if ret = 255 then @@ -572,19 +578,20 @@ let update_headers header_specifications = let check_headache_config_file () = - if not (Sys.file_exists !headache_config_file) then - error ~exit_value:5 - "Headache configuration file %s does not appear to exist@." - !headache_config_file + let config_files = + if !headache_config_file = [] then [ headache_config_file_default ] + else !headache_config_file + in List.iter (fun file -> + if not (Sys.file_exists file) then + error ~exit_value:5 + "Headache configuration file %s does not appear to exist@." + file) config_files ; + String.concat " -c " config_files (** Option management (cont.) **) let set_opt (var:'a option ref) (value:'a) = var := Some value -let get_opt = function - | None -> assert false - | Some v -> v - let executable_name = Sys.argv.(0) let umsg = @@ -622,8 +629,8 @@ let rec argspec = [ "<filename> \t considers only the files listed into the <filename>"; "-header-except-file", Arg.String (set_opt header_except_file), "<filename> \t does not look at the files listed into the <filename>"; - "-headache-config-file", Arg.Set_string headache_config_file, - Format.sprintf "<filename> \t set headache configuration file [%s]" !headache_config_file; + "-headache-config-file", Arg.String (fun set -> set_cumulative ~name:"-headache-config-file" headache_config_file ~set), + Format.sprintf "<filenames> \t set the list of headache configuration files [%s]" headache_config_file_default; "-no-exit-on-error", Arg.Unit (fun () -> exit_on_error := false), " does not exit on errors "; "-exit-on-warning", Arg.Set exit_on_warning, @@ -661,7 +668,7 @@ let _ = (Format.eprintf "error: 'headache' command not in PATH or incompatible \ version (option -e unsupported)@."; exit 6); Arg.parse (Arg.align (sort argspec)) (fun s -> spec_files := s::!spec_files) umsg; - check_headache_config_file (); + let config_file_opts = check_headache_config_file () in begin match !spec_files, !distrib_file, !header_except_file with | [], _, _ when not !from_stdin -> @@ -686,9 +693,9 @@ let _ = let distributed_files = stringset_from_opt_file distrib_file_opt in let header_exception_files = stringset_from_opt_file header_except_opt in Format.printf "- excepted=%d@.- distributed=%d@." (StringSet.cardinal header_exception_files) (StringSet.cardinal distributed_files); - check !ignored_files specified_files distributed_files header_exception_files + check ~config_file_opts !ignored_files specified_files distributed_files header_exception_files | Update -> - update_headers specified_files; + update_headers ~config_file_opts specified_files; end; if !exit_on_warning && not !has_no_warning_nor_error then exit 8 ; diff --git a/ptests/.gitignore b/tools/ptests/.gitignore similarity index 100% rename from ptests/.gitignore rename to tools/ptests/.gitignore diff --git a/share/Makefile.dynamic_config.external b/tools/ptests/Makefile similarity index 54% rename from share/Makefile.dynamic_config.external rename to tools/ptests/Makefile index bb292956a60bae3a8a82bb794cf0832d086476d0..41ccbf4be5ec0c7bf969ff63bda211d350493d04 100644 --- a/share/Makefile.dynamic_config.external +++ b/tools/ptests/Makefile @@ -20,28 +20,62 @@ # # ########################################################################## -export FRAMAC_OPT=$(BINDIR)/frama-c$(EXE) -export FRAMAC_BYTE=$(BINDIR)/frama-c.byte$(EXE) +.PHONY: all +all: ptests.exe wtests.exe -export FRAMAC_INCLUDES=-I "$(FRAMAC_LIBDIR)" +.PHONY: ptests.exe +ptests.exe: + dune build --root . ptests.exe -export PTESTS=$(BINDIR)/ptests.$(OCAMLBEST)$(EXE) +.PHONY: wtests.exe +wtests.exe: + dune build --root . wtests.exe -export FRAMAC_LIB=$(FRAMAC_LIBDIR) -export DOC_DIR=$(FRAMAC_SHARE)/doc/code +.PHONY: clean +clean: purge-tests + dune clean --root . -export PLUGIN_LIB_DIR=$(PLUGIN_DIR) +########################################################################## + +TEST_DIRS= nothing cmd + +####### + +ENV_DIR=../_build/default/ptests/tests + +# removes also eventual broken dune files +.PHONY: purge-tests +purge-tests: + @echo "Purge tests" + find tests -name dune | grep -e "oracle.*/\|result.*/" | xargs --no-run-if-empty rm + +.PHONY: clean-tests +clean-tests: purge-tests + @echo "Clean tests" + rm -rf $(ENV_DIR) + +.PHONY: %.dune-file +%.dune-file: purge-tests + @echo "Dune files for $(basename $@)" + dune exec --root . ./ptests.exe ./tests/$(basename $@)/tests + find ./tests/$(basename $@)/tests -name dune -print -export FRAMAC_COMPILED_PLUGINDIR=$(FRAMAC_LIBDIR)/plugins +.PHONY: dune-files +dune-files: $(addsuffix .dune-file,$(TEST_DIRS)) -export OCAMLPATH:=$(FRAMAC_LIB):$(FRAMAC_PLUGINDIR)$(if $(OCAMLPATH),:,)$(OCAMLPATH) -export OCAMLFIND_IGNORE_DUPS_IN:=$(FRAMAC_LIB):$(FRAMAC_PLUGINDIR)$(if $(OCAMLFIND_IGNORE_DUPS_IN),:,)$(OCAMLFIND_IGNORE_DUPS_IN) +# note: tests requires the package frama-c (even if frama-c is not used there) +.PHONY: tests +tests: dune-files + @echo "Run Tests..." + dune build $(addprefix @tests/,$(addsuffix /tests/ptests,$(TEST_DIRS))) -# fake target corresponding to the clean-install of Frama-C's Makefile -.PHONY: clean-install -clean-install: ; +.PHONY: tests +force-tests: dune-files clean-tests + @echo "Run Tests..." + dune build $(addprefix @tests/,$(addsuffix /tests/ptests,$(TEST_DIRS))) + @echo "Nb .Log files:" + find $(ENV_DIR) -name \*.log -print | wc -l + @echo "Nb .err files:" + find $(ENV_DIR) -name \*.err -print | wc -l ########################################################################## -# Local Variables: -# mode: makefile -# End: diff --git a/ptests/check_oracles.sh b/tools/ptests/check_oracles.sh similarity index 98% rename from ptests/check_oracles.sh rename to tools/ptests/check_oracles.sh index 91e7177f6b99224f6c04c156c8f435e729fd22bc..1e553eff78e9feda88f9feae2efc85429dce993f 100755 --- a/ptests/check_oracles.sh +++ b/tools/ptests/check_oracles.sh @@ -21,6 +21,9 @@ # # ########################################################################## +echo "Obsolete script since 'ptests.opt' cannot be used for that..." +exit 1 + # Checks for extraneous, leftover oracle files that are no longer necessary. # Only reports files in plugins with a ptests_config file, and in directories # tested according to that ptests' DEFAULT_SUITES. diff --git a/tools/ptests/dune b/tools/ptests/dune new file mode 100644 index 0000000000000000000000000000000000000000..2120347c8dd65d0990bfc923e4344bff5427360d --- /dev/null +++ b/tools/ptests/dune @@ -0,0 +1,37 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(executable + (public_name frama-c-ptests) + (name ptests) + (modules ptests) + (libraries unix str) + (preprocess (pps ppx_deriving_yojson)) +) + +(executable + (public_name frama-c-wtests) + (name wtests) + (modules wtests) + (libraries unix str) + (preprocess (pps ppx_deriving_yojson)) +) diff --git a/tools/ptests/dune-project b/tools/ptests/dune-project new file mode 100644 index 0000000000000000000000000000000000000000..c4f77831ca36459149f84d772cf80397a5c2c508 --- /dev/null +++ b/tools/ptests/dune-project @@ -0,0 +1,29 @@ +(lang dune 3.0) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; This file is part of Frama-C. ;; +;; ;; +;; Copyright (C) 2007-2022 ;; +;; CEA (Commissariat à l'énergie atomique et aux énergies ;; +;; alternatives) ;; +;; ;; +;; you can redistribute it and/or modify it under the terms of the GNU ;; +;; Lesser General Public License as published by the Free Software ;; +;; Foundation, version 2.1. ;; +;; ;; +;; It 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 Lesser General Public License for more details. ;; +;; ;; +;; See the GNU Lesser General Public License version 2.1 ;; +;; for more details (enclosed in the file licenses/LGPLv2.1). ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(package + (name frama-c-ptests) + (depends + (ppx_deriving_yojson (>= 3.5.1)) + ) +) diff --git a/tools/ptests/ptests.ml b/tools/ptests/ptests.ml new file mode 100644 index 0000000000000000000000000000000000000000..13254fdc71308c2a8615f2d77739283e874eb773 --- /dev/null +++ b/tools/ptests/ptests.ml @@ -0,0 +1,1960 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Command-line flags *) + +let verbosity = ref 0 +let check_oracles = ref false +let create_missing_oracles = ref false +let remove_empty_oracles = ref false +let nb_dune_files = ref 0 +let nb_ignores = ref 0 +let ignored_suites = ref [] + +(* Set to an empty string to use no wrapper *) +let wrapper_cmd = ref "frama-c-wtests -brief" + +type env_t = { + config: string +; dir: string +; dune_alias: string +; absolute_tests_dir: string +; absolute_cwd: string +} + +module Filename = struct + include Filename + let concat = + if Sys.os_type = "Win32" then fun a b -> a ^ "/" ^ b else concat + + let cygpath r = + let cmd = + Format.sprintf + "bash -c \"cygpath -m %s\"" + (String.escaped (String.escaped r)) + in + let in_channel = Unix.open_process_in cmd in + let result = input_line in_channel in + ignore(Unix.close_process_in in_channel); + result + + let temp_file = + if Sys.os_type = "Win32" then + fun a b -> cygpath (temp_file a b) + else + fun a b -> temp_file a b + [@@ warning "-32"] + + let sanitize f = String.escaped f + + let sanitize_with_space = + let regexp = Str.regexp "[\\] " in + let subst = Str.global_replace regexp " " in + subst + + let remove_extension_opt suffixes name = + let ext = extension name in + if (String.equal "" ext) || not (List.mem ext suffixes) then name + else remove_extension name +end + +let str_string_match1 regexp line pos = + if Str.string_match regexp line pos then + try + Some (Str.matched_group 1 line) + with Not_found -> None + else None + +let str_string_match2 regexp line pos = + if Str.string_match regexp line pos then + try + Some ((Str.matched_group 1 line),(Str.matched_group 2 line)) + with Not_found -> None + else None + +(* removes first blanks *) +let trim_right s = + let n = ref (String.length s - 1) in + let last_char_to_keep = + try + while !n > 0 do + if String.get s !n <> ' ' then raise Exit; + n := !n - 1 + done; + 0 + with Exit -> !n + in + String.sub s 0 (last_char_to_keep+1) + +(** the pattern that ends the parsing of options in a test file *) +let end_comment = Str.regexp ".*\\*/" + +let output_unix_error (exn : exn) = + match exn with + | Unix.Unix_error (error, _function, arg) -> + let message = Unix.error_message error in + if arg = "" then + Format.eprintf "%s@." message + else + Format.eprintf "%s: %s@." arg message + | _ -> assert false + +let mv src dest = + try + Unix.rename src dest + with Unix.Unix_error _ as e -> + output_unix_error e +[@@ warning "-32"] + +let unlink ?(silent = true) file = + let open Unix in + try + Unix.unlink file + with + | Unix_error _ when silent -> () + | Unix_error (ENOENT,_,_) -> () (* Ignore "No such file or directory" *) + | Unix_error _ as e -> output_unix_error e + +let is_file_empty_or_nonexisting filename = + let open Unix in + try + (Unix.stat filename).st_size = 0 + with + | Unix_error (UnixLabels.ENOENT, _, _) -> (* file does not exist *) + true + | Unix_error _ as e -> + output_unix_error e; + raise e + +(** special configuration, with associated oracles *) +let config_name ~env name = + if env.config = "" then name else name ^ "_" ^ env.config + +let macro_post_options = ref "" (* value set to @PTEST_POST_OPTIONS@ macro *) +let macro_pre_options = ref "" (* value set to @PTEST_PRE_OPTIONS@ macro *) +let macro_options = ref "@PTEST_PRE_OPTIONS@ @PTEST_OPT@ @PTEST_POST_OPTIONS@" +let macro_default_options = ref "-check -no-autoload-plugins -add-symbolic-path=\"@PTEST_SESSION@:.\"" + +let macro_frama_c_exe = ref "frama-c" +let macro_frama_c_cmd = ref "@frama-c-exe@ @PTEST_DEFAULT_OPTIONS@" +let macro_frama_c = ref "@frama-c-exe@ @PTEST_DEFAULT_OPTIONS@ @PTEST_LOAD_OPTIONS@" +let macro_frama_c_share = ref "../../../../install/default/share/frama-c/share" + +let default_toplevel = ref "@frama-c@" + +(** the files in [suites] whose name matches + the pattern [test_file_regexp] will be considered as test files *) +let test_file_regexp = ".*\\.\\(c\\|i\\)$" + +let example_msg = + Format.sprintf + "@.@[<v 0>\ + Build the dune files allowing running the test suite contained into directories (defaults to ./tests).@ @ \ + @[<v 1>\ + Directives of the \"ptests_config\" files:@ \ + # <comment> @[<v 0># Just a comment line.@]@ \ + DEFAULT_SUITES = <suite>... @[<v 0># Cumulative list of subdirectories containing test suites (specified by \"test_config\" files).@]@ \ + <mode>_SUITES = <suite>... @[<v 0># Cumulative list of subdirectories containing test suites (specified by \"test_config_<mode>\" files).@]@ \ + DUNE_ALIAS = <alias-name> @[<v 0># The dune alias @@<alias-name> has to be used to executes the next defined suites (defaults to \"ptests\").@]@ \ + @]@ \ + @[<v 1>\ + Directives of \"test_config[_<mode>]\" files:@ \ + COMMENT: <comment> @[<v 0># Just a comment line.@]@ \ + FILEREG: <regexp> @[<v 0># Ignores the files in suites whose name doesn't matche the pattern.@]@ \ + DONTRUN: @[<v 0># Ignores the file.@]@ \ + EXECNOW: ([LOG|BIN] <file>)+ <command> @[<v 0># Defines the command to execute to build a 'LOG' (textual) 'BIN' (binary) targets.@ \ + # Note: the textual targets are compared to oracles.@]@ \ + DEPS: <file>... @[<v 0># Adds a dependency to next sub-test and execnow commands.@ \ + # Notes: a dependency to the included file can be added with this directive.@ \ + # That is not necessary for files mentioned into the command or options when using the %%{dep:<file>} feature of dune.@]@ \ + BIN: <file>... @[<v 0># Defines binary targets built by the next sub-test command.@ \ + LOG: <file>... @[<v 0># Defines textual targets built by the next sub-test command.@ \ + # Note: the textual targets are compared to oracles.@]@ \ + CMD: <command> @[<v 0># Defines the command to execute for all tests in order to get results to be compared to oracles.@]@ \ + OPT: <options> @[<v 0># Defines a sub-test using the 'CMD' definition: <command> <options>@]@ \ + STDOPT: +<extra> @[<v 0># Defines a sub-test and append the extra to the current option.@]@ \ + STDOPT: #<extra> @[<v 0># Defines a sub-test and prepend the extra to the current option.@]@ \ + PLUGIN: <plugin>... @[<v 0># Adds a dependency and set the macro @@PTEST_PLUGIN@@ defining the '-load-plugins' option used in the macro @@PTEST_LOAD_OPTIONS@@.@]@ \ + CMXS: <module>... @[<v 0># Defines dune targets without dependency to tests so use '-load-module %%{dep:<module>.cmxs}' into the test options.@]@ \ + MODULE: <module>... @[<v 0># Adds a dependency and adds the corresponding '-load-module' option into the macro @@PTEST_LOAD_OPTIONS@@.@]@ \ + SCRIPT: <module>... @[alias 'MODULE' directive.@]@ \ + LIBS: <module>... @[<v 0># Like 'MODULE' directive but for modules that can be shared between several test files.@]@ \ + EXIT: <number> @[<v 0># Defines the exit code required for the next sub-test commands.@]@ \ + FILTER: <cmd> @[<v 0># Performs a transformation on the test result files before the comparison from the oracles.@ \ + # The oracle will be compared from the standard output of the command: cat <test-output-file> | <cmd> .@ \ + # Chaining multiple filter commands is possible in defining several FILTER directives.@ \ + # An empty command drops the previous FILTER directives.@ \ + # Note: in such a command, the macro @@PTEST_ORACLE@@ is set to the basename of the oracle.@ \ + # This allows running a 'diff' command with the oracle of another test configuration:@ \ + # FILTER: diff --new-file %%{dep:@@PTEST_SUITE_DIR@@/oracle_configuration/@@PTEST_ORACLE@@} - @]@ \ + TIMEOUT: <delay> @[<v 0># Set a timeout for all sub-test.@]@ \ + NOFRAMAC: @[<v 0># Drops previous sub-test definitions and considers that there is no defined default sub-test.@]@ \ + GCC: @[<v 0># Deprecated.@]@ \ + MACRO: <name> <def> @[<v 0># Set a definition to the macro @@<name>@@.@]@ \ + @]@ \ + @[<v 1>\ + Some predefined macros can be used in test directives:@ \ + @@PTEST_DIR@@ # Path to the test file from the execution directory (./).@ \ + @@PTEST_FILE@@ # Substituted by the test filename.@ \ + @@PTEST_NAME@@ # Basename of the test file.@ \ + @@PTEST_NUMBER@@ # Test command number.@ \ + @@PTEST_CONFIG@@ # Test configuration suffix.@ \ + @@PTEST_SUITE_DIR@ # Path to the directory contained the source of the test file (../). + @@PTEST_RESULT@@ # Shorthand alias to @@PTEST_SUITE_DIR@@/result@@PTEST_CONFIG@@ (the result directory dedicated to the tested configuration).@ \ + @@PTEST_ORACLE@@ # Basename of the current oracle file (macro only usable in FILTER directives).@ \ + @@PTEST_DEFAULT_OPTIONS@@ # The default option list: %s@ \ + @@PTEST_LIBS@@ # The current list of modules defined by the LIBS directive.@ \ + @@PTEST_DEPS@@ # The current list of dependencies defined by the DEPS directive.@ \ + @@PTEST_MODULE@@ # The current list of modules defined by the MODULE directive.@ \ + @@PTEST_SCRIPT@@ # The current list of modules defined by the SCRIPT directive (DEPRECATED).@ \ + @@PTEST_PLUGIN@@ # The current list of plugins set by the PLUGIN directive.@ \ + @]@ \ + @[<v 1>\ + Other macros can only be used in test commands (CMD and EXECNOW directives):@ \ + @@PTEST_LOAD_OPTIONS@@ # The current list of options related to PLUGIN, MODULE, SCRIPT and LIBS to load.@ \ + @@PTEST_OPTIONS@@ # The current list of options related to OPT and STDOPT directives (for CMD directives).@ \ + @@frama-c-exe@@ # Shortcut defined as follow: %s@ \ + @@frama-c@@ # Shortcut defined as follow: %s@ \ + @@frama-c-cmd@@ # Shortcut defined as follow: %s@ \ + @@FRAMAC_SHARE@@ # Shortcut defined as follow: %s@ \ + @@PTEST_SHARE_DIR@@ # Path to the share directory of the related plugin.@ \ + @@DEV_NULL@@ # Set to 'NUL' for Windows platforms and to '/dev/null' otherwise.@ \ + @]@ \ + @[<v 1>\ + Default directive values:@ \ + FILEREG: %s@ \ + CMD: %s@ \ + EXIT: 0@ \ + @]@ \ + @[<v 1>\ + Dune aliases related to the test:@ \ + @@<alias-name> # Tests all configurations related to the <alias-name>@ \ + @@<alias-name>_config # Tests only the default configuration.@ \ + @@<alias-name>_config_<configuration> # Tests only the specified <configuration>.@ \ + @@<PTEST_NAME>.wtests # Tests the specified file.@ \ + @@<PTEST_NAME>.<PTEST_NUMBER>.exec.wtests # Tests the specified sub-test comand.@ \ + @@<PTEST_NAME>.<PTEST_NUMBER>.execnow.wtests # Tests the specified execnow command.@ \ + @@<PTEST_FILE> # Force to reproduce the corresponding test and prints the outputs.@ \ + @@<PTEST_NAME>.<PTEST_NUMBER>.exec.show # Prints the related sub-test command.@ \ + @@<PTEST_NAME>.<PTEST_NUMBER>.execnow.show # Prints the related execnow command.@ \ + @@<PTEST_NAME>.<PTEST_NUMBER>.diff # Prints the difference from the related oracles.@ \ + Note: the <alias-name> defaults to 'ptests'. It can be specified in different ways:@ \ + - from the command line option '-dune-alias <alias-name>'@ \ + - from directives in 'ptests_config' files such as 'DUNE_ALIAS = <alias-name>'@ \ + Note: 'dune build @<alias-name>' can be restricted to a test subdirectory in using:@ \ + - 'dune build @<subdirectory>/<alias-name>'@ \ + @]@ \ + @]" + !macro_default_options + !macro_frama_c_exe + !macro_frama_c + !macro_frama_c_cmd + !macro_frama_c_share + test_file_regexp + !default_toplevel + +let umsg = "Usage: frama-c-ptests [options] [names of test suites]" + +let default_dune_alias = ref "ptests" +let argspec = + [ + ("-v", Arg.Unit (fun () -> incr verbosity), + "Increase verbosity (up to twice)") ; + + ("-check-oracles", Arg.Set check_oracles, + " warn on missing or empty oracles") ; + + ("-create-missing-oracles", Arg.Set create_missing_oracles, + " creates missing oracles to allow the use of dune promote") ; + + ("-remove-empty-oracles", Arg.Set remove_empty_oracles, + " remove empty oracles") ; + + ("-wrapper" , Arg.String (function + | "''" -> wrapper_cmd := "" + | s -> wrapper_cmd := s), + " <command> Uses a wrapper to executes tests (defaults to "^ !wrapper_cmd ^")"); + + ("-adds-default-options" , Arg.String (fun s -> macro_default_options := !macro_default_options ^ " " ^ s), + " <options> Appends the <options> to the default value of the @PTEST_DEFAULT_OPTIONS@ macro"); + ("-add-options-pre", Arg.String (fun s -> macro_pre_options := !macro_pre_options ^ " " ^ s), + "<options> Add additional options to be passed to the toplevels \ + that will be launched. <options> are added before standard test options."); + ("-add-options-post", Arg.String (fun s -> macro_post_options := !macro_post_options ^ " " ^ s), + "<options> Add additional options to be passed to the toplevels \ + that will be launched. <options> are added after standard test options"); + + ("-macro-default-options" , Arg.String (fun s -> macro_default_options := s), + " <value> Set the default value of the @PTEST_DEFAULT_OPTIONS@ macro (defaults to "^ !macro_default_options ^")"); + ("-macro-frama-c-exe", Arg.String (fun s -> macro_frama_c_exe := s), + " <value> Set the default value of the @frama-c-exe@ macro (defaults to "^ !macro_frama_c_exe ^")"); + ("-macro-frama-c-cmd", Arg.String (fun s -> macro_frama_c_cmd := s), + " <value> Set the default value of the @frama-c-cmd@ macro (defaults to "^ !macro_frama_c_cmd ^")"); + ("-macro-frama-c", Arg.String (fun s -> macro_frama_c := s), + " <value> Set the @frama-c@ macro (defaults to "^ !macro_frama_c ^")"); + ("-macro-frama-c-share", Arg.String (fun s -> macro_frama_c_share := s), + " <value> Set the @FRAMAC_SHARE@ macro (defaults to "^ !macro_frama_c_share ^")"); + + ("-dune-alias", Arg.String (fun s -> default_dune_alias := s), + " <name> Use @<name> as dune alias to exectute tests (defaults to "^ !default_dune_alias ^")"); + ] + +let fail s = + Format.printf "Error: %s@.Aborting (CWD=%s).@." s (Sys.getcwd()); + exit 2 + +module StringMap = Map.Make (String) +(* parses the [tests/ptests_config] file (prefers the one related to the expected configuration name*) +module Ptests_config: sig + + type alias = { alias : string } + val parse: dir:string -> alias StringMap.t StringMap.t (* config_name -> suite_name -> dune_alias *) + +end = struct + + type alias = { alias : string } + + (** parses the [dir/ptests_config] file *) + let parse = + let split_blank = Str.split (Str.regexp "[ ]+") in + let regexp = Str.regexp " *\\([^#=][^=]*\\)=\\(.*\\)" in + let regexp_config = Str.regexp "\\([a-zA-Z_]+\\)_SUITES" in + let regexp_comment = Str.regexp " *#" in + let get_key_value s = str_string_match2 regexp s 0 in + let get_config_suites (key,value) = + Option.bind (str_string_match1 regexp_config key 0) + (function + | "DEFAULT" -> Some ("", (split_blank value)) + | config -> Some (config, (split_blank value))) + in + fun ~dir -> + let default_suites = ref StringMap.empty in + let dune_alias = ref {alias = !default_dune_alias } in + let ptests_config = Filename.concat dir "ptests_config" in + let add_suite config map s = + let add_to suites = + Some (StringMap.update s (function | None -> Some !dune_alias + | Some a -> + if a.alias <> !dune_alias.alias then begin + Format.eprintf "ERROR: %s: %s_SUITES contains already %s suite (with %s as dune alias).@" + ptests_config config s !dune_alias.alias; + exit 2 + end; + Some a) suites) + in + StringMap.update config (function | None -> Some (StringMap.singleton s !dune_alias) + | Some suites -> add_to suites) map + in + let parse_config_line (key,value) = + match get_config_suites (key,value) with + | Some (config, suites) -> + default_suites := List.fold_left (add_suite config) !default_suites suites + | None -> match key with + | "DUNE_ALIAS" -> (match split_blank value with + | [ alias ] -> dune_alias := { alias } + | _ -> + Format.eprintf "ERROR: %s: %s=%s@." ptests_config key value; + exit 2) + | "IGNORE" -> + (match Option.bind (get_key_value value) get_config_suites with + | Some (_config,suites) -> nb_ignores := !nb_ignores + List.length suites + | None -> incr nb_ignores + ); + ignored_suites := (ptests_config ^ ":" ^ value)::!ignored_suites; + if !verbosity >=2 then Format.eprintf "%s: %s=%s@." ptests_config key value + | _ -> Format.eprintf "%s: (DEPRECATED): %s=%s@." ptests_config key value; + in + if Sys.file_exists ptests_config then begin + let ch = open_in ptests_config in + try + (*Parse the plugin configuration file for tests. Format is 'Key=value' *) + while true do + let line = input_line ch in + match get_key_value line with + | Some (key, value) -> parse_config_line (key,value) + | None -> + if not ((Str.string_match regexp_comment line 0) || (split_blank line = [])) then begin + close_in ch; + Format.eprintf "Cannot interpret line '%s' in file %s. Aborting (CWD=%s).@." line ptests_config (Sys.getcwd()); + exit 1 + end + done + with + | End_of_file -> close_in ch ; + end + else begin + Format.eprintf + "Cannot find configuration file %s. (CWD=%s).@." ptests_config (Sys.getcwd()) ; + end; + !default_suites +end + +module SubDir: sig + type t + + val get: t -> string + + val create: with_subdir:bool -> env:env_t -> string (** dirname *) -> t + (** creates the needed subdirectories if [with_subdir=true]. + Anyway, fails if the given dirname doesn't exists *) + + val make_file: t -> string -> string + + val oracle_subdir: env:env_t -> t -> t + val result_subdir: env:env_t -> t -> t + + val get_oracle_dir: env:env_t -> string + val oracle_dir: env:env_t -> t + + val pp_file: dir:t -> Format.formatter -> string -> unit +end = struct + type t = string + + let get s = s + + let create_if_absent dir = + if not (Sys.file_exists dir) + then Unix.mkdir dir 0o750 (* rwxr-w--- *) + else if not (Sys.is_directory dir) + then fail (Printf.sprintf "the file %s exists but is not a directory" dir) + + let oracle_subdir ~env dir = Filename.concat dir (config_name ~env "oracle") + let result_subdir ~env dir = Filename.concat dir (config_name ~env "result") + + let make_file = Filename.concat + + let oracle_dir ~env = oracle_subdir ~env ".." + let get_oracle_dir = oracle_dir + + let create ~with_subdir ~env dir = + if not (Sys.file_exists dir && Sys.is_directory dir) + then fail (Printf.sprintf "the directory %s must be an existing directory" dir); + if (with_subdir) then begin + create_if_absent (result_subdir ~env dir); + create_if_absent (oracle_subdir ~env dir) + end; + dir + + let pp_file ~dir fmt s = Format.fprintf fmt "%s/%s" dir s +end + +let dev_null = if Sys.os_type = "Win32" then "NUL" else "/dev/null" + +module Macros = struct + + type t = string StringMap.t + + let add_defaults ~defaults macros = + StringMap.merge (fun _k default cur -> + match cur with + | Some _ -> cur + | _ -> default) defaults macros + + let empty = StringMap.empty + + let pp_macros fmt macros = + Format.fprintf fmt "Macros (%d):@." (StringMap.cardinal macros); + StringMap.iter (fun key data -> Format.fprintf fmt "- %s -> %s@." key data) macros; + Format.fprintf fmt "End macros@." + + type does_expand = { + has_ptest_file : bool; + has_ptest_opt : bool; + has_frama_c_exe : bool; + } + + + let does_expand ~file = + let macro_regex = Str.regexp "@\\([-A-Za-z_0-9]+\\)@" in + fun macros s -> + let has_ptest_file = ref false in + let has_ptest_opt = ref false in + let has_ptest_options = ref false in + let has_frama_c_exe = ref false in + if !verbosity >= 4 then Format.printf "%% %s: Expand: %s@." file s; + if !verbosity >= 5 then Format.printf "%a" pp_macros macros; + let nb_loops = ref 0 in + let rec aux s = + if !nb_loops > 100 then + fail (file ^ ": possible infinite recursivity in macro expands: "^ s) + else incr nb_loops ; + let expand_macro = function + | Str.Text s -> s + | Str.Delim s -> + match str_string_match1 macro_regex s 0 with + | Some macro -> begin + (match macro with + | "PTEST_FILE" -> has_ptest_file := true + | "PTEST_OPT" -> has_ptest_opt := true + | "PTEST_OPTIONS" -> has_ptest_options := true + | "frama-c-exe" -> has_frama_c_exe := true + | _ -> ()); + if !verbosity >= 5 then Format.printf "%% %s: - macro is %s\n%!" file macro; + try + let replacement = StringMap.find macro macros in + if !verbosity >= 4 then + Format.printf "%% %s: - replacement for %s is %s\n%!" file macro replacement; + aux replacement + with Not_found -> s + end + | None -> s + in + String.concat "" (List.map expand_macro (Str.full_split macro_regex s)) + in + let r = + try aux s + with e -> + Format.eprintf "%s: uncaught exception %s\n%!" file (Printexc.to_string e); + raise e + in + if !verbosity >= 4 then Format.printf "%% %s: Expansion result: %s@." file r; + { has_ptest_file= !has_ptest_file; + has_ptest_opt= !has_ptest_opt; + has_frama_c_exe= !has_frama_c_exe; + }, r + + let expand ~file (macros:t) s = + snd (does_expand ~file macros s) + + (* Removes the expansions to an empty string from the list (for DEPS,PLUGIN,MODULE,BIN,LOG *) + let expand_list ~file (macros:t) ls = + List.filter_map (fun s -> + let s = expand ~file macros s in + if String.equal s "" then None else Some s) ls + + let expand_enabled_if ~file (macros:t) enabled_if = + Option.map (fun s -> + let s = String.trim (expand ~file macros s) in + if s = "" then "true" else s) enabled_if + + let add_list l map = + List.fold_left (fun acc (k,v) -> StringMap.add k v acc) map l + + let add_expand ~file name def macros = + StringMap.add name (expand ~file macros def) macros + + let default_macros () = add_list + [ "frama-c-exe", !macro_frama_c_exe; + "frama-c-cmd", !macro_frama_c_cmd; + "frama-c", !macro_frama_c; + "DEV_NULL", dev_null; + + "FRAMAC_SHARE",!macro_frama_c_share; + + "PTEST_DEFAULT_OPTIONS", !macro_default_options; + "PTEST_OPTIONS", !macro_options; + "PTEST_PRE_OPTIONS", !macro_pre_options; + "PTEST_POST_OPTIONS", !macro_post_options; + + "PTEST_DEPS", ""; + "PTEST_LIBS", ""; + "PTEST_MODULE", ""; + "PTEST_SCRIPT", ""; + "PTEST_PLUGIN", ""; + "PTEST_ENABLED_IF", "true"; + ] empty + +end + +module StringSet = Set.Make(String) +type deps = { + load_plugin: string list option; + load_libs: string list option; + load_module: string list option; + deps_cmd: string list option; + enabled_if: string option; +} + +type execnow = + { ex_cmd: string; (** command to launch *) + ex_log: string list; (** log files *) + ex_bin: string list; (** bin files *) + ex_dir: SubDir.t; (** directory of test suite *) + ex_timeout: string; + ex_deps: deps + } + + +(** configuration of a directory/test. *) +type cmd = { + toplevel: string; + opts: string; + macros: Macros.t; + exit_code: string option; + logs: string list; + bins: string list; + deps: deps; + timeout: string +} + +type config = + { + dc_subdir: SubDir.t ; + dc_test_regexp: string; (** regexp of test files. *) + dc_execnow : execnow list; (** command to be launched before + the toplevel(s) + *) + dc_libs : string list option; (** libraries to compile *) + dc_deps : string list option ; (** deps *) + dc_enabled_if : string option ; (** enabled if condition *) + dc_plugin : string list option; (** only plugins to load *) + dc_module : string list option; (** module to load *) + dc_macros: Macros.t; (** existing macros. *) + dc_default_toplevel : string; + (** full path of the default toplevel. *) + dc_filter : string option; (** optional filter to apply to + standard output *) + dc_exit_code : string option; (** required exit code *) + dc_commands : cmd list; + (** toplevel full path, options to launch the toplevel on, and list + of output files to monitor beyond stdout and stderr. *) + dc_dont_run : bool; + dc_framac : bool; + dc_default_log: string list; + dc_default_bin: string list; + dc_timeout: string + } + +(* Scans the test directives (from test_config or test files) and expands macros as soon as possible *) +module Test_config: sig + + (** The [test_config] filename related to the expected configuration name *) + val filename: string + val current_config: env:env_t -> SubDir.t -> config + + val scan_directives: drop:bool -> + SubDir.t -> file:string -> Scanf.Scanning.in_channel -> config -> config + val scan_test_file: env:env_t -> SubDir.t -> file:string -> config -> config + + (* updates the configuration directives that do not depend of the test number and + returns a getter of the PTEST_xxx variables including the one depending on the test number *) + val ptest_vars: env:env_t -> SubDir.t -> file:string -> config -> string * config * (nth:int -> Macros.t -> Macros.t) + +end = struct + + let ptest_vars ~env _directory ~file config = + let ptest_config = config_name ~env "" in + let ptest_file = Filename.sanitize file in + let ptest_name = Filename.remove_extension file in + let ptest_session = Filename.dirname env.dir in + let ptest_session = env.absolute_cwd ^ "/_build/default" ^ (if ptest_session = "." then "" else "/" ^ ptest_session) in + let ptest_vars = + [ "PTEST_SESSION", ptest_session ; + "PTEST_CONFIG", ptest_config; + "PTEST_DIR", "."; + "PTEST_SHARE_DIR", "../../../share"; + "PTEST_RESULT", "."; + "PTEST_SUITE_DIR", ".."; + "PTEST_FILE", ptest_file; + "PTEST_NAME", ptest_name; + ] in + let ptest_macros = Macros.add_list ptest_vars Macros.empty in + let subst = Macros.expand_list ~file ptest_macros in + let dc_enabled_if = Macros.expand_enabled_if ~file ptest_macros config.dc_enabled_if + in + ptest_name, + { config with + dc_enabled_if; + dc_execnow = List.rev config.dc_execnow; + dc_deps = Option.map subst config.dc_deps ; + dc_plugin = Option.map subst config.dc_plugin; + dc_module = Option.map subst config.dc_module; + dc_libs = Option.map subst config.dc_libs; + }, + fun ~nth macros -> + Macros.add_list (("PTEST_NUMBER", string_of_int nth)::ptest_vars) macros + + (** the name of the directory-wide configuration file*) + let filename = "test_config" + + let default_commands config = + [ { toplevel=config.dc_default_toplevel; + opts=""; + exit_code=None; + macros=config.dc_macros; + logs=[]; + bins=[]; + deps={ load_plugin=None; + load_libs=None; + load_module=None; + deps_cmd=None; + enabled_if=None; + }; + timeout="" + } ] + + let default_config dir = + { dc_subdir = dir; + dc_test_regexp = test_file_regexp; + dc_macros = Macros.default_macros (); + dc_execnow = []; + dc_libs = None; + dc_deps = None; + dc_enabled_if = None; + dc_plugin = None; + dc_module = None; + dc_filter = None ; + dc_exit_code = None; + dc_default_toplevel = !default_toplevel; + dc_commands = []; + dc_dont_run = false; + dc_framac = true; + dc_default_log = []; + dc_default_bin = []; + dc_timeout = ""; + } + + let scan_execnow ~file ~once dir ex_timeout ex_deps (s:string) = + if once=false then + Format.eprintf "%s: using EXEC directive (DEPRECATED): %s@." + file s; + let rec aux (s:execnow) = + try + Scanf.sscanf s.ex_cmd "%_[ ]LOG%_[ ]%[-A-Za-z0-9_',+=:.\\@@]%_[ ]%s@\n" + (fun name cmd -> + aux { s with ex_cmd = cmd; ex_log = name :: s.ex_log }) + with Scanf.Scan_failure _ -> + try + Scanf.sscanf s.ex_cmd "%_[ ]BIN%_[ ]%[A-Za-z0-9_.\\-@@]%_[ ]%s@\n" + (fun name cmd -> + aux { s with ex_cmd = cmd; ex_bin = name :: s.ex_bin }) + with Scanf.Scan_failure _ -> + try + Scanf.sscanf s.ex_cmd "%_[ ]make%_[ ]%s@\n" + (fun cmd -> + (* It should be better to use a specific macro into the command (such as @MAKE@) for that. *) + Format.eprintf "%s: EXEC%s directive with a make command (DEPRECATED): %s@." + file (if once then "NOW" else "") cmd; + let s = aux ({ s with ex_cmd = cmd; }) in + { s with ex_cmd = "make "^cmd; } ) + with Scanf.Scan_failure _ -> + s + in + let execnow = aux + { ex_cmd = s; + ex_log = []; + ex_bin = []; + ex_dir = dir; + ex_deps; + ex_timeout; + } + in + if execnow.ex_log = [] && execnow.ex_bin = [] then + (* Cannot detect the problem when the LOG/BIN is a macro expanded later into an @EMPTY_STRING@ *) + Format.eprintf "%s: EXEC%s without LOG nor BIN target (DEPRECATED): %s@." + file (if once then "NOW" else "") s; + execnow + + let make_custom_opts = + let space = Str.regexp " " in + fun ~file:_ ~dir:_ stdopts s -> + let rec aux opts s = + try + Scanf.sscanf s "%_[ ]%1[+#\\-]%_[ ]%S%_[ ]%s@\n" + (fun c opt rem -> + match c with + | "+" -> aux (opt :: opts) rem + | "#" -> aux (opts @ [ opt ]) rem + | "-" -> aux (List.filter (fun x -> x <> opt) opts) rem + | _ -> assert false (* format of scanned string disallow it *)) + with + | Scanf.Scan_failure _ -> + if s <> "" then s::opts else opts + | End_of_file -> opts + in + (* NB: current settings does not allow to remove a multiple-argument + option (e.g. -verbose 2). + *) + (* revert the initial list, as it will be reverted back in the end. *) + let opts = aux (List.rev (Str.split space stdopts)) s in + (* preserve options ordering *) + List.fold_right (fun x s -> s ^ " " ^ x) opts "" + + let deps_of_config ?(deps={load_module=None;load_libs=None;load_plugin=None;deps_cmd=None;enabled_if=None}) config = + let select ~prev ~config = match config with + | None -> prev + | _ -> config + in + { load_module = select ~prev:deps.load_module ~config:config.dc_module; + load_plugin = select ~prev:deps.load_plugin ~config:config.dc_plugin; + load_libs= select ~prev:deps.load_libs ~config:config.dc_libs; + deps_cmd = select ~prev:deps.deps_cmd ~config:config.dc_deps; + enabled_if = select ~prev:deps.enabled_if ~config:config.dc_enabled_if + } + + let config_exec ~once ~drop:_ ~file ~dir s current = + let s = Macros.expand ~file current.dc_macros s in + { current with + dc_execnow = + scan_execnow ~file ~once dir current.dc_timeout (deps_of_config current) s :: current.dc_execnow } + + let split_list = + (* considers blanks (not preceded by '\'), tabs and commas as separators *) + let nonsep_regexp = Str.regexp "[\\] " in (* removed for beeing reintroduced *) + let sep_regexp = Str.regexp "[\t ,]+" in + fun s -> (* splits on '\ ' first then on ' ' or ',' *) + let r = List.fold_left (fun acc -> function + | Str.Text s -> List.rev_append (Str.full_split sep_regexp s) acc + | (Str.Delim _ as delim) -> delim::acc) + [] + (Str.full_split nonsep_regexp s) + in (* [r] is in the reverse order and the next [fold] restores the order *) + let add s (glue,prev,curr) = + if glue then false,(s^prev),curr + else false,s,(if prev = "" then curr else prev::curr) + in + let acc = List.fold_left (fun ((_,prev,curr) as acc) -> function + | Str.Delim ("\\ " as nonsep) -> true,(nonsep^prev),curr (* restore '\ ' *) + | Str.Delim _ -> add "" acc (* separator *) + | Str.Text s -> add s acc) (false,"",[]) r + in + let _,_,res = (add "" acc) in + res + + let config_enabled_if ~drop:_ ~file ~dir:_ s current = + let s = Macros.expand ~file current.dc_macros s in + let s = if s = "" then "true" else s in + { current with + dc_enabled_if = Some s; + dc_macros = Macros.add_list ["PTEST_ENABLED_IF", s] current.dc_macros } + + let config_deps ~drop:_ ~file ~dir:_ s current = + let s = Macros.expand ~file current.dc_macros s in + let l = split_list s in + { current with + dc_deps = Some l; + dc_macros = Macros.add_list ["PTEST_DEPS", s] current.dc_macros } + + let config_libs ~drop:_ ~file ~dir:_ s current = + let s = Macros.expand ~file current.dc_macros s in + let l = List.map (fun s -> Filename.remove_extension_opt [ ".cmxs" ; ".cma" ; ".ml" ] s) (split_list s) in + { current with + dc_libs = Some l; + dc_macros = Macros.add_list ["PTEST_LIBS", s] current.dc_macros } + + let config_plugin ~drop:_ ~file ~dir:_ s current = + let s = Macros.expand ~file current.dc_macros s in + let l = split_list s in + { current with dc_plugin = Some l ; + dc_macros = Macros.add_list ["PTEST_PLUGIN", s] current.dc_macros } + + let config_module macro_name ~drop:_ ~file ~dir:_ s current = + let s = Macros.expand ~file current.dc_macros s in + let l = List.map (fun s -> (Filename.remove_extension_opt [".cmxs"; ".cmxo"; ".ml"] s) ^ ".cmxs") (split_list s) in + { current with + dc_module = Some l; + dc_macros = Macros.add_list [macro_name, s] current.dc_macros } + + let config_macro ~drop:_ ~file ~dir s current = + (* note: the expansion is donly done into the definition *) + let regex = Str.regexp "[ \t]*\\([^ \t@]+\\)\\([ \t]+\\(.*\\)\\|$\\)" in + if Str.string_match regex s 0 then begin + let name = Str.matched_group 1 s in + let def = + try Str.matched_group 3 s with Not_found -> (* empty text *) "" + in + if !verbosity >= 4 then + Format.printf "%% - New macro %s with definition %s@." name def; + { current with dc_macros = Macros.add_expand ~file name def current.dc_macros } + end else begin + Format.eprintf "%a: cannot understand MACRO definition: %s@." (SubDir.pp_file ~dir) file s; + current + end + + type parsing_env = { + current_default_toplevel: string; + current_default_log: string list; + current_default_bin: string list; + current_default_cmds: cmd list; + } + + let default_parsing_env = ref { + current_default_toplevel = "" ; + current_default_log = [] ; + current_default_bin = [] ; + current_default_cmds = [] + } + + let set_default_parsing_env config = + default_parsing_env := { + current_default_toplevel = config.dc_default_toplevel; + current_default_log = config.dc_default_log; + current_default_bin = config.dc_default_bin; + current_default_cmds = List.rev config.dc_commands; + } + + let config_options = + [ "CMD", + (fun ~drop:_ ~file ~dir:_ s current -> + let s = Macros.expand ~file current.dc_macros s in + { current with dc_default_toplevel = s}); + + "OPT", + (fun ~drop ~file ~dir:_ s current -> + if not (drop || current.dc_framac) then + Format.eprintf "%s: a NOFRAMAC directive has been defined before a sub-test defined by an 'OPT' directive (That NOFRAMAC directive could be misleading.).@." + file; + let s = Macros.expand ~file current.dc_macros s in + let t = + { toplevel = current.dc_default_toplevel; + opts = s; + macros = current.dc_macros ; + exit_code = current.dc_exit_code ; + logs = current.dc_default_log; + bins = current.dc_default_bin; + timeout = current.dc_timeout; + deps = deps_of_config current + } + in + { current with + dc_default_log = !default_parsing_env.current_default_log; + dc_default_bin = !default_parsing_env.current_default_bin; + dc_commands = t :: current.dc_commands }); + + "STDOPT", + (fun ~drop ~file ~dir s current -> + if not (drop || current.dc_framac) then + Format.eprintf "%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'STDOPT' directive (That NOFRAMAC directive could be misleading.).@." + file; + let s = Macros.expand ~file current.dc_macros s in + let new_top = + List.map + (fun command -> + { toplevel= current.dc_default_toplevel; + opts= make_custom_opts ~file ~dir command.opts s; + macros= current.dc_macros; + exit_code = current.dc_exit_code; + logs= command.logs @ current.dc_default_log; + bins= command.bins @ current.dc_default_bin; + timeout= current.dc_timeout; + deps = deps_of_config ~deps:command.deps current + }) + (if !default_parsing_env.current_default_cmds = [] then + default_commands current + else !default_parsing_env.current_default_cmds) + in + { current with dc_commands = new_top @ current.dc_commands; + dc_default_log = !default_parsing_env.current_default_log @ + current.dc_default_log; + dc_default_bin = !default_parsing_env.current_default_bin @ + current.dc_default_bin }); + "FILEREG", + (fun ~drop:_ ~file ~dir:_ s current -> + let s = Macros.expand ~file current.dc_macros s in + { current with dc_test_regexp = s }); + + "FILTER", + (fun ~drop:_ ~file ~dir:_ s current -> + let s = Macros.expand ~file current.dc_macros s in + let s = trim_right s in + match current.dc_filter with + | None when s="" -> { current with dc_filter = None } + | None -> { current with dc_filter = Some s } + | Some filter -> { current with dc_filter = Some (s ^ " | " ^ filter) }); + + "EXIT", + (fun ~drop:_ ~file ~dir:_ s current -> + let s = Macros.expand ~file current.dc_macros s in + { current with dc_exit_code = Some s }); + + "GCC", + (fun ~drop:_ ~file ~dir:_ _ acc -> + Format.eprintf "%s: GCC directive (DEPRECATED)@." file; + acc); + + "COMMENT", + (fun ~drop:_ ~file:_ ~dir:_ _ acc -> acc); + + "DONTRUN", + (fun ~drop:_ ~file:_ ~dir:_ _ current -> + { current with dc_dont_run = true }); + + "EXECNOW", config_exec ~once:true; + "EXEC", config_exec ~once:false; + + "MACRO", config_macro; + "LIBS", config_libs; + "DEPS", config_deps; + "ENABLED_IF", config_enabled_if; + "MODULE", config_module "PTEST_MODULE"; + "SCRIPT", config_module "PTEST_SCRIPT"; + "PLUGIN", config_plugin; + + "LOG", + (fun ~drop:_ ~file ~dir:_ s current -> + let s = Macros.expand ~file current.dc_macros s in + let l = split_list s in + { current with dc_default_log = current.dc_default_log @ l}); + + "BIN", + (fun ~drop:_ ~file ~dir:_ s current -> + let s = Macros.expand ~file current.dc_macros s in + let l = split_list s in + { current with dc_default_bin = current.dc_default_bin @ l}); + + "TIMEOUT", + (fun ~drop:_ ~file ~dir:_ s current -> + let s = Macros.expand ~file current.dc_macros s in + { current with dc_timeout = s }); + + "NOFRAMAC", + (fun ~drop ~file ~dir:_ _ current -> + if not drop && current.dc_commands <> [] && current.dc_framac then + Format.eprintf "%s: a NOFRAMAC directive has the effect of ignoring previous defined sub-tests (by some 'OPT' or 'STDOPT' directives that seems misleading). @." + file; + { current with dc_commands = []; dc_framac = false; }); + ] + + let scan_directives ~drop dir ~file scan_buffer default = + set_default_parsing_env default; + let r = ref { default with dc_commands = [] } in + let treat_line s = + try + Scanf.sscanf s "%[ *]%[_A-Za-z0-9]: %s@\n" + (fun _ name opt -> + try + r := (List.assoc name config_options) ~drop ~file ~dir opt !r + with Not_found -> + Format.eprintf "@[%s: unknown directive: %s@.@]" file name) + with + | Scanf.Scan_failure _ -> + if Str.string_match end_comment s 0 + then raise End_of_file + else () + | End_of_file -> (* ignore blank lines. *) () + in + try + while true do + if Scanf.Scanning.end_of_input scan_buffer then raise End_of_file; + Scanf.bscanf scan_buffer "%s@\n" treat_line + done; + assert false + with + | End_of_file -> + (match !r.dc_commands with + | [] when !r.dc_framac -> { !r with dc_commands = default.dc_commands } + | l -> { !r with dc_commands = List.rev l }) + + (* test for a possible toplevel configuration. *) + let current_config ~env dir = + let default_config = default_config dir in + let general_config_file = SubDir.make_file dir (config_name ~env filename) in + if Sys.file_exists general_config_file + then begin + if !verbosity >=2 then Format.printf "%% Parsing global config file=%s@." general_config_file; + let scan_buffer = Scanf.Scanning.from_file general_config_file in + scan_directives ~drop:false + (SubDir.create ~env ~with_subdir:false Filename.current_dir_name) + ~file:general_config_file + scan_buffer + default_config + end + else begin + if !verbosity >=2 then Format.printf "%% There is no global config file=%s@." general_config_file; + default_config + end + + let split_config s = Str.split (Str.regexp ",[ ]*") s + + let is_config name = + let prefix = "run.config" in + let len = String.length prefix in + String.length name >= len && String.sub name 0 len = prefix + + let scan_test_file ~env dir ~file default = + let f = SubDir.make_file dir file in + let exists_as_file = + try + (Unix.lstat f).Unix.st_kind = Unix.S_REG + with | Unix.Unix_error _ | Sys_error _ -> false + in + if exists_as_file then begin + let scan_buffer = Scanf.Scanning.open_in f in + let rec scan_config () = + (* space in format string matches any number of whitespace *) + Scanf.bscanf scan_buffer " /* %s@\n" + (fun names -> + let is_current_config name = + name = "run.config*" || + name = "run.config" && env.config = "" || + name = "run.config_" ^ env.config + in + let configs = split_config (String.trim names) in + match List.find_opt is_current_config configs with + | Some name -> + (* Found options for current config! *) + if !verbosity >= 2 then Format.printf "%% Parsing %s of file=%s@." + name f ; + scan_directives ~drop:false dir ~file:f scan_buffer default + | None -> begin + (* config name does not match: eat config and continue. + But only if the comment is still opened by the end of + the line and we are indeed reading a config + *) + (if List.exists is_config configs && + not (Str.string_match end_comment names 0) then + ignore (scan_directives ~drop:true dir ~file:f scan_buffer default); + scan_config ()) + end) + in + let config = + try + let options = scan_config () in + Scanf.Scanning.close_in scan_buffer; + options + with End_of_file | Scanf.Scan_failure _ -> + Scanf.Scanning.close_in scan_buffer; + if !verbosity >= 2 then Format.printf "%% No run.config directives in file=%s@." f ; + default + in + if config.dc_commands = [] && config.dc_framac + then { config with dc_commands = default_commands config } + else config + end else + (* if the file has disappeared, don't try to run it... *) + { default with dc_dont_run = true } + +end + +type toplevel_command = + { macros: Macros.t; + log_files: string list; + bin_files: string list; + test_name : string ; + file : string ; + nb_files : int ; + options : string ; + toplevel: string ; + filter : string option ; + exit_code : int ; + directory : SubDir.t ; + nth : int; + execnow:bool; + timeout: string; + deps: deps; + } + +let catenate_number nb_files prefix n = + if nb_files > 1 + then prefix ^ "." ^ (string_of_int n) + else prefix + +let name_without_extension command = + try + Filename.chop_extension command.file + with + Invalid_argument _ -> + fail ("this test file does not have any extension: " ^ + command.file) + +let make_result_file ~env:_ x = x +let make_oracle_file ~env x = Filename.concat (config_name ~env "oracle") x + +let gen_prefix gen_file cmd = + let prefix = gen_file (name_without_extension cmd) in + catenate_number cmd.nb_files prefix cmd.nth +let oracle_prefix ~env = gen_prefix (make_oracle_file ~env) +let log_prefix ~env = gen_prefix (make_result_file ~env) + +let list_of_deps = function + | None -> [] + | Some l -> l + +let basic_command_string command = + let plugins_options = + let load_option opt deps = match list_of_deps deps with + | [] -> "" + | l -> Printf.sprintf "%s=%s" opt (String.concat "," l) + in + let opt_plugin = load_option "-load-plugin" command.deps.load_plugin in + let opt_libs = load_option "-load-module" command.deps.load_libs in + let opt_modules = load_option "-load-module" command.deps.load_module in + String.concat " " [opt_plugin; opt_libs; opt_modules] + in + let macros = (* set expanded macros that can be used into CMD directives *) + Macros.add_list [ + "PTEST_OPT", Macros.expand ~file:command.file command.macros command.options; + "PTEST_LOAD_OPTIONS", plugins_options; + ] command.macros in + let toplevel = + let in_toplevel,toplevel = Macros.does_expand ~file:command.file macros command.toplevel in + if command.execnow || in_toplevel.has_ptest_opt then toplevel + else begin + let has_ptest_file,options = + let in_option,options = Macros.does_expand ~file:command.file macros command.options in + (in_option.has_ptest_file || in_toplevel.has_ptest_file), + (if in_toplevel.has_frama_c_exe then + [ Macros.expand ~file:command.file macros "@PTEST_PRE_OPTIONS@" ; + options ; + Macros.expand ~file:command.file macros "@PTEST_POST_OPTIONS@" ; + ] + else [ options ]) + in + let options = List.filter (fun s -> s <> "") options in + let options = if has_ptest_file then options + else (Filename.sanitize (Filename.basename command.file))::options + in + String.concat " " (toplevel::options) + end + in + let raw_command = if command.timeout = "" then toplevel + else "ulimit -t " ^ command.timeout ^ " && " ^ toplevel + in raw_command + +let pp_list fmt l = List.iter (Format.fprintf fmt " %S") l +module Fmt = struct + let framac_plugin fmt s = + Format.fprintf fmt "frama-c-%s.core" s + let plugin_as_package fmt s = + let base = + if String.contains s '.' then + String.sub s 0 (String.index s '.') + else s + in + Format.fprintf fmt "frama-c-%s" base + let quote pr fmt s = Format.fprintf fmt "%S" (Format.asprintf "%a" pr s) + let list pr fmt l = List.iter (fun s -> Format.fprintf fmt " %a" pr s) l + let var_libavailable pr fmt s = Format.fprintf fmt "%%{lib-available:%a}" pr s + let package_as_deps pr fmt s = Format.fprintf fmt "(package %a)" pr s +end + +let home_regexp = Str.regexp "^\\(~\\|[$]HOME\\|[$]\\{HOME\\}\\)\\(/.*\\)" +let get_home_env () = + try + Unix.getenv "HOME" + with Not_found -> "~" +let deps_regexp = Str.regexp "^\\([^:]*\\):\\(.*\\)" + +let pp_list_deps fmt l = + List.iter (fun s -> + let s = Filename.sanitize_with_space s in + let s = match str_string_match2 home_regexp s 0 with + | None -> s + | Some (_,subdir) -> (get_home_env ()) ^ subdir + in + if String.contains s '*' then + Format.fprintf fmt " (glob_files %S)" s + else match str_string_match2 deps_regexp s 0 with + | None -> Format.fprintf fmt " %S" s + | Some (kind,deps) -> + (* kind={env_var,source_tree,glob_files,...} *) + Format.fprintf fmt " (%s %S)" kind deps) l + +let pp_enabled_if fmt deps = + Format.fprintf fmt "(and %s%a)" + (Option.value ~default:"true" deps.enabled_if) + Fmt.(list (var_libavailable framac_plugin)) (list_of_deps deps.load_plugin) + +let pp_command_deps fmt command = + Format.fprintf fmt "%S %a (package frama-c) %a" + (* the test file *) + command.file + (* from DEPS: LIBS: and MODULE: directives *) + pp_list_deps (list_of_deps command.deps.deps_cmd) + (* from PLUGIN directives *) + Fmt.(list (package_as_deps (quote plugin_as_package))) (list_of_deps command.deps.load_plugin) + +let show_cmd = + let regexp = Str.regexp "%{[a-z]+:\\([^}]+\\)}" in + let subst = Str.global_replace regexp "\\1" in + subst + +let redirection ?reslog ?errlog cmd = + match reslog, errlog with + | None, None -> cmd + | None, Some err -> Format.sprintf "%s 2> %S" cmd err + | Some res, None -> Format.sprintf "%s > %S" cmd res + | Some res, Some err -> Format.sprintf "%s > %S 2> %S" cmd res err + +let ptests_alias ~env = config_name ~env (env.dune_alias ^ "_config") + +let mk_alias cmd suffix = Format.sprintf "%s.%d.%s" cmd.test_name cmd.nth suffix + +type wtest = { + dir: (string [@default ""]); (* information on the test directory *) + info: (string [@default ""]); (* information *) + cmd: (string [@default "echo unknown command"]); + ret_code: (int [@default 0]); + out: (string [@default "" (* bin target built by the command *) ]); (* sdtout target *) + err: (string [@default "" (* bin target built by the command *) ]); (* stderr target *) + tmpout: (string [@default ""]); (* temporary file to filter stdout result *) + tmperr: (string [@default ""]); (* temporary file to filter stderr result *) + sedout: (string [@default ""]); (* filter command for the stdout result *) + sederr: (string [@default ""]); (* filter command for the stderr result *) + bin: (string list [@default []]); (* binary targets (without oracles) *) + log: (string list [@default []]); (* log targets (compared to log oracles *) + oracle_dir: (string [@default ""]); (* directory containing the oracle of the log files *) + oracle_out: (string [@default "" ]); (* oracle of the stdout target *) + oracle_err: (string [@default "" ]); (* oracle of the stderr target *) +} +[@@deriving yojson] + +let update_oracle_dir ~env wtest = + if wtest.log = [] then wtest else + { wtest with + oracle_dir = SubDir.get_oracle_dir ~env + } + +let std = false +let pp_wtest ?(compacted=false) fmt wtest = + let writer = (if compacted + then (fun json -> Format.fprintf fmt "%s" (Yojson.Safe.to_string ~std json)) + else (fun json -> Format.fprintf fmt "%a" (Yojson.Safe.pretty_print ~std) json)) + in writer (wtest_to_yojson wtest) + +let default_wtest = match wtest_of_yojson (Yojson.Safe.from_string "{}") with + | Ok r -> r + | _ -> assert false + +let print_json_wrapper ~file wtest = + (* Prints the JSON file for the wrapper *) + if !verbosity >= 2 then Format.printf "%% Generates %S wrapper file...@." file; + let wrapper_cout = open_out file in + let wrapper_fmt = Format.formatter_of_out_channel wrapper_cout in + Format.fprintf wrapper_fmt "%a@" (pp_wtest ~compacted:false) wtest; + close_out wrapper_cout + +let oracle_target oracle_fmt dir fname = + let oracle = SubDir.make_file dir fname in + if not (Sys.file_exists oracle) then begin + if !create_missing_oracles then begin + let code = Sys.command ("touch " ^ oracle) in + if code <> 0 then + Format.printf " - cannot create missing oracle: %s@." oracle + else + Format.printf " - creates missing oracle: %s@." oracle; + end + else if !check_oracles then + Format.printf " - missing oracle: %s@." oracle; + end + else if is_file_empty_or_nonexisting oracle then begin + if !remove_empty_oracles then begin + Format.printf " - removes empty oracle: %s@." oracle; + unlink ~silent:false oracle + end + else if !check_oracles then + Format.printf " - empty oracle: %s@." oracle; + end; + Format.fprintf oracle_fmt + "(rule (target %S) (mode fallback) (action (write-file %S \"\")))\n" fname fname + +let command_string ~env ~result_fmt ~oracle_fmt command = + let log_prefix = log_prefix ~env command in + let reslog = log_prefix ^ ".res.log" in + let errlog = log_prefix ^ ".err.log" in + let cmdreslog,cmderrlog = match command.filter with + | None -> reslog,errlog + | Some _ -> (log_prefix ^ ".res.unfiltered-log"),(log_prefix ^ ".err.unfiltered-log") + in + let accepted_exit_code = Format.sprintf "with-accepted-exit-codes %d" command.exit_code in + let command_string = basic_command_string command in + let filter_res,filter_err,wtest = + match command.filter with + | None -> "","",default_wtest + | Some filter -> + let regexp = Str.regexp "@PTEST_ORACLE@" in + let filter_cmd funfiltred foracle = + let filter = Str.global_replace regexp foracle filter in + Format.sprintf "cat %s | %s" funfiltred filter + in + let filter_res = filter_cmd cmdreslog (log_prefix ^ ".res.oracle") in + let filter_err = filter_cmd cmderrlog (log_prefix ^ ".err.oracle") in + filter_res,filter_err, { default_wtest with + sedout = redirection ~reslog filter_res ; + sederr = redirection ~reslog:errlog filter_err ; + tmpout = cmdreslog ; + tmperr = cmderrlog ; + } + in + let oracle_prefix = oracle_prefix ~env command in + let wtest = update_oracle_dir ~env + { wtest with + dir = SubDir.get (SubDir.result_subdir ~env command.directory) ; + info = Format.sprintf "TEST #%d OF TEST FILE %s/%s" + command.nth (SubDir.get command.directory) command.file; + cmd = redirection ~reslog:cmdreslog ~errlog:cmderrlog command_string ; + out = reslog; + err = errlog; + ret_code = command.exit_code; + log = command.log_files; + bin = command.bin_files; + oracle_out = Filename.concat ".." (oracle_prefix ^ ".res.oracle"); + oracle_err = Filename.concat ".." (oracle_prefix ^ ".err.oracle"); + } + in + let wrapper_basename = mk_alias command "exec.wtests" in + if !wrapper_cmd <> "" then begin + Format.fprintf result_fmt + "(rule ; %s\n \ + (alias %S)\n \ + (targets %S %S %a %a)\n \ + (deps %S %S %S %a %a)\n \ + (enabled_if %a)\n\ + (action (run %s %S %S %a))\n\ + )@." + (* rule: *) + wtest.info + (* alias: *) + wrapper_basename + (* targets: *) + cmderrlog + cmdreslog + pp_list command.log_files + pp_list command.bin_files + (* deps: *) + wrapper_basename + wtest.oracle_out + wtest.oracle_err + pp_list (List.map (Filename.concat wtest.oracle_dir) command.log_files) + pp_command_deps command + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + !wrapper_cmd + wrapper_basename + wtest.cmd + pp_list (if command.filter = None then [] else [wtest.sedout ; wtest.sederr]); + + let wtest = + { wtest with + cmd = show_cmd wtest.cmd ; + sedout = show_cmd wtest.sedout ; + sederr = show_cmd wtest.sederr + } + in + (* Prints the JSON file for the wrapper *) + print_json_wrapper wtest + ~file:(SubDir.make_file (SubDir.result_subdir ~env command.directory) wrapper_basename); + end + else begin + Format.fprintf result_fmt + "(rule ; %s\n \ + (alias %S)\n \ + (targets %S %S %a %a)\n \ + (deps %a)\n \ + (enabled_if %a)\n\ + (action (with-stderr-to %S (with-stdout-to %S (%s (system %S)))))\n\ + )@." + (* rule: *) + wtest.info + (* alias: *) + wrapper_basename + (* targets: *) + cmderrlog + cmdreslog + pp_list command.log_files + pp_list command.bin_files + (* deps: *) + pp_command_deps command + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + cmderrlog + cmdreslog + accepted_exit_code + command_string + end; + let filter_rule txt fin fout cmd = + if cmd <> "" then + Format.fprintf result_fmt + "(rule ; FILTER %s #%d OF TEST FILE %S\n \ + (deps %S) + (enabled_if %a)\n\ + (action (with-stdout-to %S (with-accepted-exit-codes (or 0 1 2 125) (system %S))))\n\ + )@." + (* rule: *) + txt + command.nth + command.file + (* deps: *) + fin + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + fout cmd + in + filter_rule "RES" cmdreslog reslog filter_res ; + filter_rule "ERR" cmderrlog errlog filter_err ; + List.iteri (fun n log -> + Format.fprintf result_fmt + "(rule ; COMPARE TARGET #%d OF TEST #%d FOR TEST FILE %S\n \ + (alias %s)\n \ + (enabled_if %a)\n\ + (action (diff %S %S))\n\ + )@." + (* rule: *) + n command.nth command.file + (* alias: *) + (ptests_alias ~env) + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + (SubDir.make_file (SubDir.oracle_dir ~env) log) + log + ) command.log_files; + Format.fprintf result_fmt + "(rule ; REPRODUCE TEST #%d OF TEST FILE %S\n \ + (alias %S)\n \ + (deps %a (universe))\n \ + (enabled_if %a)\n\ + (action (%s (system %S)))\n\ + )@." + (* rule: *) + command.nth command.file + (* alias: *) + (mk_alias command "exec") + (* deps: *) + pp_command_deps command + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + accepted_exit_code + command_string + ; + Format.fprintf result_fmt + "(rule ; SHOW TEST COMMAND #%d OF TEST FILE %S\n \ + (alias %S)\n \ + (deps %a (universe))\n \ + (enabled_if %a)\n\ + (action (system %S))\n\ + )@." + (* rule: *) + command.nth command.file + (* alias: *) + (mk_alias command "exec.show") + (* deps: *) + pp_command_deps command (* to get an updated build even in case of using the result *) + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + ("echo '" ^ show_cmd wtest.cmd ^"'"); + + let diff_alias = log_prefix ^ ".diff" in + (* diff with oracles *) + Format.fprintf result_fmt + "(rule\n \ + (alias %S)\n \ + (enabled_if %a)\n\ + (action (diff %S %S))\n\ + )@." + (* alias: *) + diff_alias + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + wtest.oracle_out + reslog; + Format.fprintf result_fmt + "(rule\n \ + (alias %S)\n \ + (enabled_if %a)\n\ + (action (diff %S %S))\n\ + )@." + (* alias: *) + diff_alias + (* enabled_if: *) + pp_enabled_if command.deps + (* action: *) + wtest.oracle_err + errlog; + Format.fprintf result_fmt + "(alias (name %S)\n \ + (deps (alias %S))\n \ + (enabled_if %a)\n\ + )@." + (ptests_alias ~env) + diff_alias + pp_enabled_if command.deps + ; + let oracle_subdir = SubDir.oracle_subdir ~env command.directory in + oracle_target oracle_fmt oracle_subdir (Filename.basename (oracle_prefix ^ ".err.oracle")); + oracle_target oracle_fmt oracle_subdir (Filename.basename (oracle_prefix ^ ".res.oracle")); + List.iter (oracle_target oracle_fmt oracle_subdir) command.log_files ; + () + +let deps_command ~file macros deps = + let subst = Macros.expand_list ~file macros in + let enabled_if = Macros.expand_enabled_if ~file macros deps.enabled_if in + let load_plugin = Option.map subst deps.load_plugin in + let load_module = Option.map subst deps.load_module in + let load_libs = Option.map (fun libs -> List.map (fun s -> s^".cmxs") (subst libs)) deps.load_libs in + let deps_cmd = Option.map subst deps.deps_cmd in + { enabled_if; load_plugin; load_module; load_libs; + (* Merge LIBS: MODULE: and DEPS: directives as a dependency to files *) + deps_cmd = Some ((list_of_deps load_libs) @ (list_of_deps load_module) @ (list_of_deps deps_cmd)); + } + +let update_modules ~file modules deps = + let load_module = list_of_deps deps.load_module in + if load_module <> [] then begin + let plugin_libs = StringSet.union + (StringSet.of_list (List.map (Format.sprintf "frama-c-%s.core") (list_of_deps deps.load_plugin))) + (StringSet.of_list (List.map (fun s -> Filename.remove_extension_opt [".cmxs"; ".cma"; ".ml"] (Filename.basename s)) + (list_of_deps deps.load_libs))) + in + List.iter (fun cmxs -> + let cmxs = Filename.remove_extension_opt [".cmxs"; ".cmo"; ".ml"] cmxs in + modules := StringMap.update cmxs (function + | None -> Some (plugin_libs,[file]) + | Some (set,files) -> Some ((StringSet.inter set plugin_libs),file::files) + ) !modules) (StringSet.elements (StringSet.of_list load_module)); + end + +(** process a test file *) +let process_file ~env ~result_fmt ~oracle_fmt file directory config modules = + let config = Test_config.scan_test_file ~env directory ~file config in + if not config.dc_dont_run then + let test_name,config,ptest_vars = Test_config.ptest_vars ~env directory ~file config in + let nb_files = List.length config.dc_commands in + let make_cmd = + let i = ref 0 in + fun { toplevel; opts=options; macros; exit_code; logs; bins; timeout; deps } -> + let nth = !i in + incr i ; + let macros = ptest_vars ~nth macros in + let macros = Macros.add_defaults ~defaults:config.dc_macros macros in + let log_files = Macros.expand_list ~file macros logs in + let bin_files = Macros.expand_list ~file macros bins in + let deps = deps_command ~file macros deps in + update_modules ~file modules deps; + command_string ~env ~result_fmt ~oracle_fmt + { test_name ; file; options; toplevel; nb_files; directory; nth; timeout; + macros; log_files; bin_files; + filter = (* from a global directive applyed to all OPT tests *) + (match config.dc_filter with None -> None | Some s -> Some (Macros.expand ~file macros s)); + exit_code = begin + match exit_code with + | None -> 0 + | Some exit_code -> + try int_of_string exit_code with + | _ -> Format.eprintf "@[%s: integer required for directive EXIT: %s (defaults to 0)@]@." file exit_code ; 0 + end; + execnow=false; + deps; + } + in + let nb_files_execnow = List.length config.dc_execnow in + let make_execnow_cmd = + let e = ref 0 in + fun execnow-> + let nth = !e in + incr e ; + let macros = ptest_vars ~nth Macros.empty in + let macros = Macros.add_defaults ~defaults:config.dc_macros macros in + let cmd = + let deps = deps_command ~file macros execnow.ex_deps in + update_modules ~file modules deps; + { test_name; file; nb_files = nb_files_execnow; directory; nth; + log_files = []; + bin_files = []; + options = ""; + toplevel = execnow.ex_cmd; + exit_code = 0; + timeout=execnow.ex_timeout; + macros; + filter = None; (* no FILTER applied to EXECNOW LOG *) + execnow = true; + deps = deps; + } + in + let cmd_string = basic_command_string cmd in + let wtest = update_oracle_dir ~env + { default_wtest with + dir = SubDir.get (SubDir.result_subdir ~env cmd.directory) ; + info = Format.sprintf "EXECNOW #%d OF TEST FILE %s/%s" + nth (SubDir.get directory) file; + cmd = cmd_string; + log = Macros.expand_list ~file cmd.macros execnow.ex_log; + bin = Macros.expand_list ~file cmd.macros execnow.ex_bin; + } + in + if wtest.log = [] && wtest.bin = [] then + (* Detect the problem even if the LOG/BIN is a macro expanded there into an @EMPTY_STRING@ *) + Format.eprintf "%s: EXEC/EXECNOW#%d without LOG nor BIN target (DEPRECATED): %s@." + file nth wtest.cmd; + let wrapper_basename = mk_alias cmd "execnow.wtests" in + if !wrapper_cmd <> "" then begin + Format.fprintf result_fmt + "(rule ; %s\n \ + (alias %s)\n \ + (deps %a %a)\n \ + (targets %a %a)\n \ + (enabled_if %a)\n\ + (action (run %s %%{dep:%s} %S))\n\ + )@." + (* rule: *) + wtest.info + (* alias: *) + wrapper_basename + (* deps: *) + pp_list (List.map (Filename.concat wtest.oracle_dir) wtest.log) + pp_command_deps cmd + (* targets: *) + pp_list wtest.log + pp_list wtest.bin + (* enabled_if: *) + pp_enabled_if cmd.deps + (* action: *) + !wrapper_cmd + wrapper_basename + wtest.cmd; + let wtest = + { wtest with + cmd = show_cmd wtest.cmd ; + } + in + (* Prints the JSON file for the wrapper *) + print_json_wrapper wtest + ~file:(SubDir.make_file (SubDir.result_subdir ~env cmd.directory) wrapper_basename); + end + else begin + Format.fprintf result_fmt + "(rule ; %s\n \ + (alias %s)\n \ + (deps (package frama-c)%a)\n \ + (targets %a %a)\n \ + (enabled_if %a)\n\ + (action (system %S))\n\ + )@." + (* rule: *) + wtest.info + (* alias: *) + wrapper_basename + (* deps: *) + pp_command_deps cmd + (* targets: *) + pp_list wtest.log + pp_list wtest.bin + (* enabled_if: *) + pp_enabled_if cmd.deps + (* action: *) + wtest.cmd + end; + let oracle_subdir = SubDir.oracle_subdir ~env cmd.directory in + List.iter (oracle_target oracle_fmt oracle_subdir) wtest.log ; + List.iter (oracle_target oracle_fmt oracle_subdir) wtest.bin ; + Format.fprintf result_fmt + "(rule ; SHOW EXECNOW COMMAND #%d OF TEST FILE %S\n \ + (alias %s)\n \ + (deps %a (universe))\n \ + (enabled_if %a)\n\ + (action (system %S))\n\ + )@." + (* rule: *) + nth file + (* alias: *) + (mk_alias cmd "execnow.show") + (* deps: *) + pp_command_deps cmd (* to get an updated build even in case of using the result *) + (* enabled_if: *) + pp_enabled_if cmd.deps + (* action: *) + ("echo '" ^ show_cmd wtest.cmd ^"'"); + ; + List.iteri (fun n log -> + Format.fprintf result_fmt + "(rule ; COMPARE TARGET #%d OF EXECNOW #%d FOR TEST FILE %S\n \ + (alias %s)\n \ + (enabled_if %a)\n\ + (action (diff %S %S))\n\ + )@." + (* rule: *) + n nth file + (* alias: *) + (ptests_alias ~env) + (* enabled_if: *) + pp_enabled_if cmd.deps + (* action: *) + (SubDir.make_file (SubDir.oracle_dir ~env) log) + log + ) wtest.log + in + if config.dc_commands <> [] || config.dc_execnow <> [] then begin + let pp_list_alias fmt l = List.iter (Format.fprintf fmt "(alias %S)") l in + Format.fprintf result_fmt + "; TEST FILE %S\n\ + (alias (name %S)\n \ + (deps %a%a)) ; to performs all sub-tests related to a file\n\ + (alias (name %S)\n \ + (deps %a%a)) ; to reproduce and visualize the all sub-test outputs related to a file@." + file + (* alias #1 *) + (Format.sprintf "%s.wtests" test_name) + pp_list_alias (List.mapi (fun i _ -> Format.sprintf "%s.%d.exec.wtests" test_name i) config.dc_commands) + pp_list_alias (List.mapi (fun i _ -> Format.sprintf "%s.%d.execnow.wtests" test_name i) config.dc_execnow) + (* alias #2 *) + file + pp_list_alias (List.mapi (fun i _ -> Format.sprintf "%s.%d.exec" test_name i) config.dc_commands) + pp_list_alias (List.mapi (fun i _ -> Format.sprintf "%s.%d.execnow.wtests" test_name i) config.dc_execnow); + end ; + List.iter make_cmd config.dc_commands; + List.iter make_execnow_cmd config.dc_execnow; + (config.dc_commands <> [] || config.dc_execnow <> []) + else + false + +let test_pattern config = + let regexp = Str.regexp config.dc_test_regexp in + fun file -> Str.string_match regexp file 0 + +(* if we have some references to directories in the default config, they + need to be adapted to the actual test directory. *) +let update_dir_ref dir config = + let update_execnow e = { e with ex_dir = dir } in + let dc_execnow = List.map update_execnow config.dc_execnow in + { config with dc_execnow } + +let process ~env default_config (suites:Ptests_config.alias StringMap.t) = + StringMap.iter + (fun suite alias -> + let env = { env with dune_alias = alias.Ptests_config.alias } in + let suite = Filename.concat env.dir suite in + let directory = SubDir.create ~with_subdir:true ~env suite in + let result_dune_file = SubDir.make_file (SubDir.result_subdir ~env directory) "dune" in + if !verbosity >= 2 then Format.printf "%% Generates %S file for test suite %s%s and dune-alias=@@%s ...@." + result_dune_file suite (if env.config = "" then "" else (", config=" ^ env.config)) env.dune_alias; + let dir_config = + let config = SubDir.make_file directory (config_name ~env Test_config.filename) in + if Sys.file_exists config + then begin + let scan_buffer = Scanf.Scanning.from_file config in + if !verbosity >= 2 then Format.printf "%% Parsing suite config file=%s@." config ; + Test_config.scan_directives ~drop:false directory ~file:config + scan_buffer default_config + end + else begin + if !verbosity >= 2 then Format.printf "%% There is no suite config file=%s@." config ; + default_config + end + in + let result_cout = (open_out result_dune_file) in + let result_fmt = Format.formatter_of_out_channel result_cout in + Format.fprintf result_fmt "(copy_files ../*.*)@."; + Format.fprintf result_fmt + "(alias (name %s)\n \ + (deps (alias %s)))@." + env.dune_alias (ptests_alias ~env); + let oracle_dune_file = SubDir.make_file (SubDir.oracle_subdir ~env directory) "dune" in + let oracle_cout = (open_out oracle_dune_file) in + let oracle_fmt = Format.formatter_of_out_channel oracle_cout in + let has_test = ref false in + let modules = ref StringMap.empty in + let dir_files = Array.to_list (Sys.readdir (SubDir.get directory)) in + (* ignore hidden files (starting with '.') *) + let dir_files = + List.filter (fun n -> String.get n 0 <> '.') dir_files + in + if !verbosity >= 3 then Format.printf "%% - Look at %d entries of the directory...@." (List.length dir_files); + List.iter + (fun file -> + assert (Filename.is_relative file); + if test_pattern dir_config file + then begin + if !verbosity >= 2 then Format.printf "%% - Process test file %s ...@." file; + has_test := process_file ~env ~result_fmt ~oracle_fmt file directory dir_config modules || !has_test; + end; + ) dir_files; + let n = ref 0 in + StringMap.iter (fun cmxs (libs,files) -> + let cmxs = Filename.basename cmxs in + let files = StringSet.elements (StringSet.of_list files) in + incr n; + Format.fprintf result_fmt + "(executable ; MODULE #%d FOR TEST FILES: %a\n \ + (name %S)\n \ + (modules %S)\n \ + (modes plugin)\n \ + (libraries frama-c.init.cmdline frama-c.boot frama-c.kernel %a)\n \ + (flags :standard -w -50-9-32-6-34 -open Frama_c_kernel)\n\ + )@." + (* executable: *) + !n pp_list files + (* name: *) + cmxs + (* module: *) + cmxs + (* libraries: *) + pp_list (StringSet.elements libs)) + !modules ; + Format.fprintf result_fmt "@."; + Format.fprintf oracle_fmt "@."; + close_out result_cout; + close_out oracle_cout; + if not !has_test then begin (* there is no test_command *) + unlink ~silent:false result_dune_file; + unlink ~silent:false oracle_dune_file + end + else nb_dune_files := !nb_dune_files +2 + ) suites + +let parse_args () = + let suites = ref [] in + let add_test_suite s = suites := s :: !suites in + Arg.parse + ((Arg.align + (List.sort + (fun (optname1, _, _) (optname2, _, _) -> + compare optname1 optname2 + ) argspec) + ) @ ["", Arg.Unit (fun () -> ()), example_msg;]) + add_test_suite + umsg; + !suites + +let () = + let suites = match parse_args () with + | [] -> [ "tests" ] + | l -> l + in + let absolute_cwd = Unix.getcwd () in + List.iter (fun dir -> + Format.printf "Test directory: %s@." dir; + let absolute_tests_dir = Filename.dirname + (if Filename.is_relative dir + then Filename.concat absolute_cwd dir else dir) + in + let suites = Ptests_config.parse ~dir in + if !verbosity >= 1 then Format.printf "%% Nb config= %d@." (StringMap.cardinal suites); + let nb = !nb_dune_files in + let nbi = !nb_ignores in + StringMap.iter (fun config_mode suites -> + if !verbosity >= 1 then Format.printf "%% - %s_SUITES -> nb suites= %d@." + (match config_mode with "" -> "DEFAULT" | s -> s) (StringMap.cardinal suites); + let env = { config = config_mode ; dir ; dune_alias = "" ; absolute_tests_dir ; absolute_cwd} in + let directory = SubDir.create ~with_subdir:false ~env dir in + let config = Test_config.current_config ~env directory in + let config = update_dir_ref directory config in + process ~env config suites) suites ; + if !verbosity >= 1 then Format.printf "%% Nb dune files= %d@." (!nb_dune_files-nb); + if (!nb_ignores-nbi) <> 0 then Format.printf "- %d ignored suite(s)@." (!nb_ignores-nbi); + ) suites ; + Format.printf "Total number of generated dune files: %d@." !nb_dune_files; + if !nb_ignores <> 0 then begin + Format.printf "- ignored suites= %d@." !nb_ignores; + List.iter (Format.printf " - %s@.") !ignored_suites + end + +(* +Local Variables: +compile-command: "LC_ALL=C make -C .. ptests" +End: +*) diff --git a/tools/ptests/tests/.gitignore b/tools/ptests/tests/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..cc129cb16f5d6dfdc679d5fb58ea08837ae58cb6 --- /dev/null +++ b/tools/ptests/tests/.gitignore @@ -0,0 +1 @@ +**/dune diff --git a/tools/ptests/tests/cmd/README b/tools/ptests/tests/cmd/README new file mode 100644 index 0000000000000000000000000000000000000000..75d737ebce83a54fed8b762232c5d91d3ad1d848 --- /dev/null +++ b/tools/ptests/tests/cmd/README @@ -0,0 +1,3 @@ +Test suite where ./test_config contents: +- 1 CMD +- no OPT diff --git a/tools/ptests/tests/cmd/tests/ptests_config b/tools/ptests/tests/cmd/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..090ea4429196560292b06cc7f13bd76e925920a1 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= without-test_config diff --git a/tools/ptests/tests/cmd/tests/test_config b/tools/ptests/tests/cmd/tests/test_config new file mode 100644 index 0000000000000000000000000000000000000000..5faabe68bd2fab7fae1f2f3249e79cc10cce7891 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/test_config @@ -0,0 +1,7 @@ +MACRO: test_config1 tests/test_config1 +MACRO: test_config2 tests/test_config2 + +CMD: echo tests/test_config:CMD @test_config1@ @test_config2@ @test_config3@ @PTEST_OPTIONS@ + +MACRO: test_config2 tests/test_config2-redefined +MACRO: test_config3 tests/test_config3 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/README b/tools/ptests/tests/cmd/tests/without-test_config/README new file mode 100644 index 0000000000000000000000000000000000000000..c0ea4803c819e7d30b3896cfe032b66b1a24dafd --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/README @@ -0,0 +1,2 @@ +A test suite in a directory that have no ./test_config file. +The ../test_config has to be used as if it was in this directory. diff --git a/tools/ptests/tests/cmd/tests/without-test_config/config.i b/tools/ptests/tests/cmd/tests/without-test_config/config.i new file mode 100644 index 0000000000000000000000000000000000000000..49f1bd42fdbcb5c0f9a68841c279733d1718a066 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/config.i @@ -0,0 +1,12 @@ +/* run.config +OPT: test#0 +STDOPT: +"test#1" + +MACRO: test_config3 tests/test_config3-redef +OPT: test#2 +STDOPT: #"test#3" + +MACRO: test_config3 tests/test_config3-redef +CMD: echo CMD @test_config1@ @test_config2@ @test_config3@ @PTEST_OPTIONS@ +OPT: test#4 +*/ diff --git a/tools/ptests/tests/cmd/tests/without-test_config/empty.i b/tools/ptests/tests/cmd/tests/without-test_config/empty.i new file mode 100644 index 0000000000000000000000000000000000000000..75a70dfea46b9e7c4760cd77c4c1f2cd702ea2e4 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/empty.i @@ -0,0 +1,2 @@ +// Test with no file ./test_config nor run.config directive +// Checks that the test will use the CMD directive defined into ../test_config diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.0.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..2bc0e2c997568fb471c3d09fcf502453f61aabb9 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.0.res.oracle @@ -0,0 +1 @@ +tests/test_config:CMD tests/test_config1 tests/test_config2 tests/test_config3 test#0 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.1.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..b045b11c2a563e4f57abad8414af77eadb71daf3 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.1.res.oracle @@ -0,0 +1 @@ +tests/test_config:CMD tests/test_config1 tests/test_config2 tests/test_config3 test#1 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.2.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.2.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e4f134b7408f35967d1a24741bfefb2f91a13d3b --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.2.res.oracle @@ -0,0 +1 @@ +tests/test_config:CMD tests/test_config1 tests/test_config2 tests/test_config3-redef test#2 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.3.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.3.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..11a17c14edd44d5015fc9bf4c05da1bcf81336e7 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.3.res.oracle @@ -0,0 +1 @@ +tests/test_config:CMD tests/test_config1 tests/test_config2 tests/test_config3-redef test#3 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.4.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.4.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..4780a4e73d39fcfed2cfaf81dfa80d8a0fea69cf --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/config.4.res.oracle @@ -0,0 +1 @@ +CMD tests/test_config1 tests/test_config2-redefined tests/test_config3-redef test#4 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/empty.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/empty.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..1aa289856c068eae730b69de6b55b11991724e64 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/empty.res.oracle @@ -0,0 +1 @@ +tests/test_config:CMD tests/test_config1 tests/test_config2 tests/test_config3 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/ptest-macros.0.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/ptest-macros.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..838408a108b6ae2b4023b87a8295851fd938c979 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/ptest-macros.0.res.oracle @@ -0,0 +1 @@ +PTEST_DIR=./tests/cmd/tests/without-test_config PTEST_NAME=ptest-macros.i PTEST_RESULT=./tests/cmd/tests/without-test_config/result PTEST_NAME=ptest-macros PTEST_NUMBER=0 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/oracle/ptest-macros.1.res.oracle b/tools/ptests/tests/cmd/tests/without-test_config/oracle/ptest-macros.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..0de87067da3acde56cc5de10be6e622c06d70766 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/oracle/ptest-macros.1.res.oracle @@ -0,0 +1 @@ +PTEST_DIR=./tests/cmd/tests/without-test_config PTEST_NAME=ptest-macros.i PTEST_RESULT=./tests/cmd/tests/without-test_config/result PTEST_NAME=ptest-macros PTEST_NUMBER=1 diff --git a/tools/ptests/tests/cmd/tests/without-test_config/ptest-macros.i b/tools/ptests/tests/cmd/tests/without-test_config/ptest-macros.i new file mode 100644 index 0000000000000000000000000000000000000000..4a713ce06a3574c0717943d85ab96d272a262a08 --- /dev/null +++ b/tools/ptests/tests/cmd/tests/without-test_config/ptest-macros.i @@ -0,0 +1,5 @@ +/* run.config + CMD: echo PTEST_DIR=@PTEST_DIR@ PTEST_NAME=@PTEST_FILE@ PTEST_RESULT=@PTEST_RESULT@ PTEST_NAME=@PTEST_NAME@ PTEST_NUMBER=@PTEST_NUMBER@ + OPT: + OPT: +*/ diff --git a/tools/ptests/tests/nothing/README b/tools/ptests/tests/nothing/README new file mode 100644 index 0000000000000000000000000000000000000000..352ae03088e977994ea6baee36788134ff8c2742 --- /dev/null +++ b/tools/ptests/tests/nothing/README @@ -0,0 +1,3 @@ +Test suite where ./test_config contents: +- no CMD +- no OPT diff --git a/tools/ptests/tests/nothing/tests/basic/empty.i b/tools/ptests/tests/nothing/tests/basic/empty.i new file mode 100644 index 0000000000000000000000000000000000000000..4bd8276f349276147c911ae2c08b37e7b8811544 --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/empty.i @@ -0,0 +1 @@ +// empty file diff --git a/tools/ptests/tests/nothing/tests/basic/opt.i b/tools/ptests/tests/nothing/tests/basic/opt.i new file mode 100644 index 0000000000000000000000000000000000000000..7dafafb360ba8da1c71f09b1f41f4e5a4e2038b9 --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/opt.i @@ -0,0 +1,7 @@ +/* run.config +EXECNOW: LOG opt.execnow.@PTEST_NUMBER@ echo -- EXECNOW No0: number=@PTEST_NUMBER@ name=@PTEST_NAME@ file=@PTEST_FILE@ > opt.execnow.@PTEST_NUMBER@ +EXECNOW: LOG opt.execnow.@PTEST_NUMBER@ echo -- EXECNOW No1: number=@PTEST_NUMBER@ > opt.execnow.@PTEST_NUMBER@ +EXECNOW: LOG opt.execnow.@PTEST_NUMBER@ echo -- EXECNOW No2: number=@PTEST_NUMBER@ > opt.execnow.@PTEST_NUMBER@ +OPT: -- OPT No0: number=@PTEST_NUMBER@ name=@PTEST_NAME@ file=@PTEST_FILE@ +OPT: -- OPT No1: number=@PTEST_NUMBER@ +*/ diff --git a/tools/ptests/tests/nothing/tests/basic/oracle/empty.res.oracle b/tools/ptests/tests/nothing/tests/basic/oracle/empty.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..628d824bcc72487d0ad5d112e8c641821542873c --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/oracle/empty.res.oracle @@ -0,0 +1 @@ +frama-c default-options:=-journal-disable -check -no-autoload-plugins:= empty.i diff --git a/tools/ptests/tests/nothing/tests/basic/oracle/opt.0.res.oracle b/tools/ptests/tests/nothing/tests/basic/oracle/opt.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..96766a95c44ac79a516f84c6dd217f34150ab2ba --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/oracle/opt.0.res.oracle @@ -0,0 +1 @@ +frama-c default-options:=-journal-disable -check -no-autoload-plugins:= opt.i -- OPT No0: number=0 name=opt file=opt.i diff --git a/tools/ptests/tests/nothing/tests/basic/oracle/opt.1.res.oracle b/tools/ptests/tests/nothing/tests/basic/oracle/opt.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..8b4c69848ac8b58f39653f85fa3a168ef47bdcda --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/oracle/opt.1.res.oracle @@ -0,0 +1 @@ +frama-c default-options:=-journal-disable -check -no-autoload-plugins:= opt.i -- OPT No1: number=1 diff --git a/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.0 b/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.0 new file mode 100644 index 0000000000000000000000000000000000000000..5251218b4736a90f3531fcc7108b58ce69587c8a --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.0 @@ -0,0 +1 @@ +-- EXECNOW No0: number=0 name=opt file=opt.i diff --git a/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.1 b/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.1 new file mode 100644 index 0000000000000000000000000000000000000000..65efc6a5801244b53aacd5cc286bcf0a43929da6 --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.1 @@ -0,0 +1 @@ +-- EXECNOW No1: number=1 diff --git a/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.2 b/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.2 new file mode 100644 index 0000000000000000000000000000000000000000..c939efb76efbd097062d18635547456ce3223009 --- /dev/null +++ b/tools/ptests/tests/nothing/tests/basic/oracle/opt.execnow.2 @@ -0,0 +1 @@ +-- EXECNOW No2: number=2 diff --git a/tools/ptests/tests/nothing/tests/ptests_config b/tools/ptests/tests/nothing/tests/ptests_config new file mode 100644 index 0000000000000000000000000000000000000000..d8df396ade8c39ec6e0e14895457f5878d208d07 --- /dev/null +++ b/tools/ptests/tests/nothing/tests/ptests_config @@ -0,0 +1 @@ +DEFAULT_SUITES= basic diff --git a/tools/ptests/tests/nothing/tests/test_config b/tools/ptests/tests/nothing/tests/test_config new file mode 100644 index 0000000000000000000000000000000000000000..4085b744d7f9a8bd3fad313e54a6e7d8757996d9 --- /dev/null +++ b/tools/ptests/tests/nothing/tests/test_config @@ -0,0 +1,2 @@ +MACRO: frama-c-exe echo frama-c +MACRO: PTEST_DEFAULT_OPTIONS default-options:=@PTEST_DEFAULT_OPTIONS@:= diff --git a/tools/ptests/wtests.ml b/tools/ptests/wtests.ml new file mode 100644 index 0000000000000000000000000000000000000000..926ce13449f2f4e0992960ca03be4fffa9885bd0 --- /dev/null +++ b/tools/ptests/wtests.ml @@ -0,0 +1,283 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2022 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It 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 Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Command-line flags *) +let verbosity = ref 1 + +let cmp_cmd = "diff --new-file -q" +let diff_cmd = "diff --new-file" + +(* ------------------------------- *) + +module Filename = struct + include Filename + let concat = + if Sys.os_type = "Win32" then + fun a b -> a ^ "/" ^ b + else + concat +end + +(* ------------------------------- *) + +let pp_json fmt json = + Format.fprintf fmt "%% dune build @@%S" json + +let fail ~json s info = + Format.printf "%a: Error - %s@.%% Aborting: %s@." pp_json json s info ; + exit 2 + +let output_unix_error (exn : exn) = + match exn with + | Unix.Unix_error (error, _function, arg) -> + let message = Unix.error_message error in + if arg = "" then + Format.eprintf "%s@." message + else + Format.eprintf "%s: %s@." arg message + | _ -> assert false + +let unlink ?(silent = true) file = + let open Unix in + try + Unix.unlink file + with + | Unix_error _ when silent -> () + | Unix_error (ENOENT,_,_) -> () (* Ignore "No such file or directory" *) + | Unix_error _ as e -> output_unix_error e + +let system = + if Sys.os_type = "Win32" then + fun f -> + Unix.system (Format.sprintf "bash -c %S" f) + else + fun f -> + Unix.system f + +let print_file dir_info file = + Format.printf "%% Generated output file: %s/%s@." dir_info file; + try + let cin = open_in file in + try + while true do + let line = input_line cin in + Format.printf "%s\n" line + done + with _ -> + close_in cin + with _ -> + Format.printf "%% Cannot open file: %s@." file + +(* ------------------------------- *) + +let example_msg = + Format.sprintf + "@.@[<v 0>\ + Wrapper to run test command.@." + +let umsg = "Usage: frama-c-wtests [options] <json-config> <test-command>*" + +let rec argspec = + [ + ("-v", Arg.Unit (fun () -> incr verbosity), + "Increase verbosity (up to twice)") ; + ("-brief", Arg.Unit (fun () -> verbosity := 0), + "Brief report only on test failure") ; + ] +and help_msg () = Arg.usage (Arg.align argspec) umsg + +let parse_args () = + let suites = ref [] in + let add_test_suite s = suites := s :: !suites in + Arg.parse + ((Arg.align + (List.sort + (fun (optname1, _, _) (optname2, _, _) -> + compare optname1 optname2 + ) argspec) + ) @ ["", Arg.Unit (fun () -> ()), example_msg;]) + add_test_suite + umsg; + List.rev !suites + +(* ------------------------------- *) + +let launch command_string = + let result = system command_string in + match result with + | Unix.WEXITED 127 -> + Format.printf "%% Couldn't execute command.:@\n%s@\nStopping@." + command_string ; + exit 1 + | Unix.WEXITED r -> r + | Unix.WSIGNALED s -> + Format.printf + "%% SIGNAL %d received while executing command:@\n%s@\nStopping@." + s command_string ; + exit 1 + | Unix.WSTOPPED s -> + Format.printf + "%% STOP %d received while executing command:@\n%s@\nStopping@." + s command_string; + exit 1 + +let rm_filter_result (_cmd,stdfile) = unlink stdfile + +let filter (cmd,_stdfile) = + if !verbosity > 0 then Format.printf "%% Run filter command: %s@." cmd; + let ret_code = launch cmd in + if !verbosity > 0 && ret_code <> 0 then Format.printf "%% note: the filter command returned an error code (%d)@." ret_code + +let compare_files ~json ~error ~result oracle = + let not_generated = not (Sys.file_exists result) in + if not_generated then + Format.printf "%a: missing target %S@." pp_json json result; + let cmd = Format.sprintf "%s %S %S" (if !verbosity > 0 then diff_cmd else cmp_cmd) oracle result in + if !verbosity > 0 then Format.printf "%% Run compare command: %s@." cmd; + let ret_code = launch cmd in + let is_ko = ret_code <> 0 in + if is_ko then Format.printf "%a: diff failure on diff:@. (cd _build/default/%s && %s %S %S)@." + pp_json json (Filename.dirname json) diff_cmd result oracle ; + error || is_ko + +let compare_std ~json error = function + | "" -> fun _ -> error + | result -> compare_files ~json ~error ~result + +(* [oracle_dir] should be set to "." to look at the current directory *) +let compare_log ~json oracle_dir error result = + if String.equal oracle_dir "" then + (Format.printf "%a: missing oracle_dir for %S@." pp_json json result; + false) + else + compare_files ~json ~error ~result (Filename.concat oracle_dir result) + +let remove file = if file <> "" then unlink file + +let extract filters targets = function + | "" -> fun _ _ -> filters,targets + | stdfile -> function + | "" -> fun _ -> filters,(stdfile::targets) + | tmp -> fun cmd -> ((cmd,stdfile)::filters),(tmp::stdfile::targets) + +type wtest = { + info: (string [@default ""]); (* info *) + dir: (string [@default ""]); (* test directory *) + cmd: (string [@default "echo unknown command"]); + ret_code: (int [@default 0]); + out: (string [@default "" (* bin target built by the command *) ]); (* sdtout target *) + err: (string [@default "" (* bin target built by the command *) ]); (* stderr target *) + tmpout: (string [@default ""]); (* temporary file to filter stdout result *) + tmperr: (string [@default ""]); (* temporary file to filter stderr result *) + sedout: (string [@default ""]); (* filter command for the stdout result *) + sederr: (string [@default ""]); (* filter command for the stderr result *) + bin: (string list [@default []]); (* binary targets (without oracles) *) + log: (string list [@default []]); (* log targets (compared to log oracles *) + oracle_dir: (string [@default ""]); (* directory containing the oracle of the log files *) + oracle_out: (string [@default "" ]); (* oracle of the stdout target *) + oracle_err: (string [@default "" ]); (* oracle of the stderr target *) +} +[@@deriving of_yojson] + +let wrapper json test = + let sed,logs = extract [] test.log test.out test.tmpout test.sedout in + let sed,logs = extract sed logs test.err test.tmperr test.sederr in + if logs <> [] || test.bin <> [] then begin + if !verbosity > 0 then Format.printf "%% Clean targets...@."; + List.iter remove logs; + List.iter remove test.bin + end; + if !verbosity > 0 then Format.printf "%% Run test command: %s@." test.cmd; + let ret_code = launch test.cmd in + let error = ret_code <> test.ret_code in + if error || !verbosity > 0 then begin + if test.out <> "" then print_file test.dir (if test.tmpout = "" then test.out else test.tmpout) ; + if test.err <> "" then print_file test.dir (if test.tmperr = "" then test.err else test.tmperr) + end; + if error then begin + Format.printf "%a: return code (%d) differs from the requested code (%d) for the command:%s@." + pp_json json ret_code test.ret_code test.cmd; + true + end else begin + List.iter filter sed ; + let is_cmp_ko = compare_std ~json false test.out test.oracle_out in + let is_cmp_ko = compare_std ~json is_cmp_ko test.err test.oracle_err in + let is_cmp_ko = List.fold_left (compare_log ~json test.oracle_dir) is_cmp_ko test.log in + if !verbosity = 0 then + (* In `-brief` mode (used by the `dune` file generated by `frama-c-ptests`), + the filtered result file are removed + in order to let `dune` applying the filters. *) + List.iter rm_filter_result sed ; + (* In `-brief` mode, + the comparison failures are not reported with an error code + in order to let `dune` reporting them with the textual differences. *) + (if !verbosity > 1 then is_cmp_ko else false) + end + +let parse ~json = + if !verbosity > 0 then Format.printf "%% Parsing Jsonjson...@."; + match wtest_of_yojson (Yojson.Safe.from_file json) with + | Error txt -> fail ~json txt "Json file cannot be parsed" + | Ok r -> r + +let wrapper ~json = + try + let test = parse ~json in + let json = test.dir ^ "/" ^ json in + if !verbosity > 0 then + Format.printf "%% Wrapping info: %s@." test.info ; + match test with + | { info; out=""; tmpout=tmp; sedout=sed; _} when tmp <> "" || sed <> "" -> fail ~json "StdOut filter cannot be applied" info + | { info; err=""; tmperr=tmp; sederr=sed; _} when tmp <> "" || sed <> "" -> fail ~json "StdErr filter cannot be applied" info + | { info; out=std; oracle_out=oracle; _} when (std <> "") <> (oracle <> "") -> fail ~json "StdOut file cannot be compared to an oracle" info + | { info; err=std; oracle_err=oracle; _} when (std <> "") <> (oracle <> "") -> fail ~json "StdErr file cannot be compared to an oracle" info + | { info; tmpout=tmp; sedout=sed; _} when (tmp <> "") <> (sed <> "") -> fail ~json "StdOut filter cannot be applied" info + | { info; tmperr=tmp; sederr=sed; _} when (tmp <> "") <> (sed <> "") -> fail ~json "StdErr filter cannot be applied" info + | _ -> + if wrapper json test then + fail ~json "Test failed" test.info + with + | Yojson.Json_error txt + | Sys_error txt -> fail ~json txt "Json file cannot be parsed" + + +let () = + let args = parse_args () in + (* verbosity := 1; *) + match args with + | json::commands -> + if !verbosity > 0 then begin + Format.printf "%% Wrapping from json file: %S@." json ; + match commands with + | cmd::filters -> + Format.printf "%% Wrapped command: %s@." cmd ; + List.iter (fun s -> Format.printf "%% Wrapped filter: %s@." s) filters; + | _ -> () + end; + wrapper ~json + | _ -> help_msg () ; exit 1 + +(* +Local Variables: +compile-command: "LC_ALL=C make -C .. ptests" +End: +*)