hi,everyone,
I wrote a testing routine in linux in order to test gcc compiled link symbol
## in macro , gcc version under 3.2.2(3.2.2 and 2.9.5) was able to compile this
routine ,only with waring . but I used gcc-3.3.2 and gcc-4.1.1 to compile it
,it wasn't be compiled successfully .
testing.c
#include <stdlib.h>
#include <stdio.h>
/*this is only a testing rounte*/
#define R_ONLY_TYPE 1
#define W_ONLY_TYPE 2
#define RW_TYPE R_ONLY_TYPE+W_ONLY_TYPE
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct _info_t{
u8 uname[32];
}info_t;
typedef struct _link_info_t{
u16 type;
u16 size;
u8 *pname;
}link_info_t;
info_t Test_s;
#define LINK_TABLE(type,name) {type, sizeof(Test_s##.##name),
(u8*)&(Test_s##.##name)}
int main()
{
int i;
strcpy(Test_s.uname,"Testing");
Test_s.value = 0x0a;
link_info_t table[]={
LINK_TABLE(RW_TYPE,uname),
};
for(i=0;i<sizeof(table)/sizeof(link_info_t);i++)
printf("varname[%s],type[%d],size[%d]\n",table[i].pname,table[i].type,table[i].size);
return 0;
}
I want to know why , if I want to solve this problem with gcc-3.3.2 or
gcc-4.1.1 ,How to do ? if anybody knows this issue ,please tell me or give a
clue .
thank you in advance
advan
advan
2007-08-07
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev