summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Detect.cxx16
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/expect/gccxml.any.GNU-float128.xml.txt25
-rw-r--r--test/expect/gccxml.c89.GNU-float128.xml.txt13
-rw-r--r--test/input/GNU-float128.c1
-rw-r--r--test/input/GNU-float128.cxx1
6 files changed, 58 insertions, 0 deletions
diff --git a/src/Detect.cxx b/src/Detect.cxx
index 70b6a74..d9d2607 100644
--- a/src/Detect.cxx
+++ b/src/Detect.cxx
@@ -67,6 +67,22 @@ static void fixPredefines(Options& opts)
pd.erase(beg);
}
}
+
+ // Provide __float128 if simulating the actual GNU compiler.
+ if (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 __i386__ ") != pd.npos ||
+ pd.find("#define __x86_64__ ") != pd.npos ||
+ pd.find("#define __ia64__ ") != pd.npos)) {
+ pd += "\n"
+ "typedef struct { "
+ " char x[16] __attribute__((aligned(16))); "
+ "} __float128;\n"
+ ;
+ }
}
//----------------------------------------------------------------------------
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1430dca..9febe91 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -259,10 +259,12 @@ endforeach()
if(TEST_GNU_C)
set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_C})
+ castxml_test_gccxml_c(GNU-float128)
unset(castxml_test_gccxml_extra_arguments)
endif()
if(TEST_GNU_CXX)
set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_CXX})
+ castxml_test_gccxml(GNU-float128)
unset(castxml_test_gccxml_extra_arguments)
endif()
diff --git a/test/expect/gccxml.any.GNU-float128.xml.txt b/test/expect/gccxml.any.GNU-float128.xml.txt
new file mode 100644
index 0000000..61b11fa
--- /dev/null
+++ b/test/expect/gccxml.any.GNU-float128.xml.txt
@@ -0,0 +1,25 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1">
+ <Argument type="_2" location="f1:1" file="f1" line="1"/>
+ </Function>
+ <Typedef id="_2" name="__float128" type="_4" context="_3"/>
+ <Struct id="_4" name="" context="_3" members="_5 _6 _7 _8 _9"/>
+ <Field id="_5" name="x" type="_10" context="_4" access="public"/>
+ <Constructor id="_6" context="_4" access="public" location="f0:0" file="f0" line="0" inline="1" artificial="1"( throws="")?/>
+ <Constructor id="_7" context="_4" access="public" location="f0:0" file="f0" line="0" inline="1" artificial="1"( throws="")?>
+ <Argument type="_11"/>
+ </Constructor>
+ <OperatorMethod id="_8" name="=" returns="_12" context="_4" access="public" location="f0:0" file="f0" line="0" inline="1" artificial="1"( throws="")?>
+ <Argument type="_11"/>
+ </OperatorMethod>
+ <Destructor id="_9" context="_4" access="public" location="f0:0" file="f0" line="0" inline="1" artificial="1"( throws="")?/>
+ <ArrayType id="_10" min="0" max="15" type="_13"/>
+ <ReferenceType id="_11" type="_4c"/>
+ <ReferenceType id="_12" type="_4"/>
+ <FundamentalType id="_13" name="char"/>
+ <Namespace id="_3" name="::"/>
+ <CvQualifiedType id="_4c" type="_4" const="1"/>
+ <File id="f0" name="&lt;builtin&gt;"/>
+ <File id="f1" name=".*/test/input/GNU-float128.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.c89.GNU-float128.xml.txt b/test/expect/gccxml.c89.GNU-float128.xml.txt
new file mode 100644
index 0000000..8195cff
--- /dev/null
+++ b/test/expect/gccxml.c89.GNU-float128.xml.txt
@@ -0,0 +1,13 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1">
+ <Argument type="_2" location="f1:1" file="f1" line="1"/>
+ </Function>
+ <Typedef id="_2" name="__float128" type="_4" context="_3"/>
+ <Struct id="_4" name="" context="_3" members="_5"/>
+ <Field id="_5" name="x" type="_6" context="_4" access="public"/>
+ <ArrayType id="_6" min="0" max="15" type="_7"/>
+ <FundamentalType id="_7" name="char"/>
+ <Namespace id="_3" name="::"/>
+ <File id="f1" name=".*/test/input/GNU-float128.c"/>
+</GCC_XML>$
diff --git a/test/input/GNU-float128.c b/test/input/GNU-float128.c
new file mode 100644
index 0000000..fbb07e1
--- /dev/null
+++ b/test/input/GNU-float128.c
@@ -0,0 +1 @@
+__float128 start(__float128);
diff --git a/test/input/GNU-float128.cxx b/test/input/GNU-float128.cxx
new file mode 100644
index 0000000..fbb07e1
--- /dev/null
+++ b/test/input/GNU-float128.cxx
@@ -0,0 +1 @@
+__float128 start(__float128);