This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [COMMITTED] Fix Re: <altivec.h> not happy with 3.4 on powerpc-apple-darwin7.2.0

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.

Andrew Pinski

2004-01-18  Andrew Pinski  <>

	* config/rs6000/altivec.h: Wrap C++ functions in extern "C++"

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>


$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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]