Re: Multiple translation unit regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christopher Li wrote:
> On Wed, Jul 8, 2009 at 12:32 PM, Ramsay Jones<ramsay@xxxxxxxxxxxxxxxxxxx> wrote:
>> Unfortunately, the problem persists on Linux and I don't have time
>> tonight to try and debug it; I will look into it further, hopefully
>> tomorrow evening.
> 
> If you can give me a small test case on Linux that will be great.
> I can pick it up from there.
> 

[sorry for the late reply; something came up!]

I forgot to mention that, on Linux, enabling optimization is required to
trip this, since the extern inline function definitions are #ifdef'ed out
otherwise. That does not affect the following test case, however.

I've added to the previous test.c file (Note that the declaration of
g() does not include __inline__):

$ cat -n test.c
     1	
     2	extern __inline__ int f(int);
     3	
     4	extern __inline__ int
     5	f(int x)
     6	{
     7		return x;
     8	}
     9	
    10	
    11	extern int g(int);
    12	
    13	extern __inline__ int
    14	g(int x)
    15	{
    16		return x;
    17	}
    18	
$ ./sparse test.c
$ ./sparse test.c test.c
test.c:14:1: warning: multiple definitions for function 'g'
test.c:14:1:  the previous one is here
$ cp test.c test-again.c
$ ./sparse test.c test-again.c
test-again.c:14:1: warning: multiple definitions for function 'g'
test.c:14:1:  the previous one is here
$ 

Actually, the following may be closer to the situation on Linux:

$ cat -n test.c
     1	
     2	extern __inline__ int f(int);
     3	
     4	extern __inline__ int
     5	f(int x)
     6	{
     7		return x;
     8	}
     9	
    10	
    11	extern int g(int);
    12	
    13	#ifdef __OPTIMIZE__
    14	extern __inline__ int
    15	g(int x)
    16	{
    17		return x;
    18	}
    19	#endif
    20	
$ ./sparse test.c test.c
$ ./sparse -O2 test.c test.c
test.c:15:1: warning: multiple definitions for function 'g'
test.c:15:1:  the previous one is here


HTH

ATB
Ramsay Jones

extern __inline__ int f(int);

extern __inline__ int
f(int x)
{
	return x;
}


extern int g(int);

extern __inline__ int
g(int x)
{
	return x;
}


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux