[med-svn] [Git][med-team/castxml][upstream] New upstream version 0.6.6

Étienne Mollier (@emollier) gitlab at salsa.debian.org
Sun May 26 13:21:22 BST 2024


Étienne Mollier pushed to branch upstream at Debian Med / castxml


Commits:
9e81d64c by Étienne Mollier at 2024-05-26T11:20:22+02:00
New upstream version 0.6.6
- - - - -


28 changed files:

- CMakeLists.txt
- README.rst
- src/Output.cxx
- src/RunClang.cxx
- src/Version.cmake
- test/CMakeLists.txt
- test/cc-gnu.c
- + test/expect/castxml1.any.GNU-attr-assume.xml.txt
- + test/expect/castxml1.c.GNU-attr-assume.xml.txt
- test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
- test/expect/cmd.cc-gnu-c-tgt-i386-opt-E.stdout.txt
- test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
- test/expect/cmd.cc-gnu-tgt-i386-opt-E.stdout.txt
- + test/expect/gccxml.any.GNU-attr-assume.xml.txt
- + test/expect/gccxml.c.GNU-attr-assume.xml.txt
- test/input/GNU-_Float128.c
- test/input/GNU-_Float128.cxx
- test/input/GNU-_Float32.c
- test/input/GNU-_Float32.cxx
- test/input/GNU-_Float32x.c
- test/input/GNU-_Float32x.cxx
- test/input/GNU-_Float64.c
- test/input/GNU-_Float64.cxx
- test/input/GNU-_Float64x.c
- test/input/GNU-_Float64x.cxx
- + test/input/GNU-attr-assume.c
- + test/input/GNU-attr-assume.cxx
- test/run.cmake


Changes:

=====================================
CMakeLists.txt
=====================================
@@ -120,6 +120,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
   if(NOT LLVM_ENABLE_RTTI)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
   endif()
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+  string(APPEND CMAKE_CXX_FLAGS " -Zc:preprocessor")
 endif()
 if(CYGWIN OR MINGW)
   # Use GNU extensions on Windows as LLVM upstream does.


=====================================
README.rst
=====================================
@@ -47,7 +47,8 @@ To build CastXML from source, first obtain the prerequisites:
 * `LLVM/Clang`_ compiler SDK install tree built using the C++ compiler.
   This version of CastXML has been tested with LLVM/Clang
 
-  - Git ``main`` as of 2024-01-03 (``155d5849da``)
+  - Git ``main`` as of 2024-03-06 (``f7d354af57``)
+  - Release ``18.1``
   - Release ``17.0``
   - Release ``16.0``
   - Release ``15.0``


=====================================
src/Output.cxx
=====================================
@@ -42,9 +42,13 @@
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/Support/raw_ostream.h"
 
-#if LLVM_VERSION_MAJOR < 16
-#  define starts_with startswith
-#endif
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <queue>
+#include <set>
+#include <string>
+#include <vector>
 
 #if LLVM_VERSION_MAJOR >= 16
 #  include <optional>
@@ -85,13 +89,13 @@ using OptionalFileEntryRef = clang::FileEntry const*;
 #  define cx_TagTypeKind(x) clang::TTK_##x
 #endif
 
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-#include <queue>
-#include <set>
-#include <string>
-#include <vector>
+#if LLVM_VERSION_MAJOR < 16
+#  define starts_with startswith
+#endif
+
+#if LLVM_VERSION_MAJOR < 18
+#  define isPureVirtual isPure
+#endif
 
 class ASTVisitorBase
 {
@@ -2282,7 +2286,7 @@ void ASTVisitor::OutputCXXMethodDecl(clang::CXXMethodDecl const* d,
   if (d->isVirtual()) {
     flags |= FH_Virtual;
   }
-  if (d->isPure()) {
+  if (d->isPureVirtual()) {
     flags |= FH_Pure;
   }
   if (d->isOverloadedOperator()) {
@@ -2312,7 +2316,7 @@ void ASTVisitor::OutputCXXConversionDecl(clang::CXXConversionDecl const* d,
   if (d->isVirtual()) {
     flags |= FH_Virtual;
   }
-  if (d->isPure()) {
+  if (d->isPureVirtual()) {
     flags |= FH_Pure;
   }
   this->OutputFunctionHelper(d, dn, "Converter", flags);
@@ -2348,7 +2352,7 @@ void ASTVisitor::OutputCXXDestructorDecl(clang::CXXDestructorDecl const* d,
   if (d->isVirtual()) {
     flags |= FH_Virtual;
   }
-  if (d->isPure()) {
+  if (d->isPureVirtual()) {
     flags |= FH_Pure;
   }
   this->OutputFunctionHelper(d, dn, "Destructor", flags,


=====================================
src/RunClang.cxx
=====================================
@@ -270,6 +270,33 @@ protected:
     if (this->Opts.HaveCC) {
       builtins += this->Opts.Predefines;
 
+      // Remove GCC builtin definitions for features Clang does not implement.
+      if (this->IsActualGNU(this->Opts.Predefines)) {
+        builtins += "#undef __BFLT16_DECIMAL_DIG__\n"
+                    "#undef __BFLT16_DENORM_MIN__\n"
+                    "#undef __BFLT16_DIG__\n"
+                    "#undef __BFLT16_DIG__\n"
+                    "#undef __BFLT16_EPSILON__\n"
+                    "#undef __BFLT16_HAS_DENORM__\n"
+                    "#undef __BFLT16_HAS_INFINITY__\n"
+                    "#undef __BFLT16_HAS_QUIET_NAN__\n"
+                    "#undef __BFLT16_IS_IEC_60559__\n"
+                    "#undef __BFLT16_MANT_DIG__\n"
+                    "#undef __BFLT16_MAX_10_EXP__\n"
+                    "#undef __BFLT16_MAX_EXP__\n"
+                    "#undef __BFLT16_MAX__\n"
+                    "#undef __BFLT16_MIN_10_EXP__\n"
+                    "#undef __BFLT16_MIN_EXP__\n"
+                    "#undef __BFLT16_MIN__\n"
+                    "#undef __BFLT16_NORM_MAX__\n"
+                    "#undef __SIZEOF_FLOAT80__\n"
+                    "#undef __STDCPP_BFLOAT16_T__\n"
+                    "#undef __STDCPP_FLOAT128_T__\n"
+                    "#undef __STDCPP_FLOAT16_T__\n"
+                    "#undef __STDCPP_FLOAT32_T__\n"
+                    "#undef __STDCPP_FLOAT64_T__\n";
+      }
+
       // Provide __builtin_va_arg_pack if simulating the actual GNU compiler.
       if (this->NeedBuiltinVarArgPack(this->Opts.Predefines)) {
         // Clang does not support this builtin, so fake it to tolerate
@@ -380,6 +407,12 @@ protected:
         builtins += "\n"
                     "#define __malloc__(...) __malloc__\n";
       }
+      if (this->NeedAttributeAssumeSuppression(this->Opts.Predefines)) {
+        // Clang does not support '__attribute__((__assume__(args...)))'
+        // as a statement attribute used in libstdc++ headers.
+        builtins += "\n"
+                    "#define __assume__(...)\n";
+      }
 
       // Clang's arm_neon.h checks for a feature macro not defined by GCC.
       if (this->NeedARMv8Intrinsics(this->Opts.Predefines)) {
@@ -392,26 +425,57 @@ protected:
         // Clang does not have these types for all sizes.
         // Provide our own approximation of the builtins.
         builtins += "\n"
-                    "typedef struct __castxml_Float32_s { "
-                    "  char x[4] __attribute__((aligned(4))); "
-                    "} __castxml_Float32;\n"
                     "#define _Float32 __castxml_Float32\n"
-                    "typedef struct __castxml_Float32x_s { "
-                    "  char x[8] __attribute__((aligned(8))); "
-                    "} __castxml_Float32x;\n"
                     "#define _Float32x __castxml_Float32x\n"
-                    "typedef struct __castxml_Float64_s { "
-                    "  char x[8] __attribute__((aligned(8))); "
-                    "} __castxml_Float64;\n"
                     "#define _Float64 __castxml_Float64\n"
-                    "typedef struct __castxml_Float64x_s { "
-                    "  char x[16] __attribute__((aligned(16))); "
-                    "} __castxml_Float64x;\n"
-                    "#define _Float64x __castxml_Float64x\n"
-                    "typedef struct __castxml_Float128_s { "
-                    "  char x[16] __attribute__((aligned(16))); "
-                    "} __castxml_Float128;\n"
-                    "#define _Float128 __castxml_Float128\n";
+                    "#define _Float64x __castxml_Float64x\n";
+        if (this->NeedFloat128(this->Opts.Predefines)) {
+          builtins += "#define _Float128 __castxml_Float128\n";
+        }
+
+        if (this->IsCPlusPlus(this->Opts.Predefines)) {
+          // In C++ we need distinct types for template specializations
+          // in glibc headers, but also need conversions.
+          builtins += "\n"
+                      "typedef struct __castxml_Float32_s { "
+                      "  float x; "
+                      "  operator float() const; "
+                      "  __castxml_Float32_s(float); "
+                      "} __castxml_Float32;\n"
+                      "typedef struct __castxml_Float32x_s { "
+                      "  double x; "
+                      "  operator double() const; "
+                      "  __castxml_Float32x_s(double); "
+                      "} __castxml_Float32x;\n"
+                      "typedef struct __castxml_Float64_s { "
+                      "  double x; "
+                      "  operator double() const; "
+                      "  __castxml_Float64_s(double); "
+                      "} __castxml_Float64;\n"
+                      "typedef struct __castxml_Float64x_s { "
+                      "  long double x; "
+                      "  operator long double() const; "
+                      "  __castxml_Float64x_s(long double); "
+                      "} __castxml_Float64x;\n";
+          if (this->NeedFloat128(this->Opts.Predefines)) {
+            builtins += "typedef struct __castxml_Float128_s { "
+                        "  __float128 x; "
+                        "  operator __float128() const; "
+                        "  __castxml_Float128_s(__float128); "
+                        "} __castxml_Float128;\n";
+          }
+
+        } else {
+          // In C we need real float types for conversions in glibc headers.
+          builtins += "\n"
+                      "typedef float __castxml_Float32;\n"
+                      "typedef double __castxml_Float32x;\n"
+                      "typedef double __castxml_Float64;\n"
+                      "typedef long double __castxml_Float64x;\n";
+          if (this->NeedFloat128(this->Opts.Predefines)) {
+            builtins += "typedef __float128 __castxml_Float128;\n";
+          }
+        }
       }
 
     } else {
@@ -463,6 +527,11 @@ protected:
     return this->IsActualGNU(pd);
   }
 
+  bool NeedAttributeAssumeSuppression(std::string const& pd)
+  {
+    return this->IsActualGNU(pd);
+  }
+
   bool NeedFloat128(std::string const& pd) const
   {
     return (this->IsActualGNU(pd) &&


=====================================
src/Version.cmake
=====================================
@@ -1,7 +1,7 @@
 # CastXML version number components.
 set(CastXML_VERSION_MAJOR 0)
 set(CastXML_VERSION_MINOR 6)
-set(CastXML_VERSION_PATCH 3)
+set(CastXML_VERSION_PATCH 6)
 #set(CastXML_VERSION_RC 0)
 set(CastXML_VERSION_IS_DIRTY 0)
 
@@ -13,7 +13,7 @@ if(DEFINED CastXML_VERSION_RC)
 endif()
 
 # If this source was exported by 'git archive', use its commit info.
-set(git_info "c7218b3 CastXML 0.6.3")
+set(git_info "37ca39a CastXML 0.6.6")
 
 # Otherwise, try to identify the current development source version.
 if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "


=====================================
test/CMakeLists.txt
=====================================
@@ -696,6 +696,7 @@ castxml_test_output_c(GNU-_Float32)
 castxml_test_output_c(GNU-_Float32x)
 castxml_test_output_c(GNU-_Float64)
 castxml_test_output_c(GNU-_Float64x)
+set(castxml_test_output_extra_arguments --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> --ver-major=7 --cc-define=__x86_64__ ")")
 castxml_test_output_c(GNU-_Float128)
 unset(castxml_test_output_extra_arguments)
 
@@ -704,6 +705,7 @@ castxml_test_output(GNU-_Float32)
 castxml_test_output(GNU-_Float32x)
 castxml_test_output(GNU-_Float64)
 castxml_test_output(GNU-_Float64x)
+set(castxml_test_output_extra_arguments --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --ver-major=13 --cc-define=__x86_64__ ")")
 castxml_test_output(GNU-_Float128)
 unset(castxml_test_output_extra_arguments)
 
@@ -722,11 +724,13 @@ unset(castxml_test_output_custom_start)
 unset(castxml_test_output_extra_arguments)
 
 set(castxml_test_output_extra_arguments --castxml-cc-gnu-c $<TARGET_FILE:cc-gnu>)
+castxml_test_output_c(GNU-attr-assume)
 castxml_test_output_c(GNU-attr-malloc-args)
 castxml_test_output_c(GNU-va_arg_pack)
 unset(castxml_test_output_extra_arguments)
 
 set(castxml_test_output_extra_arguments --castxml-cc-gnu $<TARGET_FILE:cc-gnu>)
+castxml_test_output(GNU-attr-assume)
 castxml_test_output(GNU-attr-malloc-args)
 castxml_test_output(GNU-va_arg_pack)
 unset(castxml_test_output_extra_arguments)


=====================================
test/cc-gnu.c
=====================================
@@ -47,6 +47,31 @@ int main(int argc, const char* argv[])
           "#define __vector __vector\n"
           "#define __has_last(x) x",
           ver_major);
+  /* Test GCC builtin definitions for features Clang does not implement.  */
+  fprintf(stdout,
+          "#define __BFLT16_DECIMAL_DIG__\n"
+          "#define __BFLT16_DENORM_MIN__\n"
+          "#define __BFLT16_DIG__\n"
+          "#define __BFLT16_DIG__\n"
+          "#define __BFLT16_EPSILON__\n"
+          "#define __BFLT16_HAS_DENORM__\n"
+          "#define __BFLT16_HAS_INFINITY__\n"
+          "#define __BFLT16_HAS_QUIET_NAN__\n"
+          "#define __BFLT16_IS_IEC_60559__\n"
+          "#define __BFLT16_MANT_DIG__\n"
+          "#define __BFLT16_MAX_10_EXP__\n"
+          "#define __BFLT16_MAX_EXP__\n"
+          "#define __BFLT16_MAX__\n"
+          "#define __BFLT16_MIN_10_EXP__\n"
+          "#define __BFLT16_MIN_EXP__\n"
+          "#define __BFLT16_MIN__\n"
+          "#define __BFLT16_NORM_MAX__\n"
+          "#define __SIZEOF_FLOAT80__\n"
+          "#define __STDCPP_BFLOAT16_T__\n"
+          "#define __STDCPP_FLOAT128_T__\n"
+          "#define __STDCPP_FLOAT16_T__\n"
+          "#define __STDCPP_FLOAT32_T__\n"
+          "#define __STDCPP_FLOAT64_T__\n");
   fprintf(stderr,
           "#include <...> search starts here:\n"
           " /some/include\n"


=====================================
test/expect/castxml1.any.GNU-attr-assume.xml.txt
=====================================
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+"/>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/GNU-attr-assume.cxx"/>
+</CastXML>$


=====================================
test/expect/castxml1.c.GNU-attr-assume.xml.txt
=====================================
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/GNU-attr-assume.c"/>
+</CastXML>$


=====================================
test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
=====================================
@@ -3,6 +3,7 @@
 )?#define __GNUC_MINOR__ 1
 #define __GNUC__ 1(
 #define __MINGW32__ 1)?
+#define __assume__\(\.\.\.\)[ ]*
 #define __builtin_va_arg_pack\(\) 0
 #define __builtin_va_arg_pack_len\(\) 1
 #define __castxml__ [^


=====================================
test/expect/cmd.cc-gnu-c-tgt-i386-opt-E.stdout.txt
=====================================
@@ -5,6 +5,7 @@
 #define __MINGW32__ 1)?
 #define __NO_MATH_INLINES 1
 #define __OPTIMIZE__ 1
+#define __assume__\(\.\.\.\)[ ]*
 #define __builtin_va_arg_pack\(\) 0
 #define __builtin_va_arg_pack_len\(\) 1
 #define __castxml__ [^


=====================================
test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
=====================================
@@ -3,6 +3,7 @@
 )?#define __GNUC_MINOR__ 1
 #define __GNUC__ 1(
 #define __MINGW32__ 1)?
+#define __assume__\(\.\.\.\)[ ]*
 #define __builtin_va_arg_pack\(\) 0
 #define __builtin_va_arg_pack_len\(\) 1
 #define __castxml__ [^


=====================================
test/expect/cmd.cc-gnu-tgt-i386-opt-E.stdout.txt
=====================================
@@ -5,6 +5,7 @@
 #define __MINGW32__ 1)?
 #define __NO_MATH_INLINES 1
 #define __OPTIMIZE__ 1
+#define __assume__\(\.\.\.\)[ ]*
 #define __builtin_va_arg_pack\(\) 0
 #define __builtin_va_arg_pack_len\(\) 1
 #define __castxml__ [^


=====================================
test/expect/gccxml.any.GNU-attr-assume.xml.txt
=====================================
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+"/>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/GNU-attr-assume.cxx"/>
+</GCC_XML>$


=====================================
test/expect/gccxml.c.GNU-attr-assume.xml.txt
=====================================
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/GNU-attr-assume.c"/>
+</GCC_XML>$


=====================================
test/input/GNU-_Float128.c
=====================================
@@ -1 +1,6 @@
 _Float128 start(_Float128);
+
+__float128 conversions(__float128 x)
+{
+  return start(x);
+}


=====================================
test/input/GNU-_Float128.cxx
=====================================
@@ -1 +1,17 @@
 _Float128 start(_Float128);
+
+__float128 conversions(__float128 x)
+{
+  return start(x);
+}
+
+template <typename T>
+struct distinct;
+template <>
+struct distinct<__float128>
+{
+};
+template <>
+struct distinct<_Float128>
+{
+};


=====================================
test/input/GNU-_Float32.c
=====================================
@@ -1 +1,6 @@
 _Float32 start(_Float32);
+
+float conversions(float x)
+{
+  return start(x);
+}


=====================================
test/input/GNU-_Float32.cxx
=====================================
@@ -1 +1,17 @@
 _Float32 start(_Float32);
+
+float conversions(float x)
+{
+  return start(x);
+}
+
+template <typename T>
+struct distinct;
+template <>
+struct distinct<float>
+{
+};
+template <>
+struct distinct<_Float32>
+{
+};


=====================================
test/input/GNU-_Float32x.c
=====================================
@@ -1 +1,6 @@
 _Float32x start(_Float32x);
+
+double conversions(double x)
+{
+  return start(x);
+}


=====================================
test/input/GNU-_Float32x.cxx
=====================================
@@ -1 +1,17 @@
 _Float32x start(_Float32x);
+
+double conversions(double x)
+{
+  return start(x);
+}
+
+template <typename T>
+struct distinct;
+template <>
+struct distinct<double>
+{
+};
+template <>
+struct distinct<_Float32x>
+{
+};


=====================================
test/input/GNU-_Float64.c
=====================================
@@ -1 +1,6 @@
 _Float64 start(_Float64);
+
+double conversions(double x)
+{
+  return start(x);
+}


=====================================
test/input/GNU-_Float64.cxx
=====================================
@@ -1 +1,17 @@
 _Float64 start(_Float64);
+
+double conversions(double x)
+{
+  return start(x);
+}
+
+template <typename T>
+struct distinct;
+template <>
+struct distinct<double>
+{
+};
+template <>
+struct distinct<_Float64>
+{
+};


=====================================
test/input/GNU-_Float64x.c
=====================================
@@ -1 +1,6 @@
 _Float64x start(_Float64x);
+
+long double conversions(long double x)
+{
+  return start(x);
+}


=====================================
test/input/GNU-_Float64x.cxx
=====================================
@@ -1 +1,17 @@
 _Float64x start(_Float64x);
+
+long double conversions(long double x)
+{
+  return start(x);
+}
+
+template <typename T>
+struct distinct;
+template <>
+struct distinct<long double>
+{
+};
+template <>
+struct distinct<_Float64x>
+{
+};


=====================================
test/input/GNU-attr-assume.c
=====================================
@@ -0,0 +1,4 @@
+void start(void)
+{
+  __attribute__((__assume__(1)));
+}


=====================================
test/input/GNU-attr-assume.cxx
=====================================
@@ -0,0 +1,4 @@
+void start(void)
+{
+  __attribute__((__assume__(1)));
+}


=====================================
test/run.cmake
=====================================
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #=============================================================================
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.5)
 
 if(xml)
   file(REMOVE "${xml}")



View it on GitLab: https://salsa.debian.org/med-team/castxml/-/commit/9e81d64cda9c54e8e134378bedaf85704d3c8d96

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/med-team/castxml/-/commit/9e81d64cda9c54e8e134378bedaf85704d3c8d96
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20240526/509395a1/attachment-0001.htm>


More information about the debian-med-commit mailing list