tags 340871 + patch
thanks
Stephen R Marenka <stephen@marenka.net> writes:
> On Sat, Feb 25, 2006 at 11:36:53PM +0000, Roger Leigh wrote:
>
>> --- m68kmath/mathinline.h 2006-02-21 18:26:28.000000000 +0000
>> +++ mathinline.h 2006-02-25 23:30:48.000000000 +0000
>> @@ -100,7 +100,7 @@
>> /* Define a const math function. */
>> #define __m81_defun(rettype, func, args) \
>> __m81_inline rettype __attribute__((__const__)) \
>> - __m81_u(func) args
>> + __m81_u(func) args __THROW
>
> No joy.
This was in fact the solution. It just needs fixing up in a few other
places.
> On Sun, Feb 26, 2006 at 12:06:17AM +0000, Roger Leigh wrote:
>
>> Another pointer: the code in mathinline.h needs to match the
>> prototypes generated by __MATHCALL in mathcalls.h (defined in
>> /usr/include/math.h).
>>
>> I'm not sure why there's such a mismatch. Perhaps mathinline.h can
>> reuse some of the __MATHDECL* macros to prevent the differences?
OK. Attached is:
- A minimal testcase (test.cc and Makefile)
Summary: The prototypes in mathcalls.h and mathinline.h mismatch due
to __THROW being removed from the mathinline.h header.
The bug occurs when a combination of these occur:
+ -O2 is used (defines __OPTIMIZE__, causing mathinline.h to be
included.
+ _GNU_SOURCE, _SVID_SOURCE or _BSD_SOURCE are defined, causing
__USE_MISC to be defined, causing mathcalls.h to be included.
+ -pedantic is used, causing the mismatch to be a fatal error.
- A simple patch (mathinline.h.fixed.patch); this reverts the __THROW
removal.
- A smaller, better patch (mathinline.h.fixed2.patch) which fixes the
macros rather than where the macros are used. This is cleaner than
the other patch. Please could you apply this one?
I tested the patch on crest, and successfully compiled schroot
(previously failed).
Regards,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gutenprint.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
#include <cmath>
#include <iostream>
int main()
{
#ifdef __OPTIMIZE__
std::cout << "Optimisation enabled.\n";
#else
std::cout << "Optimisation disabled.\n";
#endif
#ifdef __USE_MISC
std::cout << "USE_MISC enabled.\n";
#else
std::cout << "USE_MISC disabled.\n";
#endif
double foo = atan(0.1234);
std::cout << "Foo: " << foo << std::endl;
return 0;
}
test: test.o g++ -o $@ $^ -lm test.o: test.cc g++ -I. -D_GNU_SOURCE -pedantic -g -O2 -o $@ -c $<
--- /usr/include/bits/mathinline.h 2006-03-03 15:22:14.000000000 +0100
+++ bits/mathinline.h 2006-04-07 00:29:36.000000000 +0200
@@ -118,7 +118,7 @@
#endif
#define __inline_mathop1(float_type,func, op) \
- __m81_defun (float_type, func, (float_type __mathop_x)) \
+ __m81_defun (float_type, func, (float_type __mathop_x)) __THROW \
{ \
float_type __result; \
__asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
@@ -175,7 +175,7 @@
for the function names. */
#define __inline_functions(float_type, s) \
-__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \
+__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) __THROW \
{ \
float_type __result; \
unsigned long int __ctrl_reg; \
@@ -191,7 +191,7 @@
return __result; \
} \
\
-__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \
+__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) __THROW \
{ \
float_type __result; \
unsigned long int __ctrl_reg; \
@@ -217,7 +217,7 @@
#ifdef __USE_MISC
# define __inline_functions(float_type, s) \
-__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \
+__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) __THROW \
{ \
/* There is no branch-condition for infinity, \
so we must extract and examine the condition codes manually. */ \
@@ -227,7 +227,7 @@
return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \
} \
\
-__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \
+__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) __THROW \
{ \
/* There is no branch-condition for infinity, so we must extract and \
examine the condition codes manually. */ \
@@ -238,7 +238,7 @@
} \
\
__m81_defun (float_type, __CONCAT(__scalbn,s), \
- (float_type __x, int __n)) \
+ (float_type __x, int __n)) __THROW \
{ \
float_type __result; \
__asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \
@@ -255,7 +255,7 @@
#if defined __USE_MISC || defined __USE_XOPEN
# define __inline_functions(float_type, s) \
-__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \
+__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) __THROW \
{ \
char __result; \
__asm("ftst%.x %1\n" \
@@ -275,7 +275,7 @@
#ifdef __USE_ISOC99
# define __inline_functions(float_type, s) \
-__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \
+__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) __THROW \
{ \
/* There is no branch-condition for the sign bit, so we must extract \
and examine the condition codes manually. */ \
@@ -285,13 +285,13 @@
return (__fpsr >> 27) & 1; \
} \
\
- __m81_defun (float_type, __CONCAT(__scalbln,s), \
- (float_type __x, long int __n)) \
+__m81_defun (float_type, __CONCAT(__scalbln,s), \
+ (float_type __x, long int __n)) __THROW \
{ \
return __CONCAT(__scalbn,s) (__x, __n); \
} \
\
-__m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \
+__m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) __THROW \
{ \
float_type __result; \
unsigned long int __ctrl_reg; \
@@ -305,7 +305,7 @@
return __result; \
} \
\
-__m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) \
+__m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) __THROW \
{ \
long int __result; \
__asm ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \
@@ -314,7 +314,7 @@
\
__m81_inline float_type \
__m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y, \
- float_type __z) \
+ float_type __z) __THROW \
{ \
return (__x * __y) + __z; \
}
@@ -331,7 +331,7 @@
# define __inline_functions(float_type, s) \
__m81_inline void \
__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \
- float_type *__cosx) \
+ float_type *__cosx) __THROW \
{ \
__asm ("fsincos%.x %2,%1:%0" \
: "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \
@@ -351,14 +351,14 @@
/* Note that there must be no whitespace before the argument passed for
NAME, to make token pasting work correctly with -traditional. */
# define __inline_forward_c(rettype, name, args1, args2) \
-extern __inline rettype __attribute__((__const__)) \
- name args1 \
-{ \
- return __CONCAT(__,name) args2; \
+extern __inline rettype __attribute__((__const__)) \
+name args1 __THROW \
+{ \
+ return __CONCAT(__,name) args2; \
}
# define __inline_forward(rettype, name, args1, args2) \
-extern __inline rettype name args1 \
+extern __inline rettype name args1 __THROW \
{ \
return __CONCAT(__,name) args2; \
}
--- /usr/include/bits/mathinline.h 2006-03-03 15:22:14.000000000 +0100
+++ bits/mathinline.h 2006-04-07 00:41:04.000000000 +0200
@@ -100,7 +100,7 @@
/* Define a const math function. */
#define __m81_defun(rettype, func, args) \
__m81_inline rettype __attribute__((__const__)) \
- __m81_u(func) args
+ __m81_u(func) args __THROW
/* Define the three variants of a math function that has a direct
implementation in the m68k fpu. FUNC is the name for C (which will be
@@ -314,7 +314,7 @@
\
__m81_inline float_type \
__m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y, \
- float_type __z) \
+ float_type __z) __THROW \
{ \
return (__x * __y) + __z; \
}
@@ -331,7 +331,7 @@
# define __inline_functions(float_type, s) \
__m81_inline void \
__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \
- float_type *__cosx) \
+ float_type *__cosx) __THROW \
{ \
__asm ("fsincos%.x %2,%1:%0" \
: "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \
@@ -351,14 +351,14 @@
/* Note that there must be no whitespace before the argument passed for
NAME, to make token pasting work correctly with -traditional. */
# define __inline_forward_c(rettype, name, args1, args2) \
-extern __inline rettype __attribute__((__const__)) \
- name args1 \
-{ \
- return __CONCAT(__,name) args2; \
+extern __inline rettype __attribute__((__const__)) \
+name args1 __THROW \
+{ \
+ return __CONCAT(__,name) args2; \
}
# define __inline_forward(rettype, name, args1, args2) \
-extern __inline rettype name args1 \
+extern __inline rettype name args1 __THROW \
{ \
return __CONCAT(__,name) args2; \
}
Attachment:
pgpfmDqeQEKO5.pgp
Description: PGP signature