This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[PATCH] [COMMITTED] Fix Re: <altivec.h> not happy with 3.4 on powerpc-apple-darwin7.2.0
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: "Timothy J. Wood" <tjw at omnigroup dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Andrew Pinski <pinskia at physics dot uc dot edu>, gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Sun, 18 Jan 2004 11:49:36 -0800
- Subject: [PATCH] [COMMITTED] Fix Re: <altivec.h> not happy with 3.4 on powerpc-apple-darwin7.2.0
- References: <F013576D-49EC-11D8-8B22-0003933F3BC2@omnigroup.com>
The problem is that on darwin, the system headers are defined to c
headers as some of them
(mach ones) are C++ complaint.
I committed this to the 3.4 branch and the mainline as obvious.
Thanks,
Andrew Pinski
ChangeLog:
2004-01-18 Andrew Pinski <pinskia@physics.uc.edu>
* config/rs6000/altivec.h: Wrap C++ functions in extern "C++"
block.
Patch:
Index: config/rs6000/altivec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/altivec.h,v
retrieving revision 1.25
diff -u -p -r1.25 altivec.h
--- config/rs6000/altivec.h 16 Dec 2003 07:42:08 -0000 1.25
+++ config/rs6000/altivec.h 18 Jan 2004 19:48:58 -0000
@@ -118,6 +118,8 @@ extern int __altivec_link_error_invalid_
#ifdef __cplusplus
+extern "C++" {
+
/* Prototypes for builtins that take literals and must always be
inlined. */
inline vector float vec_ctf (vector unsigned int, const char)
__attribute__ ((always_inline));
@@ -6117,6 +6119,8 @@ struct __vec_step_help<vector float>
#define vec_step(t) __vec_step_help<typeof(t)>::_S_elem
+}//extern "C++"
+
#else /* not C++ */
/* "... and so I think no man in a century will suffer as greatly as
@@ -8532,6 +8536,7 @@ __ch (__bin_args_eq (vector float, (a1),
#define vec_any_numeric(a1) __builtin_altivec_vcmpeqfp_p
(__CR6_EQ_REV, (a1), (a1))
#define vec_any_out(a1, a2) __builtin_altivec_vcmpbfp_p (__CR6_EQ_REV,
(a1), (a2))
+
#endif /* __cplusplus */
On Jan 18, 2004, at 11:31, Timothy J. Wood wrote:
Configured thusly:
../gcc/configure --prefix="$PREFIX" --enable-languages="c,c++,objc"
Compiling just:
#include <altivec.h>
with:
$PREFIX/bin/c++ -O3 -maltivec x.cpp -S -o x.s
yields zillions of errors of the form:
In file included from x.cpp:2:
/Volumes/Space/Users/bungi/Source-head/GNU/gcc/gcc-3.4/install/bin/../
lib/gcc/powerpc-apple-darwin7.2.0/3.4.0/include/altivec.h:124: error:
declaration of C function `float __vector__ vec_ctf(int __vector__,
char)' conflicts with
/Volumes/Space/Users/bungi/Source-head/GNU/gcc/gcc-3.4/install/bin/../
lib/gcc/powerpc-apple-darwin7.2.0/3.4.0/include/altivec.h:123: error:
previous declaration `float __vector__ vec_ctf(unsigned int
__vector__, char)' here
...
-tim