2012-10-02 3 views
1

난 내 코드를 컴파일 할 때이 오류가 계속 :C 오류 : 예상 발현 전에 â.â 토큰

cc -Wall -Werror -g -c -o lwp.o lwp.c 
lwp.c: In function ânew_intel_stackâ: 
lwp.c:120: error: expected expression before â.â token 
lwp.c:122: error: expected expression before â.â token 
lwp.c:124: error: expected expression before â.â token 
lwp.c:126: error: expected expression before â.â token 
lwp.c:130: error: expected expression before â.â token 
lwp.c:132: error: expected expression before â.â token 
lwp.c:134: error: expected expression before â.â token 
lwp.c:136: error: expected expression before â.â token 
lwp.c:138: error: expected expression before â.â token 
lwp.c:140: error: expected expression before â.â token 
lwp.c:142: error: expected expression before â.â token 
make: *** [lwp.o] Error 1 

가 언급 된 기능을 여기에 있습니다 :

/* make ourselves a nice intuitive "push()" macro */ 
#define push(sp,val) (*(..sp)=(unsigned)(val)) 

unsigned long *new_intel_stack(unsigned long *sp,lwpfun func, void *arg) { 
    unsigned long *ebp; 
    push(sp,arg); /* argument */ 
    push(sp,lwp_exit); /* for lwp return purposes */ 
    push(sp,func); /* function's return address */ 
    push(sp,0x1abcdef1); /* bogus "saved" base pointer */ 
    ebp=sp; /* remember sp from this point for later */ 
    push(sp,0x6c6f7453); /* push initial eax, ebx, ecx, edx, esi and edi -- bogus */ 
    push(sp,0x66206e65); 
    push(sp,0x206d6f72); 
    push(sp,0x746e6957); 
    push(sp,0x32207265); 
    push(sp,0x21363030); 
    push(sp,ebp); /* push initial edp */ 
    return sp; 
} 

I 왜이 오류가 발생하는지 알지 못합니다. 어떤 아이디어?

+0

어떤 컴파일러를 사용하고 있습니까? – Macmade

답변

4

오류는 매크로 내부의 .. 시퀀스로 인해 발생합니다.

매크로 정의에서 ..은 무엇입니까?

(*(..sp)=(unsigned)(val)) 

..의 사용량을 일치합니다 C 언어에서 아무것도 없습니다. C에는 . 연산자가 있지만 매크로 내에서 사용되는 방식으로는 사용할 수 없습니다.

+1

이것은 댓글이어야합니다 ... – Macmade

+0

이것은 답변입니다! – cYrus

+0

{..} 시퀀스는 실제로 {-}로되어 있습니다. 감사! – user1715445

0

#define push(sp,val) (*(--sp)=(unsigned)(val)) 

을 찾으셨습니까?

+0

예, 그것이 제가 의미했던 것입니다. 고맙습니다! – user1715445

관련 문제