From 0d573024069dc685777256424bab2097a1e4847b Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Tue, 13 Jul 2021 10:19:53 +0200
Subject: [PATCH] distribute cxx_builtin + avoid duplicating list of distrib
 files

---
 .headache_config.txt        |  6 ++++++
 Doxyfile                    | 22 ++++++++++++++++++++++
 Makefile                    |  6 +-----
 Makefile.common             | 33 ++++++++++++++++++---------------
 mainpage.dox                | 22 ++++++++++++++++++++++
 share/libc++/cstdbool       | 22 ++++++++++++++++++++++
 share/libc++/cxx_builtin.cc | 19 ++++++++++++++-----
 7 files changed, 105 insertions(+), 25 deletions(-)

diff --git a/.headache_config.txt b/.headache_config.txt
index 5476ac77..c18f03a1 100644
--- a/.headache_config.txt
+++ b/.headache_config.txt
@@ -35,3 +35,9 @@
 #######
 
 | "[^.]*" -> frame open: "/*" line:"*" close: "*/"
+
+########
+# Misc #
+########
+
+| ".*\.dox" -> frame open: "/*" line: "*" close: "*/"
diff --git a/Doxyfile b/Doxyfile
index e2ba2ef8..8ee2b92d 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -1,3 +1,25 @@
+/**************************************************************************/
+/*                                                                        */
+/*  This file is part of Frama-Clang                                      */
+/*                                                                        */
+/*  Copyright (C) 2012-2021                                               */
+/*    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
diff --git a/Makefile b/Makefile
index 35e7836e..a66f0e9d 100644
--- a/Makefile
+++ b/Makefile
@@ -52,11 +52,7 @@ else
 PLUGIN_NO_TESTS:=yes
 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.md \
-$(addprefix share/libc++/,$(CXX_HEADERS))
+
 include $(FRAMAC_SHARE)/Makefile.dynamic
 
 $(Frama_Clang_DIR)/tests/ptests_config: $(Frama_Clang_DIR)/Makefile.config
diff --git a/Makefile.common b/Makefile.common
index 12aa1e0d..1b97c34a 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -31,10 +31,10 @@ endif
 
 #Installed header files
 CXX_HEADERS= algorithm array atomic bitset cassert cerrno climits	\
-clocale cstdarg cstddef cstdio cstdint cstdlib cstring ctime cwchar	\
-exception functional initializer_list ios iosfwd iostream istream	\
-iterator locale memory new ostream stdexcepts streambuf string		\
-system_error type_traits typeinfo utility cxxabi.h			\
+clocale cstdarg cstdbool cstddef cstdio cstdint cstdlib cstring ctime	\
+cwchar exception functional initializer_list ios iosfwd iostream	\
+istream iterator locale memory new ostream stdexcepts streambuf		\
+string system_error type_traits typeinfo utility cxxabi.h		\
 __fc_define_char_traits_char __fc_define_fpos				\
 __fc_define_ios_base_seekdir __fc_define_mbstate_t			\
 __fc_define_streamoff __fc_define_streamsize __fc_define_streampos
@@ -46,10 +46,11 @@ FCLANG_MLFILES=\
 
 # Existing C++ source files
 FCLANG_CXXFILES=\
-  ACSLCodeAnnotation ACSLComment ACSLComponent ACSLFunctionContract \
-  ACSLGlobalAnnotation ACSLLexer ACSLLogicType ACSLLoopAnnotation \
-  ACSLParser ACSLStatementAnnotation ACSLTermOrPredicate ACSLToken \
-  Clang_utils ClangVisitor DescentParse RTTITable VisitTable
+  ACSLCodeAnnotation ACSLComment ACSLComponent		\
+  ACSLFunctionContract ACSLGlobalAnnotation ACSLLexer ACSLLogicType	\
+  ACSLLoopAnnotation ACSLParser ACSLStatementAnnotation			\
+  ACSLTermOrPredicate ACSLToken AnnotationComment Clang_utils		\
+  ClangVisitor DescentParse FramaCIRGen RTTITable VisitTable \
 
 ifndef FRAMAC_SHARE
 FRAMAC_SHARE:=$(shell frama-c -print-path)
@@ -62,13 +63,15 @@ $(PLUGIN_DIR)/.clang_complete: $(PLUGIN_DIR)/Makefile.config
 	rm -f $@
 	$(foreach opt,$(CLANG_CXXFLAGS),echo $(opt) >> $@;)
 
+PLUGIN_DISTRIB_EXTERNAL:=configure.ac configure Makefile Makefile.clang \
+Makefile.common Makefile.config.in gen_ast.ml \
+$(wildcard $(FCLANG_CXXFILES:%=%.cpp)) $(wildcard $(FCLANG_CXXFILES:%=%.h)) \
+intermediate_format.ast DescentParse.template \
+Doxyfile mainpage.dox README.md \
+$(addprefix share/libc++/,$(CXX_HEADERS)) \
+share/libc++/cxx_builtin.cc \
+
 FCLANG_DISTRIBUTED_FILES=\
  $(addprefix $(Frama_Clang_DIR)/, \
     $(FCLANG_MLFILES:%=%.ml) $(FCLANG_MLFILES:%=%.mli) Frama_Clang.mli \
-    $(FCLANG_CXXFILES:%=%.cpp) $(FCLANG_CXXFILES:%=%.h) \
-    AnnotationComment.h FramaCIRGen.cpp DescentParse.template \
-    gen_ast.ml intermediate_format.ast \
-    configure.ac configure \
-    Makefile Makefile.common Makefile.clang Makefile.config.in \
-    README.md \
-    $(addprefix share/libc++/, $(CXX_HEADERS)))
+    $(PLUGIN_DISTRIB_EXTERNAL))
diff --git a/mainpage.dox b/mainpage.dox
index d01cdb96..102d18a5 100644
--- a/mainpage.dox
+++ b/mainpage.dox
@@ -1,3 +1,25 @@
+/**************************************************************************/
+/*                                                                        */
+/*  This file is part of Frama-Clang                                      */
+/*                                                                        */
+/*  Copyright (C) 2012-2021                                               */
+/*    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).                      */
+/*                                                                        */
+/**************************************************************************/
+
 /**
 \mainpage The Frama-Clang documentation
 
diff --git a/share/libc++/cstdbool b/share/libc++/cstdbool
index f0ceeec1..93873b15 100644
--- a/share/libc++/cstdbool
+++ b/share/libc++/cstdbool
@@ -1,3 +1,25 @@
+/**************************************************************************/
+/*                                                                        */
+/*  This file is part of Frama-Clang                                      */
+/*                                                                        */
+/*  Copyright (C) 2012-2021                                               */
+/*    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).                      */
+/*                                                                        */
+/**************************************************************************/
+
 // -*- C++ -*-
 #include <stdbool.h>
 #ifdef bool
diff --git a/share/libc++/cxx_builtin.cc b/share/libc++/cxx_builtin.cc
index 2dda385b..232f594e 100644
--- a/share/libc++/cxx_builtin.cc
+++ b/share/libc++/cxx_builtin.cc
@@ -1,13 +1,22 @@
 /**************************************************************************/
 /*                                                                        */
-/*  This file is part of Frama-C.                                         */
+/*  This file is part of Frama-Clang                                      */
 /*                                                                        */
-/*  Copyright (C) 2007-2012                                               */
-/*    CEA (Commissariat à l'énergie atomique et aux énergies              */
+/*  Copyright (C) 2012-2021                                               */
+/*    CEA (Commissariat à l'énergie atomique et aux énergies              */
 /*         alternatives)                                                  */
 /*                                                                        */
-/*  All rights reserved.                                                  */
-/*  Contact CEA LIST for licensing.                                       */
+/*  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).                      */
 /*                                                                        */
 /**************************************************************************/
 
-- 
GitLab