PIC XC8编译器中的共用体出错,是什么原因啊,谢谢!
用这个共用体,却报如下错误是什么原因啊,谢谢!
union {unsigned long All_time;unsigned char time;}Total_time;
C:\Program Files (x86)\Microchip\xc8\v1.41\sources\common\Umul32.c:15: advisory: (1510) non-reentrant function "___lmul" appears in multiple call graphs and has been duplicated by the compiler
弹出这样一个提示,有解决办法吗
// 32 x 32 bit multiplication with 32 bit result
#ifdef _PIC18
#define _Has_hardware_multiply 1
#else
#define _Has_hardware_multiply 0
#endif
#if defined(_PIC14E) || defined(_PIC14EX) || defined(_PIC18)
#define _Has_large_call_stack 1
#else
#define _Has_large_call_stack 0
#endif
unsigned long
__lmul(unsigned long multiplier, unsigned long multiplicand)
{
unsigned long product;
#define LOWBYTE(x)(*(unsigned char *)(&x))
#define LMIDBYTE(x) (*(((unsigned char *)(&x))+1))
#define HMIDBYTE(x) (*(((unsigned char *)(&x))+2))
#define HIGHBYTE(x) (*(((unsigned char *)(&x))+3))
#if (_Has_hardware_multiply || _Has_large_call_stack) && defined(__OPTIMIZE_SPEED__)
{
#define USE_SHRINK
/*
a 32-bit multiply can be decomposed into the sum of ten 8-bit multiplies
abcd
* efgh
-----------------------
| dh
| ch0
| bh00
|ah000
| dg0
| cg00
|bg000
ag| 0000 (we ignore this intermediate product
because it does not affect the low 32 bits of the result)
| df00
|cf000
bf| 0000 (ignore)
af0| 0000 (ignore)
|de000
ce| 0000 (ignore)
be0| 0000 (ignore)
+ae00| 0000 (ignore)
=======================
*/
product =(unsigned int)LOWBYTE(multiplier) * LOWBYTE(multiplicand);
#if defined(USE_MASKS)
product += ((unsigned long)
((unsigned int)LOWBYTE(multiplier) * LMIDBYTE(multiplicand))
+
((unsigned int)LMIDBYTE(multiplier) * LOWBYTE(multiplicand)))
<< 8;
product += ((unsigned long)
((unsigned int)LOWBYTE(multiplier) * HMIDBYTE(multiplicand))
+
((unsigned int)LMIDBYTE(multiplier) * LMIDBYTE(multiplicand))
+
((unsigned int)HMIDBYTE(multiplier) * LOWBYTE(multiplicand)))
<< 16;
/* cast to smaller type to avoid adding high bits just to discard */
product += ((unsigned long)
(unsigned char)
((unsigned int)LOWBYTE(multiplier) * HIGHBYTE(multiplicand))
+
(unsigned char)
((unsigned int)LMIDBYTE(multiplier) * HMIDBYTE(multiplicand))
+
(unsigned char)
((unsigned int)HMIDBYTE(multiplier) * LMIDBYTE(multiplicand))
+
(unsigned char)
((unsigned int)HIGHBYTE(multiplier) * LOWBYTE(multiplicand)))
<< 24;
#elif defined(USE_SHRINK)
/* add direct to upper bytes, rather than shift and add all bytes */
*((unsigned short long*)(((unsigned char*)&product)+1)) +=
((unsigned int)LOWBYTE(multiplier) * LMIDBYTE(multiplicand));
*((unsigned short long*)(((unsigned char*)&product)+1)) +=
((unsigned int)LMIDBYTE(multiplier) * LOWBYTE(multiplicand));
*((unsigned int*)(((unsigned char*)&product)+2)) +=
((unsigned int)LOWBYTE(multiplier) * HMIDBYTE(multiplicand));
*((unsigned int*)(((unsigned char*)&product)+2)) +=
((unsigned int)LMIDBYTE(multiplier) * LMIDBYTE(multiplicand));
*((unsigned int*)(((unsigned char*)&product)+2)) +=
((unsigned int)HMIDBYTE(multiplier) * LOWBYTE(multiplicand));
*(((unsigned char*)&product)+3) +=
(unsigned char)
((unsigned int)LOWBYTE(multiplier) * HIGHBYTE(multiplicand));
*(((unsigned char*)&product)+3) +=
(unsigned char)
((unsigned int)LMIDBYTE(multiplier) * HMIDBYTE(multiplicand));
*(((unsigned char*)&product)+3) +=
(unsigned char)
((unsigned int)HMIDBYTE(multiplier) * LMIDBYTE(multiplicand));
*(((unsigned char*)&product)+3) +=
(unsigned char)
((unsigned int)HIGHBYTE(multiplier) * LOWBYTE(multiplicand));
#else
#error No method chosen
#endif
}
#else
product = 0;
do {
if(multiplier & 1)
product += multiplicand;
multiplicand <<= 1;
multiplier >>= 1;
} while(multiplier != 0);
#endif
return product;
}
在中断和主程序中(非主循环)调用同一个函数,产生警告:testmain.c:15: advisory: (1510) non-reentrant function "_autoDelay" appears in multiple call graphs and has been duplicated by the compiler。
导致程序在结构体访问时运行不正常。
页:
[1]