[med-svn] [castxml] 01/03: Imported Upstream version 0.1+git20160202
Gert Wollny
gert-guest at moszumanska.debian.org
Tue Feb 2 16:11:29 UTC 2016
This is an automated email from the git hooks/post-receive script.
gert-guest pushed a commit to branch master
in repository castxml.
commit 46e3a81806067a5275038a96244b72e3d900ed2c
Author: Gert Wollny <gw.fossdev at gmail.com>
Date: Tue Feb 2 16:05:33 2016 +0000
Imported Upstream version 0.1+git20160202
---
src/RunClang.cxx | 22 ++++++++++++++++++++--
src/Version.cmake | 2 +-
test/CMakeLists.txt | 8 ++++++++
test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt | 2 ++
test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt | 2 ++
test/expect/gccxml.any.GNU-va_arg_pack.xml.txt | 10 ++++++++++
test/expect/gccxml.c89.GNU-va_arg_pack.xml.txt | 10 ++++++++++
test/input/GNU-va_arg_pack.c | 3 +++
test/input/GNU-va_arg_pack.cxx | 3 +++
9 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/src/RunClang.cxx b/src/RunClang.cxx
index 6f35f2a..9768a25 100644
--- a/src/RunClang.cxx
+++ b/src/RunClang.cxx
@@ -180,6 +180,16 @@ protected:
if (this->Opts.HaveCC) {
builtins += this->Opts.Predefines;
+ // 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
+ // uses in function bodies while parsing.
+ builtins += "\n"
+ "#define __builtin_va_arg_pack() 0\n"
+ "#define __builtin_va_arg_pack_len() 1\n"
+ ;
+ }
+
// Provide __float128 if simulating the actual GNU compiler.
if (this->NeedFloat128(this->Opts.Predefines)) {
// Clang provides its own (fake) builtin in gnu++11 mode.
@@ -200,12 +210,20 @@ protected:
return predefines.substr(0, start) + builtins + predefines.substr(end);
}
- bool NeedFloat128(std::string const& pd) {
+ bool IsActualGNU(std::string const& pd) const {
return (pd.find("#define __GNUC__ ") != pd.npos &&
pd.find("#define __clang__ ") == pd.npos &&
pd.find("#define __INTEL_COMPILER ") == pd.npos &&
pd.find("#define __CUDACC__ ") == pd.npos &&
- pd.find("#define __PGI ") == pd.npos &&
+ pd.find("#define __PGI ") == pd.npos);
+ }
+
+ bool NeedBuiltinVarArgPack(std::string const& pd) {
+ return this->IsActualGNU(pd);
+ }
+
+ bool NeedFloat128(std::string const& pd) const {
+ return (this->IsActualGNU(pd) &&
(pd.find("#define __i386__ ") != pd.npos ||
pd.find("#define __x86_64__ ") != pd.npos ||
pd.find("#define __ia64__ ") != pd.npos));
diff --git a/src/Version.cmake b/src/Version.cmake
index 03a029d..00b35e0 100644
--- a/src/Version.cmake
+++ b/src/Version.cmake
@@ -39,7 +39,7 @@ elseif(COMMAND _git)
set(CastXML_VERSION "${CastXML_VERSION}-git")
endif()
endif()
-elseif("fc71eb9" MATCHES "^([0-9a-f]+)$")
+elseif("1489405" MATCHES "^([0-9a-f]+)$")
# Use version exported by 'git archive'.
set(CastXML_VERSION "${CastXML_VERSION}-g${CMAKE_MATCH_1}")
else()
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b88433d..e13d308 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -397,3 +397,11 @@ castxml_test_gccxml(GNU-float128-nostart)
unset(castxml_test_gccxml_custom_start)
unset(castxml_test_gccxml_custom_input)
unset(castxml_test_gccxml_extra_arguments)
+
+set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu-c $<TARGET_FILE:cc-gnu>)
+castxml_test_gccxml_c(GNU-va_arg_pack)
+unset(castxml_test_gccxml_extra_arguments)
+
+set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu $<TARGET_FILE:cc-gnu>)
+castxml_test_gccxml(GNU-va_arg_pack)
+unset(castxml_test_gccxml_extra_arguments)
diff --git a/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt b/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
index d251114..c979686 100644
--- a/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
+++ b/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
@@ -1,5 +1,7 @@
^#define __GNUC_MINOR__ 1
#define __GNUC__ 1
+#define __builtin_va_arg_pack\(\) 0
+#define __builtin_va_arg_pack_len\(\) 1
#define __castxml__ [0-9]+
#define __castxml_clang_major__ [0-9]+
#define __castxml_clang_minor__ [0-9]+
diff --git a/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt b/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
index a20a94d..c609931 100644
--- a/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
+++ b/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
@@ -1,5 +1,7 @@
^#define __GNUC_MINOR__ 1
#define __GNUC__ 1
+#define __builtin_va_arg_pack\(\) 0
+#define __builtin_va_arg_pack_len\(\) 1
#define __castxml__ [0-9]+
#define __castxml_clang_major__ [0-9]+
#define __castxml_clang_minor__ [0-9]+
diff --git a/test/expect/gccxml.any.GNU-va_arg_pack.xml.txt b/test/expect/gccxml.any.GNU-va_arg_pack.xml.txt
new file mode 100644
index 0000000..8a54afe
--- /dev/null
+++ b/test/expect/gccxml.any.GNU-va_arg_pack.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" inline="1" mangled="[^"]+">
+ <Argument name="n" type="_2" location="f1:1" file="f1" line="1"/>
+ <Ellipsis/>
+ </Function>
+ <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+ <Namespace id="_3" name="::"/>
+ <File id="f1" name=".*/test/input/GNU-va_arg_pack.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.c89.GNU-va_arg_pack.xml.txt b/test/expect/gccxml.c89.GNU-va_arg_pack.xml.txt
new file mode 100644
index 0000000..880693b
--- /dev/null
+++ b/test/expect/gccxml.c89.GNU-va_arg_pack.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" inline="1" mangled="[^"]+">
+ <Argument name="n" type="_2" location="f1:1" file="f1" line="1"/>
+ <Ellipsis/>
+ </Function>
+ <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+ <Namespace id="_3" name="::"/>
+ <File id="f1" name=".*/test/input/GNU-va_arg_pack.c"/>
+</GCC_XML>$
diff --git a/test/input/GNU-va_arg_pack.c b/test/input/GNU-va_arg_pack.c
new file mode 100644
index 0000000..7a437cf
--- /dev/null
+++ b/test/input/GNU-va_arg_pack.c
@@ -0,0 +1,3 @@
+__inline int start(int n, ...) {
+ return start(n + __builtin_va_arg_pack_len(), __builtin_va_arg_pack());
+}
diff --git a/test/input/GNU-va_arg_pack.cxx b/test/input/GNU-va_arg_pack.cxx
new file mode 100644
index 0000000..7a437cf
--- /dev/null
+++ b/test/input/GNU-va_arg_pack.cxx
@@ -0,0 +1,3 @@
+__inline int start(int n, ...) {
+ return start(n + __builtin_va_arg_pack_len(), __builtin_va_arg_pack());
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/castxml.git
More information about the debian-med-commit
mailing list