Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pub/frama-clang
  • weliveindetail/frama-clang
  • ankit247/frama-clang
  • T-Gruber/frama-clang
4 results
Show changes
Commits on Source (802)
################
# MERGE: union #
################
Changelog merge=union
##################################################
# BINARY/CHECK-SYNTAX/INDENT/EOL-EOF: set/-unset #
##################################################
*.jpg binary
*.pdf binary
####################################################
# HEADER_SPEC: CEA_LGPL_OR_PROPRIETARY.Frama_Clang #
####################################################
dune-project header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
dune header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
Doxyfile header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
configure.ac header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
*.cpp header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
*.h header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
*.template header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
/share/libc++/* header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
Make* header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
/intermediate_format.ast header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
*.ml header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
*.mli header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
*.sh header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
*.txt header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
/mainpage.dox header_spec=CEA_LGPL_OR_PROPRIETARY.Frama_Clang
########################
# HEADER_SPEC: .ignore #
########################
# Binaries
*.jpg header_spec=.ignore
*.pdf header_spec=.ignore
# CI
/nix/ci.sh header_spec=.ignore
/nix/sources.json header_spec=.ignore
/.gitlab-ci.yml header_spec=.ignore
*.nix header_spec=.ignore
# Doc
/doc/**/* header_spec=.ignore
Changelog header_spec=.ignore
LICENSE header_spec=.ignore
LLVM_REV header_spec=.ignore
README* header_spec=.ignore
VERSION header_spec=.ignore
CHANGELOG.md header_spec=.ignore
DESCRIPTION.md header_spec=.ignore
# Git
.gitattributes header_spec=.ignore
.gitignore header_spec=.ignore
.gitkeep header_spec=.ignore
# Headers
/headers/open-source/* header_spec=.ignore
/headers/closed-source/* header_spec=.ignore
/headers/headache_config.txt header_spec=.ignore
# OCaml
.merlin header_spec=.ignore
*.opam* header_spec=.ignore
# Tests
/tests/**/* header_spec=.ignore
# Misc
/Ast.org header_spec=.ignore
/gdb_commands header_spec=.ignore
/tests_list.txt header_spec=.ignore
/framaCIRGen_src/.clangd header_spec=.ignore
......@@ -34,7 +34,6 @@
/autom4te.cache
/frama_Clang_config.ml
/*.d
/doc
/frama-clang.tar.gz
/tests/*/result/*
/tests/basic/result/*
......@@ -45,7 +44,6 @@
/tests/stl/result/*
/tests/pp/result/*
/tests/ppwp/result/*
/tests/ptests_config
/bin/framaCIRGen
META.frama-c-frama_clang
/Frama_Clang.check_mli_exists
......@@ -55,3 +53,7 @@ META.frama-c-frama_clang
.frama-c/
tempirgen
/mine/
/frama-clang-*.tar.gz
_build
/tests/*/oracle/dune
*.idx
################################################################################
### STAGES
stages:
- tests
- distrib
- compatibility
- prepare-release
- release
################################################################################
### DEFAULT JOB PARAMETERS
default:
tags: [nix-v2]
################################################################################
### VARIABLES
variables:
DEFAULT: "master"
OCAML: "4.14"
################################################################################
### ONLY/EXCEPT TEMPLATES
.build_template: &manual_template
except:
refs:
- schedules
when: manual
.build_template: &when_schedules
only:
refs:
- schedules
.build_template: &when_release
only:
variables:
- $RELEASE == "yes"
################################################################################
### TESTS
.build_template: &tests_template
stage: tests
script:
- ./nix/ci.sh $LLVM_VERSION
tests-auto:
<<: *tests_template
parallel:
matrix:
- LLVM_VERSION: [ "12", "19" ]
tests-manual:
<<: *tests_template
<<: *manual_template
parallel:
matrix:
- LLVM_VERSION: [ "13", "14", "15", "16", "17", "18" ]
################################################################################
### DISTRIB
check-headers:
stage: distrib
variables:
CI_MODE: "check-headers"
script:
- ./nix/ci.sh
################################################################################
### CHECK OPAM PACKAGE STATUS
.build_template: &opam_template
tags: [docker]
image: "ocaml/opam:ubuntu-lts-ocaml-$OCAML"
stage: compatibility
variables:
CI_MODE: "check-opam"
EXTRA_PACKAGES: "clang libclang-dev libclang-cpp-dev llvm-dev"
script:
- ./nix/ci.sh
check-opam:
<<: *opam_template
<<: *manual_template
check-opam-nightly:
<<: *opam_template
<<: *when_schedules
check-opam-release:
<<: *opam_template
<<: *when_release
################################################################################
### PRE-RELEASE
.build-template: &make_manual
stage: prepare-release
variables:
OUT: "manual"
CI_MODE: "manual"
artifacts:
paths:
- manual/*.pdf
script:
- ./nix/ci.sh
release-manual:
<<: *when_release
<<: *make_manual
force-manual:
<<: *manual_template
<<: *make_manual
check-versions:
<<: *when_release
stage: prepare-release
variables:
CI_MODE: "check-versions"
script:
- ./nix/ci.sh
################################################################################
### RELEASE
release:
<<: *when_release
stage: release
variables:
CI_MODE: "release"
PLUGIN_FULL_NAME: "Frama-Clang"
REPO: "frama-clang"
RELEASE_OPT: "--assume-yes"
MANUAL_DIR: "manual"
script:
- ls -la
- ls manual
- ./nix/ci.sh
# Version +dev
- Compatibility with Clang 19
# Version 0.0.17
- Compatibility with Frama-C 30 Zinc
# Version 0.0.16
- Better handling of ACSL constructions
- Compatibility with Clang 18
- Compatibility with Frama-C 29 Copper
# Version 0.0.15
- Better handling of mixed C/C++ code and `extern "C"` declarations
- Compatibility with Clang 17
- Compatibility with Frama-C 28.x Nickel
# Version <= 0.0.14
- See https://frama-c.com/fc-plugins/frama-clang.html
set( LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
Option
Support
)
add_clang_executable(framaCIRGen
DescentParse.cpp
ACSLCodeAnnotation.cpp
ACSLComment.cpp
ACSLComponent.cpp
ACSLFunctionContract.cpp
ACSLGlobalAnnotation.cpp
ACSLLexer.cpp
ACSLLogicType.cpp
ACSLLoopAnnotation.cpp
ACSLParser.cpp
ACSLStatementAnnotation.cpp
ACSLTermOrPredicate.cpp
ACSLToken.cpp
Clang_utils.cpp
ClangVisitor.cpp
RTTITable.cpp
VisitTable.cpp
FramaCIRGen.cpp
intermediate_format.c
)
if (CLANG_VERSION VERSION_LESS 6.0.0)
target_link_libraries(framaCIRGen
clangAnalysis
clangAST
clangBasic
clangDriver
clangEdit
clangFrontend
clangLex
clangParse
clangSema
clangSerialization
clangTooling
LLVMBitReader
LLVMMCParser
LLVMOption
)
else()
target_link_libraries(framaCIRGen
PRIVATE
clangAnalysis
clangAST
clangBasic
clangDriver
clangEdit
clangFrontend
clangLex
clangParse
clangSema
clangSerialization
clangTooling
)
endif()
install(TARGETS framaCIRGen
RUNTIME DESTINATION bin)
Frama-Clang is an experimental C++ front-end for Frama-C, based on the clang compiler
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File deleted
File deleted
/**************************************************************************/
/* */
/* This file is part of Frama-Clang */
/* */
/* Copyright (C) 2012-2025 */
/* 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 LICENSE). */
/* */
/**************************************************************************/
# Doxyfile 1.8.3.1
# This file describes the settings to be used by the documentation system
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2018 *)
(* Copyright (C) 2012-2025 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
Unless otherwise specified, files in this directory are
Copyright (C) 2012-2016
Copyright (C) 2012-2023
CEA (Commissariat à l'énergie atomique et aux énergies
alternatives)
......@@ -160,7 +160,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
......@@ -470,6 +470,3 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
# LLVM/Clang revision number against which the plugin has been compiled
179014
......@@ -2,7 +2,7 @@
# #
# This file is part of Frama-Clang #
# #
# Copyright (C) 2012-2018 #
# Copyright (C) 2012-2025 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
......@@ -20,112 +20,48 @@
# #
##########################################################################
### Main Makefile. As Makefiles included from clang and Frama-C are incompatible
### we have two auxiliary Makefiles, one for each side of the front-end.
### We define here general targets that will operate on both sides.
FCLANG_VERSION=0.0.6
PLUGIN_DIR ?= .
include $(PLUGIN_DIR)/Makefile.common
PLUGIN_NAME:=Frama_Clang
PLUGIN_ENABLED:=yes
PLUGIN_CMI:=intermediate_format
PLUGIN_CMO:=intermediate_format_parser frama_Clang_option \
fclang_datatype reorder_defs cxx_utils mangling \
convert_env convert_acsl generate_spec class convert \
convert_link frama_Clang_register
ifneq ("$(MAKECMDGOALS)","uninstall")
PLUGIN_GENERATED:= \
$(addprefix ${PLUGIN_DIR}/, \
intermediate_format_parser.ml \
intermediate_format.mli intermediate_format_parser.mli)
else
PLUGIN_GENERATED:=
endif
ifeq ("$(RUN_TESTS)","yes")
PLUGIN_TESTS_DIRS:=basic stl class val_analysis template specs exn pp ppwp bugs da
else
PLUGIN_NO_TESTS:=yes
.PHONY: all build clean
ifndef FRAMAC_SHARE
FRAMAC_SHARE :=$(shell frama-c-config -print-share-path)
endif
PLUGIN_DISTRIBUTED:=no
PLUGIN_DISTRIB_EXTERNAL:=configure.ac configure Makefile Makefile.clang \
Makefile.common Makefile.config.in gen_ast.ml *.cpp *.h \
intermediate_format.ast DescentParse.template frama_Clang_config.ml.in \
Doxyfile mainpage.dox README \
$(addprefix share/libc++/,$(CXX_HEADERS))
include $(FRAMAC_SHARE)/Makefile.dynamic
$(Frama_Clang_DIR)/tests/ptests_config: $(Frama_Clang_DIR)/Makefile.config
install::
$(MKDIR) $(FRAMAC_DATADIR)/frama-clang/libc++
$(CP) $(addprefix $(Frama_Clang_DIR)/share/libc++/, \
$(CXX_HEADERS)) \
$(FRAMAC_DATADIR)/frama-clang/libc++
working-tests: $(Frama_Clang_DIR)/ptests_local_config.cmxs
@echo "FRAMAC_SHARE=$(FRAMAC_SHARE)"
LINES=$$(sed -e '/^Tests OK:$$/b out' -e d -e ':out' -e '=' -e 'd' \
$(Frama_Clang_DIR)/tests_list.txt); \
TESTS=$$(tail -n +$$((LINES+1)) \
$(Frama_Clang_DIR)/tests_list.txt | tr '\n' ' '); \
cd $(Frama_Clang_DIR) && $(PTESTS) $(PTESTS_OPTS) $$TESTS
make -C $(Frama_Clang_DIR)
tests:: dontrun
dontrun:
(cd tests; echo `grep -r 'DONTRUN' $(PLUGIN_TESTS_DIRS) | wc -l` test files marked DONTRUN )
$(Frama_Clang_DIR)/gen_ast: $(PLUGIN_DIR)/gen_ast.ml
$(PRINT_OCAMLC) $@
$(OCAMLC) $(Frama_Clang_BFLAGS) -o $@ -pp $(CAMLP4O) \
zarith.cma dynlink.cma transitioning.cmo $^
$(Frama_Clang_DIR)/test_ast: \
$(Frama_Clang_DIR)/intermediate_format.cmo \
$(Frama_Clang_DIR)/intermediate_format.o
$(PLUGIN_DIR)/%_parser.ml $(PLUGIN_DIR)/%_parser.mli \
$(PLUGIN_DIR)/%.mli $(PLUGIN_DIR)/%.c: \
$(PLUGIN_DIR)/%.ast $(PLUGIN_DIR)/gen_ast
$(PRINT_MAKING) "intermediate AST"
$(Frama_Clang_DIR)/gen_ast $<
CLANG_MAKE:=$(MAKE) PLUGIN_DIR=$(Frama_Clang_DIR) FRAMAC_SHARE=$(FRAMAC_SHARE) \
-f $(Frama_Clang_DIR)/Makefile.clang
clean::
$(RM) gen_ast
$(CLANG_MAKE) clean
all::
$(CLANG_MAKE) default
install::
@echo "BINDIR is $(BINDIR)"
$(CLANG_MAKE) install
doc::
$(CLANG_MAKE) doc
distrib: clean
$(PRINT_MAKING) $@
$(RM) -r frama-clang
$(MKDIR) frama-clang-$(FCLANG_VERSION)
$(MKDIR) frama-clang-$(FCLANG_VERSION)/bin
$(TAR) cf tmp.tar $(FCLANG_DISTRIBUTED_FILES)
cd frama-clang-$(FCLANG_VERSION) && $(TAR) xf ../tmp.tar
$(TAR) czf frama-clang-$(FCLANG_VERSION).tar.gz frama-clang-$(FCLANG_VERSION)
$(RM) -r frama-clang-$(FCLANG_VERSION)
NOHEADER=%configure README
headers::
$(PRINT_MAKING) $@
headache -c $(Frama_Clang_DIR)/.headache_config.txt \
-h $(Frama_Clang_DIR)/.LICENSE \
$(filter-out $(NOHEADER), $(FCLANG_DISTRIBUTED_FILES))
sinclude ${FRAMAC_SHARE}/Makefile.common
##########################################################################
# Build
all:: build frama-clang.opam
frama-clang.opam: frama-clang.opam.template dune-project
rm -f $@
dune build $@
build::
dune build @install
clean:: purge-tests
dune clean
rm -rf _build .merlin
##########################################################################
# Tests
# PTEST_OPTS has to be defined when Frama-Clang plugin is external
# in order to redefine the macro @FRAMAC_SHARE@ for a FILTER directive
PTEST_OPTS?= -macro-frama-c-share=$(FRAMAC_SHARE)
include ${FRAMAC_SHARE}/Makefile.testing
##########################################################################
# Install
include ${FRAMAC_SHARE}/Makefile.installation
##########################################################################
# Headers
HDRCK_EXTRA:=-headache-config-file ./headers/headache_config.txt
include ${FRAMAC_SHARE}/Makefile.headers
##########################################################################
This archive contains Frama-Clang, a Frama-C plug-in for parsing C++ files,
based on Clang, the C/C++/Objective-C front-end of the LLVM compiler
infrastructure.
# Installation
The following packages must be present on the system in order to compile
Frama-Clang
- llvm and clang (version >= 11)
- For Ubuntu and Debian, install the following packages:
libclang-<version>-dev clang-<version>
(with their dependencies).
- For Fedora, install the following packages:
llvm<version>-static clang clang-devel
(packages such as llvm<version>, llvm<version>-devel and ncurses-devel
should be included in their dependencies; otherwise, you might need to
install them as well)
- Frama-C version 30.x Zinc
- OCaml version 4.14.0 or higher
(i.e. the same version than the one that was used to compile Frama-C).
- The corresponding `camlp5` version
- `camlp-streams` (available through `opam`, it should normally be installed
together with `camlp5` if needed)
The front-end can then be compiled with the traditional commands
```
make
make install
```
Depending on the exact configuration of the system,
the last step might require administrator rights.
`frama-clang` can also be installed directly through `opam`: `opam install frama-clang`. Note
however that you might need to install some of the clang/llvm related packages by hand (see above),
as the `conf-llvm` and `conf-libclang` packages of `opam` do not properly capture all external
dependencies for some distributions.
# Usage
Once installed, Frama-Clang will be automatically called by Frama-C's kernel
whenever a C++ source file is encountered. More precisely, files ending
with `.cpp`, `.C`, `.cxx`, `.c++` or `.cc` will be treated as C++ files.
Files ending with `.ii` will be considered as already pre-processed C++ files.
Options of the plug-in are the following.
- `-cxx-unmangling key` indicates what to do when outputting a C++ symbol name.
`key` can be one the following:
- `help`: outputs a list of existing `key` with a short description
- `fully-qualified`: displays the fully qualified name (e.g. `::A::x`)
- `without-qualifier`: only display the unqualified name (e.g. `x`)
- `none`: do not any transformation, displays the name as it is stored
in Frama-C's AST (e.g. `_Z1A1x`)
- `-cxx-parseable-output` indicates that the pretty-printed code resulting
from the translation should be able to be parsed again by Frama-C.
implies `-cxx-unmangling none`
- `-cxx-cstdlib-path <path>` specifies where to look for standard
C library headers (default is the path to Frama-C's headers)
- `-cxx-c++stdlib-path <path>` specifies where to look for
standard C++ library headers (default is the path to Frama-Clang headers,
which are very incomplete)
- `-cxx-nostdinc` do not include in the search paths
Frama-C's C/C++ standard headers location (i.e. rely on the system's headers)
- `-cxx-clang-command <cmd>` allows changing the name of the
command that launches clang and its plugin that outputs the intermediate AST.
This should only be needed if the front-end as a whole has not been installed
properly.
Older versions of the plug-in used specific options for unmangling.
These are now obsolete:
- `-cxx-demangling-full`: use `-cxx-unmangling fully-qualified`
- `-cxx-demangling-short`: use `-cxx-unmangling without-qualifier`
- `-cxx-keep-mangling`: use `-cxx-unmangling none`
In addition, any command-line option taking a function name as
argument (e.g. `-main`, `-eva-slevel-function`, ...) will accept a
fully qualified C++ name (provided it refers to an existing function
in the code under analysis of course). Note however that it is
currently not possible to distinguish between overloaded functions
using this mechanism.
More information is available in the [user manual](https://frama-c.com/download/frama-clang-manual.pdf).
#!/bin/bash
##########################################################################
# #
# This file is part of Frama-Clang #
# #
# Copyright (C) 2012-2018 #
# Copyright (C) 2012-2025 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
......@@ -20,92 +21,46 @@
# #
##########################################################################
##===- tools/frama-c/Makefile --------------------------*- Makefile -*-===##
#
##===----------------------------------------------------------------------===##
### Clang specific Makefile. Don't call it directly, use the targets from
### main Makefile
### NB: This directory is supposed to be placed in clang/tools, which itself
### should reside in llvm/tools. LLVM Makefile does not seem robust enough to
### support a completely external compilation.
TOOLNAME = framaCIRGen
PLUGIN_DIR ?= .
Frama_Clang_DIR=$(PLUGIN_DIR)
include $(PLUGIN_DIR)/Makefile.common
.PHONY: default clean install doc
OBJS=\
$(addprefix $(PLUGIN_DIR)/, \
Clang_utils.o intermediate_format.o ACSLComment.o ACSLLogicType.o \
ACSLTermOrPredicate.o ACSLLoopAnnotation.o ACSLStatementAnnotation.o\
ACSLGlobalAnnotation.o ACSLCodeAnnotation.o ACSLFunctionContract.o \
ACSLComponent.o ACSLLexer.o ACSLParser.o \
ACSLToken.o DescentParse.o RTTITable.o VisitTable.o \
ClangVisitor.o FramaCIRGen.o)
DEPS=$(OBJS:.o=.d)
CXXFLAGS?=$(CLANG_CXXFLAGS)
CXXFLAGS+=-Wno-enum-compare -DCLANG_BIN_DIR=\"$(CLANG_BIN_DIR)\"
CFLAGS?=$(CLANG_CFLAGS)
CFLAGS+=-Wno-enum-compare
# enabling non-null assertions for AST construction would require
# some refactoring in RTTITable.cpp. Still TODO at this point.
CHECK_AST_CONSTRUCTION?=no
ifeq ("$(CHECK_AST_CONSTRUCTION)","no")
$(Frama_Clang_DIR)/intermediate_format.o: CFLAGS+=-DNDEBUG
endif
ifeq ("$(CLANG_DEBUG)","yes")
CXXFLAGS+=-g
CFLAGS+=-g
CLANG_LINKFLAGS+=-g
endif
#LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser support mc
USEDLIBS = clangFrontend clangDriver clangParse clangSema clangAnalysis \
clangEdit clangAST clangLex clangSerialization clangBasic
# for use in main Makefile
default: $(PLUGIN_DIR)/bin/$(TOOLNAME)
$(PLUGIN_DIR)/bin/$(TOOLNAME): $(OBJS) $(PLUGIN_DIR)/bin
$(PRINT_LINKING) $@
$(CXX) $(CLANG_LINKFLAGS) -o $@ \
$(OBJS) $(addprefix -l,$(USEDLIBS)) $(LLVM_LIBS) $(CLANG_SYSLIBS) $(CLANG_LINKFLAGS)
$(PLUGIN_DIR)/bin:
$(MKDIR) $@
clean:
$(PRINT_RM) 'FramaCIRGen'
rm -f $(PLUGIN_DIR)/bin/$(TOOLNAME) *.o *.d
%.o: %.cpp
$(PRINT) 'Compiling '$<
$(CXX) -c $(CXXFLAGS) -I $(CLANG_INCDIR) -I $(PLUGIN_DIR) \
-MD -MF $(@:.o=.d) -o $@ $<
%.o: %.c
$(PRINT) 'Compiling '$<
$(CC) -c $(CFLAGS) -I $(CLANG_INCDIR) -I $(PLUGIN_DIR) -o $@ $<
install:
$(PRINT_INSTALL) $(TOOLNAME) in $(BINDIR)
$(MKDIR) -p $(BINDIR)
cp $(PLUGIN_DIR)/bin/$(TOOLNAME) $(BINDIR)
doc:
$(PRINT_MAKING) "FramaCIRGen documentation"
cd $(PLUGIN_DIR) && doxygen
cd $(PLUGIN_DIR)/doc/latex && make
-include $(DEPS)
FCLANG_NEXT=$1
FC_NEXT=$2
FC_NEXT_NAME=$3
if ! test -f frama-clang.opam.template; then
echo "This script must be run from Frama-Clang root directory"
exit 2;
fi
if test -z "$FCLANG_NEXT" -o -z "$FC_NEXT" -o -z "$FC_NEXT_NAME"; then
echo "Missing argument. Usage is:"
echo "./bin/set-version.sh fclang-version fc-version fc-version-name"
exit 2;
fi
if command -v gsed &>/dev/null; then
SED=gsed
else
if sed --version 2>/dev/null | grep -q GNU; then
SED=sed
else
echo "GNU sed required"
exit 1
fi
fi
FC_NEXT_ROOT=$($SED -e "s/^\\([0-9]*\.[0-9]*\\).*/\\1/" <<< $FC_NEXT)
FC_NEXT_MAJOR=$($SED -e "s/^\\([0-9]*\\)\..*/\\1/" <<< $FC_NEXT)
if test -z "$FC_NEXT_ROOT" -o -z "FC_NEXT_MAJOR"; then
echo "Unrecognized fc-version number (expecting X.Y)"
exit 2;
fi
FC_NEXT_NEXT_MAJOR=$(($FC_NEXT_MAJOR + 1))
$SED -i -e "s/^ *version: .*/version: \"$FCLANG_NEXT\"/" frama-clang.opam.template
$SED -i -e "s/^ *version: .*/version: \"$FCLANG_NEXT\"/" frama-clang.opam
$SED -i -e "s/(\"frama-c\" .*/(\"frama-c\" (and (>= $FC_NEXT_ROOT~) (< $FC_NEXT_NEXT_MAJOR.0~)))/" dune-project
$SED -i -e "s/- Frama-C version.*/- Frama-C version $FC_NEXT $FC_NEXT_NAME/" README.md
echo $FCLANG_NEXT > doc/userman/FCLANG_VERSION
echo $FC_NEXT > doc/userman/FC_VERSION
echo $FC_NEXT_NAME > doc/userman/FC_VERSION_NAME
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2018 *)
(* Copyright (C) 2012-2025 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......@@ -27,7 +27,7 @@ module Inheritance_graph =
(Fclang_datatype.Qualified_name)
(struct
type t = int * access_kind * vkind
let compare = Pervasives.compare
let compare = Stdlib.compare
let default = (0, Private, VStandard)
end)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2018 *)
(* Copyright (C) 2012-2025 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
##########################################################################
# #
# This file is part of Frama-Clang #
# #
# Copyright (C) 2012-2018 #
# 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 LICENSE). #
# #
##########################################################################
m4_define([plugin_file],Makefile.config.in)
m4_define([FRAMAC_SHARE_ENV],
[m4_normalize(m4_esyscmd([echo $FRAMAC_SHARE]))])
m4_define([FRAMAC_SHARE],
[m4_ifval(FRAMAC_SHARE_ENV,
[FRAMAC_SHARE_ENV],
[m4_esyscmd(frama-c -print-path)])])
m4_ifndef([FRAMAC_M4_MACROS],
[m4_include(FRAMAC_SHARE/configure.ac)])
check_plugin([frama_clang],PLUGIN_RELATIVE_PATH(plugin_file),
[C++ front-end for Frama-C],yes)
plugin_require_external(frama_clang,camlp4o)
# check for system C++ compiler, as we can't rely on clang++ itself because
# of potential incompatibilities with GNU libstdc++ v5.
# See https://llvm.org/bugs/show_bug.cgi?id=23529 for more details
AC_PROG_CXX()
configure_tool([CAMLP4O],[camlp4o],[camlp4o not found.],no)
check_plugin_dependencies()
AC_SUBST(CLANG_CXXFLAGS)
AC_SUBST(CLANG_CFLAGS)
AC_SUBST(CLANG_INCDIR)
AC_SUBST(CLANG_LINKFLAGS)
AC_SUBST(CLANG_SYSLIBS)
AC_SUBST(CLANG_BIN_DIR)
AC_SUBST(LLVM_LIBS)
AC_SUBST(DEFAULT_FC_C_HEADERS)
AC_SUBST(DEFAULT_FC_CXX_HEADERS)
AC_SUBST(RUN_TESTS)
DEFAULT_FC_C_HEADERS=$datarootdir/frama-c/libc
DEFAULT_FC_CXX_HEADERS=$datarootdir/libc++
AC_CHECK_PROGS([CLANG],[clang clang-5.0 clang-4.0 clang-3.9 clang-3.8],no)
AC_CHECK_PROGS([CLANGXX],[clang++ clang++-5.0 clang++-4.0 clang++-3.9 clang++-3.8],no)
AC_CHECK_PROGS([LLVM_CONFIG],[llvm-config llvm-config-6.0 llvm-config-5.0 llvm-config-4.0 llvm-config-3.9 llvm-config-3.8],no)
if test "$LLVM_CONFIG" = "no"; then
plugin_disable(frama_clang,[llvm-config not found]);
fi
if test "$CLANG" = "no"; then
plugin_disable(frama_clang,[clang not found]);
fi
if test "$CLANG++" = "no"; then
plugin_disable(frama_clang,[clang++ not found]);
fi
if test "$LLVM_CONFIG" != "no"; then
AC_CHECK_FILE([$($LLVM_CONFIG --includedir)/clang],[],
[plugin_disable(frama_clang,clang dev headers not found.);])
fi
if test "$ENABLE_FRAMA_CLANG" != "no"; then
LLVM_VERSION=$($LLVM_CONFIG --version)
AC_MSG_CHECKING([LLVM version])
LLVM_SHARED_MODE=$($LLVM_CONFIG --shared-mode)
RUN_TESTS=no
case $LLVM_VERSION in
6.0.*) AC_MSG_RESULT([$LLVM_VERSION: Good]);;
7.0.*) AC_MSG_RESULT([$LLVM_VERSION: Good]);;
8.0.*) AC_MSG_RESULT([$LLVM_VERSION: Good]); RUN_TESTS=yes;;
*) plugin_disable(frama_clang,
[[LLVM Version $LLVM_VERSION is not supported. Please install LLVM 6.0.x, 7.0.x, or 8.0.x]]);;
esac
LLVM_CONFIG="$LLVM_CONFIG $LLVM_STATIC"
CLANG_CXX_COMMONFLAGS="$($LLVM_CONFIG --cppflags) -g -fPIC -fno-rtti"
CLANG_CFLAGS="$($LLVM_CONFIG --cppflags) -g -fPIC"
CLANG_INCDIR=$($LLVM_CONFIG --includedir)
CLANG_LINKFLAGS="$($LLVM_CONFIG --ldflags)"
CLANG_CXXFLAGS="$CLANG_CXX_COMMONFLAGS -std=c++11"
CLANG_SYSLIBS="$($LLVM_CONFIG --system-libs)"
CLANG_BIN_DIR="$($LLVM_CONFIG --bindir)"
if test "$LLVM_SHARED_MODE" = "shared"; then
LLVM_LIBS=$($LLVM_CONFIG --libs core);
else
LLVM_LIBS=$($LLVM_CONFIG --libs profiledata asmparser mc mcparser support bitreader option);
fi
fi
write_plugin_config(Makefile.config)
This diff is collapsed.